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


PHP XenForo_Application::parseQueryString方法代碼示例

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


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

示例1: getAccessToken

 public function getAccessToken($url, $code)
 {
     try {
         $client = XenForo_Helper_Http::getClient(sprintf('%s://%s/oauth/token', $this->schema, $this->api));
         $client->setParameterPost(array('client_id' => $this->clientId, 'redirect_uri' => $url, 'client_secret' => $this->clientSecret, 'code' => $code, 'grant_type' => 'authorization_code'));
         $response = $client->request('POST');
         $body = $response->getBody();
         if (preg_match('#^[{\\[]#', $body)) {
             $parts = json_decode($body, true);
         } else {
             $parts = XenForo_Application::parseQueryString($body);
         }
         return $parts;
     } catch (Zend_Http_Client_Exception $e) {
         return false;
     }
 }
開發者ID:anyTV,項目名稱:Xenforo_Accounts_Oauth2,代碼行數:17,代碼來源:Accounts.php

示例2: getAccessToken

 /**
  * Takes a code (with a redirect URL) and gets an access token.
  *
  * @param string $url
  * @param string $code
  *
  * @return array|false Array of info (may be error); false if Facebook integration not active
  */
 public static function getAccessToken($url, $code)
 {
     $options = XenForo_Application::get('options');
     if (!$options->facebookAppId) {
         return false;
     }
     try {
         $client = XenForo_Helper_Http::getClient('https://graph.facebook.com/v2.4/oauth/access_token');
         $client->setParameterGet(array('client_id' => $options->facebookAppId, 'redirect_uri' => $url, 'client_secret' => $options->facebookAppSecret, 'code' => $code));
         $response = $client->request('GET');
         $body = $response->getBody();
         if (preg_match('#^[{\\[]#', $body)) {
             $parts = json_decode($body, true);
         } else {
             $parts = XenForo_Application::parseQueryString($body);
         }
         return $parts;
     } catch (Zend_Http_Client_Exception $e) {
         return false;
     }
 }
開發者ID:darkearl,項目名稱:projectT122015,代碼行數:29,代碼來源:Facebook.php

示例3: convertUrlToActionAndNamedParams

 /**
  * Converts a URL that may have a route/action and named params to a form
  * action (script name, things before query string) and named params. A route
  * in the query string is converted to a named param "_".
  *
  * @param string $url
  *
  * @return array Format: [action] => form action, [params] => key-value param pairs
  */
 public static function convertUrlToActionAndNamedParams($url)
 {
     $params = array();
     if (($questPos = strpos($url, '?')) !== false) {
         $queryString = htmlspecialchars_decode(substr($url, $questPos + 1));
         $url = substr($url, 0, $questPos);
         if (preg_match('/^([^=&]*)(&|$)/', $queryString, $queryStringUrl)) {
             $route = $queryStringUrl[1];
             $queryString = substr($queryString, strlen($queryStringUrl[0]));
         } else {
             $route = '';
         }
         if ($route !== '') {
             $params['_'] = $route;
         }
         if ($queryString) {
             $params = array_merge($params, XenForo_Application::parseQueryString($queryString));
         }
     }
     return array('action' => htmlspecialchars($url), 'params' => $params);
 }
開發者ID:hahuunguyen,項目名稱:DTUI_201105,代碼行數:30,代碼來源:Core.php

示例4: _getInputFromSerialized

 /**
  * Turns a serialized (by jQuery) query string from input into a XenForo_Input object.
  *
  * @param string Name of index to fetch from $this->_input
  * @param boolean On error, throw an exception or return false
  * @param string
  *
  * @return XenForo_Input|false
  */
 protected function _getInputFromSerialized($varname, $throw = true, &$errorPhraseKey = null)
 {
     if ($inputString = $this->_input->filterSingle($varname, XenForo_Input::STRING)) {
         try {
             return new XenForo_Input(XenForo_Application::parseQueryString($inputString));
         } catch (Exception $e) {
             $errorPhraseKey = 'string_could_not_be_converted_to_input';
             if ($throw) {
                 throw $this->responseException($this->responseError(new XenForo_Phrase($errorPhraseKey)));
             }
         }
     }
     return false;
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:23,代碼來源:Controller.php

示例5: addSessionActivityDetailsToList

 /**
  * Adds details about session activity to a list of session activity records.
  *
  * @param array $activities
  *
  * @return array Activity records (in same order), with details in activityDescription/activityItemTitle/activityItemUrl keys.
  */
 public function addSessionActivityDetailsToList(array $activities)
 {
     // TODO: in the future, probably remove dependence on the visitor object (via called controllers)
     $controllerGroups = array();
     foreach ($activities as $key => $activity) {
         $activity['params'] = XenForo_Application::parseQueryString($activity['params']);
         $controllerGroups[$activity['controller_name']][$key] = $activity;
     }
     foreach ($controllerGroups as $controller => $controllerGroup) {
         try {
             $controller = XenForo_Application::resolveDynamicClass($controller, 'controller');
             $canLoad = $controller && XenForo_Application::autoload($controller);
         } catch (XenForo_Exception $e) {
             // likely an XFCP autoload error - skip this
             $canLoad = false;
         }
         if ($canLoad) {
             $result = call_user_func(array($controller, 'getSessionActivityDetailsForList'), $controllerGroup);
         } else {
             $result = false;
         }
         if (is_array($result)) {
             foreach ($result as $resultKey => $resultInfo) {
                 if (!isset($controllerGroup[$resultKey])) {
                     continue;
                 }
                 if (is_array($resultInfo)) {
                     $activities[$resultKey]['activityDescription'] = $resultInfo[0];
                     $activities[$resultKey]['activityItemTitle'] = $resultInfo[1];
                     $activities[$resultKey]['activityItemUrl'] = $resultInfo[2];
                     $activities[$resultKey]['activityItemPreviewUrl'] = $resultInfo[3];
                 } else {
                     $activities[$resultKey]['activityDescription'] = $resultInfo;
                     $activities[$resultKey]['activityItemTitle'] = false;
                     $activities[$resultKey]['activityItemUrl'] = false;
                     $activities[$resultKey]['activityItemPreviewUrl'] = false;
                 }
             }
         } else {
             foreach ($controllerGroup as $key => $activity) {
                 $activities[$key]['activityDescription'] = $result;
                 $activities[$key]['activityItemTitle'] = false;
                 $activities[$key]['activityItemUrl'] = false;
                 $activities[$key]['activityItemPreviewUrl'] = false;
             }
         }
     }
     return $activities;
 }
開發者ID:darkearl,項目名稱:projectT122015,代碼行數:56,代碼來源:Session.php


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