Changeset 20525 for trunk/wp-admin/includes/class-wp-plugins-list-table.php
- Timestamp:
- 04/19/2012 03:41:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-plugins-list-table.php
r20236 r20525 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 … … 79 79 set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 ); 80 80 81 $recently_activated = get_option( 'recently_activated', array() ); 82 83 $one_week = 7*24*60*60; 84 foreach ( $recently_activated as $key => $time ) 85 if ( $time + $one_week < time() ) 86 unset( $recently_activated[$key] ); 87 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 } 88 90 89 91 foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { 90 92 // Filter into individual sections 91 if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !$screen->is_network ) { 92 unset( $plugins['all'][ $plugin_file] ); 93 } elseif ( is_plugin_active_for_network($plugin_file) && !$screen->is_network ) { 93 if ( ! $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) { 94 94 unset( $plugins['all'][ $plugin_file ] ); 95 } elseif ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) { 96 $plugins['network'][ $plugin_file ] = $plugin_data; 97 } elseif ( ( !$screen->is_network && is_plugin_active( $plugin_file ) ) 95 } elseif ( ( ! $screen->is_network && is_plugin_active( $plugin_file ) ) 98 96 || ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) { 99 97 $plugins['active'][ $plugin_file ] = $plugin_data; … … 216 214 $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); 217 215 break; 218 case 'network':219 $text = _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $count );220 break;221 216 case 'mustuse': 222 217 $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count ); … … 249 244 $screen = get_current_screen(); 250 245 251 if ( 'active' != $status ) { 252 $action = $screen->is_network ? 'network-activate-selected' : 'activate-selected'; 253 $actions[ $action ] = $screen->is_network ? __( 'Network Activate' ) : __( 'Activate' ); 254 } 246 if ( 'active' != $status ) 247 $actions['activate-selected'] = $screen->is_network ? __( 'Network Activate' ) : __( 'Activate' ); 255 248 256 249 if ( 'inactive' != $status && 'recent' != $status ) … … 284 277 echo '<div class="alignleft actions">'; 285 278 286 if ( 'recently_activated' == $status ) 279 $screen = get_current_screen(); 280 281 if ( ! $screen->is_network && 'recently_activated' == $status ) 287 282 submit_button( __( 'Clear List' ), 'secondary', 'clear-recent-list', false ); 288 283 elseif ( 'top' == $which && 'mustuse' == $status ) … … 322 317 // preorder 323 318 $actions = array( 324 'network_deactivate' => '', 'deactivate' => '', 325 'network_only' => '', 'activate' => '', 326 'network_activate' => '', 319 'deactivate' => '', 320 'activate' => '', 327 321 'edit' => '', 328 322 'delete' => '', … … 349 343 $description .= '<p>' . $plugin_data['Description'] . '</p>'; 350 344 } else { 351 $is_active_for_network = is_plugin_active_for_network($plugin_file);352 345 if ( $screen->is_network ) 353 $is_active = $is_active_for_network;346 $is_active = is_plugin_active_for_network( $plugin_file ); 354 347 else 355 348 $is_active = is_plugin_active( $plugin_file ); 356 349 357 if ( $is_active_for_network && !is_super_admin() && !$screen->is_network )358 return;359 360 350 if ( $screen->is_network ) { 361 if ( $is_active _for_network) {351 if ( $is_active ) { 362 352 if ( current_user_can( 'manage_network_plugins' ) ) 363 $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>'; 364 354 } else { 365 355 if ( current_user_can( 'manage_network_plugins' ) ) 366 $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>'; 367 357 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) 368 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>';
Note: See TracChangeset
for help on using the changeset viewer.