Пример #1
0
 /**
  * Gets others plugins that have the `InstallShell` class
  * @return array
  */
 protected function _getOtherPlugins()
 {
     //Gets all plugins
     $plugins = Plugin::all(['exclude' => [METOOLS, MECMS]]);
     //Returns only the plugins that have the `InstallShell` class
     return af(array_map(function ($plugin) {
         return Plugin::path($plugin, 'src' . DS . 'Shell' . DS . 'InstallShell.php', true) ? $plugin : false;
     }, $plugins));
 }
Пример #2
0
 /**
  * Gets all loaded plugins.
  *
  * Available options are:
  *  - `core`, if `false` exclude the core plugins;
  *  - `exclude`, a plugin as string or an array of plugins to be excluded;
  *  - `order`, if `true` the plugins will be sorted.
  * @param array $options Options
  * @return array Plugins
  * @uses MeTools\Core\Plugin::all()
  */
 public static function all(array $options = [])
 {
     $options = am(['core' => false, 'except' => [], 'order' => true], $options);
     $plugins = parent::all($options);
     if ($options['order']) {
         $key = array_search(MECMS, $plugins);
         if ($key) {
             unset($plugins[$key]);
             array_unshift($plugins, MECMS);
         }
     }
     return $plugins;
 }