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


PHP XenForo_Link::buildApiLink方法代码示例

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


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

示例1: prepareParams

 public function prepareParams()
 {
     if (!empty($this->_params['_user']['user_id'])) {
         call_user_func_array(array('bdApi_ViewApi_Helper_Subscription', 'prepareDiscoveryParams'), array(&$this->_params, $this->_response, bdApi_Model_Subscription::TYPE_USER, $this->_params['_user']['user_id'], XenForo_Link::buildApiLink('users', $this->_params['_user'], array('oauth_token' => '')), isset($this->_params['_user']['bdapi_user']) ? $this->_params['_user']['bdapi_user'] : ''));
     }
     parent::prepareParams();
 }
开发者ID:burtay,项目名称:bdApi,代码行数:7,代码来源:Single.php

示例2: prepareParams

 public function prepareParams()
 {
     if (!empty($this->_params['_thread']['thread_id'])) {
         call_user_func_array(array('bdApi_ViewApi_Helper_Subscription', 'prepareDiscoveryParams'), array(&$this->_params, $this->_response, bdApi_Model_Subscription::TYPE_THREAD_POST, $this->_params['_thread']['thread_id'], XenForo_Link::buildApiLink('posts', null, array('thread_id' => $this->_params['_thread']['thread_id'], 'oauth_token' => '')), isset($this->_params['_thread']['bdapi_thread_post']) ? $this->_params['_thread']['bdapi_thread_post'] : ''));
     }
     parent::prepareParams();
 }
开发者ID:burtay,项目名称:bdApi,代码行数:7,代码来源:List.php

示例3: prepareDiscoveryParams

 public static function prepareDiscoveryParams(array &$params, Zend_Controller_Response_Http $response, $topicType, $topicId, $selfLink, $subscriptionOption)
 {
     if (!bdApi_Option::getSubscription($topicType)) {
         // subscription for this topic type has been disabled
         return false;
     }
     // subscription discovery
     $hubLink = XenForo_Link::buildApiLink('subscriptions', null, array('hub.topic' => bdApi_Model_Subscription::getTopic($topicType, $topicId), 'oauth_token' => ''));
     $response->setHeader('Link', sprintf('<%s>; rel=hub', $hubLink));
     $response->setHeader('Link', sprintf('<%s>; rel=self', $selfLink));
     // subscription info
     if (!empty($subscriptionOption)) {
         $subscriptionOption = @unserialize($subscriptionOption);
         if (!empty($subscriptionOption['subscriptions'])) {
             /* @var $session bdApi_Session */
             $session = XenForo_Application::getSession();
             $clientId = $session->getOAuthClientId();
             foreach ($subscriptionOption['subscriptions'] as $subscription) {
                 if ($subscription['client_id'] == $clientId) {
                     $params['subscription_callback'] = $subscription['callback'];
                 }
             }
         }
     }
     return true;
 }
开发者ID:burtay,项目名称:bdApi,代码行数:26,代码来源:Subscription.php

