Add per page screen option to plugins page. see #9527

git-svn-id: http://svn.automattic.com/wordpress/trunk@11027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-21 06:49:53 +00:00
parent 352b46a505
commit e8285dc491
3 changed files with 24 additions and 6 deletions

View File

@ -345,6 +345,7 @@ function set_screen_options() {
case 'upload_per_page': case 'upload_per_page':
case 'categories_per_page': case 'categories_per_page':
case 'edit_tags_per_page': case 'edit_tags_per_page':
case 'plugins_per_page':
$value = (int) $value; $value = (int) $value;
if ( $value < 1 || $value > 999 ) if ( $value < 1 || $value > 999 )
return; return;

View File

@ -3351,7 +3351,14 @@ function screen_meta($screen) {
if ( isset($meta_screens[$screen]) ) if ( isset($meta_screens[$screen]) )
$screen = $meta_screens[$screen]; $screen = $meta_screens[$screen];
$show_screen = false; $show_screen = false;
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) ) $show_on_screen = false;
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) ) {
$show_screen = true;
$show_on_screen = true;
}
$screen_options = screen_options($screen);
if ( $screen_options )
$show_screen = true; $show_screen = true;
if ( !isset($_wp_contextual_help) ) if ( !isset($_wp_contextual_help) )
@ -3403,6 +3410,7 @@ function screen_meta($screen) {
?> ?>
<div id="screen-options-wrap" class="hidden"> <div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post"> <form id="adv-settings" action="" method="post">
<?php if ( $show_on_screen ) : ?>
<h5><?php _e('Show on screen') ?></h5> <h5><?php _e('Show on screen') ?></h5>
<div class="metabox-prefs"> <div class="metabox-prefs">
<?php <?php
@ -3412,8 +3420,9 @@ function screen_meta($screen) {
?> ?>
<br class="clear" /> <br class="clear" />
</div> </div>
<?php endif; ?>
<?php echo screen_layout($screen); ?> <?php echo screen_layout($screen); ?>
<?php echo screen_options($screen); ?> <?php echo $screen_options; ?>
<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
</form> </form>
</div> </div>
@ -3555,6 +3564,9 @@ function screen_options($screen) {
case 'edit-tags': case 'edit-tags':
$per_page_label = __('Tags per page:'); $per_page_label = __('Tags per page:');
break; break;
case 'plugins':
$per_page_label = __('Plugins per page:');
break;
default: default:
return ''; return '';
} }

View File

@ -208,6 +208,8 @@ if ( !empty($invalid) )
<?php screen_icon(); ?> <?php screen_icon(); ?>
<h2><?php echo wp_specialchars( $title ); ?></h2> <h2><?php echo wp_specialchars( $title ); ?></h2>
<p><?php _e('Plugins extend and expand the functionality of WordPress. Install new plugins and then activate, deactivate, or delete them here.'); ?></p>
<?php <?php
$all_plugins = get_plugins(); $all_plugins = get_plugins();
@ -284,7 +286,10 @@ $plugins = &$$plugin_array_name;
$page = isset($_GET['paged']) ? $_GET['paged'] : 1; $page = isset($_GET['paged']) ? $_GET['paged'] : 1;
$total_this_page = "total_{$status}_plugins"; $total_this_page = "total_{$status}_plugins";
$total_this_page = $$total_this_page; $total_this_page = $$total_this_page;
$plugins_per_page = apply_filters('plugins_per_page', 20, $status); $plugins_per_page = get_user_option('plugins_per_page');
if ( empty($plugins_per_page) )
$plugins_per_page = 20;
$plugins_per_page = apply_filters('plugins_per_page', $plugins_per_page);
$start = ($page - 1) * $plugins_per_page; $start = ($page - 1) * $plugins_per_page;