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


PHP DispatcherFactory::add方法代码示例

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


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

示例1: setUp

 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $this->Case = $this->getMockForAbstractClass('Cake\\TestSuite\\ControllerTestCase');
     $this->Case->loadRoutes = false;
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     Router::scope('/', function ($routes) {
         $routes->fallbacks();
     });
     Router::prefix('admin', function ($routes) {
         $routes->plugin('TestPlugin', function ($routes) {
             $routes->fallbacks();
         });
         $routes->fallbacks();
     });
     Router::plugin('TestPlugin', function ($routes) {
         $routes->fallbacks();
     });
     Router::plugin('TestPluginTwo', function ($routes) {
         $routes->fallbacks();
     });
     TableRegistry::clear();
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:31,代码来源:ControllerTestCaseTest.php

示例2: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     $this->_init();
 }
开发者ID:Slayug,项目名称:castor,代码行数:13,代码来源:RequestHandlerComponentTest.php

示例3: testDispatcherFactoryCompat

 /**
  * Ensure that filters connected to the DispatcherFactory are
  * also applied
  */
 public function testDispatcherFactoryCompat()
 {
     $filter = $this->getMock('Cake\\Routing\\DispatcherFilter', ['beforeDispatch', 'afterDispatch']);
     DispatcherFactory::add($filter);
     $dispatcher = new ActionDispatcher();
     $this->assertCount(1, $dispatcher->getFilters());
     $this->assertSame($filter, $dispatcher->getFilters()[0]);
 }
开发者ID:markstory,项目名称:cakephp-spekkoek,代码行数:12,代码来源:ActionDispatcherTest.php

示例4: setUp

 /**
  * Setup method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Router::connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']);
     DispatcherFactory::clear();
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
 }
开发者ID:kfer10,项目名称:excel,代码行数:14,代码来源:IntegrationTestCaseTest.php

示例5: setUp

 /**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Security::salt('not-the-default');
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     $this->object = $this->getObjectForTrait('Cake\\Routing\\RequestActionTrait');
     Router::connect('/request_action/:action/*', ['controller' => 'RequestAction']);
     Router::connect('/tests_apps/:action/*', ['controller' => 'TestsApps']);
 }
开发者ID:Slayug,项目名称:castor,代码行数:16,代码来源:RequestActionTraitTest.php

示例6:

<?php

/**
 * CakeManager (http://cakemanager.org)
 * Copyright (c) http://cakemanager.org
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) http://cakemanager.org
 * @link          http://cakemanager.org CakeManager Project
 * @since         1.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
use Cake\Core\Configure;
use Cake\Routing\DispatcherFactory;
use Settings\Core\Setting;
# Configures
Configure::write('AB.Show', true);
Configure::write('Settings.Prefixes.AB', 'AdminBar');
# Settings
Setting::register('AB.Backend', true, ['type' => 'select', 'options' => [0 => 'Disabled', 1 => 'Enabled']]);
Setting::register('AB.Frontend', true, ['type' => 'select', 'options' => [0 => 'Disabled', 1 => 'Enabled']]);
# AdminBar
Configure::write('AdminBar.goto_backend', ['on' => ['prefix' => ['!admin', '*'], 'controller' => '*', 'action' => '*'], 'label' => 'CakeAdmin Panel', 'url' => '/admin']);
Configure::write('AdminBar.goto_website', ['on' => ['prefix' => 'admin', 'controller' => '*', 'action' => '*'], 'label' => 'Go To Website', 'url' => Configure::read('App.fullBaseUrl')]);
Configure::write('AdminBar.goto_settings', ['on' => ['prefix' => 'admin', 'controller' => '*', 'action' => '*'], 'label' => 'Settings', 'url' => ['prefix' => 'admin', 'plugin' => 'CakeAdmin', 'controller' => 'Settings', 'action' => 'index']]);
# Dispatcher Filter
DispatcherFactory::add('AdminBar.AdminBar');
开发者ID:cakemanager,项目名称:cakeadmin-adminbar,代码行数:30,代码来源:bootstrap.php

示例7: testCreate

 /**
  * Test creating a dispatcher with the factory
  *
  * @return void
  */
 public function testCreate()
 {
     $mw = $this->getMock('Cake\\Routing\\DispatcherFilter', ['beforeDispatch']);
     DispatcherFactory::add($mw);
     $result = DispatcherFactory::create();
     $this->assertInstanceOf('Cake\\Routing\\Dispatcher', $result);
     $this->assertCount(1, $result->filters());
 }
