$value) { $plugins[$key] = Inflector::underscore($value); } $pluginPattern = implode('|', $plugins); $match = array('plugin' => $pluginPattern, 'defaultRoute' => true); $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern, 'defaultRoute' => true); 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); } foreach ($prefixes as $prefix) { $params = array('prefix' => $prefix, $prefix => true); $indexParams = $params + array('action' => 'index'); Router::connect("/{$prefix}/:controller", $indexParams, array('defaultRoute' => true)); Router::connect("/{$prefix}/:controller/:action/*", $params, array('defaultRoute' => true)); } Router::connect('/:controller', array('action' => 'index'), array('defaultRoute' => true)); Router::connect('/:controller/:action/*', array(), array('defaultRoute' => true)); $namedConfig = Router::namedConfig(); if ($namedConfig['rules'] === false) { Router::connectNamed(true); } unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match, $pluginPattern, $plugins, $key, $value);