本文整理汇总了PHP中DiscussRouter::isSefEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::isSefEnabled方法的具体用法?PHP DiscussRouter::isSefEnabled怎么用?PHP DiscussRouter::isSefEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::isSefEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFeedURL
public function getFeedURL($url, $atom = false)
{
require_once DISCUSS_HELPERS . '/router.php';
$sef = DiscussRouter::isSefEnabled();
$join = $sef ? '?' : '&';
$url = DiscussRouter::_($url) . $join . 'format=feed';
$url .= $atom ? '&type=atom' : '&type=rss';
return $url;
}
示例2: getRoutedURL
public static function getRoutedURL($url, $xhtml = false, $external = false)
{
if (!$external) {
return DiscussRouter::_($url, $xhtml);
}
$mainframe = JFactory::getApplication();
$uri = JURI::getInstance(JURI::base());
//To fix 1.6 Jroute issue as it will include the administrator into the url path.
$url = str_replace('/administrator/', '/', DiscussRouter::_($url, $xhtml));
if ($mainframe->isAdmin() && DiscussRouter::isSefEnabled()) {
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
JFactory::$application = JApplication::getInstance('site');
}
if (DiscussHelper::getJoomlaVersion() >= '3.0') {
jimport('joomla.libraries.cms.router');
} else {
jimport('joomla.application.router');
require_once JPATH_ROOT . '/includes/router.php';
require_once JPATH_ROOT . '/includes/application.php';
}
$router = new JRouterSite(array('mode' => JROUTER_MODE_SEF));
$urls = $router->build($url)->toString(array('path', 'query', 'fragment'));
$urls = DISCUSS_JURIROOT . '/' . ltrim(str_replace('/administrator/', '/', $urls), '/');
$container = explode('/', $urls);
$container = array_unique($container);
$urls = implode('/', $container);
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
JFactory::$application = JApplication::getInstance('administrator');
}
return $urls;
} else {
$url = rtrim($uri->toString(array('scheme', 'host', 'port')), '/') . '/' . ltrim($url, '/');
$url = str_replace('/administrator/', '/', $url);
if (DiscussRouter::isSefEnabled()) {
$container = explode('/', $url);
$container = array_unique($container);
$url = implode('/', $container);
}
return $url;
}
}