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


PHP CakeRoute::__construct方法代码示例

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


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

示例1: __construct

/**
 * Constructor for a Route
 * Add a regex condition on the lang param to be sure it matches the available langs
 *
 * @param string $template Template string with parameter placeholders
 * @param array $defaults Array of defaults for the route.
 * @param string $params Array of parameters and additional options for the Route
 * @return void
 */
	public function __construct($template, $defaults = array(), $options = array()) {
		if (strpos($template, ':lang') === false && empty($options['disableAutoNamedLang'])) {
			$template = '/:lang' . $template;
		}
		if (strpos($template, ':lang')) {
			if (defined('DEFAULT_LANGUAGE') && empty($options['disableDefaultConnect'])) {
				// Connects the default language without the :lang param
				Router::connect(
					str_replace('/:lang', '', $template),
					array_merge($defaults, array('lang' => DEFAULT_LANGUAGE)),
					array_merge($options, array('routeClass' => $this->name, 'disableAutoNamedLang' => true)));
			}
			$options = array_merge((array)$options, array(
				'lang' => join('|', Configure::read('Config.languages')),
			));

			$Router = Router::getInstance();
			$routesList = Configure::read('I18nRoute.routes');
			$routesList[] = count($Router->routes);
			Configure::write('I18nRoute.routes', $routesList);
		}
		unset($options['disableAutoNamedLang'], $options['disableDefaultConnect']);
		
		if ($template == '/:lang/') {
			$template = '/:lang';
		}
		parent::__construct($template, $defaults, $options);
	}
开发者ID:ntung,项目名称:i18n,代码行数:37,代码来源:i18n_route.php

示例2: __construct

 public function __construct($template, $defaults = array(), $options = array())
 {
     parent::__construct($template, $defaults, $options);
     /*$this->Postcard = new Postcard();
       $this->UserPostcard = new UserPostcard();
       $this->Category = new Category();
       $this->SitePage = new SitePage();*/
 }
开发者ID:shahensargsyan,项目名称:aiisa,代码行数:8,代码来源:SlugRoute.php

示例3: __construct

 /**
  * Constructor for a Route.
  *
  * @param string $template Template string with parameter placeholders
  * @param array  $defaults Array of defaults for the route.
  * @param array  $options  Array of parameters and additional options for the Route
  *
  * @return \CakeRoute
  */
 public function __construct($template, $defaults = array(), $options = array())
 {
     if (strpos($template, ':current_tenant') === false && empty($options['disableAutoNamedLang'])) {
         Router::connect($template, $defaults + array('current_tenant' => Configure::read('Config.current_tenant')), array('routeClass' => $this->name) + $options);
         $options += array('__promote' => true);
         $template = '/:current_tenant' . $template;
     }
     $options = array_merge((array) $options, array('current_tenant' => '[a-z]{1,10}'));
     if ($template == '/:current_tenant/') {
         $template = '/:current_tenant';
     }
     parent::__construct($template, $defaults, $options);
 }
开发者ID:waldemarnt,项目名称:cake-multi-tenant,代码行数:22,代码来源:MultiTenantRouter.php

示例4: __construct

 /**
  * Constructor for a Route
  * Add a regex condition on the lang param to be sure it matches the available langs
  *
  * @param string $template Template string with parameter placeholders
  * @param array  $defaults Array of defaults for the route.
  * @param array  $options Array of parameters and additional options for the Route
  * @return \I18nRoute
  */
 public function __construct($template, $defaults = array(), $options = array())
 {
     if (strpos($template, ':lang') === false && empty($options['disableAutoNamedLang'])) {
         Router::connect($template, $defaults + array('lang' => DEFAULT_LANGUAGE), array('disableAutoNamedLang' => true, 'routeClass' => $this->name) + $options);
         $options += array('__promote' => true);
         $template = '/:lang' . $template;
     }
     $options = array_merge((array) $options, array('lang' => join('|', Configure::read('Config.languages'))));
     unset($options['disableAutoNamedLang']);
     if ($template == '/:lang/') {
         $template = '/:lang';
     }
     parent::__construct($template, $defaults, $options);
 }
开发者ID:omnuvito,项目名称:i18n,代码行数:23,代码来源:I18nRoute.php

示例5: __construct

 public function __construct($template, $defaults = array(), $options = array())
 {
     $options = Hash::merge(array('api' => Configure::read('Croogo.Api.path'), 'prefix' => 'v[0-9.]+'), $options);
     parent::__construct($template, $defaults, $options);
 }
开发者ID:saydulk,项目名称:croogo,代码行数:5,代码来源:ApiRoute.php

示例6: __construct

 /**
  * Constructor
  *
  * @param string $template Template string with parameter placeholders
  * @param array $defaults Array of defaults for the route.
  * @param array $options Array of additional options for the Route
  */
 public function __construct($template, $defaults = array(), $options = array())
 {
     parent::__construct($template, $defaults, $options);
     $this->redirect = (array) $defaults;
 }
开发者ID:MrGrigorev,项目名称:reserva-de-salas,代码行数:12,代码来源:RedirectRoute.php

示例7: __construct

 public function __construct($template, $defaults = array(), $options = array())
 {
     parent::__construct($template, $defaults, $options);
     $this->Request = new CakeRequest();
     $this->options = array_merge(array('protocol' => 'http'), $options);
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:6,代码来源:UserSubdomainRoute+GOOD.php

示例8: __construct

 /**
  * Constructor for a Route
  *
  * @param string $template Template string with parameter placeholders
  * @param array $defaults Array of defaults for the route.
  * @param string $options Array of parameters and additional options for the Route
  * @return void
  */
 public function __construct($template, $defaults = array(), $options = array())
 {
     $options = array_merge($this->options, (array) $options);
     parent::__construct($template, $defaults, $options);
 }
开发者ID:josegonzalez,项目名称:cakephp-page-route,代码行数:13,代码来源:PageRoute.php

示例9: __construct

 public function __construct($template, $defaults = array(), $options = array())
 {
     parent::__construct($template, $defaults, $options);
     $this->Request = new CakeRequest();
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:5,代码来源:SubdomainRoute.php

示例10: __construct

 /**
  * Sets up cache config and options
  *
  * @param string $template
  * @param array $defaults
  * @param array $options
  */
 public function __construct($template, $defaults = array(), $options = array())
 {
     parent::__construct($template, $defaults, $options);
     $this->config();
 }
开发者ID:jeremyharris,项目名称:slugger,代码行数:12,代码来源:SluggableRoute.php


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