Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:SSilence/selfoss
Browse files Browse the repository at this point in the history
  • Loading branch information
SSilence committed May 1, 2013
2 parents bd93d57 + dfb3230 commit 7a8fde1
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/floIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function getBestImage($height = 32, $width = 32) {
function readICO($file, $offset = 0) {
if (file_exists($file) && filesize($file) > 0 && $filePointer = fopen($file, "r")) {
fseek($filePointer, $offset);
$header = unpack("SReserved/SType/SCount", fread($filePointer, 6));
$header = unpack("vReserved/vType/vCount", fread($filePointer, 6));
for ($t = 0; $t < $header["Count"]; $t++) {
$newImage = new floIconImage();
$newImage->readImageFromICO($filePointer, 6 + ($t * 16));
Expand Down Expand Up @@ -778,14 +778,14 @@ function readImageFromICO($filePointer, $entryOffset) {
// Get the entry.
fseek($filePointer, $entryOffset);
$this->_entryIconFormat = fread($filePointer, 16);
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $this->_entryIconFormat);
$this->_entry = unpack("CWidth/CHeight/CColorCount/CReserved/vPlanes/vBitCount/VSizeInBytes/VFileOffset", $this->_entryIconFormat);

// Position the file pointer.
fseek($filePointer, $this->_entry["FileOffset"]);

// Get the header.
$this->_headerIconFormat = fread($filePointer, 40);
$this->_header = unpack("LSize/LWidth/LHeight/SPlanes/SBitCount/LCompression/LImageSize/LXpixelsPerM/LYpixelsPerM/LColorsUsed/LColorsImportant", $this->_headerIconFormat);
$this->_header = unpack("VSize/VWidth/VHeight/vPlanes/vBitCount/VCompression/VImageSize/VXpixelsPerM/VYpixelsPerM/VColorsUsed/VColorsImportant", $this->_headerIconFormat);

// Get the image.
$this->_imageIconFormat = @fread($filePointer, $this->_entry["SizeInBytes"] - strlen($this->_headerIconFormat));
Expand Down
86 changes: 86 additions & 0 deletions spouts/facebook/page.php
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);
}
}

0 comments on commit 7a8fde1

Please sign in to comment.