|
|
@@ -45,42 +45,42 @@
|
|
|
*
|
|
|
* You can disable the connection of default routes by deleting the require inside APP/Config/routes.php.
|
|
|
*/
|
|
|
- $prefixes = Router::prefixes();
|
|
|
+$prefixes = Router::prefixes();
|
|
|
|
|
|
- if ($plugins = CakePlugin::loaded()) {
|
|
|
- App::uses('PluginShortRoute', 'Routing/Route');
|
|
|
- foreach ($plugins as $key => $value) {
|
|
|
- $plugins[$key] = Inflector::underscore($value);
|
|
|
- }
|
|
|
- $pluginPattern = implode('|', $plugins);
|
|
|
- $match = array('plugin' => $pluginPattern);
|
|
|
- $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
|
|
|
-
|
|
|
- foreach ($prefixes as $prefix) {
|
|
|
- $params = array('prefix' => $prefix, $prefix => true);
|
|
|
- $indexParams = $params + array('action' => 'index');
|
|
|
- Router::connect("/{$prefix}/:plugin", $indexParams, $shortParams);
|
|
|
- Router::connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
|
|
|
- Router::connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
|
|
|
- }
|
|
|
- Router::connect('/:plugin', array('action' => 'index'), $shortParams);
|
|
|
- Router::connect('/:plugin/:controller', array('action' => 'index'), $match);
|
|
|
- Router::connect('/:plugin/:controller/:action/*', array(), $match);
|
|
|
+if ($plugins = CakePlugin::loaded()) {
|
|
|
+ App::uses('PluginShortRoute', 'Routing/Route');
|
|
|
+ foreach ($plugins as $key => $value) {
|
|
|
+ $plugins[$key] = Inflector::underscore($value);
|
|
|
}
|
|
|
+ $pluginPattern = implode('|', $plugins);
|
|
|
+ $match = array('plugin' => $pluginPattern);
|
|
|
+ $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
|
|
|
|
|
|
foreach ($prefixes as $prefix) {
|
|
|
$params = array('prefix' => $prefix, $prefix => true);
|
|
|
$indexParams = $params + array('action' => 'index');
|
|
|
- Router::connect("/{$prefix}/:controller", $indexParams);
|
|
|
- Router::connect("/{$prefix}/:controller/:action/*", $params);
|
|
|
+ Router::connect("/{$prefix}/:plugin", $indexParams, $shortParams);
|
|
|
+ Router::connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
|
|
|
+ Router::connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
|
|
|
}
|
|
|
- Router::connect('/:controller', array('action' => 'index'));
|
|
|
- Router::connect('/:controller/:action/*');
|
|
|
+ Router::connect('/:plugin', array('action' => 'index'), $shortParams);
|
|
|
+ Router::connect('/:plugin/:controller', array('action' => 'index'), $match);
|
|
|
+ Router::connect('/:plugin/:controller/:action/*', array(), $match);
|
|
|
+}
|
|
|
|
|
|
- $namedConfig = Router::namedConfig();
|
|
|
- if ($namedConfig['rules'] === false) {
|
|
|
- Router::connectNamed(true);
|
|
|
- }
|
|
|
+foreach ($prefixes as $prefix) {
|
|
|
+ $params = array('prefix' => $prefix, $prefix => true);
|
|
|
+ $indexParams = $params + array('action' => 'index');
|
|
|
+ Router::connect("/{$prefix}/:controller", $indexParams);
|
|
|
+ Router::connect("/{$prefix}/:controller/:action/*", $params);
|
|
|
+}
|
|
|
+Router::connect('/:controller', array('action' => 'index'));
|
|
|
+Router::connect('/:controller/:action/*');
|
|
|
+
|
|
|
+$namedConfig = Router::namedConfig();
|
|
|
+if ($namedConfig['rules'] === false) {
|
|
|
+ Router::connectNamed(true);
|
|
|
+}
|
|
|
|
|
|
- unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match,
|
|
|
- $pluginPattern, $plugins, $key, $value);
|
|
|
+unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match,
|
|
|
+ $pluginPattern, $plugins, $key, $value);
|