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


PHP ipsRegistry::_seoTemplates方法代码示例

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


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

示例1: _fUrlInit

 /**
  * INIT furls
  * Performs set up and figures out any incoming links
  *
  * @return	@e void
  */
 protected static function _fUrlInit()
 {
     /**
      * Fix request uri
      */
     self::_fixRequestUri();
     if (ipsRegistry::$settings['use_friendly_urls']) {
         /* Grab and store accessing URL */
         self::$_uri = preg_replace("/s=(&|\$)/", '', str_replace('/?', '/' . IPS_PUBLIC_SCRIPT . '?', $_SERVER['REQUEST_URI']));
         $_urlBits = array();
         /* Grab FURL data... */
         if (!IN_DEV and is_file(FURL_CACHE_PATH)) {
             $templates = array();
             include FURL_CACHE_PATH;
             /*noLibHook*/
             self::$_seoTemplates = $templates;
         } else {
             /* Attempt to write it */
             self::$_seoTemplates = IPSLib::buildFurlTemplates();
             try {
                 IPSLib::cacheFurlTemplates();
             } catch (Exception $e) {
             }
         }
         if (is_array(self::$_seoTemplates) and count(self::$_seoTemplates)) {
             $uri = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : @getenv('REQUEST_URI');
             /* Bug 21295 - remove known URL from test URI */
             $_t = !empty(ipsRegistry::$settings['board_url']) ? @parse_url(ipsRegistry::$settings['board_url']) : @parse_url(ipsRegistry::$settings['base_url']);
             $_toTest = ($_t['path'] and $_t['path'] != '/') ? preg_replace("#^{$_t['path']}#", '', $uri) : str_replace($_t['scheme'] . '://' . $_t['host'], '', $uri);
             $_404Check = $_toTest;
             //We want to retain any /index.php for this test later in this block of code
             $_toTest = str_ireplace(array('//' . IPS_PUBLIC_SCRIPT . '?', '/' . IPS_PUBLIC_SCRIPT . '?', '/' . IPS_PUBLIC_SCRIPT), '', $_toTest);
             $_gotMatch = false;
             foreach (self::$_seoTemplates as $key => $data) {
                 if (empty($data['in']['regex'])) {
                     continue;
                 }
                 /* Clean up regex */
                 $data['in']['regex'] = str_replace('#{__varBlock__}', preg_quote(self::$_seoTemplates['__data__']['varBlock'], '#'), $data['in']['regex']);
                 if (preg_match($data['in']['regex'], $_toTest, $matches)) {
                     $_gotMatch = true;
                     /* Handling pages as a special thing? */
                     if ($data['isPagesMode']) {
                         if (strstr($_toTest, self::$_seoTemplates['__data__']['varPage'])) {
                             preg_match('#(' . preg_quote(self::$_seoTemplates['__data__']['varPage'], '#') . '(\\d+?))(?:$|' . preg_quote(self::$_seoTemplates['__data__']['varBlock'], '#') . ')#', $_toTest, $pageMatches);
                             if ($pageMatches[1]) {
                                 $k = 'page';
                                 $_GET[$k] = intval($pageMatches[2]);
                                 $_POST[$k] = intval($pageMatches[2]);
                                 $_REQUEST[$k] = intval($pageMatches[2]);
                                 $_urlBits[$k] = intval($pageMatches[2]);
                                 ipsRegistry::$request[$k] = intval($pageMatches[2]);
                                 $_toTest = str_replace($pageMatches[1], '', $_toTest);
                             }
                         } else {
                             /* Redirect all < 3.4 links to the new sexy awesome format if need be */
                             if (self::$_seoTemplates['__data__']['varBlock'] != '/page__' && $uri && strstr($uri, '/page__')) {
                                 preg_match('#(.*)(page__.*)$#', $uri, $matches);
                                 $url = $matches[1];
                                 $query = $matches[2];
                                 $newQuery = '?';
                                 $data = explode('__', substr($query, 6));
                                 for ($i = 0, $j = count($data); $i < $j; $i++) {
                                     $newQuery .= ($i % 2 == 0 ? '&' : '=') . $data[$i];
                                 }
                                 /* Class output not created here */
                                 header("HTTP/1.1 301 Moved Permanently");
                                 header("Location: " . $_t['scheme'] . '://' . $_t['host'] . $url . $newQuery);
                                 exit;
                             }
                         }
                     }
                     if (is_array($data['in']['matches'])) {
                         foreach ($data['in']['matches'] as $_replace) {
                             $k = IPSText::parseCleanKey($_replace[0]);
                             if (strpos($_replace[1], '$') !== false) {
                                 $v = IPSText::parseCleanValue($matches[intval(str_replace('$', '', $_replace[1]))]);
                             } else {
                                 $v = IPSText::parseCleanValue($_replace[1]);
                             }
                             $_GET[$k] = $v;
                             $_POST[$k] = $v;
                             $_REQUEST[$k] = $v;
                             $_urlBits[$k] = $v;
                             ipsRegistry::$request[$k] = $v;
                         }
                     }
                     if (strpos($_toTest, self::$_seoTemplates['__data__']['varBlock']) !== false) {
                         /* Changed how the input variables are parsed based on feedback in bug report 24907
                            @link http://community.invisionpower.com/tracker/issue-24907-member-list-pagination-not-work-with-checkbox
                            Input variables now preserve array depth properly as a result */
                         $_parse = substr($_toTest, strpos($_toTest, self::$_seoTemplates['__data__']['varBlock']) + strlen(self::$_seoTemplates['__data__']['varBlock']));
                         $_data = explode(self::$_seoTemplates['__data__']['varSep'], $_parse);
                         $_query = '';
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:101,代码来源:ipsRegistry.php


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