private function list_plugins() { // Force WordPress to update the plugin list wp_update_plugins(); $plugins = get_plugins(); $plugins = array_merge($plugins, $this->mu_plugins); // Print the header WP_CLI::line('Installed plugins:'); foreach ($plugins as $file => $plugin) { if (false === strpos($file, '/')) { $name = str_replace('.php', '', basename($file)); } else { $name = dirname($file); } if (WP_CLI::get_update_status($file, 'update_plugins')) { $line = ' %yU%n'; } else { $line = ' '; } $line .= $this->get_status($file) . " {$name}%n"; WP_CLI::line($line); } // Print the footer WP_CLI::line(); $legend = array('I' => 'Inactive', '%gA' => 'Active', '%cM' => 'Must Use'); if (is_multisite()) { $legend['%bN'] = 'Network Active'; } WP_CLI::legend($legend); }
private function list_themes() { // Print the header WP_CLI::line('Installed themes:'); foreach (get_themes() as $theme) { if (WP_CLI::get_update_status($theme['Stylesheet'], 'update_themes')) { $line = ' %yU%n'; } else { $line = ' '; } $line .= $this->get_status($theme['Name']) . ' ' . $theme['Stylesheet'] . '%n'; WP_CLI::line($line); } // Print the footer WP_CLI::line(); $legend = array('I' => 'Inactive', '%gA' => 'Active'); WP_CLI::legend($legend); }