当前位置: 首页>>代码示例>>PHP>>正文


PHP FB::instance方法代码示例

本文整理汇总了PHP中FB::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP FB::instance方法的具体用法?PHP FB::instance怎么用?PHP FB::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FB的用法示例。


在下文中一共展示了FB::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 public static function getInstance($arg)
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self($arg);
     }
     return self::$instance;
 }
开发者ID:axelDelannay,项目名称:projetFB,代码行数:7,代码来源:fb.class.php

示例2: init

 /**
  * Initializes Facebook Connect
  */
 public static function init()
 {
     widget::add('foot', html::script(array('js/fbconnect.js', 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US')));
     widget::add('foot', html::script_source("FB.init('" . FB::$config['api_key'] . "');"));
     // Add logged in Facebook user id to session for easier access
     if ($logged_in = FB::instance()->get_loggedin_user()) {
         $_SESSION['fb_uid'] = $logged_in;
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:12,代码来源:FB.php

示例3: _facebook

 /**
  * Facebook connect
  */
 public function _facebook()
 {
     $this->tab_id = 'facebook';
     // Only owner may view this for now
     $owner = $this->user && $this->member->id == $this->user->id;
     if (!$owner) {
         url::redirect(url::user($this->member));
     }
     // Are we logged in Facebook?
     $fb_uid = FB::instance()->get_loggedin_user();
     $external_user = $fb_uid ? $this->member->find_external_by_id($fb_uid) : $this->member->find_external_by_provider(User_External_Model::PROVIDER_FACEBOOK);
     // Did we do an action?
     if (request::method() == 'post') {
         // Connect accounts
         if ($_POST['connect'] == User_External_Model::PROVIDER_FACEBOOK && $fb_uid) {
             if (!$external_user->loaded() && $this->member->map_external($fb_uid, User_External_Model::PROVIDER_FACEBOOK)) {
                 // Map succesful
             } else {
                 // Map failed
             }
         } else {
             // Not connected or invalid post
         }
         url::redirect(url::user($this->member) . '/facebook');
     }
     $parameters = array();
     if ($fb_uid) {
         $parameters['fb_uid'] = $fb_uid;
     }
     if ($external_user->loaded) {
         $parameters['external_user'] = $external_user;
     }
     widget::add('main', View::factory('member/facebook', $parameters));
     $this->_side_views();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:38,代码来源:member.php

示例4: external_login

 /**
  * Attempt to login with 3rd party account
  *
  * @return  bool
  */
 public function external_login($provider)
 {
     if ($provider == Model_User_External::PROVIDER_FACEBOOK && ($fb_uid = FB::instance()->get_loggedin_user())) {
         // Load the external user
         $user = Model_User::find_user_by_external($fb_uid, $provider);
         if ($user->loaded() && $this->complete_login($user)) {
             $this->_session->set($this->_config['session_key'] . '_provider', $provider);
             return true;
         }
     }
     return false;
 }
开发者ID:anqh,项目名称:core,代码行数:17,代码来源:visitor.php

示例5: logout

 /**
  * Log out a user by removing the related session variables.
  *
  * @param   boolean  $destroy  completely destroy the session
  * @return  boolean
  */
 public function logout($destroy = false)
 {
     // Delete the autologin cookie to prevent re-login
     if (cookie::get($this->config['cookie_name'])) {
         cookie::delete($this->config['cookie_name']);
     }
     // Logout 3rd party?
     if (FB::enabled() && Visitor::instance()->get_provider()) {
         $this->session->delete($this->config['session_key'] . '_provider');
         try {
             FB::instance()->expire_session();
         } catch (Exception $e) {
         }
     }
     // Destroy the session completely?
     if ($destroy === true) {
         $this->session->destroy();
     } else {
         // Remove the user from the session
         $this->session->delete($this->config['session_key']);
         // Regenerate session_id
         $this->session->regenerate();
     }
     // Double check
     return !$this->logged_in();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:32,代码来源:Visitor.php


注:本文中的FB::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。