This repository has been archived by the owner on Jan 6, 2020. It is now read-only.
forked from fossar/selfoss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:SSilence/selfoss
- Loading branch information
Showing
2 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?PHP | ||
|
||
namespace spouts\facebook; | ||
|
||
/** | ||
* Spout for fetching a facebook page feed | ||
* | ||
* @package spouts | ||
* @subpackage facebook | ||
* @copyright Copyright (c) Tobias Zeising (http://www.aditu.de) | ||
* @license GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html) | ||
* @author Tobias Zeising <[email protected]> | ||
* @author Thomas Muguet <[email protected]> | ||
*/ | ||
class page extends \spouts\rss\feed { | ||
|
||
/** | ||
* name of source | ||
* | ||
* @var string | ||
*/ | ||
public $name = 'Facebook page feed'; | ||
|
||
|
||
/** | ||
* description of this source type | ||
* | ||
* @var string | ||
*/ | ||
public $description = 'Page wall'; | ||
|
||
|
||
/** | ||
* config params | ||
* array of arrays with name, type, default value, required, validation type | ||
* | ||
* - Values for type: text, password, checkbox | ||
* - Values for validation: alpha, email, numeric, int, alnum, notempty | ||
* | ||
* e.g. | ||
* array( | ||
* "id" => array( | ||
* "title" => "URL", | ||
* "type" => "text", | ||
* "default" => "", | ||
* "required" => true, | ||
* "validation" => array("alnum") | ||
* ), | ||
* .... | ||
* ) | ||
* | ||
* @var bool|mixed | ||
*/ | ||
public $params = array( | ||
"user" => array( | ||
"title" => "Page name", | ||
"type" => "text", | ||
"default" => "", | ||
"required" => true, | ||
"validation" => array("notempty") | ||
) | ||
); | ||
|
||
|
||
|
||
// | ||
// Source Methods | ||
// | ||
|
||
|
||
/** | ||
* loads content for given source | ||
* I supress all Warnings of SimplePie for ensuring | ||
* working plugin in PHP Strict mode | ||
* | ||
* @return void | ||
* @param mixed $params the params of this source | ||
*/ | ||
public function load($params) { | ||
$content = @file_get_contents("https://graph.facebook.com/" . urlencode($params['user'])); | ||
$data = json_decode($content, TRUE); | ||
|
||
$rssParams = array("url" => "https://www.facebook.com/feeds/page.php?format=atom10&id=" . $data['id']); | ||
return parent::load($rssParams); | ||
} | ||
} |