本文整理汇总了PHP中JRouter类的典型用法代码示例。如果您正苦于以下问题:PHP JRouter类的具体用法?PHP JRouter怎么用?PHP JRouter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JRouter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: DefaultViewEventCatRowNew
function DefaultViewEventCatRowNew($view, $row, $args = "")
{
// I choost not to use $row->fgcolor()
$fgcolor = "inherit";
$router = JRouter::getInstance("site");
$vars = $router->getVars();
$vars["catids"] = $row->catid();
if (array_key_exists("Itemid", $vars) && is_null($vars["Itemid"])) {
$vars["Itemid"] = JRequest::getInt("Itemid", 0);
}
$eventlink = "index.php?";
foreach ($vars as $key => $val) {
$eventlink .= $key . "=" . $val . "&";
}
$eventlink = substr($eventlink, 0, strlen($eventlink) - 1);
$eventlink = JRoute::_($eventlink);
?>
<a class="ev_link_cat" href="<?php
echo $eventlink;
?>
" style="color:<?php
echo $fgcolor;
?>
;" title="<?php
echo JEventsHTML::special($row->catname());
?>
"><?php
echo $row->catname();
?>
</a>
<?php
}
开发者ID:madcsaba,项目名称:li-de,代码行数:32,代码来源:defaultvieweventcatrownew.php
示例2: testCreateUriGeneratesUriFromUrlAndPreset
/**
* Tests createURI() method
*
* @param array $url valid inputs to the createURI() method
* @param array $preset global Vars that should be merged into the URL
* @param string $expected expected URI string
*
* @dataProvider casesCreateUri
* @testdox createUri() generates URI combining URL and preset variables
* @since 3.4
*/
public function testCreateUriGeneratesUriFromUrlAndPreset($url, $preset, $expected)
{
$this->object->setVars($preset, false);
$createUriMethod = new ReflectionMethod('JRouter', 'createUri');
$createUriMethod->setAccessible(true);
$this->assertEquals($expected, (string) $createUriMethod->invoke($this->object, $url));
}
开发者ID:joomla-agency,项目名称:joomla-cms,代码行数:18,代码来源:JRouterTest.php
示例3: getUri
/**
* Get Uri
*
* @param string $url URL
*
* @return JUri
*/
public function getUri($url = 'SERVER')
{
static $uriArray = array();
if (!array_key_exists($url, $uriArray)) {
// This will enable both SEF and non-SEF URI to be parsed properly
$router = clone JRouter::getInstance('site');
$uri = clone JUri::getInstance($url);
$langCode = JLanguageHelper::detectLanguage();
$lang = $uri->getVar('lang', $langCode);
$uri->setVar('lang', $lang);
$sefs = JLanguageHelper::getLanguages('lang_code');
if (isset($sefs[$lang])) {
$lang = $sefs[$lang]->sef;
$uri->setVar('lang', $lang);
}
$router->setVars(array(), false);
$query = $router->parse($uri);
$query = array_merge($query, $uri->getQuery(true));
$uri->setQuery($query);
// We are removing format because of default value is csv if present and if not set
// and we are never going to remember csv page in a browser history anyway
$uri->delVar('format');
$uriArray[$url] = $uri;
}
return $uriArray[$url];
}
开发者ID:thangredweb,项目名称:redCORE,代码行数:33,代码来源:browser.php
示例4: browse
/**
* Browse the given uri.
*
* @param string $uri The uri
* @param boolean $duplicateLast True to duplicate the last element if it's the same.
*
* @return void
*/
public function browse($uri = null, $duplicateLast = false)
{
// This will enable both SEF and non-SEF URI to be parsed properly
$router = JRouter::getInstance('site');
if (null === $uri) {
$uri = Juri::getInstance();
} else {
$uri = Juri::getInstance($uri);
}
// We are removing format because of default value is csv if present and if not set
// and we are never going to remember csv page in a browser history anyway
$uri->delVar('format');
$query = $router->parse($uri);
$uri = 'index.php?' . Juri::getInstance()->buildQuery($query);
$this->history->enqueue($uri, $duplicateLast);
}
开发者ID:810,项目名称:redCORE,代码行数:24,代码来源:browser.php
示例5: getContentRoute
function getContentRoute($url)
{
static $router;
// Only get the router once.
if (!is_object($router)) {
// Import dependencies.
jimport('joomla.application.router');
require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
// Get the site router.
$config =& JFactory::getConfig();
$router = JRouter::getInstance('site');
$router->setMode($config->getValue('sef', 1));
}
// Build the route.
$uri =& $router->build($url);
$route = $uri->toString(array('path', 'query', 'fragment'));
// Strip out the base portion of the route.
$route = str_replace('administrator/', '', $route);
return $route;
}
开发者ID:joebushi,项目名称:joomla,代码行数:20,代码来源:view.html.php
示例6: render
/**
*
* JT3 Framework render
*/
public function render()
{
$replace = array();
$matches = array();
parent::loadLayout();
$data = $this->_html;
if (preg_match_all('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data, $matches)) {
$cache_exclude = parent::getParam('cache_exclude');
$cache_exclude = new JRegistry($cache_exclude);
$nc_com = explode(',', $cache_exclude->get('component'));
$nc_pos = explode(',', $cache_exclude->get('position'));
$replace = array();
$matches[0] = array_reverse($matches[0]);
$matches[1] = array_reverse($matches[1]);
$matches[2] = array_reverse($matches[2]);
$count = count($matches[1]);
$option = JRequest::getCmd('option');
$headindex = -1;
//for none cache items
$nonecachesearch = array();
$nonecachereplace = array();
//search for item load in template (css, images, js)
$regex = '/(href|src)=("|\')([^"\']*\\/templates\\/' . T3_ACTIVE_TEMPLATE . '\\/([^"\']*))\\2/';
for ($i = 0; $i < $count; $i++) {
$attribs = JUtility::parseAttributes($matches[2][$i]);
$type = $matches[1][$i];
$name = isset($attribs['name']) ? $attribs['name'] : null;
//no cache => no cache for all jdoc include except head
//cache: exclude modules positions & components listed in cache exclude param
//check if head
if ($type == 'head') {
$headindex = $i;
} else {
$content = parent::getBuffer($type, $name, $attribs);
$renderer = $this->loadRenderer('module');
$poweradmin = JRequest::getCmd('poweradmin', 0);
$vsm_changeposition = JRequest::getCmd('vsm_changeposition', 0);
//Add a div wrapper for showing block information
if ($poweradmin == 1) {
//If the page requested to render position only
if ($vsm_changeposition == 1) {
if ($type == 'modules') {
$content = '<div class="jsn-element-container_inner">' . '<div class="jsn-poweradmin-position clearafter" id="' . $name . '-jsnposition">
<p>' . $name . '</p>
</div>
</div>
';
} else {
if ($type == 'module') {
$key = "mod.{$name}";
} else {
if ($type == 'component') {
$content = '<div class="jsn-component-container" id="jsnrender-component"><div class="jsn-show-component-container"><p>' . parent::getTitle() . '</p></div></div>';
} else {
$key = "{$type}.{$name}";
}
}
}
} else {
if ($type == 'modules') {
$buffer = '';
foreach (JModuleHelper::getModules($name) as $mod) {
$buffer .= '<div class="poweradmin-module-item" id="' . $mod->id . '-jsnposition" ><div id="moduleid-' . $mod->id . '-content">' . $renderer->render($mod, $attribs) . '</div></div>';
}
$content = '<div class="jsn-element-container_inner">' . '<div class="jsn-poweradmin-position clearafter" id="' . $name . '-jsnposition">
' . $buffer . '
</div>
</div>
';
} else {
if ($type == 'module') {
$key = "mod.{$name}";
} else {
if ($type == 'component') {
$app = JFactory::getApplication();
$itemid = JRequest::getVar('itemid', '');
$menu = $app->getMenu();
if ($itemid) {
$menuItem = $menu->getItem($itemid);
} else {
$menuItem = $menu->getActive();
}
$uri = JURI::getInstance();
$route = JRouter::getInstance('site');
$params = $route->parse($uri);
if (empty($params['id']) && !empty($menuItem->id)) {
$uri->parse($menuItem->link);
$params = $route->parse($uri);
}
if (!empty($params['option'])) {
$key = array_search($params['option'], array('', 'com_content', 'com_categories', 'com_banner', 'com_weblinks', 'com_contact', 'com_newsfeeds', 'com_search', 'com_redirect'));
if ($key) {
if (!empty($params['id'])) {
if ($params['view'] == 'category') {
$editLink = 'option=com_categories&task=category.edit&id=' . $params['id'] . '&extension=' . $params['option'] . '&tmpl=component';
$task = 'category.apply';
//.........这里部分代码省略.........
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:101,代码来源:jsnjoomlart.php
示例7: getRouter
public static function getRouter($name = null, array $options = array())
{
$name = 'administrator';
try {
$router = \JRouter::getInstance($name, $options);
} catch (\Exception $e) {
return null;
}
return $router;
}
开发者ID:mvanduijker,项目名称:joomla-cli,代码行数:10,代码来源:Application.php
示例8: siteRoute
/**
* Route URI to front-end.
*
* @param object $item
* @param string $website
* @param JRouter $routerSite
*
* @return string
*/
public static function siteRoute($item, $website, $routerSite)
{
$routedUri = $routerSite->build(CrowdfundingHelperRoute::getDetailsRoute($item->slug, $item->catslug));
if ($routedUri instanceof JUri) {
$routedUri = $routedUri->toString();
}
if (false !== strpos($routedUri, "/administrator")) {
$routedUri = str_replace("/administrator", "", $routedUri);
}
return $website . $routedUri;
}
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:20,代码来源:crowdfundingbackend.php
示例9: getRouter
/**
* getRouter
*
* @return \JRouterSite
*/
protected static function getRouter()
{
return \JRouter::getInstance('site', ['mode' => JROUTER_MODE_SEF]);
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:9,代码来源:SiteRoute.php
示例10: getUrlVars
public function getUrlVars($url)
{
$router = JRouter::getInstance('site');
$origVars = $router->getVars();
$router->setVars(array(), false);
// DO NOT use JURI::getInstance! Re-routing on the same instance causes big issues
$juri = new JURI($url);
// Odd hack to prevent the parsing of the URL to redirect to the https version in certain circumstances
$jConfig = JFactory::getConfig();
$forceSSL = $jConfig->get('force_ssl');
$jConfig->set('force_ssl', 0);
$queryVars = $router->parse($juri);
$jConfig->set('force_ssl', $forceSSL);
// Reset the router back to it's original state
$router->setVars($origVars);
return $queryVars;
}
开发者ID:q0821,项目名称:esportshop,代码行数:17,代码来源:opengraphaction.php
示例11: getContentPath
/**
* Method to get the path (SEF route) for a content item.
*
* @param string $url The non-SEF route to the content item.
*
* @return string The path for the content item.
*
* @since 2.5
*/
public static function getContentPath($url)
{
static $router;
// Only get the router once.
if (!$router instanceof JRouter) {
jimport('joomla.application.router');
include_once JPATH_SITE . '/includes/application.php';
// Get and configure the site router.
$config = JFactory::getConfig();
$router = JRouter::getInstance('site');
$router->setMode($config->get('sef', 1));
}
// Build the relative route.
$uri = $router->build($url);
$route = $uri->toString(array('path', 'query', 'fragment'));
$route = str_replace(JURI::base(true) . '/', '', $route);
return $route;
}
开发者ID:christianesperar,项目名称:joomla-example,代码行数:27,代码来源:helper.php
示例12: getRouter
/**
* Returns the application JRouter object.
*
* @param string $name The name of the application.
* @param array $options An optional associative array of configuration settings.
*
* @return JRouter
*
* @since 3.2
*/
public static function getRouter($name = null, array $options = array())
{
if (!isset($name)) {
$app = JFactory::getApplication();
$name = $app->getName();
}
try {
$router = JRouter::getInstance($name, $options);
} catch (Exception $e) {
return null;
}
return $router;
}
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:23,代码来源:cms.php
示例13: logoutRouterRule
/**
* Router callback rule for appending the SSO logout variable to the URL.
*
* @param JRouter $router Reference to the router object.
* @param JURI $uri Reference to the JURI object.
*
* @return void
*
* @since 2.0
*/
public static function logoutRouterRule(JRouter $router, JURI $uri)
{
$uri->setVar($router->getVar('ssologoutkey'), $router->getVar('ssologoutval'));
}
开发者ID:philbertphotos,项目名称:JMapMyLDAP,代码行数:14,代码来源:sso.php
示例14: onAfterRoute
function onAfterRoute()
{
$app = JFactory::getApplication();
// No need in admin panel
if ($app->isAdmin()) {
return;
}
$option = JREQUEST::getVar("option", null, "REQUEST");
$view = JREQUEST::getVar("view", null, "REQUEST");
$Itemid = JREQUEST::getVar("Itemid", null, "REQUEST");
$task = JREQUEST::getVar("task", null, "REQUEST");
$id = JREQUEST::getVar("id", null, "GET");
$do = JREQUEST::getVar("do", null, "REQUEST");
$layout = JREQUEST::getVar("layout", null, "REQUEST");
//$func_kunena=JREQUEST::getVar("func",null,"GET");
$route =& JRouter::getInstance("site");
$uri =& JURI::getInstance();
$path = $uri->getPath();
$mode = $route->getMode();
$count = "";
if ($mode != "1") {
//pas de mode SEF
// We verify in database that article exists and that it is published
if ($option == "com_content" && $view == "article" && $id != "") {
$id = explode(':', $id, 2);
$id = $id[0];
$db =& JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__content WHERE id = {$id} and (state=1 or state='-1') and (publish_down>NOW() OR publish_down='0000-00-00 00:00:00')";
$db->setQuery($query);
$count = $db->loadResult();
}
if ($option == "com_kunena" && $do != "") {
return;
}
if ($option == "com_camelcitycontent") {
return;
}
if ($option == "com_content" && $view == "frontpage" && $Itemid == 1 && !isset($_SERVER['REDIRECT_URL']) && $mode == "1") {
return;
}
if ($option == "com_content" && $view == "frontpage" && $Itemid == 1 && $_SERVER['SCRIPT_FILENAME'] == JPATH_BASE . "/index.php" && $mode == "0" && !isset($_SERVER['REDIRECT_URL'])) {
return;
}
if ($option == "com_content" && $view == "article" && $layout == "form") {
return;
}
if ($view == "article" && $task == "edit") {
return;
}
if ($task == "save" or $task == "cancel") {
return;
}
if ($path == "/index2.php" or $task == "login" or $task == "logout") {
return;
}
$result_error404 = JComponentHelper::getComponent("com_error404");
//we test if com_error404 is enabled
if ($result_error404->enabled == 1) {
//we verify if the component in the query string is enabled
$component = JComponentHelper::getComponent($option, true);
if ($component->enabled != 1 and $option != "" or strpos($_SERVER['REQUEST_URI'], 'index.php') === false and $_SERVER['REQUEST_URI'] != "/" or $option == "com_content" and $view == "article" and $count != "1") {
JREQUEST::setVar("option", "com_error404");
JREQUEST::setVar("uri", $_SERVER['REQUEST_URI']);
JREQUEST::setVar("view", "error404");
}
}
}
}
开发者ID:halbo5,项目名称:plgSystemError404,代码行数:68,代码来源:error404.php
示例15: DefaultLoadedFromTemplate
function DefaultLoadedFromTemplate($view, $template_name, $event, $mask)
{
$db = JFactory::getDBO();
// find published template
static $templates;
if (!isset($templates)) {
$templates = array();
}
if (!array_key_exists($template_name, $templates)) {
$db->setQuery("SELECT * FROM #__jev_defaults WHERE state=1 AND name= " . $db->Quote($template_name));
$templates[$template_name] = $db->loadObject();
}
if (is_null($templates[$template_name]) || $templates[$template_name]->value == "") {
return false;
}
$template = $templates[$template_name];
// now replace the fields
$search = array();
$replace = array();
$blank = array();
$jevparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
// Built in fields
$search[] = "{{TITLE}}";
$replace[] = $event->title();
$blank[] = "";
// Title link
$rowlink = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false);
$rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink());
ob_start();
?>
<a class="ev_link_row" href="<?php
echo $rowlink;
?>
" style="font-weight:bold;" title="<?php
echo JEventsHTML::special($event->title());
?>
">
<?php
$linkstart = ob_get_clean();
$search[] = "{{LINK}}";
$replace[] = $rowlink;
$blank[] = "";
$search[] = "{{LINKSTART}}";
$replace[] = $linkstart;
$blank[] = "";
$search[] = "{{LINKEND}}";
$replace[] = "</a>";
$blank[] = "";
$fulllink = $linkstart . $event->title() . '</a>';
$search[] = "{{TITLE_LINK}}";
$replace[] = $fulllink;
$blank[] = "";
$search[] = "{{URL}}";
$replace[] = $event->url();
$blank[] = "";
$search[] = "{{TRUNCATED_DESC:.*}}";
$replace[] = $event->content();
$blank[] = "";
// $search[]="|{{TRUNCATED_DESC:(.*)}}|";$replace[]=$event->content();
$search[] = "{{DESCRIPTION}}";
$replace[] = $event->content();
$blank[] = "";
$search[] = "{{MANAGEMENT}}";
ob_start();
$view->_viewNavAdminPanel();
$replace[] = ob_get_clean();
$blank[] = "";
$search[] = "{{CATEGORY}}";
$replace[] = $event->catname();
$blank[] = "";
$bgcolor = $event->bgcolor();
$search[] = "{{COLOUR}}";
$replace[] = $bgcolor == "" ? "#ffffff" : $bgcolor;
$blank[] = "";
$search[] = "{{FGCOLOUR}}";
$replace[] = $event->fgcolor();
$blank[] = "";
$search[] = "{{TTTIME}}";
$replace[] = "[[TTTIME]]";
$blank[] = "";
$search[] = "{{EVTTIME}}";
$replace[] = "[[EVTTIME]]";
$blank[] = "";
$search[] = "{{TOOLTIP}}";
$replace[] = "[[TOOLTIP]]";
$blank[] = "";
$router = JRouter::getInstance("site");
$vars = $router->getVars();
$vars["catids"] = $event->catid();
$eventlink = "index.php?";
foreach ($vars as $key => $val) {
$eventlink .= $key . "=" . $val . "&";
}
$eventlink = substr($eventlink, 0, strlen($eventlink) - 1);
$eventlink = JRoute::_($eventlink);
$catlink = '<a class="ev_link_cat" href="' . $eventlink . '" title="' . JEventsHTML::special($event->catname()) . '">' . $event->catname() . '</a>';
$search[] = "{{CATEGORYLNK}}";
$replace[] = $catlink;
$blank[] = "";
$search[] = "{{CATEGORYIMG}}";
//.........这里部分代码省略.........
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:101,代码来源:defaultloadedfromtemplate.php
示例16: array
/**
* Return a reference to the application JRouter object.
*
* @access public
* @param array $options An optional associative array of configuration settings.
* @return JRouter.
* @since 1.5
*/
function &getRouter($name = null, $options = array())
{
if (!isset($name)) {
$name = $this->_name;
}
jimport('joomla.application.router');
$router =& JRouter::getInstance($name, $options);
if (JError::isError($router)) {
$null = null;
return $null;
}
return $router;
}
开发者ID:walteraries,项目名称:anahita,代码行数:21,代码来源:application.php
示例17: DefaultLoadedFromTemplate
//.........这里部分代码省略.........
case "{{CALENDAR}}":
$search[] = "{{CALENDAR}}";
$replace[] = $event->getCalendarName();
$blank[] = "";
break;
case "{{COLOUR}}":
case "{{colour}}":
$bgcolor = $event->bgcolor();
$search[] = $strippedmatch;
$replace[] = $bgcolor == "" ? "#ffffff" : $bgcolor;
$blank[] = "";
break;
case "{{FGCOLOUR}}":
$search[] = "{{FGCOLOUR}}";
$replace[] = $event->fgcolor();
$blank[] = "";
break;
case "{{TTTIME}}":
$search[] = "{{TTTIME}}";
$replace[] = "[[TTTIME]]";
$blank[] = "";
break;
case "{{EVTTIME}}":
$search[] = "{{EVTTIME}}";
$replace[] = "[[EVTTIME]]";
$blank[] = "";
break;
case "{{TOOLTIP}}":
$search[] = "{{TOOLTIP}}";
$replace[] = "[[TOOLTIP]]";
$blank[] = "";
break;
case "{{CATEGORYLNK}}":
$router = JRouter::getInstance("site");
$catlinks = array();
if ($jevparams->get("multicategory", 0)) {
$catids = $event->catids();
$catdata = $event->getCategoryData();
} else {
$catids = array($event->catid());
$catdata = array($event->getCategoryData());
}
$vars = $router->getVars();
foreach ($catids as $cat) {
$vars["catids"] = $cat;
$catname = "xxx";
foreach ($catdata as $cg) {
if ($cat == $cg->id) {
$catname = $cg->name;
break;
}
}
$eventlink = "index.php?";
foreach ($vars as $key => $val) {
// this is only used in the latest events module so do not perpetuate it here
if ($key == "filter_reset") {
continue;
}
if ($key == "task" && ($val == "icalrepeat.detail" || $val == "icalevent.detail")) {
$val = "week.listevents";
}
$eventlink .= $key . "=" . $val . "&";
}
$eventlink = substr($eventlink, 0, strlen($eventlink) - 1);
$eventlink = JRoute::_($eventlink);
$catlinks[] = '<a class="ev_link_cat" href="' . $eventlink . '" title="' . JEventsHTML::special($catname) . '">' . $catname . '</a>';
开发者ID:madcsaba,项目名称:li-de,代码行数:67,代码来源:defaultloadedfromtemplate.php
示例18: getRouter
/**
* Returns the application JRouter object.
*
* @param string $name The name of the application.
* @param array $options An optional associative array of configuration settings.
*
* @return JRouter A JRouter object
*
* @since 11.1
*/
public static function getRouter($name = null, array $options = array())
{
if (!isset($name)) {
$app = JFactory::getApplication();
$name = $app->getName();
}
jimport('joomla.application.router');
$router = JRouter::getInstance($name, $options);
if ($router instanceof Exception) {
return null;
}
return $router;
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:23,代码来源:application.php
示例19: _
/**
* Translates an internal Joomla URL to a humanly readible URL.
*
* @param string $url Absolute or Relative URI to Joomla resource.
* @param boolean $xhtml Replace & by & for XML compilance.
* @param integer $ssl Secure state for the resolved URI.
* 1: Make URI secure using global secure site URI.
* 0: Leave URI in the same secure state as it was passed to the function.
* -1: Make URI unsecure using the global unsecure site URI.
*
* @return The translated humanly readible URL.
*
* @since 11.1
*/
public static function _($url, $xhtml = true, $ssl = null)
{
if (!self::$_router) {
// Get the router.
self::$_router = JFactory::getApplication()->getRouter();
// Make sure that we have our router
if (!self::$_router) {
return null;
}
}
if (strpos($url, '&') !== 0 && strpos($url, 'index.php') !== 0) {
return $url;
}
// Build route.
$uri = self::$_router->build($url);
$url = $uri->toString(array('path', 'query', 'fragment'));
// Replace spaces.
$url = preg_replace('/\\s/u', '%20', $url);
/*
* Get the secure/unsecure URLs.
*
* If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
* https and need to set our secure URL to the current request URL, if not, and the scheme is
* 'http', then we need to do a quick string manipulation to switch schemes.
*/
if ((int) $ssl) {
$uri = JURI::getInstance();
// Get additional parts.
static $prefix;
if (!$prefix) {
$prefix = $uri->toString(array('host', 'port'));
}
// Determine which scheme we want.
$scheme = (int) $ssl === 1 ? 'https' : 'http';
// Make sure our URL path begins with a slash.
if (!preg_match('#^/#', $url)) {
$url = '/' . $url;
}
// Build the URL.
$url = $scheme . '://' . $prefix . $url;
}
if ($xhtml) {
$url = htmlspecialchars($url);
}
return $url;
}
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:60,代码来源:route.php
示例20: testSetComponentRouter
/**
* Tests the setComponentRouter() method
*
* @return void
*
* @since 3.4
*/
public function testSetComponentRouter()
{
// Check if a router that implements JComponentRouterInterface gets accepted
$router = new TestRouter();
$this->assertEquals($this->object->setComponentRouter('com_test', $router), true);
$this->assertSame($this->object->getComponentRouter('com_test'), $router);
// Check if a false router is correctly rejected
$this->assertFalse($this->object->setComponentRouter('com_test3', new stdClass()));
}
开发者ID:nirpan,项目名称:joomla-cms,代码行数:16,代码来源:JRouterSiteTest.php
注:本文中的JRouter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论