当前位置: 首页>>代码示例>>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;未经允许,请勿转载。