當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FRoute::referer方法代碼示例

本文整理匯總了PHP中FRoute::referer方法的典型用法代碼示例。如果您正苦於以下問題:PHP FRoute::referer方法的具體用法?PHP FRoute::referer怎麽用?PHP FRoute::referer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FRoute的用法示例。


在下文中一共展示了FRoute::referer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: oauthDialog

 /**
  * This is the first entry point when the social site redirects back to this callback.
  * It is responsible to close the popup and redirect to the appropriate url.
  *
  * @since	1.0
  * @access	public
  */
 public function oauthDialog()
 {
     // Get allowed clients
     $allowedClients = array_keys((array) $this->config->get('oauth'));
     // Get the current client.
     $oauthClient = $this->input->get('client', '', 'word');
     if (!in_array($oauthClient, $allowedClients)) {
         FD::info()->set(false, JText::sprintf('COM_EASYSOCIAL_OAUTH_INVALID_OAUTH_CLIENT_PROVIDED', $oauthClient), SOCIAL_MSG_ERROR);
         return $this->redirect(FRoute::login(array(), false));
     }
     // Get the oauth client object.
     $client = FD::oauth($oauthClient);
     // Detect if the user has already registered with the site.
     if ($client->isRegistered()) {
         // We need to update the token
         $client->updateToken();
         $client->login();
         // Determine which URL to redirect the user to based on the settings
         $url = FRoute::getMenuLink($this->config->get('general.site.login'));
         if ($url === false) {
             // Default URL redirection
             $url = FRoute::dashboard(array(), false);
             // Determine if there a referer URL
             $callback = FRoute::referer();
             if ($callback) {
                 $url = $callback;
             }
         }
         $redirect = $url;
     } else {
         // Get the access
         $access = $client->getAccess();
         // Set the access token on the session
         $key = $oauthClient . '.token';
         $session = JFactory::getSession();
         $session->set($key, $access->token, SOCIAL_SESSION_NAMESPACE);
         $redirect = FRoute::registration(array('layout' => 'oauth', 'client' => $oauthClient), false);
     }
     $this->set('redirect', $redirect);
     parent::display('site/registration/oauth.popup');
 }
開發者ID:knigherrant,項目名稱:decopatio,代碼行數:48,代碼來源:view.html.php

示例2: requireLogin

 /**
  * Renders a login page if necessary. If this is called via an ajax method, it will trigger a dialog instead.
  *
  * @access	public
  * @param	null
  * @return	string	Contents.
  */
 public static function requireLogin()
 {
     $document = JFactory::getDocument();
     $my = FD::user();
     if ($my->id > 0) {
         return true;
     }
     switch ($document->getType()) {
         case 'html':
             // Do some redirects here?
             $info = FD::info();
             $message = new stdClass();
             $message->message = JText::_('COM_EASYSOCIAL_PLEASE_LOGIN_FIRST');
             $message->type = SOCIAL_MSG_INFO;
             $info->set($message);
             // Get the application framework.
             $app = JFactory::getApplication();
             // Get the current URI.
             $callback = FRoute::current();
             FD::setCallback($callback);
             $url = FRoute::login(array(), false);
             $app->redirect($url);
             $app->close();
             break;
         case 'ajax':
             $ajax = FD::ajax();
             // Get the referer URI.
             $callback = FRoute::referer();
             if ($callback) {
                 FD::setCallback($callback);
             }
             $ajax->script('EasySocial.login();');
             return $ajax->send();
             break;
     }
 }
開發者ID:knigherrant,項目名稱:decopatio,代碼行數:43,代碼來源:foundry.php


注:本文中的FRoute::referer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。