/** * tearDown method * * @return void */ public function tearDown() { parent::tearDown(); DispatcherFactory::clear(); $this->_init(); unset($this->RequestHandler, $this->Controller); }
/** * tearDown * * @return void */ public function tearDown() { parent::tearDown(); Plugin::unload(); DispatcherFactory::clear(); $this->Case->controller = null; }
/** * 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]); }
/** * @param \Spekkoek\ControllerFactory $factory A controller factory instance. */ public function __construct($factory = null) { // Compatibility with DispatcherFilters. foreach (DispatcherFactory::filters() as $filter) { $this->addFilter($filter); } $this->factory = $factory ?: new ControllerFactory(); }
/** * tearDown method * * @return void */ public function tearDown() { parent::tearDown(); DispatcherFactory::clear(); Router::reload(); Router::$initialized = false; unset($this->RequestHandler, $this->Controller); }
/** * Run a request and get the response. * * @param array $request The request context to execute. * @return \Cake\Network\Response The generated response. */ public function execute($request) { $request = new Request($request); $response = new Response(); $dispatcher = DispatcherFactory::create(); $dispatcher->eventManager()->on('Dispatcher.invokeController', ['priority' => 999], [$this->_test, 'controllerSpy']); $dispatcher->dispatch($request, $response); return $response; }
/** * 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'); }
/** * Catch all for Opauth * Handling callback */ public function index() { $this->_loadOpauth(); try { $callback = ['validated' => true, 'response' => $this->Opauth->run()]; } catch (OpauthException $e) { $callback = ['validated' => false, 'message' => $e->getMessage(), 'code' => $e->getCode()]; } $Request = new Request(Configure::read('Opauth.CompleteURL')); $Request->data = $callback; $dispatcher = DispatcherFactory::create(); $dispatcher->dispatch($Request, new Response()); exit; }
<?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);
/** * teardown * * @return void */ public function tearDown() { parent::tearDown(); DispatcherFactory::clear(); Router::reload(); }
* 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');
/** * Creates and send the request into a Dispatcher instance. * * Receives and stores the response for future inspection. * * @param string|array $url The URL * @param string $method The HTTP method * @param array|null $data The request data. * @return void * @throws \Exception */ protected function _sendRequest($url, $method, $data = []) { $request = $this->_buildRequest($url, $method, $data); $response = new Response(); $dispatcher = DispatcherFactory::create(); $dispatcher->eventManager()->on('Dispatcher.beforeDispatch', ['priority' => 999], [$this, 'controllerSpy']); try { $dispatcher->dispatch($request, $response); $this->_requestSession = $request->session(); $this->_response = $response; } catch (PHPUnit_Exception $e) { throw $e; } catch (DatabaseException $e) { throw $e; } catch (Exception $e) { $this->_exception = $e; $this->_handleError($e); } }
* 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]);
/** * Run the shutdown events. * * Triggers the afterFilter and afterDispatch events. * * @return \Cake\Network\Response The response to serve. */ protected function _shutdown() { $this->controller->dispatchEvent('Controller.shutdown'); $dispatcher = DispatcherFactory::create(); $eventManager = $dispatcher->eventManager(); foreach ($dispatcher->filters() as $filter) { $eventManager->attach($filter); } $args = ['request' => $this->controller->request, 'response' => $this->controller->response]; $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args); return $result->data['response']; }
<?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 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'); }
*/ /** * 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();
/** * Makes a request. * * @param \Cake\Network\Request $request Cake request. * @return \Cake\Network\Response Cake response. */ protected function doRequest($request) { $response = new Response(); $dispatcher = DispatcherFactory::create(); $dispatcher->eventManager()->on('Dispatcher.beforeDispatch', ['priority' => 999], [$this, 'controllerSpy']); try { $dispatcher->dispatch($request, $response); } catch (\PHPUnit_Exception $e) { throw $e; } catch (\Exception $e) { $response = $this->handleError($e); } return $response; }
* 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();
*/ 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');
* 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']);
/** * Calls a controller's method from any location. Can be used to connect controllers together * or tie plugins into a main application. requestAction can be used to return rendered views * or fetch the return value from controller actions. * * Under the hood this method uses Router::reverse() to convert the $url parameter into a string * URL. You should use URL formats that are compatible with Router::reverse() * * ### Examples * * A basic example getting the return value of the controller action: * * ``` * $variables = $this->requestAction('/articles/popular'); * ``` * * A basic example of request action to fetch a rendered page without the layout. * * ``` * $viewHtml = $this->requestAction('/articles/popular', ['return']); * ``` * * You can also pass the URL as an array: * * ``` * $vars = $this->requestAction(['controller' => 'articles', 'action' => 'popular']); * ``` * * ### Passing other request data * * You can pass POST, GET, COOKIE and other data into the request using the appropriate keys. * Cookies can be passed using the `cookies` key. Get parameters can be set with `query` and post * data can be sent using the `post` key. * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'query' => ['page' => 1], * 'cookies' => ['remember_me' => 1], * ]); * ``` * * ### Sending environment or header values * * By default actions dispatched with this method will use the global $_SERVER and $_ENV * values. If you want to override those values for a request action, you can specify the values: * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'environment' => ['CONTENT_TYPE' => 'application/json'] * ]); * ``` * * ### Transmitting the session * * By default actions dispatched with this method will use the standard session object. * If you want a particular session instance to be used, you need to specify it. * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'session' => new Session($someSessionConfig) * ]); * ``` * * @param string|array $url String or array-based url. Unlike other url arrays in CakePHP, this * url will not automatically handle passed arguments in the $url parameter. * @param array $extra if array includes the key "return" it sets the autoRender to true. Can * also be used to submit GET/POST data, and passed arguments. * @return mixed Boolean true or false on success/failure, or contents * of rendered action if 'return' is set in $extra. * @deprecated 3.3.0 You should refactor your code to use View Cells instead of this method. */ public function requestAction($url, array $extra = []) { if (empty($url)) { return false; } if (($index = array_search('return', $extra)) !== false) { $extra['return'] = 0; $extra['autoRender'] = 1; unset($extra[$index]); } $extra += ['autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1]; $baseUrl = Configure::read('App.fullBaseUrl'); if (is_string($url) && strpos($url, $baseUrl) === 0) { $url = Router::normalize(str_replace($baseUrl, '', $url)); } if (is_string($url)) { $params = ['url' => $url]; } elseif (is_array($url)) { $defaultParams = ['plugin' => null, 'controller' => null, 'action' => null]; $params = ['params' => $url + $defaultParams, 'base' => false, 'url' => Router::reverse($url)]; if (empty($params['params']['pass'])) { $params['params']['pass'] = []; } } $current = Router::getRequest(); if ($current) { $params['base'] = $current->base; $params['webroot'] = $current->webroot; } $params['post'] = $params['query'] = []; if (isset($extra['post'])) { $params['post'] = $extra['post']; } if (isset($extra['query'])) { $params['query'] = $extra['query']; } if (isset($extra['cookies'])) { $params['cookies'] = $extra['cookies']; } if (isset($extra['environment'])) { $params['environment'] = $extra['environment'] + $_SERVER + $_ENV; } unset($extra['environment'], $extra['post'], $extra['query']); $params['session'] = isset($extra['session']) ? $extra['session'] : new Session(); $request = new Request($params); $request->addParams($extra); $dispatcher = DispatcherFactory::create(); // If an application is using PSR7 middleware, // we need to 'fix' their missing dispatcher filters. $needed = ['routing' => RoutingFilter::class, 'controller' => ControllerFactoryFilter::class]; foreach ($dispatcher->filters() as $filter) { if ($filter instanceof RoutingFilter) { unset($needed['routing']); } if ($filter instanceof ControllerFactoryFilter) { unset($needed['controller']); } } foreach ($needed as $class) { $dispatcher->addFilter(new $class()); } $result = $dispatcher->dispatch($request, new Response()); Router::popRequest(); return $result; }
/** * Calls a controller's method from any location. Can be used to connect controllers together * or tie plugins into a main application. requestAction can be used to return rendered views * or fetch the return value from controller actions. * * Under the hood this method uses Router::reverse() to convert the $url parameter into a string * URL. You should use URL formats that are compatible with Router::reverse() * * ### Examples * * A basic example getting the return value of the controller action: * * ``` * $variables = $this->requestAction('/articles/popular'); * ``` * * A basic example of request action to fetch a rendered page without the layout. * * ``` * $viewHtml = $this->requestAction('/articles/popular', ['return']); * ``` * * You can also pass the URL as an array: * * ``` * $vars = $this->requestAction(['controller' => 'articles', 'action' => 'popular']); * ``` * * ### Passing other request data * * You can pass POST, GET, COOKIE and other data into the request using the appropriate keys. * Cookies can be passed using the `cookies` key. Get parameters can be set with `query` and post * data can be sent using the `post` key. * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'query' => ['page' => 1], * 'cookies' => ['remember_me' => 1], * ]); * ``` * * ### Sending environment or header values * * By default actions dispatched with this method will use the global $_SERVER and $_ENV * values. If you want to override those values for a request action, you can specify the values: * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'environment' => ['CONTENT_TYPE' => 'application/json'] * ]); * ``` * * ### Transmitting the session * * By default actions dispatched with this method will use the standard session object. * If you want a particular session instance to be used, you need to specify it. * * ``` * $vars = $this->requestAction('/articles/popular', [ * 'session' => new Session($someSessionConfig) * ]); * ``` * * @param string|array $url String or array-based url. Unlike other url arrays in CakePHP, this * url will not automatically handle passed arguments in the $url parameter. * @param array $extra if array includes the key "return" it sets the autoRender to true. Can * also be used to submit GET/POST data, and passed arguments. * @return mixed Boolean true or false on success/failure, or contents * of rendered action if 'return' is set in $extra. */ public function requestAction($url, array $extra = []) { if (empty($url)) { return false; } if (($index = array_search('return', $extra)) !== false) { $extra['return'] = 0; $extra['autoRender'] = 1; unset($extra[$index]); } $extra += ['autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1]; $baseUrl = Configure::read('App.fullBaseUrl'); if (is_string($url) && strpos($url, $baseUrl) === 0) { $url = Router::normalize(str_replace($baseUrl, '', $url)); } if (is_string($url)) { $params = ['url' => $url]; } elseif (is_array($url)) { $defaultParams = ['plugin' => null, 'controller' => null, 'action' => null]; $params = ['params' => $url + $defaultParams, 'base' => false, 'url' => Router::reverse($url)]; if (empty($params['params']['pass'])) { $params['params']['pass'] = []; } } $current = Router::getRequest(); if ($current) { $params['base'] = $current->base; $params['webroot'] = $current->webroot; } $params['post'] = $params['query'] = []; if (isset($extra['post'])) { $params['post'] = $extra['post']; } if (isset($extra['query'])) { $params['query'] = $extra['query']; } if (isset($extra['cookies'])) { $params['cookies'] = $extra['cookies']; } if (isset($extra['environment'])) { $params['environment'] = $extra['environment'] + $_SERVER + $_ENV; } unset($extra['environment'], $extra['post'], $extra['query']); $params['session'] = isset($extra['session']) ? $extra['session'] : new Session(); $request = new Request($params); $request->addParams($extra); $dispatcher = DispatcherFactory::create(); $result = $dispatcher->dispatch($request, new Response()); Router::popRequest(); return $result; }
/** * Run the shutdown events. * * Triggers the afterFilter and afterDispatch events. * * @return \Cake\Network\Response The response to serve. */ protected function _shutdown() { $this->controller->dispatchEvent('Controller.shutdown'); $dispatcher = DispatcherFactory::create(); $args = ['request' => $this->controller->request, 'response' => $this->controller->response]; $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args); return $result->data['response']; }
<?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);
/** * 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()); }
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]);
/** * The Front Controller for handling every request * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.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) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @since 0.2.9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ // for built-in server if (php_sapi_name() === 'cli-server') { $_SERVER['PHP_SELF'] = '/' . basename(__FILE__); $url = parse_url(urldecode($_SERVER['REQUEST_URI'])); $file = __DIR__ . $url['path']; if (strpos($url['path'], '..') === false && strpos($url['path'], '.') !== false && is_file($file)) { return false; } } require dirname(__DIR__) . '/config/bootstrap.php'; use Cake\Network\Request; use Cake\Network\Response; use Cake\Routing\DispatcherFactory; $dispatcher = DispatcherFactory::create(); $dispatcher->dispatch(Request::createFromGlobals(), new Response());
<?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');