function showContent() { $this->elementStart('fieldset'); $facebook = Facebookclient::getFacebook(); $params = array('scope' => 'read_stream,publish_stream,offline_access,user_status,user_location,user_website,email', 'redirect_uri' => common_local_url('facebookfinishlogin')); // Degrade to plain link if JavaScript is not available $this->elementStart('a', array('href' => $facebook->getLoginUrl($params), 'id' => 'facebook_button')); $attrs = array('src' => Plugin::staticPath('FacebookBridge', 'images/login-button.png'), 'alt' => _m('Login with Facebook'), 'title' => _m('Login with Facebook.')); $this->element('img', $attrs); $this->elementEnd('a'); $this->elementEnd('fieldset'); }
/** * Initializer for this plugin * * Gets an instance of the Facebook API client object * * @return boolean hook value; true means continue processing, false means stop. */ function initialize() { // Allow the id and key to be passed in // Control panel will override if (isset($this->appId)) { $appId = common_config('facebook', 'appid'); if (empty($appId)) { Config::save('facebook', 'appid', $this->appId); } } if (isset($this->secret)) { $secret = common_config('facebook', 'secret'); if (empty($secret)) { Config::save('facebook', 'secret', $this->secret); } } $this->facebook = Facebookclient::getFacebook($this->appId, $this->secret); return true; }
function showContent() { $this->elementStart('fieldset'); $facebook = Facebookclient::getFacebook(); // Degrade to plain link if JavaScript is not available $this->elementStart('a', array('href' => $facebook->getLoginUrl(array('next' => common_local_url('facebookfinishlogin'), 'cancel' => common_local_url('facebooklogin'), 'req_perms' => 'read_stream,publish_stream,offline_access,user_status,user_location,user_website,email')), 'id' => 'facebook_button')); $attrs = array('src' => Plugin::staticPath('FacebookBridge', 'images/login-button.png'), 'alt' => _m('Login with Facebook'), 'title' => _m('Login with Facebook.')); $this->element('img', $attrs); $this->elementEnd('a'); /* $this->element('div', array('id' => 'fb-root')); $this->script( sprintf( 'http://connect.facebook.net/en_US/all.js#appId=%s&xfbml=1', common_config('facebook', 'appid') ) ); $this->element('fb:facepile', array('max-rows' => '2', 'width' =>'300')); */ $this->elementEnd('fieldset'); }
/** * For initializing members of the class. * * @param array $args misc. arguments * * @return boolean true */ function prepare($args) { $this->facebook = Facebookclient::getFacebook(); return true; }