本文整理汇总了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);
}
示例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();*/
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例9: __construct
public function __construct($template, $defaults = array(), $options = array())
{
parent::__construct($template, $defaults, $options);
$this->Request = new CakeRequest();
}
示例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();
}