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


PHP KunenaRoute::initialize方法代码示例

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


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

示例1: display

	public function display($cachable = false, $urlparams = false) {
		$menu = $this->app->getMenu ();
		$home = $menu->getActive ();
		if (!$home) {
			JRequest::setVar ( 'view', 'category' );
			JRequest::setVar ( 'layout', 'list' );
			//JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );

		} else {
			// Find default menu item
			$default = $this->_getDefaultMenuItem($menu, $home);
			if (!$default || $default->id == $home->id) {
				// There is no default menu item, use category view instead

				$default = $menu->getItem ( KunenaRoute::getItemID("index.php?option=com_kunena&view=category&layout=list") );
				if ($default) {
					$default = clone $default;
					$defhome = KunenaRoute::getHome($default);
					if (!$defhome || $defhome->id != $home->id) $default = clone $home;
					$default->query['view'] = 'category';
					$default->query['layout'] = 'list';
				}
			}
			if (!$default) {
				JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
			}

			// Add query variables from shown menu item
			foreach ( $default->query as $var => $value ) {
				JRequest::setVar ( $var, $value );
			}

			// Remove query variables coming from the home menu item
			JRequest::setVar ( 'defaultmenu', null );

			// Set active menu item to point the real page
			$menu->setActive ( $default->id );
		}

		// Reset our router
		KunenaRoute::initialize();

		// Run display task from our new controller
		$controller = KunenaController::getInstance();
		$controller->execute ('display');

		// Set redirect and message
		$this->setRedirect ($controller->getRedirect(), $controller->getMessage(), $controller->getMessageType());
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:49,代码来源:home.php

示例2: execute

 /**
  * Redirect to home page.
  *
  * @return KunenaLayout
  *
  * @throws KunenaExceptionAuthorise
  */
 public function execute()
 {
     $menu = $this->app->getMenu();
     $home = $menu->getActive();
     if (!$home) {
         $this->input->set('view', 'category');
         $this->input->set('layout', 'list');
         // throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
     } else {
         // Find default menu item.
         $default = $this->getDefaultMenuItem($menu, $home);
         if (!$default || $default->id == $home->id) {
             // There is no default menu item, use category view instead.
             $default = $menu->getItem(KunenaRoute::getItemID('index.php?option=com_kunena&view=category&layout=list'));
             if ($default) {
                 $default = clone $default;
                 $defhome = KunenaRoute::getHome($default);
                 if (!$defhome || $defhome->id != $home->id) {
                     $default = clone $home;
                 }
                 $default->query['view'] = 'category';
                 $default->query['layout'] = 'list';
             }
         }
         if (!$default) {
             throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
         }
         // Add query variables from shown menu item.
         foreach ($default->query as $var => $value) {
             $this->input->set($var, $value);
         }
         // Remove query variables coming from the home menu item.
         $this->input->set('defaultmenu', null);
         // Set active menu item to point the real page.
         $this->input->set('Itemid', $default->id);
         $menu->setActive($default->id);
     }
     // Reset our router.
     KunenaRoute::initialize();
     // Get HMVC controller for the current page.
     $controller = KunenaControllerApplication::getInstance($this->input->getCmd('view'), $this->input->getCmd('layout', 'default'), $this->input->getCmd('task', 'display'), $this->input, $this->app);
     if (!$controller) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     return $controller->execute();
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:53,代码来源:display.php

示例3: defined

/**
 * Kunena Component
 * @package Kunena.Framework
 * @subpackage Route
 *
 * @copyright (C) 2008 - 2016 Kunena Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link https://www.kunena.org
 **/
defined ( '_JEXEC' ) or die ();

jimport('joomla.environment.uri');
jimport('joomla.html.parameter');
jimport('joomla.filter.output');

KunenaRoute::initialize();

/**
 * Class KunenaRoute
 */
abstract class KunenaRoute
{
	// List of views: array of default variable=>value pairs, which can be removed from URI
	static $views = array(
		'attachment'=>array('layout'=>'default', 'thumb'=>0, 'download'=>0),
		'announcement'=>array('layout'=>'default'),
		'category'=>array('layout'=>'default', 'catid'=>'0'),
		'common'=>array('layout'=>'default'),
		'credits'=>array('layout'=>'default'),
		'home'=>array(),
		'misc'=>array('layout'=>'default'),
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:31,代码来源:route.php

示例4: display

	public function display() {
		global $Itemid;
		$menu = JFactory::getApplication ()->getMenu ();
		$home = $menu->getActive ();
		// TODO: maybe add error
		if (!$home) return;

		// Find default menu item
		$default = $this->_getDefaultMenuItem($menu, $home);
		if (!$default) {
			// There is no default menu item, use category view instead
			$default = clone $menu->getItem ( KunenaRoute::getItemID("index.php?option=com_kunena&view=category&layout=index") );
			$default->query['view'] = 'category';
			$default->query['layout'] = 'index';
		}
		if (!$default) {
			JError::raiseError ( 500, JText::_ ( 'COM_KUNENA_NO_ACCESS' ) );
		}

		// Check if menu item was correctly routed
		$active = $menu->getItem ( KunenaRoute::getItemID() );
		if (!$active || ($active->id != $home->id && $active->id != $default->id)) {
			// Routing has been changed, redirect or fail
			if ($active) {
				JRequest::setVar ( 'defaultmenu', null );
				// FIXME: chack possible redirect loops!
				$this->setRedirect (KunenaRoute::_(null, false));
			}
			return;
		}

		// Check if we are using default menu item
		if (!isset($default->query['layout'])) $default->query['layout'] = 'default';
		foreach ( $default->query as $var => $value ) {
			$cmp = JRequest::getVar($var, null);
			if ($var == 'defaultmenu') continue;
			if ($var == 'view' && $cmp == 'home') continue;
			if ($cmp !== null && $value != $cmp) {
				$default = $home;
				break;
			}
		}
		// Add query variables from shown menu item
		if ($default != $home) {
			foreach ( $default->query as $var => $value ) {
				JRequest::setVar ( $var, $value );
			}
		}
		// Set active menu item to point the real page
		$menu->setActive ( $default->id );

		// Joomla 1.5 hack:
		$Itemid = $default->id;
		KunenaRoute::initialize();

		if (JRequest::getVar ( 'view' ) != 'home') {
			// Run display task from our new controller
			$controller = KunenaController::getInstance(true);
			$controller->execute ('display');
			// Set redirect and message
			$this->setRedirect ($controller->getRedirect(), $controller->getMessage(), $controller->getMessageType());
		}
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:63,代码来源:home.php


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