|
1 <?php |
|
2 /** |
|
3 * Plugins administration panel. |
|
4 * |
|
5 * @package WordPress |
|
6 * @subpackage Administration |
|
7 */ |
|
8 |
|
9 /** WordPress Administration Bootstrap */ |
|
10 require_once('admin.php'); |
|
11 |
|
12 if ( ! current_user_can('activate_plugins') ) |
|
13 wp_die(__('You do not have sufficient permissions to manage plugins for this blog.')); |
|
14 |
|
15 if ( isset($_POST['clear-recent-list']) ) |
|
16 $action = 'clear-recent-list'; |
|
17 elseif ( !empty($_REQUEST['action']) ) |
|
18 $action = $_REQUEST['action']; |
|
19 elseif ( !empty($_REQUEST['action2']) ) |
|
20 $action = $_REQUEST['action2']; |
|
21 else |
|
22 $action = false; |
|
23 |
|
24 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; |
|
25 |
|
26 $default_status = get_user_option('plugins_last_view'); |
|
27 if ( empty($default_status) ) |
|
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']); |
|
39 |
|
40 if ( !empty($action) ) { |
|
41 switch ( $action ) { |
|
42 case 'activate': |
|
43 if ( ! current_user_can('activate_plugins') ) |
|
44 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
|
45 |
|
46 check_admin_referer('activate-plugin_' . $plugin); |
|
47 |
|
48 $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin); |
|
49 if ( is_wp_error( $result ) ) |
|
50 wp_die($result); |
|
51 |
|
52 $recent = (array)get_option('recently_activated'); |
|
53 if ( isset($recent[ $plugin ]) ) { |
|
54 unset($recent[ $plugin ]); |
|
55 update_option('recently_activated', $recent); |
|
56 } |
|
57 |
|
58 wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above |
|
59 exit; |
|
60 break; |
|
61 case 'activate-selected': |
|
62 if ( ! current_user_can('activate_plugins') ) |
|
63 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
|
64 |
|
65 check_admin_referer('bulk-manage-plugins'); |
|
66 |
|
67 $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. |
|
69 if ( empty($plugins) ) { |
|
70 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
|
71 exit; |
|
72 } |
|
73 |
|
74 activate_plugins($plugins, 'plugins.php?error=true'); |
|
75 |
|
76 $recent = (array)get_option('recently_activated'); |
|
77 foreach ( $plugins as $plugin => $time) |
|
78 if ( isset($recent[ $plugin ]) ) |
|
79 unset($recent[ $plugin ]); |
|
80 |
|
81 update_option('recently_activated', $recent); |
|
82 |
|
83 wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page"); |
|
84 exit; |
|
85 break; |
|
86 case 'error_scrape': |
|
87 if ( ! current_user_can('activate_plugins') ) |
|
88 wp_die(__('You do not have sufficient permissions to activate plugins for this blog.')); |
|
89 |
|
90 check_admin_referer('plugin-activation-error_' . $plugin); |
|
91 |
|
92 $valid = validate_plugin($plugin); |
|
93 if ( is_wp_error($valid) ) |
|
94 wp_die($valid); |
|
95 |
|
96 if ( defined('E_RECOVERABLE_ERROR') ) |
|
97 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|
98 else |
|
99 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); |
|
100 |
|
101 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
|
102 include(WP_PLUGIN_DIR . '/' . $plugin); |
|
103 do_action('activate_' . $plugin); |
|
104 exit; |
|
105 break; |
|
106 case 'deactivate': |
|
107 if ( ! current_user_can('activate_plugins') ) |
|
108 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
|
109 |
|
110 check_admin_referer('deactivate-plugin_' . $plugin); |
|
111 deactivate_plugins($plugin); |
|
112 update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); |
|
113 wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page"); |
|
114 exit; |
|
115 break; |
|
116 case 'deactivate-selected': |
|
117 if ( ! current_user_can('activate_plugins') ) |
|
118 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
|
119 |
|
120 check_admin_referer('bulk-manage-plugins'); |
|
121 |
|
122 $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
123 $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated. |
|
124 if ( empty($plugins) ) { |
|
125 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
|
126 exit; |
|
127 } |
|
128 |
|
129 deactivate_plugins($plugins); |
|
130 |
|
131 $deactivated = array(); |
|
132 foreach ( $plugins as $plugin ) |
|
133 $deactivated[ $plugin ] = time(); |
|
134 |
|
135 update_option('recently_activated', $deactivated + (array)get_option('recently_activated')); |
|
136 wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page"); |
|
137 exit; |
|
138 break; |
|
139 case 'delete-selected': |
|
140 if ( ! current_user_can('delete_plugins') ) |
|
141 wp_die(__('You do not have sufficient permissions to delete plugins for this blog.')); |
|
142 |
|
143 check_admin_referer('bulk-manage-plugins'); |
|
144 |
|
145 //$_POST = from the plugin form; $_GET = from the FTP details screen. |
|
146 $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. |
|
148 if ( empty($plugins) ) { |
|
149 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
|
150 exit; |
|
151 } |
|
152 |
|
153 include(ABSPATH . 'wp-admin/update.php'); |
|
154 |
|
155 $parent_file = 'plugins.php'; |
|
156 |
|
157 if ( ! isset($_REQUEST['verify-delete']) ) { |
|
158 wp_enqueue_script('jquery'); |
|
159 require_once('admin-header.php'); |
|
160 ?> |
|
161 <div class="wrap"> |
|
162 <h2><?php _e('Delete Plugin(s)'); ?></h2> |
|
163 <?php |
|
164 $files_to_delete = $plugin_info = array(); |
|
165 foreach ( (array) $plugins as $plugin ) { |
|
166 if ( '.' == dirname($plugin) ) { |
|
167 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; |
|
168 if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) |
|
169 $plugin_info[ $plugin ] = $data; |
|
170 } else { |
|
171 //Locate all the files in that folder: |
|
172 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) ); |
|
173 if( $files ) { |
|
174 $files_to_delete = array_merge($files_to_delete, $files); |
|
175 } |
|
176 //Get plugins list from that folder |
|
177 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) |
|
178 $plugin_info = array_merge($plugin_info, $folder_plugins); |
|
179 } |
|
180 } |
|
181 ?> |
|
182 <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p> |
|
183 <ul class="ul-disc"> |
|
184 <?php |
|
185 foreach ( $plugin_info as $plugin ) |
|
186 echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>'; |
|
187 ?> |
|
188 </ul> |
|
189 <p><?php _e('Are you sure you wish to delete these files?') ?></p> |
|
190 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
|
191 <input type="hidden" name="verify-delete" value="1" /> |
|
192 <input type="hidden" name="action" value="delete-selected" /> |
|
193 <?php |
|
194 foreach ( (array)$plugins as $plugin ) |
|
195 echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />'; |
|
196 ?> |
|
197 <?php wp_nonce_field('bulk-manage-plugins') ?> |
|
198 <input type="submit" name="submit" value="<?php esc_attr_e('Yes, Delete these files') ?>" class="button" /> |
|
199 </form> |
|
200 <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" /> |
|
202 </form> |
|
203 |
|
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> |
|
205 <div id="files-list" style="display:none;"> |
|
206 <ul class="code"> |
|
207 <?php |
|
208 foreach ( (array)$files_to_delete as $file ) |
|
209 echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>'; |
|
210 ?> |
|
211 </ul> |
|
212 </div> |
|
213 </div> |
|
214 <?php |
|
215 require_once('admin-footer.php'); |
|
216 exit; |
|
217 } //Endif verify-delete |
|
218 $delete_result = delete_plugins($plugins); |
|
219 |
|
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 |
|
221 wp_redirect("plugins.php?deleted=true&plugin_status=$status&paged=$page"); |
|
222 exit; |
|
223 break; |
|
224 case 'clear-recent-list': |
|
225 update_option('recently_activated', array()); |
|
226 break; |
|
227 } |
|
228 } |
|
229 |
|
230 wp_enqueue_script('plugin-install'); |
|
231 add_thickbox(); |
|
232 |
|
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>'; |
|
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>'; |
|
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>'; |
|
236 |
|
237 add_contextual_help('plugins', $help); |
|
238 |
|
239 $title = __('Manage Plugins'); |
|
240 require_once('admin-header.php'); |
|
241 |
|
242 $invalid = validate_active_plugins(); |
|
243 if ( !empty($invalid) ) |
|
244 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>'; |
|
246 ?> |
|
247 |
|
248 <?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> |
|
250 <?php |
|
251 if ( 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> |
|
253 <?php |
|
254 } |
|
255 ?> |
|
256 </div> |
|
257 <?php elseif ( isset($_GET['deleted']) ) : |
|
258 $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
|
259 delete_transient('plugins_delete_result'); //Delete it once we're done. |
|
260 |
|
261 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> |
|
263 <?php else : ?> |
|
264 <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
|
265 <?php endif; ?> |
|
266 <?php elseif ( isset($_GET['activate']) ) : ?> |
|
267 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
|
268 <?php elseif (isset($_GET['activate-multi'])) : ?> |
|
269 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
|
270 <?php elseif ( isset($_GET['deactivate']) ) : ?> |
|
271 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
|
272 <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
|
273 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
|
274 <?php endif; ?> |
|
275 |
|
276 <div class="wrap"> |
|
277 <?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> |
|
279 |
|
280 <?php |
|
281 |
|
282 $all_plugins = get_plugins(); |
|
283 $search_plugins = array(); |
|
284 $active_plugins = array(); |
|
285 $inactive_plugins = array(); |
|
286 $recent_plugins = array(); |
|
287 $recently_activated = get_option('recently_activated', array()); |
|
288 $upgrade_plugins = array(); |
|
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 |
|
503 <form method="get" action=""> |
|
504 <p class="search-box"> |
|
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> |
|
510 |
|
511 <form method="post" action="<?php echo admin_url('plugins.php') ?>"> |
|
512 <?php wp_nonce_field('bulk-manage-plugins') ?> |
|
513 <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" /> |
|
514 <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" /> |
|
515 |
|
516 <ul class="subsubsub"> |
|
517 <?php |
|
518 $status_links = array(); |
|
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 ?> |