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


PHP FB::enabled方法代码示例

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


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

示例1: in

 /**
  * Sign in
  */
 public function in()
 {
     $this->history = false;
     if (request::method() == 'post') {
         // Normal sign in
         ORM::factory('user')->login($this->input->post(), false);
     } else {
         if (request::method() == 'get') {
             // 3rd party sign in
             if (FB::enabled()) {
                 $this->visitor->external_login(User_External_Model::PROVIDER_FACEBOOK);
             }
         }
     }
     // Add newsfeed item
     // newsfeeditem_user::login($this->visitor->get_user());
     url::back();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:21,代码来源:sign.php

示例2: __call

 /**
  * Magic call, use for (almost) all member controller views
  *
  * @param  string  $username
  * @param  array   $actions
  */
 public function __call($username, $actions = false)
 {
     $username = urldecode($username);
     $this->member = ORM::factory('user')->find_user($username);
     if (!$this->member->loaded()) {
         // TODO: redirect to search
         return;
     }
     // Basic information
     $this->page_title = text::title($this->member->username, false);
     if (!empty($this->member->title)) {
         $this->template->subtitle = html::specialchars($this->member->title);
     }
     $action = is_array($actions) && count($actions) ? $actions[0] : false;
     switch ($action) {
         // View blog
         case 'blog':
             $this->_blog();
             break;
             // Edit basic info
         // Edit basic info
         case 'edit':
             $this->_edit();
             break;
             // View Facebook content
         // View Facebook content
         case 'facebook':
             if (FB::enabled()) {
                 $this->_facebook();
             } else {
                 $this->_view();
             }
             break;
             // View favorites
         // View favorites
         case 'favorites':
             $this->_favorites();
             break;
             // Add to friends
         // Add to friends
         case 'friend':
             $this->_friendadd();
             break;
             // View friends
         // View friends
         case 'friends':
             $this->_friends();
             break;
             // Remove from friends
         // Remove from friends
         case 'unfriend':
             $this->_frienddelete();
             break;
             // View profile
         // View profile
         default:
             if (request::is_ajax() && isset($_REQUEST['peep'])) {
                 // View peepbox
                 $this->_peepbox();
             } else {
                 // View profile
                 $this->_view();
             }
             break;
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:72,代码来源:member.php

示例3: 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

示例4: __construct

 /**
  * Construct new page controller
  */
 function __construct()
 {
     parent::__construct();
     // Init page values
     $this->country = Session::instance()->get('country', false);
     // AJAX requests output without template
     if (request::is_ajax()) {
         $this->auto_render = false;
         $this->history = false;
         return;
     }
     // Use profiler only when an admin is logged in
     if ($this->visitor->logged_in('admin')) {
         Profiler::enable();
     }
     // Bind the generic page variables
     $this->template->bind('skin', $this->skin)->bind('skin_imports', $this->skin_imports)->bind('stylesheets', $this->stylesheets)->bind('language', $this->language)->bind('page_width', $this->page_width)->bind('page_main', $this->page_main)->bind('page_id', $this->page_id)->bind('page_class', $this->page_class)->bind('page_title', $this->page_title)->bind('page_subtitle', $this->page_subtitle);
     // Add controller name as default page id
     $this->page_id = Router::$controller;
     // Init page values
     $this->menu = Kohana::config('site.menu');
     $skin_path = 'ui/' . Kohana::config('site.skin') . '/';
     $this->skin = $skin_path . 'skin.less';
     $this->skin_imports = array('ui/layout.less', 'ui/widget.less', 'ui/jquery-ui.css', 'ui/site.css', $skin_path . 'jquery-ui.css');
     $this->page_width = Session::instance()->get('page_width', 'fixed');
     $this->page_main = Session::instance()->get('page_main', 'left');
     //$this->stylesheets = array('ui/' . Kohana::config('site.skin') . '/skin', 'ui/' . Kohana::config('site.skin') . '/jquery-ui');
     $this->breadcrumb = array();
     //html::anchor('/', __('Home')));
     $this->tabs = array();
     // If a country is seleced, add custom stylesheet
     if ($this->country && Kohana::config('site.country_css')) {
         widget::add('head', html::stylesheet('ui/' . utf8::strtolower($this->country) . '/skin'));
     }
     // Generic views
     widget::add('actions', View::factory('generic/actions')->bind('actions', $this->page_actions));
     // widget::add('breadcrumb', View::factory('generic/breadcrumb')->bind('breadcrumb', $this->breadcrumb));
     widget::add('navigation', View::factory('generic/navigation')->bind('items', $this->menu)->bind('selected', $this->page_id));
     widget::add('tabs', View::factory('generic/tabs_top')->bind('tabs', $this->tabs)->bind('selected', $this->tab_id));
     // Header
     widget::add('header', View::factory('generic/header'));
     // Footer
     widget::add('footer', View_Mod::factory('events/events_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article unit size1of4 cut events', 'mod_title' => __('New events'), 'events' => ORM::factory('event')->order_by('id', 'DESC')->find_all(10))));
     widget::add('footer', View_Mod::factory('forum/topics_list', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article unit size1of4 cut topics', 'mod_title' => __('New posts'), 'topics' => ORM::factory('forum_topic')->order_by('last_post_id', 'DESC')->find_all(10))));
     widget::add('footer', View_Mod::factory('blog/entries_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article unit size1of4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => ORM::factory('blog_entry')->find_latest(10))));
     // Dock
     $classes = array(html::anchor('set/width/narrow', __('Narrow'), array('onclick' => '$("body").addClass("fixed").removeClass("liquid"); $.get(this.href); return false;')), html::anchor('set/width/wide', __('Wide'), array('onclick' => '$("body").addClass("liquid").removeClass("narrow"); $.get(this.href); return false;')), html::anchor('set/main/left', __('Left'), array('onclick' => '$("body").addClass("left").removeClass("right"); $.get(this.href); return false;')), html::anchor('set/main/right', __('Right'), array('onclick' => '$("body").addClass("right").removeClass("left"); $.get(this.href); return false;')));
     widget::add('dock2', __('Layout: ') . implode(', ', $classes));
     // Language selection
     $available_languages = Kohana::config('locale.languages');
     if (count($available_languages)) {
         $languages = array();
         foreach ($available_languages as $lang => $locale) {
             $languages[] = html::anchor('set/lang/' . $lang, html::chars($locale[2]));
         }
         widget::add('dock2', ' | ' . __('Language: ') . implode(', ', $languages));
     }
     if ($this->user) {
         // Authenticated view
         widget::add('dock', __('[#:id] :user', array(':id' => $this->user->id, ':user' => html::nick($this->user->id, $this->user->username))));
         $new_messages = array();
         if ($this->user->newcomments) {
             $new_messages[] = html::anchor(url::user($this->user), __(':commentsC', array(':comments' => $this->user->newcomments)), array('title' => __('New comments'), 'class' => 'new-comments'));
         }
         if (!empty($new_messages)) {
             widget::add('dock', ' - ' . __('New messages: ') . implode(' ', $new_messages));
         }
         // Logout also from Facebook
         if (FB::enabled() && Visitor::instance()->get_provider()) {
             widget::add('dock', ' - ' . html::anchor('sign/out', FB::icon() . __('Sign out'), array('onclick' => "FB.Connect.logoutAndRedirect('/sign/out'); return false;")));
         } else {
             widget::add('dock', ' - ' . html::anchor('sign/out', __('Sign out')));
         }
         if (Kohana::config('site.inviteonly')) {
             //				widget::add('dock', ' | ' . html::anchor('sign/up', __('Send invite')));
         }
         // Admin functions
         if ($this->visitor->logged_in('admin')) {
             widget::add('dock2', ' | ' . __('Admin: ') . html::anchor('roles', __('Roles')) . ', ' . html::anchor('tags', __('Tags')) . ', ' . html::anchor('#kohana-profiler', __('Profiler'), array('onclick' => '$("#kohana-profiler").toggle();')));
         }
     } else {
         // Non-authenticated view
         $form = form::open('sign/in');
         $form .= form::input('username', null, 'title="' . __('Username') . '"');
         $form .= form::password('password', '', 'title="' . __('Password') . '"');
         $form .= form::submit('submit', __('Sign in'));
         $form .= form::close();
         $form .= html::anchor('/sign/up', __('Sign up'));
         if (FB::enabled()) {
             $form .= ' | ' . FB::fbml_login();
         }
         widget::add('dock', $form);
     }
     // End
     widget::add('end', View::factory('generic/end'));
     // Analytics
     $google_analytics = Kohana::config('site.google_analytics');
//.........这里部分代码省略.........
开发者ID:anqqa,项目名称:Anqh,代码行数:101,代码来源:website.php


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