Created
April 30, 2012 07:58
-
-
Save davidpmccormick/2556382 to your computer and use it in GitHub Desktop.
facebook data datasource
This file contains hidden or 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
<?php | |
require_once(TOOLKIT . '/class.datasource.php'); | |
Class datasourcefacebookdata extends Datasource{ | |
public $dsParamROOTELEMENT = 'facebookdata'; | |
public $dsParamURL = 'https://graph.facebook.com/davidpmccormick/feed?access_token=240983112675860%7CXJ-2ylXI7gJWVUMmz1nPoBKy9Ik'; | |
public $dsParamXPATH = '/'; | |
public $dsParamCACHE = '30'; | |
public $dsParamTIMEOUT = '6'; | |
public function __construct(&$parent, $env=NULL, $process_params=true){ | |
parent::__construct($parent, $env, $process_params); | |
$this->_dependencies = array(); | |
} | |
public function about(){ | |
return array( | |
'name' => 'facebookdata', | |
'author' => array( | |
'name' => 'David McCormick', | |
'website' => 'http://sumnoise.com', | |
'email' => '[email protected]'), | |
'version' => 'Symphony 2.2.5', | |
'release-date' => '2012-04-29T20:59:32+00:00' | |
); | |
} | |
public function getSource(){ | |
return 'dynamic_xml'; | |
} | |
public function allowEditorToParse(){ | |
return true; | |
} | |
public function grab(&$param_pool=NULL){ | |
$result = new XMLElement($this->dsParamROOTELEMENT); | |
try{ | |
include(EXTENSIONS . '/dynamic_json/lib/datasource.dynamic_json.php'); | |
} | |
catch(FrontendPageNotFoundException $e){ | |
// Work around. This ensures the 404 page is displayed and | |
// is not picked up by the default catch() statement below | |
FrontendPageNotFoundExceptionHandler::render($e); | |
} | |
catch(Exception $e){ | |
$result->appendChild(new XMLElement('error', $e->getMessage())); | |
return $result; | |
} | |
if($this->_force_empty_result) $result = $this->emptyXMLSet(); | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment