Zend
class Facebook_Api {
/**
*
* @var object
*/
protected $_facebook;
/**
*
* @var string
*/
protected$Application_Id;
/**
*
* @var string
*/
protected $Application_Secret;
/**
*
* @var string
*/
protected $Permissions;
/**
*
* @varstring
*/
protected $CallBack;
/**
* setup the facebook login functionality!
*
* @param string $Application_Id
* @param string $Application_Secret
*@param string $Permissions
* @param string $callback
*/
public function __construct($Application_Id, $Application_Secret, $Permissions = '', $CallBack = '') {$this->Application_Id = $Application_Id;
$this->Application_Secret = $Application_Secret;
$this->Permissions = $Permissions;
$this->CallBack = $CallBack;
$this->_facebook = newFacebook(array(
'appId' => $this->Application_Id,
'secret' => $this->Application_Secret,
'cookie' => true
));
}/**
* checks for a session
* @return string html
*/
public function connection() {
$session = $this->_facebook->getSession();
$me = null;
if($session) {
try {
$uid = $this->_facebook->getUser();
$me = $this->_facebook->api('/me');
} catch (Facebook_Api_Exception $e) {throw new Zend_Exception('connection error facebook',0,$e);
}
}
return "
window.fbAsyncInit = function()
{FB.init
({
appId : '" . $this->_facebook->getAppId() . "',
session : " . json_encode($session) . ",
status :...
Regístrate para leer el documento completo.