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


PHP JApplication::getRouter方法代码示例

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


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

示例1: _actionRoute

 /**
  * Parses the route.
  *
  * @param KCommandContext $context Command chain context
  *
  * @return bool
  */
 protected function _actionRoute(KCommandContext $context)
 {
     //route the application
     $url = clone KRequest::url();
     $this->_application->getRouter()->parse($url);
     JRequest::set($url->query, 'get', false);
     // trigger the onAfterRoute events
     $this->_application->triggerEvent('onAfterRoute');
     $url->query = KRequest::get('get', 'raw');
     //globally set ItemId
     global $Itemid;
     $Itemid = KRequest::get('get.Itemid', 'int', 0);
     //set the request
     $this->getRequest()->append($url->query);
     $component = substr($this->_request->option, 4);
     $this->setComponent($component);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:24,代码来源:dispatcher.php

示例2: getRouter

 /**
  * Return a reference to the JRouter object.
  *
  * @param   string    $name        The name of the application.
  * @param   array     $options     An optional associative array of configuration settings.
  *
  * @return  JRouter
  * @since   1.5
  */
 public static function getRouter($name = null, array $options = array())
 {
     $config = JFactory::getConfig();
     $options['mode'] = $config->get('sef');
     $router = parent::getRouter('site', $options);
     return $router;
 }
开发者ID:TFToto,项目名称:playjoom-builds,代码行数:16,代码来源:application.php

示例3:

 /**
  * Return a reference to the JRouter object.
  *
  * @access	public
  * @return	JRouter.
  * @since	1.5
  */
 function &getRouter()
 {
     $router =& parent::getRouter('administrator');
     return $router;
 }
开发者ID:esumerfd,项目名称:ssol_joomla,代码行数:12,代码来源:application.php

示例4: getRouter

 /**
  * Return a reference to the JRouter object.
  *
  * @return	JRouter
  * @since	1.5
  */
 public static function getRouter($name = null, array $options = array())
 {
     $router = parent::getRouter('administrator');
     return $router;
 }
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:11,代码来源:application.php

示例5: 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
  */
 public static function getRouter($name = null, array $options = array())
 {
     //die('getRouter() invalid in API application context');
     /*
     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;
     */
     $config = JFactory::getConfig();
     $options['mode'] = $config->getValue('config.sef');
     $router = parent::getRouter('api', $options);
     return $router;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:28,代码来源:application.php

示例6: loadMenu

 function loadMenu($menuname = 'mainmenu')
 {
     $list = array();
     $db = JFactory::getDbo();
     $acl = JFactory::getACL();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $aid = max($user->getAuthorisedViewLevels());
     //find active element or set default
     $active = $menu->getActive() ? $menu->getActive() : $menu->getDefault();
     $this->open = $active->tree;
     $rows = $menu->getItems('menutype', $menuname);
     if (!count($rows)) {
         return;
     }
     $children = array();
     $this->items = array();
     foreach ($rows as $index => $v) {
         if (isset($v->title)) {
             $v->name = $v->title;
         }
         if (isset($v->parent_id)) {
             $v->parent = $v->parent_id;
         }
         $v->name = str_replace('&', '&', str_replace('&amp', '&', $v->name));
         if ($v->access <= $aid) {
             $ptr = $v->parent;
             $list = @$children[$ptr] ? $children[$ptr] : array();
             $v->gkparams = new JObject();
             $v->gkparams = $gkparams = new JObject(json_decode($v->params));
             if ($gkparams) {
                 foreach (get_object_vars($gkparams) as $gk_name => $gk_value) {
                     if (preg_match('/gk_(.+)/', $gk_name, $matches)) {
                         if (is_array($gk_value)) {
                             $gk_value = implode(',', $gk_value);
                         }
                         $v->gkparams->set($matches[1], $gk_value);
                     }
                 }
             }
             // set cols to 1
             if ($v->gkparams->get('group')) {
                 $v->gkparams->set('cols', 1);
             }
             if ($v->gkparams->get('subcontent') == 'pos') {
                 $modules = $this->loadModules($v->gkparams);
                 if ($modules && count($modules) > 0) {
                     $v->content = "";
                     $total = count($modules);
                     $cols = min($v->gkparams->get('cols'), $total);
                     for ($col = 0; $col < $cols; $col++) {
                         $pos = $col == 0 ? 'first' : ($col == $cols - 1 ? 'last' : '');
                         if ($cols > 1) {
                             $v->content .= $this->beginSubMenuModules($v->id, 1, $pos, $col, true);
                         }
                         $i = $col;
                         while ($i < $total) {
                             $mod = $modules[$i];
                             $i += $cols;
                             $mod_params = new JObject(json_decode($mod->params));
                             $v->content .= "<jdoc:include type=\"modules\" name=\"{$mod->position}\" style=\"" . $v->gkparams->get('style', 'none') . "\" />";
                         }
                         if ($cols > 1) {
                             $v->content .= $this->endSubMenuModules($v->id, 1, true);
                         }
                     }
                     $v->cols = $cols;
                     $v->content = trim($v->content);
                     $this->items[$v->id] = $v;
                 }
             }
             // friendly links
             $v->flink = $v->link;
             switch ($v->type) {
                 case 'separator':
                     continue;
                 case 'url':
                     if (strpos($v->link, 'index.php?') === 0 && strpos($v->link, 'Itemid=') === false) {
                         $v->flink = $v->link . '&Itemid=' . $v->id;
                     }
                     break;
                 case 'alias':
                     $v->flink = 'index.php?Itemid=' . $v->gkparams->get('aliasoptions');
                     break;
                 default:
                     $router = JApplication::getRouter();
                     $router->getMode() == JROUTER_MODE_SEF ? $v->flink = 'index.php?Itemid=' . $v->id : ($v->flink .= '&Itemid=' . $v->id);
                     break;
             }
             $v->url = $v->flink = JRoute::_($v->flink);
             if ($v->home == 1) {
                 $v->url = JURI::base();
             }
             // class suffix
             if (!isset($v->clssfx)) {
                 $v->clssfx = $v->gkparams->get('pageclass_sfx', '');
                 if ($v->gkparams->get('cols')) {
                     $v->cols = $v->gkparams->get('cols');
                     $v->col = array();
//.........这里部分代码省略.........
开发者ID:Roma48,项目名称:moesto,代码行数:101,代码来源:GKBase.class.php

示例7: getList

	public static function getList(&$params)
	{
		$lang = JFactory::getLanguage();
		$languages	= JLanguageHelper::getLanguages();
		$app		= JFactory::getApplication();

        //use to remove default language code in url
        $lang_codes 	= JLanguageHelper::getLanguages('lang_code');
        $default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
        $default_sef 	= $lang_codes[$default_lang]->sef;

        $sefToolsEnabled = modFaLangHelper::sefToolEnabled();


        $menu = $app->getMenu();
        $active = $menu->getActive();
        $uri = JURI::getInstance();


        // Get menu home items
        $homes = array();

        foreach ($menu->getMenu() as $item)
        {
            if ($item->home)
            {
                $homes[$item->language] = $item;
            }
        }


        if (FALANG_J30) {
            //since 3.2
            if (version_compare(JVERSION, '3.2', 'ge')) {
                $assoc =  JLanguageAssociations::isEnabled();
            } else {
                $assoc = isset($app->item_associations) ? (boolean) $app->item_associations : false;
            }
        } else {
            $assoc = (boolean) $app->get('menu_associations', true);
        }


		if ($assoc) {
			if ($active) {
				$associations = MenusHelper::getAssociations($active->id);
			}
		}
   		foreach($languages as $i => &$language) {
			// Do not display language without frontend UI
			if (!JLanguage::exists($language->lang_code)) {
				unset($languages[$i]);
			}
            if (FALANG_J30) {
                $language_filter = JLanguageMultilang::isEnabled();
            } else {
                $language_filter = $app->getLanguageFilter();
            }



            //set language active before language filter use for sh404 notice
            $language->active =  $language->lang_code == $lang->getTag();

            //since v1.4 change in 1.5 , ex rsform preview don't have active
            if (isset($active)){
                $language->display = ($active->language == '*' || $language->active)?true:false;
            } else {
                $language->display = true;
            }


            if ($language_filter) {
                if (isset($associations[$language->lang_code]) && $menu->getItem($associations[$language->lang_code])) {
                    $language->display = true;
                    $itemid = $associations[$language->lang_code];
                    if ($app->getCfg('sef')=='1') {
                        $language->link = JRoute::_('index.php?lang='.$language->sef.'&Itemid='.$itemid);
                    }
                    else {
                        $language->link = 'index.php?lang='.$language->sef.'&Itemid='.$itemid;
                    }
                }
                else {
                    //sef case
                    if ($app->getCfg('sef')=='1') {

                        //sefToolsEnabled
                        if ($sefToolsEnabled) {
                            $itemid = isset($homes[$language->lang_code]) ? $homes[$language->lang_code]->id : $homes['*']->id;
                            $language->link = JRoute::_('index.php?lang='.$language->sef.'&Itemid='.$itemid);
                            continue;
                        }


                         //$uri->setVar('lang',$language->sef);
                         $router = JApplication::getRouter();
                         $tmpuri = clone($uri);

                         $router->parse($tmpuri);
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:helper.php

示例8: loadMenu

 function loadMenu($menuname = 'mainmenu')
 {
     $list = array();
     $db = JFactory::getDbo();
     $acl = JFactory::getACL();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $aid = $user->get('aid');
     //find active element or set default
     $active = $menu->getActive() ? $menu->getActive() : $menu->getDefault();
     $this->open = $active->tree;
     $this->open = $this->open[count($this->open) - 1];
     $rows = $menu->getItems('menutype', $menuname);
     if (!count($rows)) {
         return;
     }
     $children = array();
     $this->items = array();
     foreach ($rows as $index => $v) {
         if (isset($v->title)) {
             $v->name = $v->title;
         }
         if (isset($v->parent_id)) {
             $v->parent = $v->parent_id;
         }
         $v->name = str_replace('&', '&amp;', str_replace('&amp', '&', $v->name));
         if ($v->access >= $aid) {
             $ptr = $v->parent;
             $list = @$children[$ptr] ? $children[$ptr] : array();
             // friendly links
             $v->flink = $v->link;
             switch ($v->type) {
                 case 'separator':
                     continue;
                 case 'url':
                     if (strpos($v->link, 'index.php?') === 0 && strpos($v->link, 'Itemid=') === false) {
                         $v->flink = $v->link . '&Itemid=' . $v->id;
                     }
                     break;
                 case 'alias':
                     $v->flink = 'index.php?Itemid=' . $v->params->get('aliasoptions');
                     break;
                 default:
                     $router = JApplication::getRouter();
                     if ($router->getMode() == JROUTER_MODE_SEF) {
                         $v->flink = 'index.php?Itemid=' . $v->id;
                     } else {
                         $v->flink .= '&Itemid=' . $v->id;
                     }
                     break;
             }
             $v->url = $v->flink = JRoute::_($v->flink);
             if ($v->home == 1) {
                 $v->url = JURI::base();
             }
             $v->_idx = count($list);
             array_push($list, $v);
             $children[$ptr] = $list;
             $this->items[$v->id] = $v;
         }
     }
     $this->children = $children;
 }
开发者ID:Roma48,项目名称:moesto,代码行数:64,代码来源:GKHandheld.php

示例9:

	/**
	 * Return a reference to the JRouter object.
	 *
	 * @access	public
	 * @return	JRouter.
	 * @since	1.5
	 */
	function &getRouter()
	{
		$config =& JFactory::getConfig();
		$options['mode'] = $config->getValue('config.sef');
		$router =& parent::getRouter('site', $options);
		return $router;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:14,代码来源:application.php

示例10:

 /**
  * Return a reference to the JRouter object.
  *
  * @access	public
  * @return	JRouter.
  * @since	1.5
  */
 function &getRouter()
 {
     $options['mode'] = $this->getCfg('sef');
     $router =& parent::getRouter('forum', $options);
     return $router;
 }
开发者ID:skyview059,项目名称:e-learning-website,代码行数:13,代码来源:application.php


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