WordPress.org

Make WordPress Core

Changeset 10999


Ignore:
Timestamp:
04/19/2009 01:11:13 AM (9 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r10978 r10999  
    165165add_thickbox();
    166166
     167$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>';
     168$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>';
     169
     170add_contextual_help('plugins', $help);
     171
    167172$title = __('Manage Plugins');
    168173require_once('admin-header.php');
     
    229234        $active_plugins[ $plugin_file ] = $plugin_data;
    230235    } else {
    231         if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
     236        if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
    232237            $recent_plugins[ $plugin_file ] = $plugin_data;
    233         else
    234             $inactive_plugins[ $plugin_file ] = $plugin_data;
     238        $inactive_plugins[ $plugin_file ] = $plugin_data;
    235239    }
    236240}
    237241
    238 ?>
    239 
    240 <?php
     242$total_plugins = count($all_plugins);
     243$total_inactive_plugins = count($inactive_plugins);
     244$total_active_plugins = count($active_plugins);
     245$total_recent_plugins = count($recent_plugins);
     246
     247$status = ( isset($_GET['plugin_status']) ) ? $_GET['plugin_status'] : 'all';
     248if ( !in_array($status, array('all', 'active', 'inactive', 'recent')) )
     249    $status = 'all';
     250$plugin_array_name = "${status}_plugins";
     251$plugins = &$$plugin_array_name;
     252
    241253/**
    242254 * @ignore
     
    288300        $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
    289301        $action_count = count($actions);
    290 
     302        $class = is_plugin_active($plugin_file) ? 'active' : 'inactive';
    291303        echo "
    292     <tr class='$context'>
     304    <tr class='$class'>
    293305        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
    294306        <td class='plugin-title'><strong>{$plugin_data['Title']}</strong>";
     
    344356?>
    345357
    346 <?php if ( ! empty($active_plugins) ) : ?>
    347 <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
    348358<form method="post" action="<?php echo admin_url('plugins.php') ?>">
    349359<?php wp_nonce_field('bulk-manage-plugins') ?>
    350360
     361<ul class="subsubsub">
     362<?php
     363$status_links = array();
     364$class = ( 'all' == $status ) ? ' class="current"' : '';
     365$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>';
     366if ( ! empty($active_plugins) ) {
     367    $class = ( 'active' == $status ) ? ' class="current"' : '';
     368    $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>';
     369}
     370if ( ! empty($recent_plugins) ) {
     371    $class = ( 'recent' == $status ) ? ' class="current"' : '';
     372    $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>';
     373}
     374if ( ! empty($inactive_plugins) ) {
     375    $class = ( 'inactive' == $status ) ? ' class="current"' : '';
     376    $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>';
     377}
     378echo implode( " |</li>\n", $status_links ) . '</li>';
     379unset( $status_links );
     380?>
     381</ul>
     382
    351383<div class="tablenav">
    352 <?php print_plugin_actions('active') ?>
     384<?php print_plugin_actions($status) ?>
    353385</div>
    354386<div class="clear"></div>
    355 <?php print_plugins_table($active_plugins, 'active') ?>
     387<?php print_plugins_table($plugins, $status) ?>
    356388</form>
    357 
    358 <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>
    359 <?php endif; ?>
    360 
    361 <?php if ( ! empty($recent_plugins) ) : ?>
    362 <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
    363 <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>
    364 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
    365 <?php wp_nonce_field('bulk-manage-plugins') ?>
    366 
    367 <div class="tablenav">
    368 <?php print_plugin_actions('recent') ?>
    369 </div>
    370 <div class="clear"></div>
    371 <?php print_plugins_table($recent_plugins, 'recent') ?>
    372 </form>
    373 <?php endif; ?>
    374 
    375 <?php if ( ! empty($inactive_plugins) ) : ?>
    376 <h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
    377 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
    378 <?php wp_nonce_field('bulk-manage-plugins') ?>
    379 
    380 <div class="tablenav">
    381 <?php print_plugin_actions('inactive') ?>
    382 </div>
    383 <div class="clear"></div>
    384 <?php print_plugins_table($inactive_plugins, 'inactive') ?>
    385 </form>
    386 <?php endif; ?>
    387389
    388390<?php if ( empty($all_plugins) ) : ?>
     
    390392<?php endif; ?>
    391393
    392 <h2><?php _e('Get More Plugins'); ?></h2>
    393 <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>
    394 <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>
    395 <p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p>
    396 
    397394</div>
    398395
Note: See TracChangeset for help on using the changeset viewer.