开发者ID:Slayug,项目名称:castor,代码行数:13,代码来源:DispatcherFactoryTest.php

示例8:

 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
//Plugin::load('Crud');
Plugin::load('Migrations');
Plugin::load('FOC/Authenticate');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('REST', ['priority' => 1]);
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('date')->useLocaleParser();
Type::build('datetime')->useLocaleParser();
开发者ID:vla9isla8,项目名称:hochuna_cakephp,代码行数:31,代码来源:bootstrap.php

示例9:

 * Inflector::rules('uninflected', ['dontinflectme']);
 * Inflector::rules('transliteration', ['/å/' => 'aa']);
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::loadAll();
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('Acesso');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('datetime')->useLocaleParser();
开发者ID:gbauso,项目名称:asirb,代码行数:31,代码来源:bootstrap.php

示例10: setupBeforeClass

 /**
  * test case startup
  *
  * @return void
  */
 public static function setupBeforeClass()
 {
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
 }
开发者ID:dereuromark,项目名称:cakephp-shim,代码行数:10,代码来源:SessionComponentTest.php

示例11:

 * Inflector::rules('transliteration', ['/å/' => 'aa']);
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
Plugin::load('Bootstrap');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('LocaleSelector');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('date')->useLocaleParser();
Type::build('datetime')->useLocaleParser();
开发者ID:eduardoweiland,项目名称:jasmine,代码行数:31,代码来源:bootstrap.php

示例12:

<?php

/**
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) MindForce Team (http://mindforce.me)
 * @link          http://mindforce.me Garderobe CakePHP 3 UI Plugin
 * @since         0.0.1
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
use Cake\Event\EventManager;
use Cake\Core\Configure;
use Cake\Routing\DispatcherFactory;
EventManager::instance()->attach(new Garderobe\Core\Event\CoreEvent(), null);
DispatcherFactory::add('Garderobe/Core.Asset');
开发者ID:mindforce,项目名称:cakephp-garderobe,代码行数:17,代码来源:bootstrap.php

示例13: implode

 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('LocaleSelector', ['locales' => ['pt-BR']]);
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('date')->useLocaleParser()->setLocaleFormat('dd-M-y');
Type::build('datetime')->useLocaleParser();
/**
 * Carregando o arquivo de tradução padrão
 */
require implode(DS, [__DIR__, '..', 'src', 'Template', 'translate.ctp']);
开发者ID:joaorsb,项目名称:lumisial,代码行数:31,代码来源:bootstrap.php

示例14: Switcher

<?php

/**
 * Copyright (c) 2015 ELASTIC Consultants Inc. (https://elasticconsultants.com/)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright (c) 2015, ELASTIC Consultatnts Inc. (https://elasticconsultants.com/)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Load filter
 */
use Cake\Routing\DispatcherFactory;
use TestDatasourceSwitcher\Routing\Filter\Switcher;
DispatcherFactory::add(new Switcher(['priority' => 1]));
开发者ID:nojimage,项目名称:cakephp-TestDatasourceSwitcher,代码行数:18,代码来源:bootstrap.php

示例15: file

<?php

use Cake\Core\Configure;
use Cake\Routing\DispatcherFactory;
use CookieWarning\Routing\Filter\CookieWarningFilter;
use CookieWarning\Validation\ConfigValidator;
$config = Configure::read('CookieWarning');
if ($config == null) {
    throw new \Exception(__d('cookie_warning', 'Please add a configuration for the CookieWarning plugin in the app.php file (see readme in plugin folder)'));
}
// Validate the Configure Data
$validator = new ConfigValidator();
$errors = $validator->errors($config);
if (!empty($errors)) {
    throw new \Exception(__d('cookie_warning', 'Délai d\'expiration du cookie incorrect'));
}
$filter = new CookieWarningFilter(['priority' => 9999]);
DispatcherFactory::add($filter);
开发者ID:cakephp-fr,项目名称:cookie-warning,代码行数:18,代码来源:bootstrap.php


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