/** * 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(); }
/** * setUp method * * @return void */ public function setUp() { parent::setUp(); Configure::write('App.namespace', 'TestApp'); DispatcherFactory::add('Routing'); DispatcherFactory::add('ControllerFactory'); $this->_init(); }
/** * 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]); }
/** * 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'); }
/** * 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']); }
<?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');
/** * 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()); }
*/ /** * 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();
* 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();
/** * test case startup * * @return void */ public static function setupBeforeClass() { DispatcherFactory::add('Routing'); DispatcherFactory::add('ControllerFactory'); }
* 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();
<?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');
* 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']);
<?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]));
<?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);
<?php use WebService\Routing\Filter\ServiceFilter; use Cake\Routing\DispatcherFactory; use Cake\Routing\Router; DispatcherFactory::add(new ServiceFilter()); //Routing statements. /*Router::extensions(['json', 'xml']); Router::connect('/api/:controller', ['_ext' => 'json'], []); Router::connect('/rest/:controller', ['_ext' => 'json'], []); Router::connect('/:controller-:id', ['action' => 'view'], ['id' => '[0-9]+', 'pass' => ['id']]);*/
*/ Inflector::rules('irregular', ['clazz' => 'clazzes']); /** * 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'); DispatcherFactory::add('LocaleSelector', ['locales' => ['en_US', 'zh_CN']]); /** * 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();
<?php use Cake\Core\Configure; use Cake\Core\Plugin; use Cake\Routing\DispatcherFactory; Plugin::load('Josegonzalez/Upload'); Plugin::load('ADmad/Glide'); Configure::write('Glide', ['serverConfig' => ['base_url' => '/_images/', 'source' => ROOT . DS . 'uploads/', 'cache' => WWW_ROOT . 'cache', 'response' => new ADmad\Glide\Responses\CakeResponseFactory()], 'secureUrls' => true]); DispatcherFactory::add('ADmad/Glide.Glide', ['for' => '/_images']);
<?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\Routing\DispatcherFactory; use Cake\Core\Configure; DispatcherFactory::add('Analyzer.Analyzer'); Configure::write('Analyzer.Ignore.default', ['plugin' => 'DebugKit']); Configure::write('CA.Menu.main.Analyzer', ['url' => ['prefix' => 'admin', 'controller' => 'Analyzer', 'plugin' => 'Analyzer'], 'weight' => 40]);
<?php use AssetCompress\Middleware\AssetCompressMiddleware; use Cake\Core\Configure; use Cake\Event\EventManager; use Cake\Routing\DispatcherFactory; $appClass = Configure::read('App.namespace') . '\\Application'; if (class_exists($appClass)) { // Bind the middleware class after the error handler, or at the end // of the queue. We want to be after the error handler so 404's render nicely. EventManager::instance()->on('Server.buildMiddleware', function ($event, $queue) { $middleware = new AssetCompressMiddleware(); $queue->insertAfter('Cake\\Error\\Middleware\\ErrorHandlerMiddleware', $middleware); }); } else { DispatcherFactory::add('AssetCompress.AssetCompressor'); }
<?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) iTeam s.r.o. (http://iteam-pro.com) * @link http://iteam-pro.com Editorial Plugin * @since 0.0.1 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ use Cake\Core\Configure; use Cake\Event\EventManager; use Cake\Routing\DispatcherFactory; Configure::write('Editorial', ['editor' => false, 'class' => 'editor', 'autoload' => false, 'shortenUrls' => false]); EventManager::instance()->attach(new Editorial\Core\Event\EditorialEvent(), null); DispatcherFactory::add('Editorial/Core.ShortenAsset');
* 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'); // 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'); /** * 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(); Plugin::load('BoxManager', ['bootstrap' => false, 'routes' => true]); Plugin::load('SocialManager', ['bootstrap' => false, 'routes' => true]);
try { // Load and apply the Wasabi Core cache config. Configure::load('Wasabi/Core.cache', 'default'); foreach (Configure::consume('Cache') as $key => $config) { new Folder($config['path'], true, 0775); Cache::config($key, $config); } unset($key, $config); } catch (\Exception $e) { die($e->getMessage() . "\n"); } // Configure plugin translation paths. Configure::write('App.paths.locales', array_merge(Configure::read('App.paths.locales'), [Plugin::path('Wasabi/Core') . 'src' . DS . 'Locale' . DS])); EventManager::instance()->on(new GuardianListener()); EventManager::instance()->on(new MenuListener()); EventManager::instance()->on(new LanguagesListener()); if (!function_exists('guardian')) { /** * Provides easy access to the GuardianComponent and can be used * throughout the whole backend. * * @return GuardianComponent */ function guardian() { return GuardianComponent::getInstance(); } } Plugin::load('FrankFoerster/Filter'); DispatcherFactory::add('FrankFoerster/Asset.Asset');
*/ Plugin::load('Migrations'); // Override debug by Setting Debug Configure::write('debug', (bool) Setting::read('App.Debug')); // 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('Maintenance'); /** * Enable immutable time objects in the ORM. * * You can enable default locale format parsing by adding calls * to `useLocaleParser()`. This enables the automatic conversion of * locale specific date formats. For details see * @link http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data */ Type::build('time')->useImmutable(); Type::build('date')->useImmutable(); Type::build('datetime')->useImmutable(); Type::map('json', 'App\\Database\\Type\\JsonType'); Type::map('serialize', 'App\\Database\\Type\\SerializeType'); Plugin::load('WyriHaximus/MinifyHtml', ['bootstrap' => true]); Plugin::load('TinyAuth');
<?php use Cake\Core\Configure; use Cake\Event\EventManager; use Cake\Routing\DispatcherFactory; use Cake\Routing\Router; use CakeRatchet\Routing\Filter\CakeRatchetFilter; $debugBar = new CakeRatchetFilter(EventManager::instance()); DispatcherFactory::add($debugBar);
<?php \Cake\Routing\DispatcherFactory::add('Muffin/Webservice.ControllerEndpoint');
define('CAKE', CORE_PATH . APP_DIR . DS); define('WWW_ROOT', ROOT . DS . 'webroot' . DS); define('CONFIG', dirname(__FILE__) . DS . 'config' . DS); ini_set('intl.default_locale', 'de-DE'); require ROOT . '/vendor/autoload.php'; require CORE_PATH . 'config/bootstrap.php'; Cake\Core\Configure::write('App', ['namespace' => 'App', 'encoding' => 'UTF-8']); Cake\Core\Configure::write('debug', true); Cake\Core\Configure::write('EmailTransport', ['default' => ['className' => 'Debug']]); Cake\Core\Configure::write('Email', ['default' => ['transport' => 'default', 'from' => 'you@localhost']]); mb_internal_encoding('UTF-8'); $Tmp = new \Cake\Filesystem\Folder(TMP); $Tmp->create(TMP . 'cache/models', 0770); $Tmp->create(TMP . 'cache/persistent', 0770); $Tmp->create(TMP . 'cache/views', 0770); $cache = ['default' => ['engine' => 'File', 'path' => CACHE], '_cake_core_' => ['className' => 'File', 'prefix' => 'crud_myapp_cake_core_', 'path' => CACHE . 'persistent/', 'serialize' => true, 'duration' => '+10 seconds'], '_cake_model_' => ['className' => 'File', 'prefix' => 'crud_my_app_cake_model_', 'path' => CACHE . 'models/', 'serialize' => 'File', 'duration' => '+10 seconds']]; Cake\Cache\Cache::config($cache); DispatcherFactory::add('Routing'); Plugin::load('Utils', ['path' => ROOT, 'bootstrap' => false, 'routes' => true]); Plugin::load('CakeManager', ['path' => ROOT, 'bootstrap' => false, 'routes' => true]); Cake\Core\Plugin::load('PaypalIpn', ['path' => ROOT . DS, 'bootstrap' => true]); // Ensure default test connection is defined if (!getenv('db_class')) { putenv('db_class=Cake\\Database\\Driver\\Sqlite'); putenv('db_dsn=sqlite::memory:'); } if (WINDOWS) { Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => 'Cake\\Database\\Driver\\Mysql', 'database' => 'cake_test', 'username' => 'root', 'password' => '', 'timezone' => 'UTC', 'quoteIdentifiers' => true, 'cacheMetadata' => true]); return; } Cake\Datasource\ConnectionManager::config('test', ['className' => 'Cake\\Database\\Connection', 'driver' => getenv('db_class'), 'dsn' => getenv('db_dsn'), 'database' => getenv('db_database'), 'username' => getenv('db_username'), 'password' => getenv('db_password'), 'timezone' => 'UTC', 'quoteIdentifiers' => true, 'cacheMetadata' => true]);
<?php use Cake\Routing\DispatcherFactory; use IpBehavior\Routing\Filter\IpBehaviorFilter; DispatcherFactory::add('IpBehavior.IpBehavior');