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


PHP Router::getParams方法代码示例

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


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

示例1: _process

 /**
  * Processes the dispatch
  *
  * @return bool
  */
 private function _process()
 {
     $this->_hasResult = $this->_router->getResult();
     $this->_parameters = $this->_router->getParams();
     if ($this->_parameters !== false) {
         $type = $this->_parameters["type"];
     }
     if ($this->_hasResult === false) {
         $type = "error";
     }
     return $this->_dispatch($type);
 }
开发者ID:andreums,项目名称:framework1.5,代码行数:17,代码来源:Dispatcher.class.php

示例2: __construct

 function __construct($method, $messages)
 {
     $this->controller = new AppController();
     $params = Router::getParams();
     $viewPath = $this->controller->viewPath;
     if (Configure::read('App.theme')) {
         $viewPath = 'errors';
         if ($this->controller->view == 'Theme') {
             $viewPath = 'themed' . DS . Configure::read('App.theme') . DS . 'errors';
         }
     }
     if (Configure::read('debug') == 0) {
         $method = 'error404';
     }
     $checkView = VIEWS . $viewPath . DS . Inflector::underscore($method) . '.ctp';
     if (file_exists($checkView)) {
         $this->controller->_set(Router::getPaths());
         $this->controller->viewPath = $viewPath;
         $this->controller->theme = $appConfigurations['theme'];
         $this->controller->pageTitle = __('Error', true);
         $this->controller->set('message', $messages[0]['url']);
         $this->controller->set('appConfigurations', $appConfigurations);
         $this->controller->render($method);
         e($this->controller->output);
     } else {
         parent::__construct($method, $messages);
     }
 }
开发者ID:nicoeche,项目名称:Finalus,代码行数:28,代码来源:app_error.php

示例3: init

 /**
  * Starting point for every page request. Loads required core modules, gets data from url and calls
  * necessary modules to make things happen.
  */
 public static function init()
 {
     if (!self::$_inited) {
         self::$_inited = true;
         foreach (self::$_requiredCore as $module) {
             require_once ROOT . 'core/' . $module . '/' . $module . EXT;
         }
         // Set the Load::auto method to handle all class loading from now on
         spl_autoload_register('Load::auto');
         Load::loadSetupFiles();
         // If CLI mode, everything thats needed has been loaded
         if (IS_CLI) {
             return;
         }
         date_default_timezone_set(Config::get('system.timezone'));
         Event::trigger('caffeine.started');
         // If maintenance mode has been set in the config, stop everything and load mainteance view
         if (Config::get('system.maintenance_mode')) {
             View::error(ERROR_MAINTENANCE);
         } else {
             list($route, $data) = Router::getRouteData();
             if ($data) {
                 if (self::_hasPermission($route, $data)) {
                     list($module, $controller, $method) = $data['callback'];
                     $params = Router::getParams();
                     // Make sure controller words are upper-case
                     $conBits = explode('_', $controller);
                     foreach ($conBits as &$bit) {
                         $bit = ucfirst($bit);
                     }
                     $controller = implode('_', $conBits);
                     $controller = sprintf('%s_%sController', ucfirst($module), ucwords($controller));
                     // Call the routes controller and method
                     if (method_exists($controller, $method)) {
                         $response = call_user_func_array(array($controller, $method), $params);
                         if (!self::_isErrorResponse($response)) {
                             Event::trigger('module.response', array($response));
                             View::load($module, $controller, $method);
                         } else {
                             View::error($response);
                         }
                     } else {
                         Log::error($module, sprintf('The method %s::%s() called by route %s doesn\'t exist.', $controller, $method, $route));
                         View::error(ERROR_500);
                     }
                 } else {
                     View::error(ERROR_ACCESSDENIED);
                 }
             } else {
                 if ($route !== '[index]' || !View::directLoad('index')) {
                     View::error(ERROR_404);
                 }
             }
         }
         View::output();
         Event::trigger('caffeine.finished');
     } else {
         die('Why are you trying to re-initialize Caffeine?');
     }
 }
开发者ID:simudream,项目名称:caffeine,代码行数:64,代码来源:index.php

示例4: execute

 public function execute()
 {
     $suffix = "Controller";
     Router::parseUri();
     try {
         $_cc = ucfirst(Router::getController()) . $suffix;
         Loader::autoload($_cc);
         if (!class_exists($_cc, false) && !interface_exists($_cc, false)) {
             throw new Exception('Class ' . $_cc . ' does not exist');
         }
         $class = new ReflectionClass($_cc);
         if ($class->isAbstract()) {
             throw new Exception('Cannot create instances of abstract ' . $_cc . '');
         }
         // Create a new instance of the controller
         $controller = $class->newInstance();
         // Execute the "before action" method
         //$class->getMethod('before')->invoke($controller);
         // Execute the main action with the parameters
         $class->getMethod(Router::getAction() . 'Action')->invokeArgs($controller, Router::getParams());
         // Execute the "after action" method
         //$class->getMethod('after')->invoke($controller);
     } catch (Exception $e) {
         throw $e;
     }
     return $this;
 }
