Skip to content

Instantly share code, notes, and snippets.

@davidpmccormick
Created April 30, 2012 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidpmccormick/2556382 to your computer and use it in GitHub Desktop.
Save davidpmccormick/2556382 to your computer and use it in GitHub Desktop.
facebook data datasource
<?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' => 'davidpmccormick@gmail.com'),
'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