|
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 = (array) $_POST['checked']; |
|
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 error_reporting( E_ALL ^ E_NOTICE ); |
|
97 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
|
98 include(WP_PLUGIN_DIR . '/' . $plugin); |
|
99 do_action('activate_' . $plugin); |
|
100 exit; |
|
101 break; |
|
102 case 'deactivate': |
|
103 if ( ! current_user_can('activate_plugins') ) |
|
104 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
|
105 |
|
106 check_admin_referer('deactivate-plugin_' . $plugin); |
|
107 deactivate_plugins($plugin); |
|
108 update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); |
|
109 wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page"); |
|
110 exit; |
|
111 break; |
|
112 case 'deactivate-selected': |
|
113 if ( ! current_user_can('activate_plugins') ) |
|
114 wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.')); |
|
115 |
|
116 check_admin_referer('bulk-manage-plugins'); |
|
117 |
|
118 $plugins = (array) $_POST['checked']; |
|
119 $plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated. |
|
120 if ( empty($plugins) ) { |
|
121 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
|
122 exit; |
|
123 } |
|
124 |
|
125 deactivate_plugins($plugins); |
|
126 |
|
127 $deactivated = array(); |
|
128 foreach ( $plugins as $plugin ) |
|
129 $deactivated[ $plugin ] = time(); |
|
130 |
|
131 update_option('recently_activated', $deactivated + (array)get_option('recently_activated')); |
|
132 wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page"); |
|
133 exit; |
|
134 break; |
|
135 case 'delete-selected': |
|
136 if ( ! current_user_can('delete_plugins') ) |
|
137 wp_die(__('You do not have sufficient permissions to delete plugins for this blog.')); |
|
138 |
|
139 check_admin_referer('bulk-manage-plugins'); |
|
140 |
|
141 $plugins = (array) $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen. |
|
142 $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins. |
|
143 if ( empty($plugins) ) { |
|
144 wp_redirect("plugins.php?plugin_status=$status&paged=$page"); |
|
145 exit; |
|
146 } |
|
147 |
|
148 include(ABSPATH . 'wp-admin/update.php'); |
|
149 |
|
150 $parent_file = 'plugins.php'; |
|
151 |
|
152 if ( ! isset($_REQUEST['verify-delete']) ) { |
|
153 wp_enqueue_script('jquery'); |
|
154 require_once('admin-header.php'); |
|
155 ?> |
|
156 <div class="wrap"> |
|
157 <h2><?php _e('Delete Plugin(s)'); ?></h2> |
|
158 <?php |
|
159 $files_to_delete = $plugin_info = array(); |
|
160 foreach ( (array) $plugins as $plugin ) { |
|
161 if ( '.' == dirname($plugin) ) { |
|
162 $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; |
|
163 if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) |
|
164 $plugin_info[ $plugin ] = $data; |
|
165 } else { |
|
166 //Locate all the files in that folder: |
|
167 $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) ); |
|
168 if( $files ) { |
|
169 $files_to_delete = array_merge($files_to_delete, $files); |
|
170 } |
|
171 //Get plugins list from that folder |
|
172 if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) |
|
173 $plugin_info = array_merge($plugin_info, $folder_plugins); |
|
174 } |
|
175 } |
|
176 ?> |
|
177 <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p> |
|
178 <ul class="ul-disc"> |
|
179 <?php |
|
180 foreach ( $plugin_info as $plugin ) |
|
181 echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>'; |
|
182 ?> |
|
183 </ul> |
|
184 <p><?php _e('Are you sure you wish to delete these files?') ?></p> |
|
185 <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
|
186 <input type="hidden" name="verify-delete" value="1" /> |
|
187 <input type="hidden" name="action" value="delete-selected" /> |
|
188 <?php |
|
189 foreach ( (array)$plugins as $plugin ) |
|
190 echo '<input type="hidden" name="checked[]" value="' . esc_attr($plugin) . '" />'; |
|
191 ?> |
|
192 <?php wp_nonce_field('bulk-manage-plugins') ?> |
|
193 <input type="submit" name="submit" value="<?php esc_attr_e('Yes, Delete these files') ?>" class="button" /> |
|
194 </form> |
|
195 <form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;"> |
|
196 <input type="submit" name="submit" value="<?php esc_attr_e('No, Return me to the plugin list') ?>" class="button" /> |
|
197 </form> |
|
198 |
|
199 <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> |
|
200 <div id="files-list" style="display:none;"> |
|
201 <ul class="code"> |
|
202 <?php |
|
203 foreach ( (array)$files_to_delete as $file ) |
|
204 echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>'; |
|
205 ?> |
|
206 </ul> |
|
207 </div> |
|
208 </div> |
|
209 <?php |
|
210 require_once('admin-footer.php'); |
|
211 exit; |
|
212 } //Endif verify-delete |
|
213 $delete_result = delete_plugins($plugins); |
|
214 |
|
215 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 |
|
216 wp_redirect("plugins.php?deleted=true&plugin_status=$status&paged=$page"); |
|
217 exit; |
|
218 break; |
|
219 case 'clear-recent-list': |
|
220 update_option('recently_activated', array()); |
|
221 break; |
|
222 } |
|
223 } |
|
224 |
|
225 wp_enqueue_script('plugin-install'); |
|
226 add_thickbox(); |
|
227 |
|
228 $help = '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>'; |
|
229 $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>'; |
|
230 $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>'; |
|
231 |
|
232 add_contextual_help('plugins', $help); |
|
233 |
|
234 $title = __('Manage Plugins'); |
|
235 require_once('admin-header.php'); |
|
236 |
|
237 $invalid = validate_active_plugins(); |
|
238 if ( !empty($invalid) ) |
|
239 foreach ( $invalid as $plugin_file => $error ) |
|
240 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>'; |
|
241 ?> |
|
242 |
|
243 <?php if ( isset($_GET['error']) ) : ?> |
|
244 <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p> |
|
245 <?php |
|
246 if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?> |
|
247 <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> |
|
248 <?php |
|
249 } |
|
250 ?> |
|
251 </div> |
|
252 <?php elseif ( isset($_GET['deleted']) ) : |
|
253 $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
|
254 delete_transient('plugins_delete_result'); //Delete it once we're done. |
|
255 |
|
256 if ( is_wp_error($delete_result) ) : ?> |
|
257 <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> |
|
258 <?php else : ?> |
|
259 <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
|
260 <?php endif; ?> |
|
261 <?php elseif ( isset($_GET['activate']) ) : ?> |
|
262 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
|
263 <?php elseif (isset($_GET['activate-multi'])) : ?> |
|
264 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
|
265 <?php elseif ( isset($_GET['deactivate']) ) : ?> |
|
266 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
|
267 <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
|
268 <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
|
269 <?php endif; ?> |
|
270 |
|
271 <div class="wrap"> |
|
272 <?php screen_icon(); ?> |
|
273 <h2><?php echo esc_html( $title ); ?></h2> |
|
274 |
|
275 <?php |
|
276 |
|
277 $all_plugins = get_plugins(); |
|
278 $search_plugins = array(); |
|
279 $active_plugins = array(); |
|
280 $inactive_plugins = array(); |
|
281 $recent_plugins = array(); |
|
282 $recently_activated = get_option('recently_activated', array()); |
|
283 $upgrade_plugins = array(); |
|
284 |
|
285 set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 ); |
|
286 |
|
287 // Clean out any plugins which were deactivated over a week ago. |
|
288 foreach ( $recently_activated as $key => $time ) |
|
289 if ( $time + (7*24*60*60) < time() ) //1 week |
|
290 unset($recently_activated[ $key ]); |
|
291 if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it. |
|
292 update_option('recently_activated', $recently_activated); |
|
293 $current = get_transient( 'update_plugins' ); |
|
294 |
|
295 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { |
|
296 |
|
297 //Translate, Apply Markup, Sanitize HTML |
|
298 $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
299 $all_plugins[ $plugin_file ] = $plugin_data; |
|
300 |
|
301 //Filter into individual sections |
|
302 if ( is_plugin_active($plugin_file) ) { |
|
303 $active_plugins[ $plugin_file ] = $plugin_data; |
|
304 } else { |
|
305 if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated? |
|
306 $recent_plugins[ $plugin_file ] = $plugin_data; |
|
307 $inactive_plugins[ $plugin_file ] = $plugin_data; |
|
308 } |
|
309 |
|
310 if ( isset( $current->response[ $plugin_file ] ) ) |
|
311 $upgrade_plugins[ $plugin_file ] = $plugin_data; |
|
312 } |
|
313 |
|
314 $total_all_plugins = count($all_plugins); |
|
315 $total_inactive_plugins = count($inactive_plugins); |
|
316 $total_active_plugins = count($active_plugins); |
|
317 $total_recent_plugins = count($recent_plugins); |
|
318 $total_upgrade_plugins = count($upgrade_plugins); |
|
319 |
|
320 //Searching. |
|
321 if ( isset($_GET['s']) ) { |
|
322 function _search_plugins_filter_callback($plugin) { |
|
323 static $term; |
|
324 if ( is_null($term) ) |
|
325 $term = stripslashes($_GET['s']); |
|
326 if ( stripos($plugin['Name'], $term) !== false || |
|
327 stripos($plugin['Description'], $term) !== false || |
|
328 stripos($plugin['Author'], $term) !== false || |
|
329 stripos($plugin['PluginURI'], $term) !== false || |
|
330 stripos($plugin['AuthorURI'], $term) !== false || |
|
331 stripos($plugin['Version'], $term) !== false ) |
|
332 return true; |
|
333 else |
|
334 return false; |
|
335 } |
|
336 $status = 'search'; |
|
337 $search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback'); |
|
338 $total_search_plugins = count($search_plugins); |
|
339 } |
|
340 |
|
341 $plugin_array_name = "${status}_plugins"; |
|
342 if ( empty($$plugin_array_name) && $status != 'all' ) { |
|
343 $status = 'all'; |
|
344 $plugin_array_name = "${status}_plugins"; |
|
345 } |
|
346 |
|
347 $plugins = &$$plugin_array_name; |
|
348 |
|
349 //Paging. |
|
350 $total_this_page = "total_{$status}_plugins"; |
|
351 $total_this_page = $$total_this_page; |
|
352 $plugins_per_page = get_user_option('plugins_per_page'); |
|
353 if ( empty($plugins_per_page) ) |
|
354 $plugins_per_page = 999; |
|
355 $plugins_per_page = apply_filters('plugins_per_page', $plugins_per_page); |
|
356 |
|
357 $start = ($page - 1) * $plugins_per_page; |
|
358 |
|
359 $page_links = paginate_links( array( |
|
360 'base' => add_query_arg( 'paged', '%#%' ), |
|
361 'format' => '', |
|
362 'prev_text' => __('«'), |
|
363 'next_text' => __('»'), |
|
364 'total' => ceil($total_this_page / $plugins_per_page), |
|
365 'current' => $page |
|
366 )); |
|
367 $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', |
|
368 number_format_i18n( $start + 1 ), |
|
369 number_format_i18n( min( $page * $plugins_per_page, $total_this_page ) ), |
|
370 '<span class="total-type-count">' . number_format_i18n( $total_this_page ) . '</span>', |
|
371 $page_links |
|
372 ); |
|
373 |
|
374 /** |
|
375 * @ignore |
|
376 * |
|
377 * @param array $plugins |
|
378 * @param string $context |
|
379 */ |
|
380 function print_plugins_table($plugins, $context = '') { |
|
381 global $page; |
|
382 ?> |
|
383 <table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table"> |
|
384 <thead> |
|
385 <tr> |
|
386 <th scope="col" class="manage-column check-column"><input type="checkbox" /></th> |
|
387 <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th> |
|
388 <th scope="col" class="manage-column"><?php _e('Description'); ?></th> |
|
389 </tr> |
|
390 </thead> |
|
391 |
|
392 <tfoot> |
|
393 <tr> |
|
394 <th scope="col" class="manage-column check-column"><input type="checkbox" /></th> |
|
395 <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th> |
|
396 <th scope="col" class="manage-column"><?php _e('Description'); ?></th> |
|
397 </tr> |
|
398 </tfoot> |
|
399 |
|
400 <tbody class="plugins"> |
|
401 <?php |
|
402 |
|
403 if ( empty($plugins) ) { |
|
404 echo '<tr> |
|
405 <td colspan="3">' . __('No plugins to show') . '</td> |
|
406 </tr>'; |
|
407 } |
|
408 foreach ( (array)$plugins as $plugin_file => $plugin_data) { |
|
409 $actions = array(); |
|
410 $is_active = is_plugin_active($plugin_file); |
|
411 |
|
412 if ( $is_active ) |
|
413 $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>'; |
|
414 else |
|
415 $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>'; |
|
416 |
|
417 if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) |
|
418 $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; |
|
419 |
|
420 if ( ! $is_active && current_user_can('delete_plugins') ) |
|
421 $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>'; |
|
422 |
|
423 $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
424 $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); |
|
425 $action_count = count($actions); |
|
426 $class = $is_active ? 'active' : 'inactive'; |
|
427 echo " |
|
428 <tr class='$class'> |
|
429 <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> |
|
430 <td class='plugin-title'><strong>{$plugin_data['Name']}</strong></td> |
|
431 <td class='desc'><p>{$plugin_data['Description']}</p></td> |
|
432 </tr> |
|
433 <tr class='$class second'> |
|
434 <td></td> |
|
435 <td class='plugin-title'>"; |
|
436 echo '<div class="row-actions-visible">'; |
|
437 foreach ( $actions as $action => $link ) { |
|
438 $sep = end($actions) == $link ? '' : ' | '; |
|
439 echo "<span class='$action'>$link$sep</span>"; |
|
440 } |
|
441 echo "</div></td> |
|
442 <td class='desc'>"; |
|
443 $plugin_meta = array(); |
|
444 if ( !empty($plugin_data['Version']) ) |
|
445 $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
446 if ( !empty($plugin_data['Author']) ) { |
|
447 $author = $plugin_data['Author']; |
|
448 if ( !empty($plugin_data['AuthorURI']) ) |
|
449 $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>'; |
|
450 $plugin_meta[] = sprintf( __('By %s'), $author ); |
|
451 } |
|
452 if ( ! empty($plugin_data['PluginURI']) ) |
|
453 $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>'; |
|
454 |
|
455 $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context); |
|
456 echo implode(' | ', $plugin_meta); |
|
457 echo "</td> |
|
458 </tr>\n"; |
|
459 |
|
460 do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context ); |
|
461 do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context ); |
|
462 } |
|
463 ?> |
|
464 </tbody> |
|
465 </table> |
|
466 <?php |
|
467 } //End print_plugins_table() |
|
468 |
|
469 /** |
|
470 * @ignore |
|
471 * |
|
472 * @param string $context |
|
473 */ |
|
474 function print_plugin_actions($context, $field_name = 'action' ) { |
|
475 ?> |
|
476 <div class="alignleft actions"> |
|
477 <select name="<?php echo $field_name; ?>"> |
|
478 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> |
|
479 <?php if ( 'active' != $context ) : ?> |
|
480 <option value="activate-selected"><?php _e('Activate'); ?></option> |
|
481 <?php endif; ?> |
|
482 <?php if ( 'inactive' != $context && 'recent' != $context ) : ?> |
|
483 <option value="deactivate-selected"><?php _e('Deactivate'); ?></option> |
|
484 <?php endif; ?> |
|
485 <?php if ( current_user_can('delete_plugins') && ( 'active' != $context ) ) : ?> |
|
486 <option value="delete-selected"><?php _e('Delete'); ?></option> |
|
487 <?php endif; ?> |
|
488 </select> |
|
489 <input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" /> |
|
490 <?php if( 'recent' == $context ) : ?> |
|
491 <input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" /> |
|
492 <?php endif; ?> |
|
493 </div> |
|
494 <?php |
|
495 } |
|
496 ?> |
|
497 |
|
498 <form method="get" action=""> |
|
499 <p class="search-box"> |
|
500 <label class="screen-reader-text" for="plugin-search-input"><?php _e( 'Search Plugins' ); ?>:</label> |
|
501 <input type="text" id="plugin-search-input" name="s" value="<?php _admin_search_query(); ?>" /> |
|
502 <input type="submit" value="<?php esc_attr_e( 'Search Plugins' ); ?>" class="button" /> |
|
503 </p> |
|
504 </form> |
|
505 |
|
506 <form method="post" action="<?php echo admin_url('plugins.php') ?>"> |
|
507 <?php wp_nonce_field('bulk-manage-plugins') ?> |
|
508 <input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" /> |
|
509 <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" /> |
|
510 |
|
511 <ul class="subsubsub"> |
|
512 <?php |
|
513 $status_links = array(); |
|
514 $class = ( 'all' == $status ) ? ' class="current"' : ''; |
|
515 $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>'; |
|
516 if ( ! empty($active_plugins) ) { |
|
517 $class = ( 'active' == $status ) ? ' class="current"' : ''; |
|
518 $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>'; |
|
519 } |
|
520 if ( ! empty($recent_plugins) ) { |
|
521 $class = ( 'recent' == $status ) ? ' class="current"' : ''; |
|
522 $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>'; |
|
523 } |
|
524 if ( ! empty($inactive_plugins) ) { |
|
525 $class = ( 'inactive' == $status ) ? ' class="current"' : ''; |
|
526 $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>'; |
|
527 } |
|
528 if ( ! empty($upgrade_plugins) ) { |
|
529 $class = ( 'upgrade' == $status ) ? ' class="current"' : ''; |
|
530 $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>'; |
|
531 } |
|
532 if ( ! empty($search_plugins) ) { |
|
533 $class = ( 'search' == $status ) ? ' class="current"' : ''; |
|
534 $term = isset($_REQUEST['s']) ? urlencode(stripslashes($_REQUEST['s'])) : ''; |
|
535 $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>'; |
|
536 } |
|
537 echo implode( " |</li>\n", $status_links ) . '</li>'; |
|
538 unset( $status_links ); |
|
539 ?> |
|
540 </ul> |
|
541 |
|
542 <div class="tablenav"> |
|
543 <?php |
|
544 if ( $page_links ) |
|
545 echo '<div class="tablenav-pages">', $page_links_text, '</div>'; |
|
546 |
|
547 print_plugin_actions($status); |
|
548 ?> |
|
549 </div> |
|
550 <div class="clear"></div> |
|
551 <?php |
|
552 if ( $total_this_page > $plugins_per_page ) |
|
553 $plugins = array_slice($plugins, $start, $plugins_per_page); |
|
554 |
|
555 print_plugins_table($plugins, $status); |
|
556 ?> |
|
557 <div class="tablenav"> |
|
558 <?php |
|
559 if ( $page_links ) |
|
560 echo "<div class='tablenav-pages'>$page_links_text</div>"; |
|
561 |
|
562 print_plugin_actions($status, "action2"); |
|
563 ?> |
|
564 </div> |
|
565 </form> |
|
566 |
|
567 <?php if ( empty($all_plugins) ) : ?> |
|
568 <p><?php _e('You do not appear to have any plugins available at this time.') ?></p> |
|
569 <?php endif; ?> |
|
570 |
|
571 </div> |
|
572 |
|
573 <?php |
|
574 include('admin-footer.php'); |
|
575 ?> |