开发者ID:hexcode007,项目名称:yfcms,代码行数:27,代码来源:Request.class.php

示例5: read_group

 /**
  *
  */
 public function read_group($userSlug, $collectionSlug, $groupTypeSlug, $groupSlug)
 {
     $userId = $this->Users->getIdFromSlug($userSlug);
     $collectionId = $this->Collections->getIdFromSlug($collectionSlug);
     $collectionFieldId = $this->CollectionGroups->getFieldIdFromSlug($groupTypeSlug);
     $groupValue = $this->CollectionGroups->getFieldValueFromSlug($groupSlug);
     $user = $this->Users->getUser($userId);
     $this->set('user', $user);
     $collection = $this->Collections->getCollection($collectionId);
     $this->set('collection', $collection);
     $group = $this->CollectionGroups->getGroup($collectionFieldId, $groupValue);
     $this->set('collectionGroup', $group);
     $participation = $this->Participations->getCollectionForUser($userId, $collectionId);
     $this->set('participation', $participation);
     $itemIds = $this->CollectionGroups->getItemIds($collectionFieldId, $groupValue);
     $page = empty($this->request->query['page']) ? 0 : $this->request->query['page'];
     $items = $this->CollectionItems->getItems(null, $itemIds, $page);
     $this->set('collectionItems', $items);
     $this->set('collectionItemsPaging', Router::getParams()['paging']['CollectionItem']);
     $participations = $this->Participations->getUsersForGroup($collectionId, $collectionFieldId, $groupValue);
     $this->set('participations', $participations);
     $participationGroup = $this->ParticipationGroups->getGroup($userId, $collectionId, $group['CollectionGroup']['name']);
     $this->set('participationGroup', $participationGroup);
     $completions = $this->Completions->getCompletions($userId, $collectionId);
     $this->set('completions', $completions);
     $legendAvailability = $this->CollectionItems->getAvailabilityLegend();
     $this->set('legendAvailability', $legendAvailability);
     $legendCompletion = $this->Completions->readCompletionLegend();
     $this->set('legendCompletion', $legendCompletion);
     $this->set('collectionSlug', $collectionSlug);
     $this->set('groupTypeSlug', $groupTypeSlug);
     $this->set('groupSlug', $groupSlug);
     $this->set('groupValue', $groupValue);
 }
开发者ID:absolutholz,项目名称:andStuffandEverything-Backend--old,代码行数:37,代码来源:ParticipationGroupsController.php

示例6: read_collection

 /**
  *
  */
 public function read_collection($userSlug, $collectionSlug)
 {
     $userId = $this->Users->getIdFromSlug($userSlug);
     $collectionId = $this->Collections->getIdFromSlug($collectionSlug);
     $user = $this->Users->getUser($userId);
     $this->set('user', $user);
     $collection = $this->Collections->getCollection($collectionId);
     $this->set('collection', $collection);
     $participation = $this->Participations->getCollectionForUser($userId, $collectionId);
     $this->set('participation', $participation);
     $page = empty($this->request->query['page']) ? 0 : $this->request->query['page'];
     $items = $this->CollectionItems->getItems($collectionId, null, $page);
     $this->set('collectionItems', $items);
     $this->set('collectionItemsPaging', Router::getParams()['paging']['CollectionItem']);
     $participations = $this->Participations->getUsersForCollection($collectionId);
     $this->set('participations', $participations);
     $completions = $this->Completions->getCompletions($userId, $collectionId);
     $this->set('completions', $completions);
     $legendAvailability = $this->CollectionItems->getAvailabilityLegend();
     $this->set('legendAvailability', $legendAvailability);
     $legendCompletion = $this->Completions->readCompletionLegend();
     $this->set('legendCompletion', $legendCompletion);
     $this->set('userSlug', $userSlug);
     $this->set('collectionSlug', $collectionSlug);
 }
开发者ID:absolutholz,项目名称:andStuffandEverything,代码行数:28,代码来源:ParticipationsController.php

示例7: testGetParams_MultipleUrlsInPathInfo_ReturnArray

 /**
  * Test getParams with multiple urls given in PATH_INFO
  * 
  * @dataProvider getSamplePathInfoStrings
  */
 public function testGetParams_MultipleUrlsInPathInfo_ReturnArray($sPathInfo, $aCorrectValues)
 {
     $_SERVER['PATH_INFO'] = $sPathInfo;
     $oRouter = new Router(array('Default_controller' => 'Ctrl', 'Default_function' => 'indexAction'));
     $this->assertTrue(array_diff($oRouter->getParams(), $aCorrectValues['params']) === array());
     unset($oRouter);
     unset($_SERVER['PATH_INFO']);
 }
