Ejemplo n.º 1
0
 /**
  * @brief get all the places plugins are found and tell cake about them
  *
  * Get the paths out of cache if there are any or get them with Folder::read
  * They are used with App::build() to make any extra folders  in APP be plugin
  * folders. This can help if you want to keep plugins outside of /plugins
  */
 private static function __findPlugins()
 {
     if (!empty(self::$__pluginPaths)) {
         return true;
     }
     self::$__pluginPaths = Cache::read('plugin_paths');
     if (self::$__pluginPaths === false) {
         $Folder = new Folder(APP);
         $folders = $Folder->read();
         $folders = array_flip($folders[0]);
         unset($Folder, $folders['.git'], $folders['Config'], $folders['Locale'], $folders['nbproject'], $folders['Console'], $folders['tmp'], $folders['View'], $folders['Controller'], $folders['Lib'], $folders['webroot'], $folders['Test'], $folders['Model']);
         self::$__pluginPaths = array();
         foreach (array_flip($folders) as $folder) {
             self::$__pluginPaths[] = APP . $folder . DS;
         }
         Cache::write('plugin_paths', self::$__pluginPaths);
         unset($Folder, $folders);
         // @todo trigger event to get oter plugin paths
     }
     return App::build(array('Plugin' => self::$__pluginPaths));
 }