Add plugin filter by status. Move help verbage to contextual help. see #9527

git-svn-id: http://svn.automattic.com/wordpress/trunk@10999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-19 01:11:13 +00:00
parent 08ef658e61
commit 86695c7c5f
1 changed files with 42 additions and 45 deletions

View File

@ -164,6 +164,11 @@ if( !empty($action) ) {
wp_enqueue_script('plugin-install'); wp_enqueue_script('plugin-install');
add_thickbox(); add_thickbox();
$help = '<p>' . sprintf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>';
$help .= '<p>' . sprintf(__('You can find additional plugins for your site by using the new <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually. To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%2$s</code> directory. Once a plugin has been installed, you may activate it here.'), 'plugin-install.php', WP_PLUGIN_DIR) . '</p>';
add_contextual_help('plugins', $help);
$title = __('Manage Plugins'); $title = __('Manage Plugins');
require_once('admin-header.php'); require_once('admin-header.php');
@ -228,16 +233,23 @@ foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
if ( is_plugin_active($plugin_file) ) { if ( is_plugin_active($plugin_file) ) {
$active_plugins[ $plugin_file ] = $plugin_data; $active_plugins[ $plugin_file ] = $plugin_data;
} else { } else {
if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated? if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
$recent_plugins[ $plugin_file ] = $plugin_data; $recent_plugins[ $plugin_file ] = $plugin_data;
else
$inactive_plugins[ $plugin_file ] = $plugin_data; $inactive_plugins[ $plugin_file ] = $plugin_data;
} }
} }
?> $total_plugins = count($all_plugins);
$total_inactive_plugins = count($inactive_plugins);
$total_active_plugins = count($active_plugins);
$total_recent_plugins = count($recent_plugins);
$status = ( isset($_GET['plugin_status']) ) ? $_GET['plugin_status'] : 'all';
if ( !in_array($status, array('all', 'active', 'inactive', 'recent')) )
$status = 'all';
$plugin_array_name = "${status}_plugins";
$plugins = &$$plugin_array_name;
<?php
/** /**
* @ignore * @ignore
* *
@ -287,9 +299,9 @@ function print_plugins_table($plugins, $context = '') {
$actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
$actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
$action_count = count($actions); $action_count = count($actions);
$class = is_plugin_active($plugin_file) ? 'active' : 'inactive';
echo " echo "
<tr class='$context'> <tr class='$class'>
<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th> <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
<td class='plugin-title'><strong>{$plugin_data['Title']}</strong>"; <td class='plugin-title'><strong>{$plugin_data['Title']}</strong>";
$i = 0; $i = 0;
@ -343,57 +355,42 @@ function print_plugin_actions($context) {
} }
?> ?>
<?php if ( ! empty($active_plugins) ) : ?>
<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>"> <form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?> <?php wp_nonce_field('bulk-manage-plugins') ?>
<div class="tablenav"> <ul class="subsubsub">
<?php print_plugin_actions('active') ?> <?php
</div> $status_links = array();
<div class="clear"></div> $class = ( 'all' == $status ) ? ' class="current"' : '';
<?php print_plugins_table($active_plugins, 'active') ?> $status_links[] = "<li><a href='plugins.php' $class>" . sprintf( _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_plugins ), number_format_i18n( $total_plugins ) ) . '</a>';
</form> if ( ! empty($active_plugins) ) {
$class = ( 'active' == $status ) ? ' class="current"' : '';
<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p> $status_links[] = "<li><a href='plugins.php?plugin_status=active' $class>" . sprintf( _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $total_active_plugins ), number_format_i18n( $total_active_plugins ) ) . '</a>';
<?php endif; ?> }
if ( ! empty($recent_plugins) ) {
<?php if ( ! empty($recent_plugins) ) : ?> $class = ( 'recent' == $status ) ? ' class="current"' : '';
<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> $status_links[] = "<li><a href='plugins.php?plugin_status=recent' $class>" . sprintf( _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $total_recent_plugins ), number_format_i18n( $total_recent_plugins ) ) . '</a>';
<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p> }
<form method="post" action="<?php echo admin_url('plugins.php') ?>"> if ( ! empty($inactive_plugins) ) {
<?php wp_nonce_field('bulk-manage-plugins') ?> $class = ( 'inactive' == $status ) ? ' class="current"' : '';
$status_links[] = "<li><a href='plugins.php?plugin_status=inactive' $class>" . sprintf( _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $total_inactive_plugins ), number_format_i18n( $total_inactive_plugins ) ) . '</a>';
}
echo implode( " |</li>\n", $status_links ) . '</li>';
unset( $status_links );
?>
</ul>
<div class="tablenav"> <div class="tablenav">
<?php print_plugin_actions('recent') ?> <?php print_plugin_actions($status) ?>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<?php print_plugins_table($recent_plugins, 'recent') ?> <?php print_plugins_table($plugins, $status) ?>
</form> </form>
<?php endif; ?>
<?php if ( ! empty($inactive_plugins) ) : ?>
<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?>
<div class="tablenav">
<?php print_plugin_actions('inactive') ?>
</div>
<div class="clear"></div>
<?php print_plugins_table($inactive_plugins, 'inactive') ?>
</form>
<?php endif; ?>
<?php if ( empty($all_plugins) ) : ?> <?php if ( empty($all_plugins) ) : ?>
<p><?php _e('You do not appear to have any plugins available at this time.') ?></p> <p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
<?php endif; ?> <?php endif; ?>
<h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site by using the new <a href="plugin-install.php">Plugin Browser/Installer</a> functionality, Or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.'); ?></p>
<p><?php printf(__('To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory.'), WP_PLUGIN_DIR); ?></p>
<p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p>
</div> </div>
<?php <?php