开发者ID:maxwroc,项目名称:PHP,代码行数:13,代码来源:RouterTest.php

示例8: api_users

 public function api_users()
 {
     $users = $this->Users->readUsers();
     $this->set('users', $users);
     $this->set('paging', Router::getParams()['paging']['User']);
     $this->set('_serialize', array('users', 'paging'));
     $this->render('../api_read');
 }
开发者ID:absolutholz,项目名称:andStuffandEverything-Backend--old,代码行数:8,代码来源:UsersController.php

示例9: __construct

	/**
	 * __construct
	 *
	 * @access public
	 * @return void
	 */
	function __construct() {
		parent::__construct();
		$this->_set(Router::getPaths());
		$this->params = Router::getParams();
		$this->constructClasses();
		$this->Component->initialize($this);
		$this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
	}
开发者ID:ralmeida,项目名称:FoundFree.org,代码行数:14,代码来源:error.php

示例10: api_items

 /**
  *
  */
 public function api_items($collection_id)
 {
     $items = $this->CollectionItems->getItems($collection_id);
     $this->set('collectionItems', $items);
     $this->set('paging', Router::getParams()['paging']['CollectionItem']);
     $this->set('_serialize', array('collectionItems', 'paging'));
     $this->render('../api_read');
 }
开发者ID:absolutholz,项目名称:andStuffandEverything,代码行数:11,代码来源:CollectionItemsController.php

示例11: __construct

 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if ($this->name == 'CakeError') {
         $this->_set(Router::getPaths());
         $this->request->params = Router::getParams();
         $this->constructClasses();
         $this->startupProcess();
     }
 }
开发者ID:hotanlam,项目名称:japansource,代码行数:10,代码来源:AppController.php

示例12: has

 /**
  * Check wither the routing table has a specific route
  * @param Router $router
  * @return bool
  */
 public function has(Router $router)
 {
     $found = false;
     foreach ($this->_routingTable as $routeID => $routeDetails) {
         if (preg_match("/^" . str_replace('/', '\\/', $routeDetails['_url_']) . "\$/i", $router->getFinalRequestedId()) && in_array($router->getRequest()->getMethod(), $this->_routingTable[$routeID]['_method_'])) {
             $found = true;
             break;
         }
     }
     $router->setController($this->_routingTable[$routeID]['_controller_']);
     $router->setAction($this->_routingTable[$routeID]['_action_']);
     if (!empty($router->getParams())) {
         $index = 0;
         $parameters = array();
         $routerFetchedParameters = $router->getParams();
         foreach ($this->_routingTable[$routeID]['_params_'] as $parameter) {
             $parameters[$parameter] = $routerFetchedParameters[$index++];
         }
         $router->setParams($parameters);
     }
     return $found;
 }
开发者ID:firefoxrebo,项目名称:Lily,代码行数:27,代码来源:routingtable.php

示例13: init

 public static function init($action = "news")
 {
     self::$routerData = Router::getParams();
     if (!isset(self::$routerData['clanid'])) {
         self::$routerData['clanid'] = 1;
     }
     if (!isset(self::$routerData['site'])) {
         self::$routerData['site'] = "news";
     }
     SiteData::siteExists(self::$routerData['clanid']);
     self::$clanData = SiteData::getSiteData(self::$routerData['clanid']);
     self::testTemplateType();
 }
开发者ID:homieforever,项目名称:MyClanKonto,代码行数:13,代码来源:site.php

示例14: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     Croogo::applyHookProperties('Hook.controller_properties');
     parent::__construct();
     if ($this->name == 'CakeError') {
         $this->_set(Router::getPaths());
         $this->params = Router::getParams();
         $this->constructClasses();
         $this->Component->initialize($this);
         $this->beforeFilter();
         $this->Component->triggerCallback('startup', $this);
     }
 }
开发者ID:Tamsmiranda,项目名称:croogo,代码行数:18,代码来源:app_controller.php

示例15: putWebmasterToolsConfigOnHeader

 /**
  * Put webmaster tools config on header
  *
  * @param CakeEvent $event Represents the transport class of events across the system.
  *
  * @return string
  */
 public function putWebmasterToolsConfigOnHeader(CakeEvent $event)
 {
     $router = Router::getParams();
     if ($router['controller'] == 'posts' && $router['action'] == 'index') {
         $meta = [];
         if (Configure::check('HuradSeo')) {
             $verification = Configure::read('HuradSeo.google_webmaster_verification');
             if (Configure::check('HuradSeo.google_webmaster_verification') && !empty($verification)) {
                 $meta[] = $event->subject()->Html->meta(['name' => 'google-site-verification', 'content' => $verification]);
             }
         }
         echo implode("\n", $meta);
     }
 }
开发者ID:atkrad,项目名称:hurad-seo,代码行数:21,代码来源:HuradSeoListener.php


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