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


PHP cmsFramework::siteRoute方法代码示例

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


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

示例1: route

 function route($link, $xhtml = true, $ssl = null)
 {
     if (false === strpos($link, 'index.php') && false === strpos($link, 'index2.php')) {
         $link = 'index.php?' . $link;
     }
     // Check core sef
     $sef = cmsFramework::getConfig('sef');
     $sef_rewrite = cmsFramework::getConfig('sef_rewrite');
     if (false === strpos($link, 'option=com_jreviews') && !$sef) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         if (false === strpos($url, 'http')) {
             $parsedUrl = parse_url(WWW_ROOT);
             $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
             $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . $url;
         }
         return $url;
     } elseif (false === strpos($link, 'option=com_jreviews')) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         return $url;
     }
     // Fixes component menu urls with pagination and ordering parameters when core sef is enabled.
     $link = str_replace('//', '/', $link);
     if ($sef) {
         if (substr($link, 0, 10) === 'index.php') {
             $link = str_replace('/', '%2F', $link);
         }
         // Core sef doesn't know how to deal with colons, so we convert them to something else and then replace them again.
         $link = str_replace(_PARAM_CHAR, '*@*', $link);
         $sefUrl = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         $sefUrl = str_replace('%2A%40%2A', _PARAM_CHAR, $sefUrl);
         $sefUrl = str_replace('*@*', _PARAM_CHAR, $sefUrl);
         // For non sef links
         $link = $sefUrl;
     }
     if (false !== strpos($link, 'http')) {
         return $link;
     } else {
         $parsedUrl = parse_url(WWW_ROOT);
         $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
         $www_root = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . ($sef ? _DS : $parsedUrl['path']);
         return $www_root . ltrim($link, _DS);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:43,代码来源:joomla15.php

示例2: route

 function route($link, $xhtml = true, $ssl = null)
 {
     $menu_alias = '';
     if (false === strpos($link, 'index.php') && false === strpos($link, 'index2.php')) {
         $link = 'index.php?' . $link;
     }
     // Check core sef
     $sef = cmsFramework::getConfig('sef');
     $sef_rewrite = cmsFramework::getConfig('sef_rewrite');
     if (false === strpos($link, 'option=com_jreviews') && !$sef) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         if (false === strpos($url, 'http')) {
             $parsedUrl = parse_url(WWW_ROOT);
             $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
             $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . $url;
         }
         return $url;
     } elseif (false === strpos($link, 'option=com_jreviews')) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         return $url;
     }
     // Fixes component menu urls with pagination and ordering parameters when core sef is enabled.
     $link = str_replace('//', '/', $link);
     if ($sef) {
         $mod_rewrite = cmsFramework::getConfig('sef_rewrite');
         // Mod Rewrite is not enabled
         if (!$mod_rewrite) {
             preg_match('/Itemid=([0-9]+)/', $link, $matches);
             if (isset($matches[1]) && is_numeric($matches[1])) {
                 $link2 = 'index.php?option=com_jreviews&Itemid=' . $matches[1];
                 $menu_alias = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link2, $xhtml, $ssl) : JRoute::_($link2, $xhtml, $ssl);
                 strstr($menu_alias, 'index.php') and $menu_alias = str_replace('.html', '/', substr($menu_alias, strpos($menu_alias, 'index.php' . _DS) + 10));
                 $menu_alias .= '/';
                 $menu_alias = '/' . ltrim(array_shift(explode('?', $menu_alias)), '/');
             }
         }
         // Core sef doesn't know how to deal with colons, so we convert them to something else and then replace them again.
         $link = $nonsef_link = str_replace(_PARAM_CHAR, '*@*', $link);
         $sefUrl = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         $sefUrl = str_replace('%2A%40%2A', _PARAM_CHAR, $sefUrl);
         $sefUrl = str_replace('*@*', _PARAM_CHAR, $sefUrl);
         // For non sef links
         if (!class_exists('shRouter')) {
             // Get rid of duplicate menu alias segments added by the JRoute function
             if (strstr($sefUrl, 'order:') || strstr($sefUrl, 'page:') || strstr($sefUrl, 'limit:')) {
                 $sefUrl = str_replace(array('/format:html/', '.html'), '/', $sefUrl);
             }
             // Get rid of duplicate menu alias segments added by the JRoute function
             if ($menu_alias != '' && $menu_alias != '/' && !$mod_rewrite) {
                 $sefUrl = str_replace($menu_alias, '--menuAlias--', $sefUrl, $count);
                 $sefUrl = str_replace(str_repeat('--menuAlias--', $count), $menu_alias, $sefUrl);
             }
         }
         $link = $sefUrl;
         // If it's not a JReviews menu url remove the suffix
         $nonsef_link = str_replace('&', '&', $nonsef_link);
         if (substr($nonsef_link, -5) == '.thtml' && !preg_match('/^index.php\\?option=com_jreviews&Itemid=([0-9]+)$/i', $nonsef_link)) {
             $link = str_replace('.html', '', $sefUrl);
         }
     }
     if (false !== strpos($link, 'http')) {
         return $link;
     } else {
         $parsedUrl = parse_url(WWW_ROOT);
         $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
         $www_root = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . ($sef ? _DS : $parsedUrl['path']);
         return $www_root . ltrim($link, _DS);
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:69,代码来源:joomla15.php


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