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


PHP XenForo_Link::_checkForFullLink方法代码示例

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


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

示例1: buildApiLink

 public static function buildApiLink($type, $data = null, array $extraParams = array(), $skipPrepend = false)
 {
     // the type MUST BE full:type
     // NOTE: this is the opposite with public links
     if (strpos($type, 'canonical:') === 0) {
         // replace canonical: with full:
         $type = str_replace('canonical:', 'full:', $type);
     } elseif (strpos($type, 'full:') === false) {
         // enforce full:
         $type = 'full:' . $type;
     }
     // auto appends oauth_token param from the session
     if (!isset($extraParams['oauth_token'])) {
         $session = bdApi_Data_Helper_Core::safeGetSession();
         if (!empty($session)) {
             $oauthToken = $session->getOAuthTokenText();
             if (!empty($oauthToken) && !empty($_REQUEST['oauth_token']) && $_REQUEST['oauth_token'] === $oauthToken) {
                 // only append token to built link if the current request has token in query too
                 // this will prevent token in links if it's requested with OTT, token in Auth header
                 // or token in body (PUT/POST requests)
                 $extraParams['oauth_token'] = $oauthToken;
             }
         }
     }
     $type = XenForo_Link::_checkForFullLink($type, $fullLink, $fullLinkPrefix);
     $link = XenForo_Link::_buildLink(self::API_LINK_GROUP, $type, $data, $extraParams);
     $queryString = XenForo_Link::buildQueryString($extraParams);
     if ($link instanceof XenForo_Link) {
         $canPrependFull = $link->canPrependFull();
     } else {
         $canPrependFull = true;
         if (strpos($link, '#') !== false) {
             list($link, $hash) = explode('#', $link);
         }
     }
     if ($queryString !== '' && $link !== '') {
         $append = "?{$link}&{$queryString}";
     } else {
         // 1 or neither of these has content
         $append = $link . $queryString;
         if ($append !== '') {
             $append = "?{$append}";
         }
     }
     if ($skipPrepend) {
         $outputLink = $append;
     } else {
         $outputLink = 'index.php' . $append;
     }
     if ($fullLink && $canPrependFull) {
         $outputLink = $fullLinkPrefix . $outputLink;
     }
     // deal with a hash in the $type {xen:link prefix#hash..}
     if (($hashPos = strpos($type, '#')) !== false) {
         $hash = substr($type, $hashPos + 1);
     }
     if ($outputLink === '') {
         $outputLink = '.';
     }
     return $outputLink . (empty($hash) ? '' : '#' . $hash);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:61,代码来源:Link.php


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