- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-plugins-list-table.php
r18811 r20853 14 14 15 15 $status = 'all'; 16 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', ' network', 'mustuse', 'dropins', 'search' ) ) )16 if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) 17 17 $status = $_REQUEST['plugin_status']; 18 18 … … 66 66 $plugins['dropins'] = get_dropins(); 67 67 68 $current = get_site_transient( 'update_plugins' ); 69 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 70 if ( isset( $current->response[ $plugin_file ] ) ) 71 $plugins['upgrade'][ $plugin_file ] = $plugin_data; 68 if ( current_user_can( 'update_plugins' ) ) { 69 $current = get_site_transient( 'update_plugins' ); 70 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 71 if ( isset( $current->response[ $plugin_file ] ) ) { 72 $plugins['all'][ $plugin_file ]['update'] = true; 73 $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; 74 } 75 } 72 76 } 73 77 } … … 75 79 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 ); 76 80 77 $recently_activated = get_option( 'recently_activated', array() ); 78 79 $one_week = 7*24*60*60; 80 foreach ( $recently_activated as $key => $time ) 81 if ( $time + $one_week < time() ) 82 unset( $recently_activated[$key] ); 83 update_option( 'recently_activated', $recently_activated ); 81 if ( ! $screen->is_network ) { 82 $recently_activated = get_option( 'recently_activated', array() ); 83 84 $one_week = 7*24*60*60; 85 foreach ( $recently_activated as $key => $time ) 86 if ( $time + $one_week < time() ) 87 unset( $recently_activated[$key] ); 88 update_option( 'recently_activated', $recently_activated ); 89 } 84 90 85 91 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 86 92 // Filter into individual sections 87 if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !$screen->is_network ) { 88 unset( $plugins['all'][ $plugin_file] ); 89 } elseif ( is_plugin_active_for_network($plugin_file) && !$screen->is_network ) { 93 if ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) { 90 94 unset( $plugins['all'][ $plugin_file ] ); 91 } elseif ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) { 92 $plugins['network'][ $plugin_file ] = $plugin_data; 93 } elseif ( ( !$screen->is_network && is_plugin_active( $plugin_file ) ) 95 } elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) ) 94 96 || ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) { 95 97 $plugins['active'][ $plugin_file ] = $plugin_data; … … 101 103 } 102 104 103 if ( !current_user_can( 'update_plugins' ) )104 $plugins['upgrade'] = array();105 106 105 if ( $s ) { 107 106 $status = 'search'; … … 214 213 case 'inactive': 215 214 $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); 216 break;217 case 'network':218 $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );219 215 break; 220 216 case 'mustuse': … … 248 244 $screen = get_current_screen(); 249 245 250 if ( 'active' != $status ) { 251 $action = $screen->is_network ? 'network-activate-selected' : 'activate-selected'; 252 $actions[ $action ] = __( 'Activate' ); 253 } 246 if ( 'active' != $status ) 247 $actions['activate-selected'] = $screen->is_network ? __( 'Network Activate' ) : __( 'Activate' ); 254 248 255 249 if ( 'inactive' != $status && 'recent' != $status ) 256 $actions['deactivate-selected'] = __( 'Deactivate' );250 $actions['deactivate-selected'] = $screen->is_network ? __( 'Network Deactivate' ) : __( 'Deactivate' ); 257 251 258 252 if ( !is_multisite() || $screen->is_network ) { … … 283 277 echo '<div class="alignleft actions">'; 284 278 285 if ( 'recently_activated' == $status ) 279 $screen = get_current_screen(); 280 281 if ( ! $screen->is_network && 'recently_activated' == $status ) 286 282 submit_button( __( 'Clear List' ), 'secondary', 'clear-recent-list', false ); 287 283 elseif ( 'top' == $which && 'mustuse' == $status ) … … 313 309 314 310 function single_row( $plugin_file, $plugin_data ) { 315 global $status, $page, $s ;311 global $status, $page, $s, $totals; 316 312 317 313 $context = $status; … … 321 317 // preorder 322 318 $actions = array( 323 'network_deactivate' => '', 'deactivate' => '', 324 'network_only' => '', 'activate' => '', 325 'network_activate' => '', 319 'deactivate' => '', 320 'activate' => '', 326 321 'edit' => '', 327 322 'delete' => '', … … 348 343 $description .= '<p>' . $plugin_data['Description'] . '</p>'; 349 344 } else { 350 $is_active_for_network = is_plugin_active_for_network($plugin_file);351 345 if ( $screen->is_network ) 352 $is_active = $is_active_for_network;346 $is_active = is_plugin_active_for_network( $plugin_file ); 353 347 else 354 348 $is_active = is_plugin_active( $plugin_file ); 355 349 356 if ( $is_active_for_network && !is_super_admin() && !$screen->is_network )357 return;358 359 350 if ( $screen->is_network ) { 360 if ( $is_active _for_network) {351 if ( $is_active ) { 361 352 if ( current_user_can( 'manage_network_plugins' ) ) 362 $actions[' network_deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';353 $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>'; 363 354 } else { 364 355 if ( current_user_can( 'manage_network_plugins' ) ) 365 $actions[' network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';356 $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>'; 366 357 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) 367 358 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; … … 395 386 396 387 $id = sanitize_title( $plugin_name ); 388 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) 389 $class .= ' update'; 397 390 398 391 echo "<tr id='$id' class='$class'>"; … … 449 442 } 450 443 } 451 452 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)