WordPress.org

Make WordPress Core

Ticket #7091: 7091.4.2.diff

File 7091.4.2.diff, 4.8 KB (added by DD32, 6 years ago)
  • wp-admin/plugins.php

     
    22require_once('admin.php'); 
    33 
    44$action = ''; 
    5 foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) { 
     5foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) { 
    66        if( isset($_POST[$action_key]) ) { 
    77                $action = $action_key; 
    88                break; 
     
    149149                                <?php 
    150150                                require_once('admin-footer.php'); 
    151151                                exit; 
    152                         } 
     152                        } //Endif verify-delete 
    153153                        $delete_result = delete_plugins($plugins); 
    154154 
    155155                        wp_cache_delete('plugins', 'plugins'); 
    156  
    157156                        break; 
     157                case 'clear-recent-list': 
     158                        update_option('recently_activated', array()); 
     159                        break; 
    158160        } 
    159161} 
    160162 
     
    197199<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> 
    198200<?php 
    199201 
     202$all_plugins = get_plugins(); 
    200203$active_plugins = array(); 
    201 $available_plugins = array(); 
     204$inactive_plugins = array(); 
    202205$recent_plugins = array(); 
    203206$recently_activated = (array)get_option('recently_activated'); 
    204207 
     
    209212if( $recently_activated != get_option('recently_activated') ) //If array changed, update it. 
    210213        update_option('recently_activated', $recently_activated); 
    211214 
    212 $all_plugins = get_plugins(); 
    213  
    214215$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); 
    215216 
    216217foreach( (array)$all_plugins as $plugin_file => $plugin_data) { 
     
    223224        if( ! empty($plugin_data['Author']) ) 
    224225                $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>'; 
    225226 
     227        //Filter into individual sections 
    226228        if ( is_plugin_active($plugin_file) ) { 
    227229                $active_plugins[ $plugin_file ] = $plugin_data; 
    228230        } else { 
    229231                if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated? 
    230232                        $recent_plugins[ $plugin_file ] = $plugin_data; 
    231233                else 
    232                         $available_plugins[ $plugin_file ] = $plugin_data; 
     234                        $inactive_plugins[ $plugin_file ] = $plugin_data; 
    233235        } 
    234236} 
    235237 
     
    289291} //End print_plugins_table() 
    290292?> 
    291293 
     294<?php if ( ! empty($active_plugins) ) : ?> 
    292295<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3> 
    293296<form method="post" action="<?php echo admin_url('plugins.php') ?>"> 
    294297<?php wp_nonce_field('bulk-manage-plugins') ?> 
     
    303306</form> 
    304307 
    305308<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> 
     309<?php endif; ?> 
    306310 
    307311<?php if ( ! empty($recent_plugins) ) : ?> 
    308312<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> 
     313<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> 
    309314<form method="post" action="<?php echo admin_url('plugins.php') ?>"> 
    310315<?php wp_nonce_field('bulk-manage-plugins') ?> 
    311316 
     
    315320<?php if( current_user_can('delete_plugins') ) : ?> 
    316321                <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" /> 
    317322<?php endif; ?> 
     323                <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" /> 
    318324        </div> 
    319325</div> 
    320326<br class="clear" /> 
     
    322328</form> 
    323329<?php endif; ?> 
    324330 
    325 <h3 id="available-plugins"><?php _e('Available Plugins') ?></h3> 
     331<?php if ( ! empty($inactive_plugins) ) : ?> 
     332<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3> 
    326333<form method="post" action="<?php echo admin_url('plugins.php') ?>"> 
    327334<?php wp_nonce_field('bulk-manage-plugins') ?> 
    328335 
    329 <?php if ( ! empty($available_plugins) ) : ?> 
    330336<div class="tablenav"> 
    331337        <div class="alignleft"> 
    332338                <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" /> 
     
    336342        </div> 
    337343</div> 
    338344<br class="clear" /> 
    339 <?php print_plugins_table($available_plugins, 'available') ?> 
     345<?php print_plugins_table($inactive_plugins, 'inactive') ?> 
    340346</form> 
    341347<?php endif; ?> 
    342348 
     349<?php if ( empty($all_plugins) ) : ?> 
     350<p><?php _e('You do not appear to have any plugins available at this time.') ?></p> 
     351<?php endif; ?> 
     352 
    343353<h2><?php _e('Get More Plugins'); ?></h2> 
    344354<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p> 
    345355<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>