本文整理汇总了PHP中cmsFramework::reorderUrlParams方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsFramework::reorderUrlParams方法的具体用法?PHP cmsFramework::reorderUrlParams怎么用?PHP cmsFramework::reorderUrlParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsFramework
的用法示例。
在下文中一共展示了cmsFramework::reorderUrlParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
function route($link, $xhtml = true, $ssl = null)
{
$menu_alias = '';
$traditionalUrlParams = defined('URL_PARAM_JOOMLA_STYLE') || class_exists('shRouter');
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');
$isJReviewsUrl = strpos($link, 'option=com_jreviews');
if (false === $isJReviewsUrl && !$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 === $isJReviewsUrl) {
$url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
return $url;
}
$isJReviewsUrl and $link = cmsFramework::reorderUrlParams($link, $traditionalUrlParams);
// 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');
preg_match('/Itemid=([0-9]+)/', $link, $matches);
$Itemid = Sanitize::getInt($matches, 1);
// Mod Rewrite is not enabled
if (!$mod_rewrite) {
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, 0, 9) == 'index.php' && (!$Itemid || $traditionalUrlParams == false && !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);
}
}