5 * @package WordPress |
5 * @package WordPress |
6 * @subpackage Administration |
6 * @subpackage Administration |
7 */ |
7 */ |
8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once('admin.php'); |
10 require_once('./admin.php'); |
11 |
11 |
12 if ( ! current_user_can('activate_plugins') ) |
12 if ( is_multisite() ) { |
13 wp_die(__('You do not have sufficient permissions to manage plugins for this blog.')); |
13 $menu_perms = get_site_option( 'menu_items', array() ); |
14 |
14 |
15 if ( isset($_POST['clear-recent-list']) ) |
15 if ( empty( $menu_perms['plugins'] ) && ! current_user_can( 'manage_network_plugins' ) ) |
16 $action = 'clear-recent-list'; |
16 wp_die( __( 'Cheatin’ uh?' ) ); |
17 elseif ( !empty($_REQUEST['action']) ) |
17 } |
18 $action = $_REQUEST['action']; |
18 |
19 elseif ( !empty($_REQUEST['action2']) ) |
19 if ( !current_user_can('activate_plugins') ) |
20 $action = $_REQUEST['action2']; |
20 wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) ); |
21 else |
21 |
22 $action = false; |
22 $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
23 $pagenum = $wp_list_table->get_pagenum(); |
|
24 |
|
25 $action = $wp_list_table->current_action(); |
23 |
26 |
24 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; |
27 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; |
25 |
28 $s = isset($_REQUEST['s']) ? urlencode($_REQUEST['s']) : ''; |
26 $default_status = get_user_option('plugins_last_view'); |
29 |
27 if ( empty($default_status) ) |
30 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
28 $default_status = 'all'; |
|
29 $status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : $default_status; |
|
30 if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'search')) ) |
|
31 $status = 'all'; |
|
32 if ( $status != $default_status && 'search' != $status ) |
|
33 update_usermeta($current_user->ID, 'plugins_last_view', $status); |
|
34 |
|
35 $page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1; |
|
36 |
|
37 //Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
|
38 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); |
31 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); |
39 |
32 |
40 if ( !empty($action) ) { |
33 if ( $action ) { |
|
34 |
41 switch ( $action ) { |
35 switch ( $action ) { |
42 case 'activate': |
36 case 'activate': |
43 if ( ! current_user_can('activate_plugins') ) |
37 if ( ! current_user_can('activate_plugins') ) |
44 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
38 wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
45 |
39 |
46 check_admin_referer('activate-plugin_' . $plugin); |
40 check_admin_referer('activate-plugin_' . $plugin); |
47 |
41 |
48 $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin); |
42 $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() ); |
49 if ( is_wp_error( $result ) ) |
43 if ( is_wp_error( $result ) ) { |
50 wp_die($result); |
44 if ( 'unexpected_output' == $result->get_error_code() ) { |
51 |
45 $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s"); |
52 $recent = (array)get_option('recently_activated'); |
46 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); |
53 if ( isset($recent[ $plugin ]) ) { |
47 exit; |
54 unset($recent[ $plugin ]); |
48 } else { |
55 update_option('recently_activated', $recent); |
49 wp_die($result); |
56 } |
50 } |
57 |
51 } |
58 wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above |
52 |
|
53 if ( ! is_network_admin() ) { |
|
54 if ( is_network_only_plugin( $plugin ) ) { |
|
55 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
56 exit; |
|
57 } |
|
58 |
|
59 $recent = (array) get_option( 'recently_activated' ); |
|
60 unset( $recent[ $plugin ] ); |
|
61 update_option( 'recently_activated', $recent ); |
|
62 } |
|
63 |
|
64 if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { |
|
65 wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
66 } else { |
|
67 wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above |
|
68 } |
59 exit; |
69 exit; |
60 break; |
70 break; |
61 case 'activate-selected': |
71 case 'activate-selected': |
62 if ( ! current_user_can('activate_plugins') ) |
72 if ( ! current_user_can('activate_plugins') ) |
63 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
73 wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
64 |
74 |
65 check_admin_referer('bulk-manage-plugins'); |
75 check_admin_referer('bulk-plugins'); |
66 |
76 |
67 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
77 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
68 $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Only activate plugins which are not already active. |
78 |
|
79 // Only activate plugins which are not already active. |
|
80 if ( is_network_admin() ) { |
|
81 foreach ( $plugins as $i => $plugin ) { |
|
82 if ( is_plugin_active_for_network( $plugin ) ) |
|
83 unset( $plugins[ $i ] ); |
|
84 } |
|
85 } else { |
|
86 foreach ( $plugins as $i => $plugin ) { |
|
87 if ( is_plugin_active( $plugin ) || is_network_only_plugin( $plugin ) ) |
|
88 unset( $plugins[ $i ] ); |
|
89 } |
|
90 } |
|
91 |
69 if ( empty($plugins) ) { |
92 if ( empty($plugins) ) { |
70 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
93 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
71 exit; |
94 exit; |
72 } |
95 } |
73 |
96 |
74 activate_plugins($plugins, 'plugins.php?error=true'); |
97 activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() ); |
75 |
98 |
76 $recent = (array)get_option('recently_activated'); |
99 if ( ! is_network_admin() ) { |
77 foreach ( $plugins as $plugin => $time) |
100 $recent = (array) get_option('recently_activated' ); |
78 if ( isset($recent[ $plugin ]) ) |
101 foreach ( $plugins as $plugin ) |
79 unset($recent[ $plugin ]); |
102 unset( $recent[ $plugin ] ); |
80 |
103 update_option( 'recently_activated', $recent ); |
81 update_option('recently_activated', $recent); |
104 } |
82 |
105 |
83 wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page"); |
106 wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
107 exit; |
|
108 break; |
|
109 case 'update-selected' : |
|
110 |
|
111 check_admin_referer( 'bulk-plugins' ); |
|
112 |
|
113 if ( isset( $_GET['plugins'] ) ) |
|
114 $plugins = explode( ',', $_GET['plugins'] ); |
|
115 elseif ( isset( $_POST['checked'] ) ) |
|
116 $plugins = (array) $_POST['checked']; |
|
117 else |
|
118 $plugins = array(); |
|
119 |
|
120 $title = __( 'Update Plugins' ); |
|
121 $parent_file = 'plugins.php'; |
|
122 |
|
123 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
124 |
|
125 echo '<div class="wrap">'; |
|
126 screen_icon(); |
|
127 echo '<h2>' . esc_html( $title ) . '</h2>'; |
|
128 |
|
129 $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); |
|
130 $url = wp_nonce_url($url, 'bulk-update-plugins'); |
|
131 |
|
132 echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
|
133 echo '</div>'; |
|
134 require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
84 exit; |
135 exit; |
85 break; |
136 break; |
86 case 'error_scrape': |
137 case 'error_scrape': |
87 if ( ! current_user_can('activate_plugins') ) |
138 if ( ! current_user_can('activate_plugins') ) |
88 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
139 wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
89 |
140 |
90 check_admin_referer('plugin-activation-error_' . $plugin); |
141 check_admin_referer('plugin-activation-error_' . $plugin); |
91 |
142 |
92 $valid = validate_plugin($plugin); |
143 $valid = validate_plugin($plugin); |
93 if ( is_wp_error($valid) ) |
144 if ( is_wp_error($valid) ) |
94 wp_die($valid); |
145 wp_die($valid); |
95 |
146 |
96 if ( defined('E_RECOVERABLE_ERROR') ) |
147 if ( ! WP_DEBUG ) { |
97 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
148 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
98 else |
149 } |
99 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); |
|
100 |
150 |
101 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
151 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
102 include(WP_PLUGIN_DIR . '/' . $plugin); |
152 // Go back to "sandbox" scope so we get the same errors as before |
|
153 function plugin_sandbox_scrape( $plugin ) { |
|
154 include( WP_PLUGIN_DIR . '/' . $plugin ); |
|
155 } |
|
156 plugin_sandbox_scrape( $plugin ); |
103 do_action('activate_' . $plugin); |
157 do_action('activate_' . $plugin); |
104 exit; |
158 exit; |
105 break; |
159 break; |
106 case 'deactivate': |
160 case 'deactivate': |
107 if ( ! current_user_can('activate_plugins') ) |
161 if ( ! current_user_can('activate_plugins') ) |
108 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
162 wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
109 |
163 |
110 check_admin_referer('deactivate-plugin_' . $plugin); |
164 check_admin_referer('deactivate-plugin_' . $plugin); |
111 deactivate_plugins($plugin); |
165 |
112 update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); |
166 if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { |
113 wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page"); |
167 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
168 exit; |
|
169 } |
|
170 |
|
171 deactivate_plugins( $plugin, false, is_network_admin() ); |
|
172 if ( ! is_network_admin() ) |
|
173 update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
|
174 if ( headers_sent() ) |
|
175 echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
176 else |
|
177 wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
114 exit; |
178 exit; |
115 break; |
179 break; |
116 case 'deactivate-selected': |
180 case 'deactivate-selected': |
117 if ( ! current_user_can('activate_plugins') ) |
181 if ( ! current_user_can('activate_plugins') ) |
118 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
182 wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
119 |
183 |
120 check_admin_referer('bulk-manage-plugins'); |
184 check_admin_referer('bulk-plugins'); |
121 |
185 |
122 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
186 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
123 $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated. |
187 // Do not deactivate plugins which are already deactivated. |
|
188 if ( is_network_admin() ) { |
|
189 $plugins = array_filter( $plugins, 'is_plugin_active_for_network' ); |
|
190 } else { |
|
191 $plugins = array_filter( $plugins, 'is_plugin_active' ); |
|
192 $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) ); |
|
193 } |
124 if ( empty($plugins) ) { |
194 if ( empty($plugins) ) { |
125 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
195 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
126 exit; |
196 exit; |
127 } |
197 } |
128 |
198 |
129 deactivate_plugins($plugins); |
199 deactivate_plugins( $plugins, false, is_network_admin() ); |
130 |
200 |
131 $deactivated = array(); |
201 if ( ! is_network_admin() ) { |
132 foreach ( $plugins as $plugin ) |
202 $deactivated = array(); |
133 $deactivated[ $plugin ] = time(); |
203 foreach ( $plugins as $plugin ) |
134 |
204 $deactivated[ $plugin ] = time(); |
135 update_option('recently_activated', $deactivated + (array)get_option('recently_activated')); |
205 update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
136 wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page"); |
206 } |
|
207 |
|
208 wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
137 exit; |
209 exit; |
138 break; |
210 break; |
139 case 'delete-selected': |
211 case 'delete-selected': |
140 if ( ! current_user_can('delete_plugins') ) |
212 if ( ! current_user_can('delete_plugins') ) |
141 wp_die(__('You do not have sufficient permissions to delete plugins for this blog.')); |
213 wp_die(__('You do not have sufficient permissions to delete plugins for this site.')); |
142 |
214 |
143 check_admin_referer('bulk-manage-plugins'); |
215 check_admin_referer('bulk-plugins'); |
144 |
216 |
145 //$_POST = from the plugin form; $_GET = from the FTP details screen. |
217 //$_POST = from the plugin form; $_GET = from the FTP details screen. |
146 $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
218 $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
147 $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins. |
219 if ( empty( $plugins ) ) { |
148 if ( empty($plugins) ) { |
220 wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
149 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
221 exit; |
|
222 } |
|
223 |
|
224 $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. |
|
225 if ( empty( $plugins ) ) { |
|
226 wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
150 exit; |
227 exit; |
151 } |
228 } |
152 |
229 |
153 include(ABSPATH . 'wp-admin/update.php'); |
230 include(ABSPATH . 'wp-admin/update.php'); |
154 |
231 |
155 $parent_file = 'plugins.php'; |
232 $parent_file = 'plugins.php'; |
156 |
233 |
157 if ( ! isset($_REQUEST['verify-delete']) ) { |
234 if ( ! isset($_REQUEST['verify-delete']) ) { |
158 wp_enqueue_script('jquery'); |
235 wp_enqueue_script('jquery'); |
159 require_once('admin-header.php'); |
236 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
160 ?> |
237 ?> |
161 <div class="wrap"> |
238 <div class="wrap"> |
162 <h2><?php _e('Delete Plugin(s)'); ?></h2> |
|
163 <?php |
239 <?php |
164 $files_to_delete = $plugin_info = array(); |
240 $files_to_delete = $plugin_info = array(); |
|
241 $have_non_network_plugins = false; |
165 foreach ( (array) $plugins as $plugin ) { |
242 foreach ( (array) $plugins as $plugin ) { |
166 if ( '.' == dirname($plugin) ) { |
243 if ( '.' == dirname($plugin) ) { |
167 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; |
244 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; |
168 if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) |
245 if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) { |
169 $plugin_info[ $plugin ] = $data; |
246 $plugin_info[ $plugin ] = $data; |
|
247 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
248 if ( ! $plugin_info[ $plugin ]['Network'] ) |
|
249 $have_non_network_plugins = true; |
|
250 } |
170 } else { |
251 } else { |
171 //Locate all the files in that folder: |
252 // Locate all the files in that folder |
172 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) ); |
253 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) ); |
173 if( $files ) { |
254 if ( $files ) { |
174 $files_to_delete = array_merge($files_to_delete, $files); |
255 $files_to_delete = array_merge($files_to_delete, $files); |
175 } |
256 } |
176 //Get plugins list from that folder |
257 // Get plugins list from that folder |
177 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) |
258 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) { |
178 $plugin_info = array_merge($plugin_info, $folder_plugins); |
259 foreach( $folder_plugins as $plugin_file => $data ) { |
|
260 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
|
261 $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
262 if ( ! $plugin_info[ $plugin_file ]['Network'] ) |
|
263 $have_non_network_plugins = true; |
|
264 } |
|
265 } |
179 } |
266 } |
180 } |
267 } |
|
268 screen_icon(); |
|
269 $plugins_to_delete = count( $plugin_info ); |
|
270 echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>'; |
181 ?> |
271 ?> |
182 <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p> |
272 <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
|
273 <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This plugin may be active on other sites in the network.', 'These plugins may be active on other sites in the network.', $plugins_to_delete ); ?></p></div> |
|
274 <?php endif; ?> |
|
275 <p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p> |
183 <ul class="ul-disc"> |
276 <ul class="ul-disc"> |
184 <?php |
277 <?php |
185 foreach ( $plugin_info as $plugin ) |
278 $data_to_delete = false; |
186 echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>'; |
279 foreach ( $plugin_info as $plugin ) { |
|
280 if ( $plugin['is_uninstallable'] ) { |
|
281 /* translators: 1: plugin name, 2: plugin author */ |
|
282 echo '<li>', sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>'; |
|
283 $data_to_delete = true; |
|
284 } else { |
|
285 /* translators: 1: plugin name, 2: plugin author */ |
|
286 echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>'; |
|
287 } |
|
288 } |
187 ?> |
289 ?> |
188 </ul> |
290 </ul> |
189 <p><?php _e('Are you sure you wish to delete these files?') ?></p> |
291 <p><?php |
|
292 if ( $data_to_delete ) |
|
293 _e('Are you sure you wish to delete these files and data?'); |
|
294 else |
|
295 _e('Are you sure you wish to delete these files?'); |
|
296 ?></p> |
190 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
297 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
191 <input type="hidden" name="verify-delete" value="1" /> |
298 <input type="hidden" name="verify-delete" value="1" /> |
192 <input type="hidden" name="action" value="delete-selected" /> |
299 <input type="hidden" name="action" value="delete-selected" /> |
193 <?php |
300 <?php |
194 foreach ( (array)$plugins as $plugin ) |
301 foreach ( (array) $plugins as $plugin ) |
195 echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />'; |
302 echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />'; |
196 ?> |
303 ?> |
197 <?php wp_nonce_field('bulk-manage-plugins') ?> |
304 <?php wp_nonce_field('bulk-plugins') ?> |
198 <input type="submit" name="submit" value="<?php esc_attr_e('Yes, Delete these files') ?>" class="button" /> |
305 <?php submit_button( $data_to_delete ? __( 'Yes, Delete these files and data' ) : __( 'Yes, Delete these files' ), 'button', 'submit', false ); ?> |
199 </form> |
306 </form> |
200 <form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;"> |
307 <form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;"> |
201 <input type="submit" name="submit" value="<?php esc_attr_e('No, Return me to the plugin list') ?>" class="button" /> |
308 <?php submit_button( __( 'No, Return me to the plugin list' ), 'button', 'submit', false ); ?> |
202 </form> |
309 </form> |
203 |
310 |
204 <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p> |
311 <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p> |
205 <div id="files-list" style="display:none;"> |
312 <div id="files-list" style="display:none;"> |
206 <ul class="code"> |
313 <ul class="code"> |
207 <?php |
314 <?php |
208 foreach ( (array)$files_to_delete as $file ) |
315 foreach ( (array)$files_to_delete as $file ) |
209 echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>'; |
316 echo '<li>' . esc_html(str_replace(WP_PLUGIN_DIR, '', $file)) . '</li>'; |
210 ?> |
317 ?> |
211 </ul> |
318 </ul> |
212 </div> |
319 </div> |
213 </div> |
320 </div> |
214 <?php |
321 <?php |
215 require_once('admin-footer.php'); |
322 require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
216 exit; |
323 exit; |
217 } //Endif verify-delete |
324 } //Endif verify-delete |
218 $delete_result = delete_plugins($plugins); |
325 $delete_result = delete_plugins($plugins); |
219 |
326 |
220 set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
327 set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
221 wp_redirect("plugins.php?deleted=true&plugin_status=$status&paged=$page"); |
328 wp_redirect( self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s") ); |
222 exit; |
329 exit; |
223 break; |
330 break; |
224 case 'clear-recent-list': |
331 case 'clear-recent-list': |
225 update_option('recently_activated', array()); |
332 if ( ! is_network_admin() ) |
|
333 update_option( 'recently_activated', array() ); |
226 break; |
334 break; |
227 } |
335 } |
228 } |
336 } |
229 |
337 |
|
338 $wp_list_table->prepare_items(); |
|
339 |
230 wp_enqueue_script('plugin-install'); |
340 wp_enqueue_script('plugin-install'); |
231 add_thickbox(); |
341 add_thickbox(); |
232 |
342 |
233 $help = '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>'; |
343 add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999 ) ); |
234 $help .= '<p>' . sprintf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>'; |
344 |
235 $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>'; |
345 get_current_screen()->add_help_tab( array( |
236 |
346 'id' => 'overview', |
237 add_contextual_help('plugins', $help); |
347 'title' => __('Overview'), |
238 |
348 'content' => |
239 $title = __('Manage Plugins'); |
349 '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . |
240 require_once('admin-header.php'); |
350 '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '</p>' |
|
351 ) ); |
|
352 get_current_screen()->add_help_tab( array( |
|
353 'id' => 'compatibility-problems', |
|
354 'title' => __('Troubleshooting'), |
|
355 'content' => |
|
356 '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . |
|
357 '<p>' . sprintf( __('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>' |
|
358 ) ); |
|
359 |
|
360 get_current_screen()->set_help_sidebar( |
|
361 '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
362 '<p>' . __('<a href="http://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' . |
|
363 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
364 ); |
|
365 |
|
366 $title = __('Plugins'); |
|
367 $parent_file = 'plugins.php'; |
|
368 |
|
369 require_once(ABSPATH . 'wp-admin/admin-header.php'); |
241 |
370 |
242 $invalid = validate_active_plugins(); |
371 $invalid = validate_active_plugins(); |
243 if ( !empty($invalid) ) |
372 if ( !empty($invalid) ) |
244 foreach ( $invalid as $plugin_file => $error ) |
373 foreach ( $invalid as $plugin_file => $error ) |
245 echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>'; |
374 echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>'; |
246 ?> |
375 ?> |
247 |
376 |
248 <?php if ( isset($_GET['error']) ) : ?> |
377 <?php if ( isset($_GET['error']) ) : |
249 <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p> |
378 |
|
379 if ( isset( $_GET['main'] ) ) |
|
380 $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
381 elseif ( isset($_GET['charsout']) ) |
|
382 $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
383 else |
|
384 $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
385 ?> |
|
386 <div id="message" class="updated"><p><?php echo $errmsg; ?></p> |
250 <?php |
387 <?php |
251 if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?> |
388 if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?> |
252 <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&plugin=' . esc_attr($plugin) . '&_wpnonce=' . esc_attr($_GET['_error_nonce'])); ?>"></iframe> |
389 <iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&plugin=' . esc_attr($plugin) . '&_wpnonce=' . esc_attr($_GET['_error_nonce']); ?>"></iframe> |
253 <?php |
390 <?php |
254 } |
391 } |
255 ?> |
392 ?> |
256 </div> |
393 </div> |
257 <?php elseif ( isset($_GET['deleted']) ) : |
394 <?php elseif ( isset($_GET['deleted']) ) : |
258 $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
395 $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
259 delete_transient('plugins_delete_result'); //Delete it once we're done. |
396 delete_transient('plugins_delete_result'); //Delete it once we're done. |
260 |
397 |
261 if ( is_wp_error($delete_result) ) : ?> |
398 if ( is_wp_error($delete_result) ) : ?> |
262 <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
399 <div id="message" class="updated"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
263 <?php else : ?> |
400 <?php else : ?> |
264 <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
401 <div id="message" class="updated"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
265 <?php endif; ?> |
402 <?php endif; ?> |
266 <?php elseif ( isset($_GET['activate']) ) : ?> |
403 <?php elseif ( isset($_GET['activate']) ) : ?> |
267 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
404 <div id="message" class="updated"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
268 <?php elseif (isset($_GET['activate-multi'])) : ?> |
405 <?php elseif (isset($_GET['activate-multi'])) : ?> |
269 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
406 <div id="message" class="updated"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
270 <?php elseif ( isset($_GET['deactivate']) ) : ?> |
407 <?php elseif ( isset($_GET['deactivate']) ) : ?> |
271 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
408 <div id="message" class="updated"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
272 <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
409 <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
273 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
410 <div id="message" class="updated"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
|
411 <?php elseif ( 'update-selected' == $action ) : ?> |
|
412 <div id="message" class="updated"><p><?php _e('No out of date plugins were selected.'); ?></p></div> |
274 <?php endif; ?> |
413 <?php endif; ?> |
275 |
414 |
276 <div class="wrap"> |
415 <div class="wrap"> |
277 <?php screen_icon(); ?> |
416 <?php screen_icon(); ?> |
278 <h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a></h2> |
417 <h2><?php echo esc_html( $title ); |
279 |
418 if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> |
280 <?php |
419 <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
281 |
420 <?php } |
282 $all_plugins = get_plugins(); |
421 if ( $s ) |
283 $search_plugins = array(); |
422 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> |
284 $active_plugins = array(); |
423 </h2> |
285 $inactive_plugins = array(); |
424 |
286 $recent_plugins = array(); |
425 <?php do_action( 'pre_current_active_plugins', $plugins['all'] ) ?> |
287 $recently_activated = get_option('recently_activated', array()); |
426 |
288 $upgrade_plugins = array(); |
427 <?php $wp_list_table->views(); ?> |
289 |
|
290 set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 ); |
|
291 |
|
292 // Clean out any plugins which were deactivated over a week ago. |
|
293 foreach ( $recently_activated as $key => $time ) |
|
294 if ( $time + (7*24*60*60) < time() ) //1 week |
|
295 unset($recently_activated[ $key ]); |
|
296 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it. |
|
297 update_option('recently_activated', $recently_activated); |
|
298 $current = get_transient( 'update_plugins' ); |
|
299 |
|
300 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { |
|
301 |
|
302 //Translate, Apply Markup, Sanitize HTML |
|
303 $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
304 $all_plugins[ $plugin_file ] = $plugin_data; |
|
305 |
|
306 //Filter into individual sections |
|
307 if ( is_plugin_active($plugin_file) ) { |
|
308 $active_plugins[ $plugin_file ] = $plugin_data; |
|
309 } else { |
|
310 if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? |
|
311 $recent_plugins[ $plugin_file ] = $plugin_data; |
|
312 $inactive_plugins[ $plugin_file ] = $plugin_data; |
|
313 } |
|
314 |
|
315 if ( isset( $current->response[ $plugin_file ] ) ) |
|
316 $upgrade_plugins[ $plugin_file ] = $plugin_data; |
|
317 } |
|
318 |
|
319 $total_all_plugins = count($all_plugins); |
|
320 $total_inactive_plugins = count($inactive_plugins); |
|
321 $total_active_plugins = count($active_plugins); |
|
322 $total_recent_plugins = count($recent_plugins); |
|
323 $total_upgrade_plugins = count($upgrade_plugins); |
|
324 |
|
325 //Searching. |
|
326 if ( isset($_GET['s']) ) { |
|
327 function _search_plugins_filter_callback($plugin) { |
|
328 static $term; |
|
329 if ( is_null($term) ) |
|
330 $term = stripslashes($_GET['s']); |
|
331 if ( stripos($plugin['Name'], $term) !== false || |
|
332 stripos($plugin['Description'], $term) !== false || |
|
333 stripos($plugin['Author'], $term) !== false || |
|
334 stripos($plugin['PluginURI'], $term) !== false || |
|
335 stripos($plugin['AuthorURI'], $term) !== false || |
|
336 stripos($plugin['Version'], $term) !== false ) |
|
337 return true; |
|
338 else |
|
339 return false; |
|
340 } |
|
341 $status = 'search'; |
|
342 $search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback'); |
|
343 $total_search_plugins = count($search_plugins); |
|
344 } |
|
345 |
|
346 $plugin_array_name = "${status}_plugins"; |
|
347 if ( empty($$plugin_array_name) && $status != 'all' ) { |
|
348 $status = 'all'; |
|
349 $plugin_array_name = "${status}_plugins"; |
|
350 } |
|
351 |
|
352 $plugins = &$$plugin_array_name; |
|
353 |
|
354 //Paging. |
|
355 $total_this_page = "total_{$status}_plugins"; |
|
356 $total_this_page = $$total_this_page; |
|
357 $plugins_per_page = (int) get_user_option( 'plugins_per_page', 0, false ); |
|
358 if ( empty( $plugins_per_page ) || $plugins_per_page < 1 ) |
|
359 $plugins_per_page = 999; |
|
360 $plugins_per_page = apply_filters( 'plugins_per_page', $plugins_per_page ); |
|
361 |
|
362 $start = ($page - 1) * $plugins_per_page; |
|
363 |
|
364 $page_links = paginate_links( array( |
|
365 'base' => add_query_arg( 'paged', '%#%' ), |
|
366 'format' => '', |
|
367 'prev_text' => __('«'), |
|
368 'next_text' => __('»'), |
|
369 'total' => ceil($total_this_page / $plugins_per_page), |
|
370 'current' => $page |
|
371 )); |
|
372 $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', |
|
373 number_format_i18n( $start + 1 ), |
|
374 number_format_i18n( min( $page * $plugins_per_page, $total_this_page ) ), |
|
375 '<span class="total-type-count">' . number_format_i18n( $total_this_page ) . '</span>', |
|
376 $page_links |
|
377 ); |
|
378 |
|
379 /** |
|
380 * @ignore |
|
381 * |
|
382 * @param array $plugins |
|
383 * @param string $context |
|
384 */ |
|
385 function print_plugins_table($plugins, $context = '') { |
|
386 global $page; |
|
387 ?> |
|
388 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table"> |
|
389 <thead> |
|
390 <tr> |
|
391 <th scope="col" class="manage-column check-column"><input type="checkbox" /></th> |
|
392 <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th> |
|
393 <th scope="col" class="manage-column"><?php _e('Description'); ?></th> |
|
394 </tr> |
|
395 </thead> |
|
396 |
|
397 <tfoot> |
|
398 <tr> |
|
399 <th scope="col" class="manage-column check-column"><input type="checkbox" /></th> |
|
400 <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th> |
|
401 <th scope="col" class="manage-column"><?php _e('Description'); ?></th> |
|
402 </tr> |
|
403 </tfoot> |
|
404 |
|
405 <tbody class="plugins"> |
|
406 <?php |
|
407 |
|
408 if ( empty($plugins) ) { |
|
409 echo '<tr> |
|
410 <td colspan="3">' . __('No plugins to show') . '</td> |
|
411 </tr>'; |
|
412 } |
|
413 foreach ( (array)$plugins as $plugin_file => $plugin_data) { |
|
414 $actions = array(); |
|
415 $is_active = is_plugin_active($plugin_file); |
|
416 |
|
417 if ( $is_active ) |
|
418 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>'; |
|
419 else |
|
420 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>'; |
|
421 |
|
422 if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) |
|
423 $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; |
|
424 |
|
425 if ( ! $is_active && current_user_can('delete_plugins') ) |
|
426 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; |
|
427 |
|
428 $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
429 $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); |
|
430 $action_count = count($actions); |
|
431 $class = $is_active ? 'active' : 'inactive'; |
|
432 echo " |
|
433 <tr class='$class'> |
|
434 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> |
|
435 <td class='plugin-title'><strong>{$plugin_data['Name']}</strong></td> |
|
436 <td class='desc'><p>{$plugin_data['Description']}</p></td> |
|
437 </tr> |
|
438 <tr class='$class second'> |
|
439 <td></td> |
|
440 <td class='plugin-title'>"; |
|
441 echo '<div class="row-actions-visible">'; |
|
442 foreach ( $actions as $action => $link ) { |
|
443 $sep = end($actions) == $link ? '' : ' | '; |
|
444 echo "<span class='$action'>$link$sep</span>"; |
|
445 } |
|
446 echo "</div></td> |
|
447 <td class='desc'>"; |
|
448 $plugin_meta = array(); |
|
449 if ( !empty($plugin_data['Version']) ) |
|
450 $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
451 if ( !empty($plugin_data['Author']) ) { |
|
452 $author = $plugin_data['Author']; |
|
453 if ( !empty($plugin_data['AuthorURI']) ) |
|
454 $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>'; |
|
455 $plugin_meta[] = sprintf( __('By %s'), $author ); |
|
456 } |
|
457 if ( ! empty($plugin_data['PluginURI']) ) |
|
458 $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>'; |
|
459 |
|
460 $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context); |
|
461 echo implode(' | ', $plugin_meta); |
|
462 echo "</td> |
|
463 </tr>\n"; |
|
464 |
|
465 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context ); |
|
466 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context ); |
|
467 } |
|
468 ?> |
|
469 </tbody> |
|
470 </table> |
|
471 <?php |
|
472 } //End print_plugins_table() |
|
473 |
|
474 /** |
|
475 * @ignore |
|
476 * |
|
477 * @param string $context |
|
478 */ |
|
479 function print_plugin_actions($context, $field_name = 'action' ) { |
|
480 ?> |
|
481 <div class="alignleft actions"> |
|
482 <select name="<?php echo $field_name; ?>"> |
|
483 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> |
|
484 <?php if ( 'active' != $context ) : ?> |
|
485 <option value="activate-selected"><?php _e('Activate'); ?></option> |
|
486 <?php endif; ?> |
|
487 <?php if ( 'inactive' != $context && 'recent' != $context ) : ?> |
|
488 <option value="deactivate-selected"><?php _e('Deactivate'); ?></option> |
|
489 <?php endif; ?> |
|
490 <?php if ( current_user_can('delete_plugins') && ( 'active' != $context ) ) : ?> |
|
491 <option value="delete-selected"><?php _e('Delete'); ?></option> |
|
492 <?php endif; ?> |
|
493 </select> |
|
494 <input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" /> |
|
495 <?php if( 'recent' == $context ) : ?> |
|
496 <input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" /> |
|
497 <?php endif; ?> |
|
498 </div> |
|
499 <?php |
|
500 } |
|
501 ?> |
|
502 |
428 |
503 <form method="get" action=""> |
429 <form method="get" action=""> |
504 <p class="search-box"> |
430 <?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> |
505 <label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label> |
|
506 <input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" /> |
|
507 <input type="submit" value="<?php esc_attr_e( 'Search Plugins' ); ?>" class="button" /> |
|
508 </p> |
|
509 </form> |
431 </form> |
510 |
432 |
511 <form method="post" action="<?php echo admin_url('plugins.php') ?>"> |
433 <form method="post" action=""> |
512 <?php wp_nonce_field('bulk-manage-plugins') ?> |
434 |
513 <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" /> |
435 <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" /> |
514 <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" /> |
436 <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" /> |
515 |
437 |
516 <ul class="subsubsub"> |
438 <?php $wp_list_table->display(); ?> |
|
439 </form> |
|
440 |
|
441 </div> |
|
442 |
517 <?php |
443 <?php |
518 $status_links = array(); |
444 include(ABSPATH . 'wp-admin/admin-footer.php'); |
519 $class = ( 'all' == $status ) ? ' class="current"' : ''; |
|
520 $status_links[] = "<li><a href='plugins.php?plugin_status=all' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_all_plugins, 'plugins' ), number_format_i18n( $total_all_plugins ) ) . '</a>'; |
|
521 if ( ! empty($active_plugins) ) { |
|
522 $class = ( 'active' == $status ) ? ' class="current"' : ''; |
|
523 $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>'; |
|
524 } |
|
525 if ( ! empty($recent_plugins) ) { |
|
526 $class = ( 'recent' == $status ) ? ' class="current"' : ''; |
|
527 $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>'; |
|
528 } |
|
529 if ( ! empty($inactive_plugins) ) { |
|
530 $class = ( 'inactive' == $status ) ? ' class="current"' : ''; |
|
531 $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>'; |
|
532 } |
|
533 if ( ! empty($upgrade_plugins) ) { |
|
534 $class = ( 'upgrade' == $status ) ? ' class="current"' : ''; |
|
535 $status_links[] = "<li><a href='plugins.php?plugin_status=upgrade' $class>" . sprintf( _n( 'Upgrade Available <span class="count">(%s)</span>', 'Upgrade Available <span class="count">(%s)</span>', $total_upgrade_plugins ), number_format_i18n( $total_upgrade_plugins ) ) . '</a>'; |
|
536 } |
|
537 if ( ! empty($search_plugins) ) { |
|
538 $class = ( 'search' == $status ) ? ' class="current"' : ''; |
|
539 $term = isset($_REQUEST['s']) ? urlencode(stripslashes($_REQUEST['s'])) : ''; |
|
540 $status_links[] = "<li><a href='plugins.php?s=$term' $class>" . sprintf( _n( 'Search Results <span class="count">(%s)</span>', 'Search Results <span class="count">(%s)</span>', $total_search_plugins ), number_format_i18n( $total_search_plugins ) ) . '</a>'; |
|
541 } |
|
542 echo implode( " |</li>\n", $status_links ) . '</li>'; |
|
543 unset( $status_links ); |
|
544 ?> |
|
545 </ul> |
|
546 |
|
547 <div class="tablenav"> |
|
548 <?php |
|
549 if ( $page_links ) |
|
550 echo '<div class="tablenav-pages">', $page_links_text, '</div>'; |
|
551 |
|
552 print_plugin_actions($status); |
|
553 ?> |
|
554 </div> |
|
555 <div class="clear"></div> |
|
556 <?php |
|
557 if ( $total_this_page > $plugins_per_page ) |
|
558 $plugins = array_slice($plugins, $start, $plugins_per_page); |
|
559 |
|
560 print_plugins_table($plugins, $status); |
|
561 ?> |
|
562 <div class="tablenav"> |
|
563 <?php |
|
564 if ( $page_links ) |
|
565 echo "<div class='tablenav-pages'>$page_links_text</div>"; |
|
566 |
|
567 print_plugin_actions($status, "action2"); |
|
568 ?> |
|
569 </div> |
|
570 </form> |
|
571 |
|
572 <?php if ( empty($all_plugins) ) : ?> |
|
573 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p> |
|
574 <?php endif; ?> |
|
575 |
|
576 </div> |
|
577 |
|
578 <?php |
|
579 include('admin-footer.php'); |
|
580 ?> |
|