本文整理汇总了PHP中Cake\Routing\Router::plugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::plugin方法的具体用法?PHP Router::plugin怎么用?PHP Router::plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Routing\Router
的用法示例。
在下文中一共展示了Router::plugin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Setup method.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Router::plugin('DebugKit', function ($routes) {
$routes->connect('/toolbar/:action/*', ['controller' => 'Requests']);
});
}
示例2: 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();
}
示例3: setUp
/**
* Setup method.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Router::plugin('DebugKit', function ($routes) {
$routes->connect('/toolbar/clear_cache/*', ['plugin' => 'DebugKit', 'controller' => 'Toolbar', 'action' => 'clearCache']);
});
}
示例4: testBuildResetWithPlugin
/**
* @return void
*/
public function testBuildResetWithPlugin()
{
Router::connect('/:controller/:action/*');
$result = $this->Url->buildReset(['controller' => 'foobar', 'action' => 'test']);
$expected = '/foobar/test';
$this->assertSame($expected, $result);
$this->Url->request->here = '/admin/foo/bar/baz/test';
$this->Url->request->params['prefix'] = 'admin';
$this->Url->request->params['plugin'] = 'Foo';
Router::reload();
Router::connect('/:controller/:action/*');
Router::plugin('Foo', function ($routes) {
$routes->fallbacks();
});
Router::prefix('admin', function ($routes) {
$routes->plugin('Foo', function ($routes) {
$routes->fallbacks();
});
});
Plugin::routes();
Router::pushRequest($this->Url->request);
$result = $this->Url->build(['controller' => 'bar', 'action' => 'baz', 'x']);
$expected = '/admin/foo/bar/baz/x';
$this->assertSame($expected, $result);
$result = $this->Url->buildReset(['controller' => 'bar', 'action' => 'baz', 'x']);
$expected = '/bar/baz/x';
$this->assertSame($expected, $result);
}
示例5: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
Plugin::load('TestPlugin', ['autoload' => true]);
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
}
示例6: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
Plugin::load('TestPlugin');
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$this->View = $this->getMock('Union\\Core\\View\\AppView', ['append']);
$this->Button = new ButtonHelper($this->View);
}
示例7: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('TestPlugin', ['autoload' => true]);
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$this->Controller = new AppController(new Request(['session' => new Session()]));
$componentRegistry = new ComponentRegistry($this->Controller);
$this->App = new AppComponent($componentRegistry);
}
示例8: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('TestPlugin');
Plugin::load('Union/Core', ['path' => ROOT]);
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$this->View = new AppView();
$this->Html = new HtmlHelper($this->View);
}
示例9: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
Plugin::load('TestPlugin');
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$this->View = new AppView();
$this->Form = new FormHelper($this->View, ['widgets' => ['_default' => 'Union\\Core\\View\\Widget\\BasicWidget', 'button' => 'Union\\Core\\View\\Widget\\ButtonWidget', 'textarea' => 'Union\\Core\\View\\Widget\\TextAreaWidget'], 'templates' => 'Union/Core.templates/form']);
}
示例10: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
Plugin::load('TestPlugin');
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$Request = new Request(['params' => ['plugin' => 'TestPlugin', 'controller' => 'Event', 'action' => 'view', 'pass' => []]]);
$this->View = new AppView($Request);
$this->ToolBar = new ToolBarHelper($this->View);
}
示例11: setUp
/**
* Setup test data.
*
* @return void
*/
public function setUp()
{
parent::setUp();
Plugin::load('Union/Core', ['path' => ROOT, 'routes' => true, 'bootstrap' => true]);
Plugin::load('TestPlugin', ['autoload' => true]);
Router::plugin('TestPlugin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
Router::plugin('TestPlugin', ['path' => '/'], function (RouteBuilder $routeBuilder) {
$routeBuilder->prefix('admin', function (RouteBuilder $routeBuilder) {
$routeBuilder->connect('/:plugin/:controller/:action/*', []);
});
});
}
示例12: function
<?php
/**
* HybridAuth Plugin routes
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
*/
namespace ADmad\HybridAuth\Config;
use Cake\Routing\Router;
Router::plugin('ADmad/HybridAuth', ['path' => '/hybrid_auth'], function ($routes) {
$routes->connect('/endpoint', ['controller' => 'HybridAuth', 'action' => 'endpoint']);
$routes->connect('/authenticated', ['controller' => 'HybridAuth', 'action' => 'authenticated']);
});
示例13: function
<?php
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
Router::plugin('Pie/Users', ['path' => '/users'], function (RouteBuilder $routes) {
$routes->fallbacks('DashedRoute');
});
示例14: function
/**
* Adding routes for the api-prefix and CakeManager-Plugin
*/
Router::prefix('api', function ($routes) {
$routes->plugin('CakeManager', ['path' => '/'], function ($routes) {
$routes->extensions(['json']);
$routes->resources('Roles');
$routes->resources('Users');
$routes->fallbacks('InflectedRoute');
});
});
/*
* Adding default routes for the CakeManager
*/
Router::plugin('CakeManager', ['path' => '/'], function ($routes) {
$routes->fallbacks('InflectedRoute');
});
/**
* Default routes for usersController from the CakeManager
*
* Previous:
* manager/users/request
*
* New:
* users/request
*
*/
Router::connect('/users/:action/*', ['plugin' => 'CakeManager', 'prefix' => false, 'controller' => 'Users']);
/**
* Default login-url
*/
示例15: function
<?php
use Cake\Routing\Router;
Router::extensions(['xlsx']);
Router::plugin('Cewi/Excel', null, function ($routes) {
$routes->connect('/:controller/:action');
});