Make WordPress Core

Changeset 16194


Ignore:
Timestamp:
11/04/2010 08:49:30 PM (16 years ago)
Author:
scribu
Message:

Fix screen options for the network admin themes and plugins. Props ocean90. Fixes #15269. Also fixes [16190]

Location:
trunk/wp-admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-ms-themes-list-table.php

    r16182 r16194  
    9696                }
    9797
    98                 $themes_per_page = $this->get_items_per_page( 'themes_per_page', 999 );
     98                $themes_per_page = $this->get_items_per_page( 'themes_network_per_page' );
    9999
    100100                $start = ( $page - 1 ) * $themes_per_page;
  • trunk/wp-admin/includes/class-wp-plugins-list-table.php

    r16190 r16194  
    2020                if ( $status != $default_status && 'search' != $status )
    2121                        update_user_meta( get_current_user_id(), 'plugins_last_view', $status );
     22
     23                $page = $this->get_pagenum();
    2224
    2325                parent::WP_List_Table( array(
    … …  
    5658                );
    5759
    58                 if ( ! is_multisite() || ( is_network_admin() && current_user_can('manage_network_plugins') ) ) {
     60                if ( ! is_multisite() || ( $this->_screen->is_network && current_user_can('manage_network_plugins') ) ) {
    5961                        if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
    6062                                $plugins['mustuse'] = get_mu_plugins();
    … …  
    8486                foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
    8587                        // Filter into individual sections
    86                         if ( is_plugin_active_for_network($plugin_file) && !is_network_admin() ) {
     88                        if ( is_plugin_active_for_network($plugin_file) && !$this->_screen->is_network ) {
    8789                                unset( $plugins['all'][ $plugin_file ] );
    8890                                continue;
    8991                        } elseif ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
    9092                                $plugins['network'][ $plugin_file ] = $plugin_data;
    91                         } elseif ( ( !is_network_admin() && is_plugin_active( $plugin_file ) )
    92                                 || ( is_network_admin() && is_plugin_active_for_network( $plugin_file ) ) ) {
     93                        } elseif ( ( !$this->_screen->is_network && is_plugin_active( $plugin_file ) )
     94                                || ( $this->_screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) {
    9395                                $plugins['active'][ $plugin_file ] = $plugin_data;
    9496                        } else {
    95                                 if ( !is_network_admin() && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
     97                                if ( !$this->_screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
    9698                                        $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
    9799                                $plugins['inactive'][ $plugin_file ] = $plugin_data;
    … …  
    127129                }
    128130
    129                 $plugins_per_page = $this->get_items_per_page( 'plugins_per_page', 999 );
     131                $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', "{$this->_screen->id}_per_page" ) );
    130132
    131133                $start = ( $page - 1 ) * $plugins_per_page;
    … …  
    253255
    254256                if ( 'active' != $status ) {
    255                         $action = is_network_admin() ? 'network-activate-selected' : 'activate-selected';
     257                        $action = $this->_screen->is_network ? 'network-activate-selected' : 'activate-selected';
    256258                        $actions[ $action ] = __( 'Activate' );
    257259                }
    … …  
    260262                        $actions['deactivate-selected'] = __( 'Deactivate' );
    261263
    262                 if ( !is_multisite() || is_network_admin() ) {
     264                if ( !is_multisite() || $this->_screen->is_network ) {
    263265                        if ( current_user_can( 'update_plugins' ) )
    264266                                $actions['update-selected'] = __( 'Update' );
    … …  
    312314
    313315                        if ( 'mustuse' == $context ) {
    314                                 if ( is_multisite() && !is_network_admin() )
     316                                if ( is_multisite() && !$this->_screen->is_network )
    315317                                        continue;
    316318                                $is_active = true;
    317319                        } elseif ( 'dropins' == $context ) {
    318                                 if ( is_multisite() && !is_network_admin() )
     320                                if ( is_multisite() && !$this->_screen->is_network )
    319321                                        continue;
    320322                                $dropins = _get_dropins();
    … …  
    336338                        } else {
    337339                                $is_active_for_network = is_plugin_active_for_network($plugin_file);
    338                                 if ( is_network_admin() )
     340                                if ( $this->_screen->is_network )
    339341                                        $is_active = $is_active_for_network;
    340342                                else
    341343                                        $is_active = is_plugin_active( $plugin_file );
    342344
    343                                 if ( $is_active_for_network && !is_super_admin() && !is_network_admin() )
     345                                if ( $is_active_for_network && !is_super_admin() && !$this->_screen->is_network )
    344346                                        continue;
    345347
    346                                 if ( is_network_admin() ) {
     348                                if ( $this->_screen->is_network ) {
    347349                                        if ( $is_active_for_network ) {
    348350                                                if ( current_user_can( 'manage_network_plugins' ) )
    … …  
    358360                                                $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
    359361                                        } else {
    360                                                 if ( is_network_only_plugin( $plugin_file ) && !is_network_admin() )
     362                                                if ( is_network_only_plugin( $plugin_file ) && !$this->_screen->is_network )
    361363                                                        continue;
    362364
    … …  
    366368                                                        $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
    367369                                        } // end if $is_active
    368                                  } // end if is_network_admin()
     370                                 } // end if $this->_screen->is_network
    369371
    370372                                if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
  • trunk/wp-admin/includes/misc.php

    r15746 r16194  
    344344                switch ( $map_option ) {
    345345                        case 'edit_per_page':
    346                         case 'sites_network_per_page':
    347346                        case 'users_per_page':
    348                         case 'users_network_per_page':
    349347                        case 'edit_comments_per_page':
    350348                        case 'upload_per_page':
    351349                        case 'edit_tags_per_page':
    352350                        case 'plugins_per_page':
     351                        // Network admin
     352                        case 'sites_network_per_page':
     353                        case 'users_network_per_page':
     354                        case 'plugins_network_per_page':
     355                        case 'themes_network_per_page':
    353356                                $value = (int) $value;
    354357                                if ( $value < 1 || $value > 999 )
  • trunk/wp-admin/network/themes.php

    r16193 r16194  
    6161add_thickbox();
    6262
    63 add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' ), 'default' => 999) );
     63add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
    6464
    6565add_contextual_help($current_screen,
  • trunk/wp-admin/plugins.php

    r16175 r16194  
    297297add_thickbox();
    298298
    299 add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999) );
     299add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' )) );
    300300
    301301add_contextual_help($current_screen,
Note: See TracChangeset for help on using the changeset viewer.