當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。