Changeset 12903 for trunk/wp-admin/plugins.php
- Timestamp:
- 01/29/2010 09:45:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/plugins.php
r12848 r12903 28 28 $default_status = 'all'; 29 29 $status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : $default_status; 30 if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', ' search')) )30 if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'network', 'search')) ) 31 31 $status = 'all'; 32 32 if ( $status != $default_status && 'search' != $status ) … … 39 39 40 40 if ( !empty($action) ) { 41 $network_wide = false; 42 if ( isset($_GET['networkwide']) && is_multisite() && is_super_admin() ) 43 $network_wide = true; 44 41 45 switch ( $action ) { 42 46 case 'activate': … … 46 50 check_admin_referer('activate-plugin_' . $plugin); 47 51 48 $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin );52 $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin, $network_wide); 49 53 if ( is_wp_error( $result ) ) 50 54 wp_die($result); … … 72 76 } 73 77 74 activate_plugins($plugins, 'plugins.php?error=true' );78 activate_plugins($plugins, 'plugins.php?error=true', $network_wide); 75 79 76 80 $recent = (array)get_option('recently_activated'); … … 341 345 $recently_activated = get_option('recently_activated', array()); 342 346 $upgrade_plugins = array(); 347 $network_plugins = array(); 343 348 344 349 set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 ); … … 354 359 foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { 355 360 356 // Translate, Apply Markup, Sanitize HTML361 // Translate, Apply Markup, Sanitize HTML 357 362 $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); 358 363 $all_plugins[ $plugin_file ] = $plugin_data; 359 364 360 //Filter into individual sections 361 if ( is_plugin_active($plugin_file) ) { 365 // Filter into individual sections 366 if ( is_plugin_active_for_network($plugin_file) && is_super_admin() ) { 367 $network_plugins[ $plugin_file ] = $plugin_data; 368 } elseif ( is_plugin_active($plugin_file) ) { 362 369 $active_plugins[ $plugin_file ] = $plugin_data; 363 370 } else { … … 379 386 $total_recent_plugins = count($recent_plugins); 380 387 $total_upgrade_plugins = count($upgrade_plugins); 388 $total_network_plugins = count($network_plugins); 381 389 382 390 //Searching. … … 409 417 $plugins = &$$plugin_array_name; 410 418 411 // Paging.419 // Paging. 412 420 $total_this_page = "total_{$status}_plugins"; 413 421 $total_this_page = $$total_this_page; … … 471 479 $actions = array(); 472 480 $is_active = is_plugin_active($plugin_file); 473 474 if ( $is_active ) 475 $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>'; 476 else 481 $is_active_for_network = is_plugin_active_for_network($plugin_file); 482 483 if ( $is_active_for_network && !is_super_admin() ) 484 continue; 485 486 if ( $is_active ) { 487 if ( $is_active_for_network ) { 488 if ( is_super_admin() ) 489 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>'; 490 } else { 491 $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>'; 492 } 493 } else { 477 494 $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>'; 478 479 if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) 495 if ( is_multisite() && is_super_admin() ) 496 $actions[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>'; 497 } 498 499 if ( !is_multisite() && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) 480 500 $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; 481 501 … … 593 613 $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>'; 594 614 } 615 if ( ! empty($network_plugins) ) { 616 $class = ( 'network' == $status ) ? ' class="current"' : ''; 617 $status_links[] = "<li><a href='plugins.php?plugin_status=network' $class>" . sprintf( _n( 'Network <span class="count">(%s)</span>', 'Network <span class="count">(%s)</span>', $total_network_plugins ), number_format_i18n( $total_network_plugins ) ) . '</a>'; 618 } 595 619 if ( ! empty($upgrade_plugins) ) { 596 620 $class = ( 'upgrade' == $status ) ? ' class="current"' : '';
Note: See TracChangeset
for help on using the changeset viewer.