Ticket #7091: 7091.4.2.diff

File 7091.4.2.diff, 4.8 KB (added by DD32, 5 years ago)
Line 
1Index: wp-admin/plugins.php
2===================================================================
3--- wp-admin/plugins.php        (revision 8124)
4+++ wp-admin/plugins.php        (working copy)
5@@ -2,7 +2,7 @@
6 require_once('admin.php');
7 
8 $action = '';
9-foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) {
10+foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
11        if( isset($_POST[$action_key]) ) {
12                $action = $action_key;
13                break;
14@@ -149,12 +149,14 @@
15                                <?php
16                                require_once('admin-footer.php');
17                                exit;
18-                       }
19+                       } //Endif verify-delete
20                        $delete_result = delete_plugins($plugins);
21 
22                        wp_cache_delete('plugins', 'plugins');
23-
24                        break;
25+               case 'clear-recent-list':
26+                       update_option('recently_activated', array());
27+                       break;
28        }
29 }
30 
31@@ -197,8 +199,9 @@
32 <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>
33 <?php
34 
35+$all_plugins = get_plugins();
36 $active_plugins = array();
37-$available_plugins = array();
38+$inactive_plugins = array();
39 $recent_plugins = array();
40 $recently_activated = (array)get_option('recently_activated');
41 
42@@ -209,8 +212,6 @@
43 if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
44        update_option('recently_activated', $recently_activated);
45 
46-$all_plugins = get_plugins();
47-
48 $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
49 
50 foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
51@@ -223,13 +224,14 @@
52        if( ! empty($plugin_data['Author']) )
53                $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
54 
55+       //Filter into individual sections
56        if ( is_plugin_active($plugin_file) ) {
57                $active_plugins[ $plugin_file ] = $plugin_data;
58        } else {
59                if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
60                        $recent_plugins[ $plugin_file ] = $plugin_data;
61                else
62-                       $available_plugins[ $plugin_file ] = $plugin_data;
63+                       $inactive_plugins[ $plugin_file ] = $plugin_data;
64        }
65 }
66 
67@@ -289,6 +291,7 @@
68 } //End print_plugins_table()
69 ?>
70 
71+<?php if ( ! empty($active_plugins) ) : ?>
72 <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
73 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
74 <?php wp_nonce_field('bulk-manage-plugins') ?>
75@@ -303,9 +306,11 @@
76 </form>
77 
78 <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>
79+<?php endif; ?>
80 
81 <?php if ( ! empty($recent_plugins) ) : ?>
82 <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
83+<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>
84 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
85 <?php wp_nonce_field('bulk-manage-plugins') ?>
86 
87@@ -315,6 +320,7 @@
88 <?php if( current_user_can('delete_plugins') ) : ?>
89                <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
90 <?php endif; ?>
91+               <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
92        </div>
93 </div>
94 <br class="clear" />
95@@ -322,11 +328,11 @@
96 </form>
97 <?php endif; ?>
98 
99-<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
100+<?php if ( ! empty($inactive_plugins) ) : ?>
101+<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
102 <form method="post" action="<?php echo admin_url('plugins.php') ?>">
103 <?php wp_nonce_field('bulk-manage-plugins') ?>
104 
105-<?php if ( ! empty($available_plugins) ) : ?>
106 <div class="tablenav">
107        <div class="alignleft">
108                <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
109@@ -336,10 +342,14 @@
110        </div>
111 </div>
112 <br class="clear" />
113-<?php print_plugins_table($available_plugins, 'available') ?>
114+<?php print_plugins_table($inactive_plugins, 'inactive') ?>
115 </form>
116 <?php endif; ?>
117 
118+<?php if ( empty($all_plugins) ) : ?>
119+<p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
120+<?php endif; ?>
121+
122 <h2><?php _e('Get More Plugins'); ?></h2>
123 <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>
124 <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>