Esempio n. 1
0
/**
 * Function is responsible for loading all of the functions
 *
 */
function five_load_plugins()
{
    //initializing
    $plugins = five_get_plugins();
    foreach ((array) $plugins as $plugin) {
        require_once $plugin;
    }
}
Esempio n. 2
0
 /**
  * Connects the default, built-in routes, including prefix and plugin routes. The following routes are created
  * in the order below:
  *
  * For each of the Routing.prefixes the following routes are created. Routes containing `:plugin` are only
  * created when your application has one or more plugins.
  *
  * - `/:prefix/:plugin` a plugin shortcut route.
  * - `/:prefix/:plugin/:action/*` a plugin shortcut route.
  * - `/:prefix/:plugin/:controller`
  * - `/:prefix/:plugin/:controller/:action/*`
  * - `/:prefix/:controller`
  * - `/:prefix/:controller/:action/*`
  *
  * If plugins are found in your application the following routes are created:
  *
  * - `/:plugin` a plugin shortcut route.
  * - `/:plugin/:action/*` a plugin shortcut route.
  * - `/:plugin/:controller`
  * - `/:plugin/:controller/:action/*`
  *
  * And lastly the following catch-all routes are connected.
  *
  * - `/:controller'
  * - `/:controller/:action/*'
  *
  * You can disable the connection of default routes with Router::defaults().
  *
  * @return void
  * @access private
  */
 function __connectDefaultRoutes()
 {
     if ($plugins = five_get_plugins()) {
         foreach ($plugins as $key => $value) {
             $parts = explode('/', dirname($value));
             $value = array_pop($parts);
             $plugins[$key] = $value;
         }
         $pluginPattern = implode('|', $plugins);
         $match = array('plugin' => $pluginPattern);
         $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
         foreach ($this->__prefixes as $prefix) {
             $params = array('prefix' => $prefix, $prefix => true);
             $indexParams = $params + array('action' => 'index');
             $this->connect("/{$prefix}/:plugin", $indexParams, $shortParams);
             $this->connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
             $this->connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
         }
         $this->connect('/:plugin', array('action' => 'index'), $shortParams);
         $this->connect('/:plugin/:controller', array('action' => 'index'), $match);
         $this->connect('/:plugin/:controller/:action/*', array(), $match);
     }
     foreach ($this->__prefixes as $prefix) {
         $params = array('prefix' => $prefix, $prefix => true);
         $indexParams = $params + array('action' => 'index');
         $this->connect("/{$prefix}/:controller", $indexParams);
         $this->connect("/{$prefix}/:controller/:action/*", $params);
     }
     $this->connect('/:controller', array('action' => 'index'));
     $this->connect('/:controller/:action/*');
     if ($this->named['rules'] === false) {
         $this->connectNamed(true);
     }
     $this->__defaultsMapped = true;
 }