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:
parent
352b46a505
commit
e8285dc491
|
@ -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;
|
||||||
|
|
|
@ -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 '';
|
||||||
}
|
}
|
||||||
|
@ -3568,8 +3580,8 @@ function screen_options($screen) {
|
||||||
$return .= "<div class='screen-options'>\n";
|
$return .= "<div class='screen-options'>\n";
|
||||||
if ( !empty($per_page_label) )
|
if ( !empty($per_page_label) )
|
||||||
$return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n";
|
$return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n";
|
||||||
$return .= "<input type='submit' class='button' value='" . __('Apply') . "' />";
|
$return .= "<input type='submit' class='button' value='" . __('Apply') . "' />";
|
||||||
$return .= "<input type='hidden' name='wp_screen_options[option]' value='$option' />";
|
$return .= "<input type='hidden' name='wp_screen_options[option]' value='$option' />";
|
||||||
$return .= "</div>\n";
|
$return .= "</div>\n";
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,9 @@ if ( !empty($invalid) )
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<?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
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue