示例#1
0
文件: plugin.php 项目: joeymetal/v1
if ($command == 'list') {
    $options = get_console_options_for('List available plugins.', array('source' => array('short' => 's', 'desc' => "Use the specified plugin repositories. --source URL1 URL2", 'max' => -1, 'min' => 1), 'local' => array('short' => 'l', 'desc' => "List locally installed plugins.", 'max' => 0), 'remote' => array('short' => 'r', 'desc' => "List remotely available plugins. This is the default behavior", 'max' => 0)));
    if (isset($options['local']) && isset($options['remote'])) {
        die("Local and remote arguments can not be used simultaneously\n");
    }
    if (!empty($options['source'])) {
        $PluginManager->tmp_repositories = Ak::toArray($options['source']);
    }
    $installed_plugins = $PluginManager->getInstalledPlugins();
    if (isset($options['local'])) {
        if (empty($installed_plugins)) {
            die("There are not plugins intalled at {$ak_app_dir}/vendor/plugins\n");
        } else {
            echo "Plugins installed at  {$ak_app_dir}/vendor/plugins:\n\n";
            foreach ($installed_plugins as $plugin) {
                echo " * " . $plugin . " (" . rtrim($PluginManager->getRepositoryForPlugin($plugin), '/') . "/{$plugin})\n";
            }
            die("\n");
        }
    } else {
        $plugins = $PluginManager->getPlugins(true);
        if (empty($plugins)) {
            die("Could not find remote plugins\n");
        } else {
            $repsositories = array();
            foreach ($plugins as $plugin => $repository) {
                if (empty($repsositories[$repository])) {
                    $repsositories[$repository] = array();
                }
                if (in_array($plugin, $installed_plugins)) {
                    array_unshift($repsositories[$repository], '[INSTALLED] ' . $plugin);
示例#2
0
文件: plugin.php 项目: bermi/akelos
 $options = get_console_options_for('List available plugins.', array('source' => array('short' => 's', 'desc' => "Use the specified plugin repositories. --source URL1 URL2", 'max' => -1, 'min' => 1), 'local' => array('short' => 'l', 'desc' => "List locally installed plugins.", 'max' => 0), 'remote' => array('short' => 'r', 'desc' => "List remotely available plugins. This is the default behavior", 'max' => 0)));
 if (isset($options['local']) && isset($options['remote'])) {
     AkConsole::displayError("Local and remote arguments can not be used simultaneously", true);
 }
 if (!empty($options['source'])) {
     $PluginManager->tmp_repositories = Ak::toArray($options['source']);
 }
 $installed_plugins = $PluginManager->getInstalledPlugins();
 if (isset($options['local'])) {
     $plugins_dir = $ak_app_dir . DS . 'vendor' . DS . 'plugins';
     if (empty($installed_plugins)) {
         AkConsole::displayError("There are not plugins intalled at {$plugins_dir}", true);
     } else {
         echo "Plugins installed at  {$plugins_dir}:\n\n";
         foreach ($installed_plugins as $plugin) {
             echo " * " . $plugin . " (" . rtrim($PluginManager->getRepositoryForPlugin($plugin), '/') . "/{$plugin})\n";
         }
         die("\n");
     }
 } else {
     $plugins = $PluginManager->getPlugins(true);
     if (empty($plugins)) {
         AkConsole::displayError("Could not find remote plugins", true);
     } else {
         $repsositories = array();
         foreach ($plugins as $plugin => $repository) {
             if (empty($repsositories[$repository])) {
                 $repsositories[$repository] = array();
             }
             if (in_array($plugin, $installed_plugins)) {
                 array_unshift($repsositories[$repository], '[INSTALLED] ' . $plugin);