public static function get_facebook() { if (!static::$facebook_instance) { $conf = static::get_conf(); static::$facebook_instance = new Facebook(array('app_id' => $conf->FacebookAppId, 'app_secret' => $conf->FacebookAppSecret)); } return static::$facebook_instance; }
public function getFacebook() { if (!$this->conf) { $this->conf = $this->getConf(); } if (!static::$facebook_instance) { if (!empty($this->conf->FacebookAppId) && !empty($this->conf->FacebookAppSecret)) { // init fb static::$facebook_instance = new Facebook(array('app_id' => $this->conf->FacebookAppId, 'app_secret' => $this->conf->FacebookAppSecret)); // get access token $token = (string) SocialHelper::fb_access_token(); // set token static::$facebook_instance->setDefaultAccessToken($token); } } return static::$facebook_instance; }