本文整理汇总了PHP中shRouter::build方法的典型用法代码示例。如果您正苦于以下问题:PHP shRouter::build方法的具体用法?PHP shRouter::build怎么用?PHP shRouter::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shRouter
的用法示例。
在下文中一共展示了shRouter::build方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sh404Sef
/**
* Create sh404SEF URLs
*
* @copyright
* @author RolandD
* @todo
* @see http://dev.anything-digital.com/sh404SEF/
* @see getSiteRoute()
* @access private
* @param string $url the original URL to turn into SEF
* @return string SEF URL
* @since 3.0
*/
private function _sh404Sef($url)
{
// Load sh404SEF
require_once JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php';
$sefConfig = shRouter::shGetConfig();
// Turn off any security and flooding setting
$sefConfig->shSecEnableSecurity = 0;
$sefConfig->shSecActivateAntiFlood = 0;
// Require some necessary files
require_once JPATH_ROOT . '/components/com_sh404sef/shCache.php';
require_once JPATH_ROOT . '/components/com_sh404sef/shSec.php';
// Start the sh404sef Router
if (class_exists('shRouter')) {
$shRouter = new shRouter();
} else {
return $this->_domainname . '/' . $url;
}
// Force the domain name
$GLOBALS['shConfigLiveSite'] = $this->_domainname;
// Initialize sh404sef
include_once JPATH_ROOT . '/components/com_sh404sef/shInit.php';
// Build the SEF URL
$uri = $shRouter->build($url);
$sefurl = $uri->toString();
if (strpos($sefurl, 'http://') === false) {
$sefurl = str_ireplace('http:/', 'http://', $sefurl);
}
return $sefurl;
}
示例2: header
$sefConfig->page404 == '0';
}
// configuration values carried over when upgrading
if ($sefConfig->page404 == '0') {
$sql = 'SELECT id FROM #__content WHERE `title`="__404__"';
$database->setQuery($sql);
if ($id = $database->loadResult()) {
} else {
JError::raiseError(404, JText::_('Component Not Found') . $mosmsg);
}
} else {
$id = $sefConfig->page404;
}
$vars['id'] = $id;
$shPageInfo->QUERY_STRING = 'option=com_content&view=article&id=' . $id . (empty($vars['Itemid']) ? '' : '&Itemid=' . $vars['Itemid']);
$uri = shRouter::build($GLOBALS['shConfigLiveSite'] . '/index.php?' . $shPageInfo->QUERY_STRING);
$shPageInfo->shCurrentPageNonSef = 'index.php?' . $shPageInfo->QUERY_STRING;
$tmpl = str_replace('.php', '', $sefConfig->error404SubTemplate);
if (!empty($tmpl)) {
$vars['tmpl'] = $tmpl;
}
if (!headers_sent()) {
header('HTTP/1.0 404 NOT FOUND');
// V x : include error page, faster than loading Joomla 404 page. Not recommended though, why not show
// your site ?
if (is_readable(sh404SEF_FRONT_ABS_PATH . '404-Not-Found.tpl.html')) {
$errorPage = file_get_contents(sh404SEF_FRONT_ABS_PATH . '404-Not-Found.tpl.html');
if ($errorPage !== false) {
$errorPage = str_replace('%sh404SEF_404_URL%', $vars['mosmsg'], $errorPage);
$errorPage = str_replace('%sh404SEF_404_SITE_URL%', $GLOBALS['shConfigLiveSite'], $errorPage);
$errorPage = str_replace('%sh404SEF_404_SITE_NAME%', $mainframe->getCfg('sitename'), $errorPage);