~canonical-sysadmins/wordpress/4.2.4

« back to all changes in this revision

Viewing changes to wp-admin/includes/screen.php

  • Committer: Paul Gear
  • Date: 2015-04-24 01:35:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: paul.gear@canonical.com-20150424013520-w4p9ksth76zh6opw
Merge new upstream release 4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
368
368
         * @since 3.3.0
369
369
         * @access public
370
370
         *
371
 
         * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
 
371
         * @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
372
372
         *      Defaults to the current $hook_suffix global.
373
373
         * @return WP_Screen Screen object.
374
374
         */
375
375
        public static function get( $hook_name = '' ) {
376
376
 
377
 
                if ( is_a( $hook_name, 'WP_Screen' ) )
 
377
                if ( $hook_name instanceof WP_Screen ) {
378
378
                        return $hook_name;
 
379
                }
379
380
 
380
381
                $post_type = $taxonomy = null;
381
382
                $in_admin = false;
1025
1026
 
1026
1027
                ?>
1027
1028
                <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">
1028
 
                <form id="adv-settings" action="" method="post">
 
1029
                <form id="adv-settings" method="post">
1029
1030
                <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
1030
1031
                        <h5><?php _e( 'Show on screen' ); ?></h5>
1031
1032
                <?php
1126
1127
         * @since 3.3.0
1127
1128
         */
1128
1129
        public function render_per_page_options() {
1129
 
                if ( ! $this->get_option( 'per_page' ) )
 
1130
                if ( null === $this->get_option( 'per_page' ) ) {
1130
1131
                        return;
 
1132
                }
1131
1133
 
1132
1134
                $per_page_label = $this->get_option( 'per_page', 'label' );
 
1135
                if ( null === $per_page_label ) {
 
1136
                        $per_page_label = __( 'Number of items per page:' );
 
1137
                }
1133
1138
 
1134
1139
                $option = $this->get_option( 'per_page', 'option' );
1135
 
                if ( ! $option )
 
1140
                if ( ! $option ) {
1136
1141
                        $option = str_replace( '-', '_', "{$this->id}_per_page" );
 
1142
                }
1137
1143
 
1138
1144
                $per_page = (int) get_user_option( $option );
1139
1145
                if ( empty( $per_page ) || $per_page < 1 ) {
1140
1146
                        $per_page = $this->get_option( 'per_page', 'default' );
1141
 
                        if ( ! $per_page )
 
1147
                        if ( ! $per_page ) {
1142
1148
                                $per_page = 20;
 
1149
                        }
1143
1150
                }
1144
1151
 
1145
1152
                if ( 'edit_comments_per_page' == $option ) {
1164
1171
                ?>
1165
1172
                <div class="screen-options">
1166
1173
                        <?php if ( $per_page_label ) : ?>
 
1174
                                <label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label>
1167
1175
                                <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
1168
1176
                                        id="<?php echo esc_attr( $option ); ?>" maxlength="3"
1169
1177
                                        value="<?php echo esc_attr( $per_page ); ?>" />
1170
 
                                <label for="<?php echo esc_attr( $option ); ?>">
1171
 
                                        <?php echo esc_html( $per_page_label ); ?>
1172
 
                                </label>
1173
1178
                        <?php endif;
1174
1179
 
1175
1180
                        echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
1176
 
                        <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' />
 
1181
                        <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" />
1177
1182
                </div>
1178
1183
                <?php
1179
1184
        }