示例4: actionGetIndex

 public function actionGetIndex()
 {
     /* @var $session bdApi_Session */
     $session = XenForo_Application::getSession();
     $systemInfo = array();
     if ($session->checkScope(bdApi_Model_OAuth2::SCOPE_POST)) {
         $systemInfo = array('api_revision' => 2014030701, 'api_modules' => $this->_getModules());
     }
     $data = array('links' => array('conversations' => XenForo_Link::buildApiLink('conversations'), 'conversation-messages' => XenForo_Link::buildApiLink('conversation-messages'), 'notifications' => XenForo_Link::buildApiLink('notifications'), 'search' => XenForo_Link::buildApiLink('search'), 'navigation' => XenForo_Link::buildApiLink('navigation', array(), array('parent' => 0)), 'threads' => XenForo_Link::buildApiLink('threads'), 'threads/recent' => XenForo_Link::buildApiLink('threads/recent'), 'threads/new' => XenForo_Link::buildApiLink('threads/new'), 'posts' => XenForo_Link::buildApiLink('posts'), 'users' => XenForo_Link::buildApiLink('users'), 'batch' => XenForo_Link::buildApiLink('batch'), 'subscriptions' => XenForo_Link::buildApiLink('subscriptions'), 'oauth_authorize' => XenForo_Link::buildApiLink('oauth/authorize', array(), array('oauth_token' => '')), 'oauth_token' => XenForo_Link::buildApiLink('oauth/token', array(), array('oauth_token' => ''))), 'system_info' => $systemInfo);
     return $this->responseData('bdApi_ViewApi_Index', $data);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:11,代码来源:Index.php

示例5: actionGetSdk

 public function actionGetSdk()
 {
     $prefix = $this->_input->filterSingle('prefix', XenForo_Input::STRING);
     $prefix = preg_replace('/[^a-zA-Z0-9]/', '', $prefix);
     $sdkPath = XenForo_Autoloader::getInstance()->getRootDir() . '/../js/bdApi/full/sdk.js';
     $sdk = file_get_contents($sdkPath);
     $sdk = str_replace('{prefix}', $prefix, $sdk);
     $sdk = str_replace('{data_uri}', XenForo_Link::buildPublicLink('canonical:misc/api-data'), $sdk);
     $sdk = str_replace('{request_uri}', XenForo_Link::buildApiLink('index'), $sdk);
     header('Content-Type: application/x-javascript; charset=utf-8');
     header('Cache-Control: public, max-age=31536000');
     header(sprintf('Last-Modified: %s', gmstrftime("%a, %d %b %Y %T %Z", filemtime($sdkPath))));
     die($sdk);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:14,代码来源:Asset.php

示例6: _arrangeElements

 protected function _arrangeElements(array &$elements, array &$nodesGrouped, $parentNodeId, array &$options = array())
 {
     foreach ($nodesGrouped as $_parentNodeId => $nodes) {
         if ($parentNodeId != $_parentNodeId) {
             continue;
         }
         foreach ($nodes as $node) {
             $element = false;
             switch ($node['node_type_id']) {
                 case 'Category':
                     $element = $this->_getCategoryModel()->prepareApiDataForCategory($node);
                     break;
                 case 'Forum':
                     if (!empty($options['forums'][$node['node_id']])) {
                         $element = $this->_getForumModel()->prepareApiDataForForum($options['forums'][$node['node_id']]);
                     }
                     break;
                 case 'LinkForum':
                     $element = $this->_getLinkForumModel()->prepareApiDataForLinkForum($node);
                     break;
             }
             if (!empty($element)) {
                 $element['navigation_type'] = strtolower($node['node_type_id']);
                 $element['navigation_id'] = $node['node_id'];
                 $element['navigation_parent_id'] = $node['parent_node_id'];
                 $element['has_sub_elements'] = !empty($nodesGrouped[$node['node_id']]);
                 if ($element['has_sub_elements']) {
                     if (empty($element['links'])) {
                         $element['links'] = array();
                     }
                     $element['links']['sub-elements'] = XenForo_Link::buildApiLink('navigation', '', array('parent' => $element['navigation_id']));
                 }
                 $elements[] = $element;
                 if ($element['has_sub_elements'] && !is_int($options['expectedParentNodeId'])) {
                     $this->_arrangeElements($elements, $nodesGrouped, intval($node['node_id']), $options);
                 }
             }
         }
     }
 }
开发者ID:burtay,项目名称:bdApi,代码行数:40,代码来源:Navigation.php

示例7: addPageLinks

 /**
  * Builds and adds the navigation for api data
  *
  * @param XenForo_Input $input
  * @param array $data
  * @param int $perPage
  * @param int $totalItems
  * @param int $page
  * @param string $linkType
  * @param mixed $linkData
  * @param array $linkParams
  * @param array $options
  */
 public static function addPageLinks(XenForo_Input $input, array &$data, $perPage, $totalItems, $page, $linkType, $linkData = null, array $linkParams = array(), array $options = array())
 {
     if (empty($perPage)) {
         return;
     }
     $pageNav = array();
     $inputData = $input->filter(array('fields_include' => XenForo_Input::STRING, 'fields_exclude' => XenForo_Input::STRING));
     if (!empty($inputData['fields_include'])) {
         $linkParams['fields_include'] = $inputData['fields_include'];
     } elseif (!empty($inputData['fields_exclude'])) {
         $linkParams['fields_exclude'] = $inputData['fields_exclude'];
     }
     if (empty($page)) {
         $page = 1;
     }
     $pageNav['pages'] = ceil($totalItems / $perPage);
     if ($pageNav['pages'] <= 1) {
         // do not do anything if there is only 1 page (or no pages)
         return;
     }
     $pageNav['page'] = $page;
     if ($page > 1) {
         // a previous link should only be added if we are not at page 1
         $pageNav['prev'] = XenForo_Link::buildApiLink($linkType, $linkData, array_merge($linkParams, array('page' => $page - 1)));
     }
     if ($page < $pageNav['pages']) {
         // a next link should only be added if we are not at the last page
         $pageNav['next'] = XenForo_Link::buildApiLink($linkType, $linkData, array_merge($linkParams, array('page' => $page + 1)));
     }
     // add the page navigation into `links`
     // the data may have existing links or not
     // we simply don't care
     if (empty($data['links'])) {
         $data['links'] = array();
     }
     $data['links'] = array_merge($data['links'], $pageNav);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:50,代码来源:Core.php

示例8: actionGetIndex

 public function actionGetIndex()
 {
     $data = array('links' => array('posts' => XenForo_Link::buildApiLink('search/posts'), 'threads' => XenForo_Link::buildApiLink('search/threads'), 'profile-posts' => XenForo_Link::buildApiLink('search/profile-posts')));
     return $this->responseData('bdApi_ViewApi_Index', $data);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:5,代码来源:Search.php

示例9: actionPostPassword

 public function actionPostPassword()
 {
     $link = XenForo_Link::buildApiLink('users', array('user_id' => $this->_input->filterSingle('user_id', XenForo_Input::UINT)));
     $this->_setDeprecatedHeaders('PUT', $link);
     return $this->responseReroute(__CLASS__, 'put-index');
 }
开发者ID:burtay,项目名称:bdApi,代码行数:6,代码来源:User.php


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