| 1 | Index: wp-includes/admin-bar.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/admin-bar.php (revision 21736) |
|---|
| 4 | +++ wp-includes/admin-bar.php (working copy) |
|---|
| 5 | @@ -657,6 +657,26 @@ |
|---|
| 6 | ) ); |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | +function wp_admin_bar_screen_options( $wp_admin_bar ) { |
|---|
| 10 | + |
|---|
| 11 | + $wp_admin_bar->add_menu( array( |
|---|
| 12 | + 'parent' => 'top-secondary', |
|---|
| 13 | + 'id' => 'screen-options', |
|---|
| 14 | + 'title' => '<span class="ab-icon"></span>', |
|---|
| 15 | + 'href' => '', |
|---|
| 16 | + ) ); |
|---|
| 17 | + |
|---|
| 18 | + get_current_screen()->render_options( 'screen-options', $wp_admin_bar ); |
|---|
| 19 | + |
|---|
| 20 | + $wp_admin_bar->add_menu( array( |
|---|
| 21 | + 'parent' => 'top-secondary', |
|---|
| 22 | + 'id' => 'screen-help', |
|---|
| 23 | + 'title' => 'Help<span class="ab-icon"></span>', |
|---|
| 24 | + 'href' => '', |
|---|
| 25 | + ) ); |
|---|
| 26 | + |
|---|
| 27 | + get_current_screen()->render_help( 'screen-help', $wp_admin_bar ); |
|---|
| 28 | +} |
|---|
| 29 | /** |
|---|
| 30 | * Add secondary menus. |
|---|
| 31 | * |
|---|
| 32 | Index: wp-includes/js/admin-bar.js |
|---|
| 33 | =================================================================== |
|---|
| 34 | --- wp-includes/js/admin-bar.js (revision 21736) |
|---|
| 35 | +++ wp-includes/js/admin-bar.js (working copy) |
|---|
| 36 | @@ -10,7 +10,7 @@ |
|---|
| 37 | node.attr('tabindex', '0').attr('tabindex', tab); |
|---|
| 38 | }; |
|---|
| 39 | |
|---|
| 40 | - $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').hoverIntent({ |
|---|
| 41 | + $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').not('.sticky').hoverIntent({ |
|---|
| 42 | over: function(e){ |
|---|
| 43 | $(this).addClass('hover'); |
|---|
| 44 | }, |
|---|
| 45 | @@ -22,6 +22,11 @@ |
|---|
| 46 | interval: 100 |
|---|
| 47 | }); |
|---|
| 48 | |
|---|
| 49 | + $('.sticky', '#wpadminbar').click(function(e){ |
|---|
| 50 | + e.preventDefault(); |
|---|
| 51 | + $(this).toggleClass('hover'); |
|---|
| 52 | + }); |
|---|
| 53 | + |
|---|
| 54 | $('#wp-admin-bar-get-shortlink').click(function(e){ |
|---|
| 55 | e.preventDefault(); |
|---|
| 56 | $(this).addClass('selected').children('.shortlink-input').blur(function(){ |
|---|
| 57 | Index: wp-includes/images/admin-bar-sprite.png |
|---|
| 58 | =================================================================== |
|---|
| 59 | Cannot display: file marked as a binary type. |
|---|
| 60 | svn:mime-type = application/octet-stream |
|---|
| 61 | Index: wp-includes/images/admin-bar-sprite-2x.png |
|---|
| 62 | =================================================================== |
|---|
| 63 | Cannot display: file marked as a binary type. |
|---|
| 64 | svn:mime-type = application/octet-stream |
|---|
| 65 | Index: wp-includes/css/admin-bar.css |
|---|
| 66 | =================================================================== |
|---|
| 67 | --- wp-includes/css/admin-bar.css (revision 21736) |
|---|
| 68 | +++ wp-includes/css/admin-bar.css (working copy) |
|---|
| 69 | @@ -310,6 +310,71 @@ |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | /** |
|---|
| 73 | + * Screen Options |
|---|
| 74 | + */ |
|---|
| 75 | + |
|---|
| 76 | +#wpadminbar #wp-admin-bar-screen-options ul { |
|---|
| 77 | + min-width: 200px; |
|---|
| 78 | + padding: 0 0 15px; |
|---|
| 79 | +} |
|---|
| 80 | + |
|---|
| 81 | +#wpadminbar #wp-admin-bar-screen-options li { |
|---|
| 82 | + padding: 0 12px; |
|---|
| 83 | +} |
|---|
| 84 | + |
|---|
| 85 | +#wpadminbar #wp-admin-bar-screen-options h5 { |
|---|
| 86 | + padding: 15px 0 0; |
|---|
| 87 | + color: #888; |
|---|
| 88 | + font-size: 11px; |
|---|
| 89 | + text-transform: uppercase; |
|---|
| 90 | +} |
|---|
| 91 | + |
|---|
| 92 | +#wpadminbar #wp-admin-bar-screen-options label { |
|---|
| 93 | + display: block; |
|---|
| 94 | +} |
|---|
| 95 | + |
|---|
| 96 | +#wpadminbar #wp-admin-bar-per-page-1 label { |
|---|
| 97 | + display: inline; |
|---|
| 98 | +} |
|---|
| 99 | + |
|---|
| 100 | +#wpadminbar li.ab-title:hover, |
|---|
| 101 | +#wpadminbar li.ab-title:focus, |
|---|
| 102 | +#wpadminbar li.ab-inline:hover, |
|---|
| 103 | +#wpadminbar li.ab-inline:focus { |
|---|
| 104 | + background: transparent; |
|---|
| 105 | +} |
|---|
| 106 | + |
|---|
| 107 | +#wpadminbar li#wp-admin-bar-column-layout, |
|---|
| 108 | +#wpadminbar li#wp-admin-bar-per-page { |
|---|
| 109 | + margin-top: 15px; |
|---|
| 110 | + border-top: 1px solid #e0e0e0; |
|---|
| 111 | +} |
|---|
| 112 | + |
|---|
| 113 | +#wpadminbar li.ab-inline { |
|---|
| 114 | + display: inline-block; |
|---|
| 115 | + padding-right: 5px !important; |
|---|
| 116 | +} |
|---|
| 117 | + |
|---|
| 118 | +#wpadminbar #wp-admin-bar-screen-options li.ab-inline * { |
|---|
| 119 | + display: inline; |
|---|
| 120 | +} |
|---|
| 121 | + |
|---|
| 122 | +#wpadminbar #wp-admin-bar-screen-options input[type=checkbox] { |
|---|
| 123 | + float: left; |
|---|
| 124 | + margin: 7px 10px 1px 0; |
|---|
| 125 | +} |
|---|
| 126 | + |
|---|
| 127 | +#wpadminbar #wp-admin-bar-screen-options input[type=radio] { |
|---|
| 128 | + float: left; |
|---|
| 129 | + margin: 7px 5px 1px 0; |
|---|
| 130 | +} |
|---|
| 131 | + |
|---|
| 132 | +#wpadminbar #wp-admin-bar-screen-options .postbox-title-action { |
|---|
| 133 | + display: none; |
|---|
| 134 | +} |
|---|
| 135 | + |
|---|
| 136 | + |
|---|
| 137 | +/** |
|---|
| 138 | * My Account |
|---|
| 139 | */ |
|---|
| 140 | #wp-admin-bar-my-account > ul { |
|---|
| 141 | @@ -517,6 +582,25 @@ |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | /** |
|---|
| 145 | + * Sticky menu toggle arrows |
|---|
| 146 | + */ |
|---|
| 147 | +#wpadminbar .sticky .sticky-indicator { |
|---|
| 148 | + position: relative; |
|---|
| 149 | + float: right; |
|---|
| 150 | + width: 20px; |
|---|
| 151 | + height: 16px; |
|---|
| 152 | + margin-top: 6px; |
|---|
| 153 | + background-image: url("../images/admin-bar-sprite.png"); |
|---|
| 154 | + background-position: 0 -254px; |
|---|
| 155 | + background-repeat: no-repeat; |
|---|
| 156 | + cursor: pointer; |
|---|
| 157 | +} |
|---|
| 158 | + |
|---|
| 159 | +#wpadminbar .sticky.hover .sticky-indicator { |
|---|
| 160 | + background-position: 0 -228px; |
|---|
| 161 | +} |
|---|
| 162 | + |
|---|
| 163 | +/** |
|---|
| 164 | * WP Logo icon |
|---|
| 165 | */ |
|---|
| 166 | #wp-admin-bar-wp-logo > .ab-item .ab-icon { |
|---|
| 167 | @@ -573,6 +657,22 @@ |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | /** |
|---|
| 171 | + * Screen Settings icon |
|---|
| 172 | + */ |
|---|
| 173 | +#wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon { |
|---|
| 174 | + background-image: url(../images/admin-bar-sprite.png?d=20111130); |
|---|
| 175 | + background-position: -3px -252px; |
|---|
| 176 | + background-repeat: no-repeat; |
|---|
| 177 | +} |
|---|
| 178 | + |
|---|
| 179 | +#wpadminbar.nojs #wp-admin-bar-screen-options:hover > .ab-item .ab-icon, |
|---|
| 180 | +#wpadminbar #wp-admin-bar-screen-options.hover > .ab-item .ab-icon { |
|---|
| 181 | + background-image: url(../images/admin-bar-sprite.png?d=20111130); |
|---|
| 182 | + background-position: -3px -228px; |
|---|
| 183 | + background-repeat: no-repeat; |
|---|
| 184 | +} |
|---|
| 185 | + |
|---|
| 186 | +/** |
|---|
| 187 | * Customize support classes |
|---|
| 188 | */ |
|---|
| 189 | .no-customize-support .hide-if-no-customize, |
|---|
| 190 | @@ -590,9 +690,11 @@ |
|---|
| 191 | #wp-admin-bar-wp-logo > .ab-item .ab-icon, |
|---|
| 192 | #wp-admin-bar-updates > .ab-item .ab-icon, |
|---|
| 193 | #wp-admin-bar-comments > .ab-item .ab-icon, |
|---|
| 194 | - #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon { |
|---|
| 195 | - background-image: url(../images/admin-bar-sprite-2x.png?d=20120830); |
|---|
| 196 | - background-size: 20px 220px; |
|---|
| 197 | + #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon, |
|---|
| 198 | + #wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon, |
|---|
| 199 | + #wpadminbar .sticky .sticky-indicator { |
|---|
| 200 | + background-image: url( "../images/admin-bar-sprite-2x.png?d=20120830" ); |
|---|
| 201 | + background-size: 20px 276px; |
|---|
| 202 | } |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | Index: wp-includes/class-wp-admin-bar.php |
|---|
| 206 | =================================================================== |
|---|
| 207 | --- wp-includes/class-wp-admin-bar.php (revision 21736) |
|---|
| 208 | +++ wp-includes/class-wp-admin-bar.php (working copy) |
|---|
| 209 | @@ -104,6 +104,7 @@ |
|---|
| 210 | 'parent' => false, |
|---|
| 211 | 'href' => false, |
|---|
| 212 | 'group' => false, |
|---|
| 213 | + 'sticky' => false, |
|---|
| 214 | 'meta' => array(), |
|---|
| 215 | ); |
|---|
| 216 | |
|---|
| 217 | @@ -396,6 +397,8 @@ |
|---|
| 218 | |
|---|
| 219 | $is_parent = ! empty( $node->children ); |
|---|
| 220 | $has_link = ! empty( $node->href ); |
|---|
| 221 | + $has_title = ! empty( $node->title ); |
|---|
| 222 | + $is_sticky = $node->sticky === true ? true : false; |
|---|
| 223 | |
|---|
| 224 | $tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : ''; |
|---|
| 225 | $aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : ''; |
|---|
| 226 | @@ -410,40 +413,49 @@ |
|---|
| 227 | if ( ! empty( $node->meta['class'] ) ) |
|---|
| 228 | $menuclass .= $node->meta['class']; |
|---|
| 229 | |
|---|
| 230 | + if ( $is_sticky ) |
|---|
| 231 | + $menuclass .= 'sticky'; |
|---|
| 232 | + |
|---|
| 233 | if ( $menuclass ) |
|---|
| 234 | $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; |
|---|
| 235 | |
|---|
| 236 | ?> |
|---|
| 237 | |
|---|
| 238 | <li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php |
|---|
| 239 | - if ( $has_link ): |
|---|
| 240 | - ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php |
|---|
| 241 | - if ( ! empty( $node->meta['onclick'] ) ) : |
|---|
| 242 | - ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php |
|---|
| 243 | + if ( $has_title ): |
|---|
| 244 | + if ( $has_link ): |
|---|
| 245 | + ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php |
|---|
| 246 | + if ( ! empty( $node->meta['onclick'] ) ) : |
|---|
| 247 | + ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php |
|---|
| 248 | + endif; |
|---|
| 249 | + if ( ! empty( $node->meta['target'] ) ) : |
|---|
| 250 | + ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php |
|---|
| 251 | endif; |
|---|
| 252 | - if ( ! empty( $node->meta['target'] ) ) : |
|---|
| 253 | - ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php |
|---|
| 254 | + if ( ! empty( $node->meta['title'] ) ) : |
|---|
| 255 | + ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php |
|---|
| 256 | + endif; |
|---|
| 257 | + ?>><?php |
|---|
| 258 | + else: |
|---|
| 259 | + ?><a href="#" onclick="return false;" class="ab-item ab-empty-item" <?php echo $aria_attributes; |
|---|
| 260 | + if ( ! empty( $node->meta['title'] ) ) : |
|---|
| 261 | + ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php |
|---|
| 262 | + endif; |
|---|
| 263 | + ?>><?php |
|---|
| 264 | endif; |
|---|
| 265 | - if ( ! empty( $node->meta['title'] ) ) : |
|---|
| 266 | - ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php |
|---|
| 267 | + |
|---|
| 268 | + echo $node->title; |
|---|
| 269 | + |
|---|
| 270 | + if ( $is_sticky ) : |
|---|
| 271 | + ?><span class="sticky-indicator"></span><?php |
|---|
| 272 | endif; |
|---|
| 273 | - ?>><?php |
|---|
| 274 | - else: |
|---|
| 275 | - ?><div class="ab-item ab-empty-item" <?php echo $aria_attributes; |
|---|
| 276 | - if ( ! empty( $node->meta['title'] ) ) : |
|---|
| 277 | - ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php |
|---|
| 278 | + |
|---|
| 279 | + if ( $has_link ) : |
|---|
| 280 | + ?></a><?php |
|---|
| 281 | + else: |
|---|
| 282 | + ?></a><?php |
|---|
| 283 | endif; |
|---|
| 284 | - ?>><?php |
|---|
| 285 | endif; |
|---|
| 286 | |
|---|
| 287 | - echo $node->title; |
|---|
| 288 | - |
|---|
| 289 | - if ( $has_link ) : |
|---|
| 290 | - ?></a><?php |
|---|
| 291 | - else: |
|---|
| 292 | - ?></div><?php |
|---|
| 293 | - endif; |
|---|
| 294 | - |
|---|
| 295 | if ( $is_parent ) : |
|---|
| 296 | ?><div class="ab-sub-wrapper"><?php |
|---|
| 297 | foreach ( $node->children as $group ) { |
|---|
| 298 | @@ -483,6 +495,9 @@ |
|---|
| 299 | } |
|---|
| 300 | add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); |
|---|
| 301 | |
|---|
| 302 | + if ( is_admin() ) |
|---|
| 303 | + add_action( 'admin_bar_menu', 'wp_admin_bar_screen_options', 90 ); |
|---|
| 304 | + |
|---|
| 305 | add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); |
|---|
| 306 | |
|---|
| 307 | do_action( 'add_admin_bar_menus' ); |
|---|
| 308 | Index: wp-admin/includes/screen.php |
|---|
| 309 | =================================================================== |
|---|
| 310 | --- wp-admin/includes/screen.php (revision 21736) |
|---|
| 311 | +++ wp-admin/includes/screen.php (working copy) |
|---|
| 312 | @@ -49,31 +49,7 @@ |
|---|
| 313 | * @param string|WP_Screen $screen |
|---|
| 314 | */ |
|---|
| 315 | function meta_box_prefs( $screen ) { |
|---|
| 316 | - global $wp_meta_boxes; |
|---|
| 317 | - |
|---|
| 318 | - if ( is_string( $screen ) ) |
|---|
| 319 | - $screen = convert_to_screen( $screen ); |
|---|
| 320 | - |
|---|
| 321 | - if ( empty($wp_meta_boxes[$screen->id]) ) |
|---|
| 322 | - return; |
|---|
| 323 | - |
|---|
| 324 | - $hidden = get_hidden_meta_boxes($screen); |
|---|
| 325 | - |
|---|
| 326 | - foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { |
|---|
| 327 | - foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { |
|---|
| 328 | - foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { |
|---|
| 329 | - if ( false == $box || ! $box['title'] ) |
|---|
| 330 | - continue; |
|---|
| 331 | - // Submit box cannot be hidden |
|---|
| 332 | - if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) |
|---|
| 333 | - continue; |
|---|
| 334 | - $box_id = $box['id']; |
|---|
| 335 | - echo '<label for="' . $box_id . '-hide">'; |
|---|
| 336 | - echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />'; |
|---|
| 337 | - echo "{$box['title']}</label>\n"; |
|---|
| 338 | - } |
|---|
| 339 | - } |
|---|
| 340 | - } |
|---|
| 341 | + return; |
|---|
| 342 | } |
|---|
| 343 | |
|---|
| 344 | /** |
|---|
| 345 | @@ -754,7 +730,282 @@ |
|---|
| 346 | * @since 3.3.0 |
|---|
| 347 | */ |
|---|
| 348 | public function render_screen_meta() { |
|---|
| 349 | + return; |
|---|
| 350 | + } |
|---|
| 351 | |
|---|
| 352 | + public function show_screen_options() { |
|---|
| 353 | + global $wp_meta_boxes; |
|---|
| 354 | + |
|---|
| 355 | + if ( is_bool( $this->_show_screen_options ) ) |
|---|
| 356 | + return $this->_show_screen_options; |
|---|
| 357 | + |
|---|
| 358 | + $columns = get_column_headers( $this ); |
|---|
| 359 | + |
|---|
| 360 | + $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); |
|---|
| 361 | + |
|---|
| 362 | + $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); |
|---|
| 363 | + |
|---|
| 364 | + switch ( $this->id ) { |
|---|
| 365 | + case 'widgets': |
|---|
| 366 | + $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; |
|---|
| 367 | + break; |
|---|
| 368 | + } |
|---|
| 369 | + |
|---|
| 370 | + if ( $this->_screen_settings || $this->_options ) |
|---|
| 371 | + $show_screen = true; |
|---|
| 372 | + |
|---|
| 373 | + $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); |
|---|
| 374 | + return $this->_show_screen_options; |
|---|
| 375 | + } |
|---|
| 376 | + |
|---|
| 377 | + /** |
|---|
| 378 | + * Render the screen options tab. |
|---|
| 379 | + * |
|---|
| 380 | + * @since 3.3.0 |
|---|
| 381 | + */ |
|---|
| 382 | + public function render_screen_options() { |
|---|
| 383 | + return; |
|---|
| 384 | + } |
|---|
| 385 | + |
|---|
| 386 | + /* |
|---|
| 387 | + * Render screen options in the admin bar |
|---|
| 388 | + * |
|---|
| 389 | + */ |
|---|
| 390 | + function render_options( $parent, $wp_admin_bar ) { |
|---|
| 391 | + $this->render_show_on_screen( $parent, $wp_admin_bar ); |
|---|
| 392 | + $this->render_layout( $parent, $wp_admin_bar ); |
|---|
| 393 | + $this->render_per_page( $parent, $wp_admin_bar ); |
|---|
| 394 | + // @todo $this->_screen_settings |
|---|
| 395 | + } |
|---|
| 396 | + |
|---|
| 397 | + function render_show_on_screen( $parent, $wp_admin_bar ) { |
|---|
| 398 | + global $wp_meta_boxes; |
|---|
| 399 | + |
|---|
| 400 | + if ( ! $this->show_screen_options() ) |
|---|
| 401 | + return; |
|---|
| 402 | + |
|---|
| 403 | + $columns = get_column_headers( $this ); |
|---|
| 404 | + |
|---|
| 405 | + if ( ! isset( $wp_meta_boxes[ $this->id ] ) && ( ! $columns || isset( $columns['_title'] ) ) ) |
|---|
| 406 | + return; |
|---|
| 407 | + |
|---|
| 408 | + $wp_admin_bar->add_menu( array( |
|---|
| 409 | + 'id' => 'show-on-screen', |
|---|
| 410 | + 'parent' => $parent, |
|---|
| 411 | + 'href' => '', |
|---|
| 412 | + 'meta' => array( |
|---|
| 413 | + 'html' => '<h5 class="ab-item">' . __( 'Show on screen' ) . '</h5>', |
|---|
| 414 | + 'class' => 'ab-title' |
|---|
| 415 | + ), |
|---|
| 416 | + ) ); |
|---|
| 417 | + |
|---|
| 418 | + // Render meta box show/hide. |
|---|
| 419 | + if ( isset( $wp_meta_boxes[ $this->id ] ) ) { |
|---|
| 420 | + $hidden = get_hidden_meta_boxes($this); |
|---|
| 421 | + |
|---|
| 422 | + foreach ( array_keys($wp_meta_boxes[$this->id]) as $context ) { |
|---|
| 423 | + foreach ( array_keys($wp_meta_boxes[$this->id][$context]) as $priority ) { |
|---|
| 424 | + foreach ( $wp_meta_boxes[$this->id][$context][$priority] as $box ) { |
|---|
| 425 | + if ( false == $box || ! $box['title'] ) |
|---|
| 426 | + continue; |
|---|
| 427 | + // Submit box cannot be hidden |
|---|
| 428 | + if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) |
|---|
| 429 | + continue; |
|---|
| 430 | + $box_id = $box['id']; |
|---|
| 431 | + $html = '<label class="ab-item" for="' . $box_id . '-hide">' . |
|---|
| 432 | + '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />' . |
|---|
| 433 | + "{$box['title']}</label>\n"; |
|---|
| 434 | + $wp_admin_bar->add_menu( array( |
|---|
| 435 | + 'id' => 'show-on-screen-' . $box_id, |
|---|
| 436 | + 'parent' => $parent, |
|---|
| 437 | + 'href' => '', |
|---|
| 438 | + 'meta' => array( 'html' => $html ), |
|---|
| 439 | + ) ); |
|---|
| 440 | + } |
|---|
| 441 | + } |
|---|
| 442 | + } |
|---|
| 443 | + |
|---|
| 444 | + if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) { |
|---|
| 445 | + if ( isset( $_GET['welcome'] ) ) { |
|---|
| 446 | + $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; |
|---|
| 447 | + update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); |
|---|
| 448 | + } else { |
|---|
| 449 | + $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|---|
| 450 | + if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) |
|---|
| 451 | + $welcome_checked = false; |
|---|
| 452 | + } |
|---|
| 453 | + $html = '<label class="ab-item" for="wp_welcome_panel-hide">' . |
|---|
| 454 | + '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />' . |
|---|
| 455 | + _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; |
|---|
| 456 | + $wp_admin_bar->add_menu( array( |
|---|
| 457 | + 'id' => 'show-on-screen-' . $box_id, |
|---|
| 458 | + 'parent' => $parent, |
|---|
| 459 | + 'href' => '', |
|---|
| 460 | + 'meta' => array( 'html' => $html ), |
|---|
| 461 | + ) ); |
|---|
| 462 | + } |
|---|
| 463 | + } |
|---|
| 464 | + |
|---|
| 465 | + // Render column show/hide. |
|---|
| 466 | + if ( $columns ) { |
|---|
| 467 | + $hidden = get_hidden_columns( $this ); |
|---|
| 468 | + |
|---|
| 469 | + if ( ! empty( $columns['_title'] ) ) { |
|---|
| 470 | + echo '<h5>' . $columns['_title'] . '</h5>'; |
|---|
| 471 | + } |
|---|
| 472 | + |
|---|
| 473 | + $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); |
|---|
| 474 | + |
|---|
| 475 | + foreach ( $columns as $column => $title ) { |
|---|
| 476 | + // Can't hide these for they are special |
|---|
| 477 | + if ( in_array( $column, $special ) ) |
|---|
| 478 | + continue; |
|---|
| 479 | + if ( empty( $title ) ) |
|---|
| 480 | + continue; |
|---|
| 481 | + |
|---|
| 482 | + if ( 'comments' == $column ) |
|---|
| 483 | + $title = __( 'Comments' ); |
|---|
| 484 | + $id = "$column-hide"; |
|---|
| 485 | + $html = '<label class="ab-item" for="' . $id . '">' . |
|---|
| 486 | + '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />' . |
|---|
| 487 | + "$title</label>\n"; |
|---|
| 488 | + $wp_admin_bar->add_menu( array( |
|---|
| 489 | + 'id' => 'show-on-screen-' . $column, |
|---|
| 490 | + 'parent' => $parent, |
|---|
| 491 | + 'href' => '', |
|---|
| 492 | + 'meta' => array( 'html' => $html ), |
|---|
| 493 | + ) ); |
|---|
| 494 | + } |
|---|
| 495 | + } |
|---|
| 496 | + } |
|---|
| 497 | + |
|---|
| 498 | + function render_layout( $parent, $wp_admin_bar ) { |
|---|
| 499 | + // Back compat for plugins using the filter instead of add_screen_option() |
|---|
| 500 | + $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
|---|
| 501 | + |
|---|
| 502 | + if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|---|
| 503 | + $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|---|
| 504 | + |
|---|
| 505 | + if ( $this->get_option( 'layout_columns' ) ) { |
|---|
| 506 | + $this->columns = (int) get_user_option("screen_layout_$this->id"); |
|---|
| 507 | + |
|---|
| 508 | + if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|---|
| 509 | + $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|---|
| 510 | + } |
|---|
| 511 | + $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
|---|
| 512 | + |
|---|
| 513 | + if ( ! $this->get_option('layout_columns') ) |
|---|
| 514 | + return; |
|---|
| 515 | + |
|---|
| 516 | + $screen_layout_columns = $this->get_columns(); |
|---|
| 517 | + $num = $this->get_option( 'layout_columns', 'max' ); |
|---|
| 518 | + |
|---|
| 519 | + $wp_admin_bar->add_menu( array( |
|---|
| 520 | + 'id' => 'column-layout', |
|---|
| 521 | + 'parent' => $parent, |
|---|
| 522 | + 'href' => '', |
|---|
| 523 | + 'meta' => array( |
|---|
| 524 | + 'html' => '<h5 class="ab-item">' . __( 'Column Layout' ) . '</h5>', |
|---|
| 525 | + 'class' => 'ab-title' |
|---|
| 526 | + ), |
|---|
| 527 | + ) ); |
|---|
| 528 | + |
|---|
| 529 | + for ( $i = 1; $i <= $num; ++$i ) { |
|---|
| 530 | + $html = '<label class="ab-item" class="columns-prefs-' . $i . '">' . |
|---|
| 531 | + "<input type='radio' name='screen_columns' value='" . $i . "'" . |
|---|
| 532 | + checked( $screen_layout_columns, $i, false ) . '/>' . |
|---|
| 533 | + esc_html( $i ) . |
|---|
| 534 | + '</label>'; |
|---|
| 535 | + |
|---|
| 536 | + $wp_admin_bar->add_menu( array( |
|---|
| 537 | + 'id' => 'column-layout-' . $i, |
|---|
| 538 | + 'parent' => $parent, |
|---|
| 539 | + 'href' => '', |
|---|
| 540 | + 'meta' => array( |
|---|
| 541 | + 'html' => $html, |
|---|
| 542 | + 'class' => 'ab-inline' |
|---|
| 543 | + ), |
|---|
| 544 | + ) ); |
|---|
| 545 | + } |
|---|
| 546 | + } |
|---|
| 547 | + |
|---|
| 548 | + /** |
|---|
| 549 | + * Render the items per page option |
|---|
| 550 | + * |
|---|
| 551 | + * @since 3.5.0 |
|---|
| 552 | + */ |
|---|
| 553 | + function render_per_page( $parent, $wp_admin_bar ) { |
|---|
| 554 | + // @todo form and nonce |
|---|
| 555 | + // wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); |
|---|
| 556 | + |
|---|
| 557 | + if ( ! $this->get_option( 'per_page' ) ) |
|---|
| 558 | + return; |
|---|
| 559 | + |
|---|
| 560 | + $per_page_label = $this->get_option( 'per_page', 'label' ); |
|---|
| 561 | + |
|---|
| 562 | + $option = $this->get_option( 'per_page', 'option' ); |
|---|
| 563 | + if ( ! $option ) |
|---|
| 564 | + $option = str_replace( '-', '_', "{$this->id}_per_page" ); |
|---|
| 565 | + |
|---|
| 566 | + $per_page = (int) get_user_option( $option ); |
|---|
| 567 | + if ( empty( $per_page ) || $per_page < 1 ) { |
|---|
| 568 | + $per_page = $this->get_option( 'per_page', 'default' ); |
|---|
| 569 | + if ( ! $per_page ) |
|---|
| 570 | + $per_page = 20; |
|---|
| 571 | + } |
|---|
| 572 | + |
|---|
| 573 | + if ( 'edit_comments_per_page' == $option ) { |
|---|
| 574 | + $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|---|
| 575 | + $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); |
|---|
| 576 | + } elseif ( 'categories_per_page' == $option ) { |
|---|
| 577 | + $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|---|
| 578 | + } else { |
|---|
| 579 | + $per_page = apply_filters( $option, $per_page ); |
|---|
| 580 | + } |
|---|
| 581 | + |
|---|
| 582 | + // Back compat |
|---|
| 583 | + if ( isset( $this->post_type ) ) |
|---|
| 584 | + $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); |
|---|
| 585 | + |
|---|
| 586 | + $wp_admin_bar->add_menu( array( |
|---|
| 587 | + 'id' => 'per-page', |
|---|
| 588 | + 'parent' => $parent, |
|---|
| 589 | + 'href' => '', |
|---|
| 590 | + 'meta' => array( |
|---|
| 591 | + 'html' => '<h5 class="ab-item">' . __( 'Items Per Page' ) . '</h5>', |
|---|
| 592 | + 'class' => 'ab-title' |
|---|
| 593 | + ), |
|---|
| 594 | + ) ); |
|---|
| 595 | + |
|---|
| 596 | + if ( $per_page_label ) { |
|---|
| 597 | + $html = '<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" |
|---|
| 598 | + id="' . esc_attr( $option ) . '" maxlength="3" value="' . esc_attr( $per_page ) . '" />' . |
|---|
| 599 | + '<label class="ab-item" for="' . esc_attr( $option ) . '">' . |
|---|
| 600 | + esc_html( $per_page_label ) . |
|---|
| 601 | + '</label>'; |
|---|
| 602 | + $wp_admin_bar->add_menu( array( |
|---|
| 603 | + 'id' => 'per-page-1', |
|---|
| 604 | + 'parent' => $parent, |
|---|
| 605 | + 'href' => '', |
|---|
| 606 | + 'meta' => array( |
|---|
| 607 | + 'html' => $html, |
|---|
| 608 | + 'class' => 'ab-inline' |
|---|
| 609 | + ), |
|---|
| 610 | + ) ); |
|---|
| 611 | + } |
|---|
| 612 | + |
|---|
| 613 | + $html = get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ) . |
|---|
| 614 | + "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />"; |
|---|
| 615 | + |
|---|
| 616 | + $wp_admin_bar->add_menu( array( |
|---|
| 617 | + 'id' => 'per-page-submit', |
|---|
| 618 | + 'parent' => $parent, |
|---|
| 619 | + 'href' => '', |
|---|
| 620 | + 'meta' => array( 'html' => $html ), |
|---|
| 621 | + ) ); |
|---|
| 622 | + } |
|---|
| 623 | + |
|---|
| 624 | + function render_help( $parent, $wp_admin_bar ) { |
|---|
| 625 | // Call old contextual_help_list filter. |
|---|
| 626 | self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); |
|---|
| 627 | |
|---|
| 628 | @@ -841,177 +1092,23 @@ |
|---|
| 629 | </div> |
|---|
| 630 | </div> |
|---|
| 631 | <?php |
|---|
| 632 | - // Setup layout columns |
|---|
| 633 | |
|---|
| 634 | - // Back compat for plugins using the filter instead of add_screen_option() |
|---|
| 635 | - $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
|---|
| 636 | - |
|---|
| 637 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|---|
| 638 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|---|
| 639 | - |
|---|
| 640 | - if ( $this->get_option( 'layout_columns' ) ) { |
|---|
| 641 | - $this->columns = (int) get_user_option("screen_layout_$this->id"); |
|---|
| 642 | - |
|---|
| 643 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|---|
| 644 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|---|
| 645 | - } |
|---|
| 646 | - $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
|---|
| 647 | - |
|---|
| 648 | - // Add screen options |
|---|
| 649 | - if ( $this->show_screen_options() ) |
|---|
| 650 | - $this->render_screen_options(); |
|---|
| 651 | ?> |
|---|
| 652 | </div> |
|---|
| 653 | <?php |
|---|
| 654 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|---|
| 655 | + if ( ! $this->get_help_tabs() ) |
|---|
| 656 | return; |
|---|
| 657 | ?> |
|---|
| 658 | - <div id="screen-meta-links"> |
|---|
| 659 | - <?php if ( $this->get_help_tabs() ) : ?> |
|---|
| 660 | - <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
|---|
| 661 | - <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a> |
|---|
| 662 | - </div> |
|---|
| 663 | - <?php endif; |
|---|
| 664 | - if ( $this->show_screen_options() ) : ?> |
|---|
| 665 | - <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
|---|
| 666 | - <a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></a> |
|---|
| 667 | - </div> |
|---|
| 668 | - <?php endif; ?> |
|---|
| 669 | - </div> |
|---|
| 670 | <?php |
|---|
| 671 | } |
|---|
| 672 | |
|---|
| 673 | - public function show_screen_options() { |
|---|
| 674 | - global $wp_meta_boxes; |
|---|
| 675 | - |
|---|
| 676 | - if ( is_bool( $this->_show_screen_options ) ) |
|---|
| 677 | - return $this->_show_screen_options; |
|---|
| 678 | - |
|---|
| 679 | - $columns = get_column_headers( $this ); |
|---|
| 680 | - |
|---|
| 681 | - $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); |
|---|
| 682 | - |
|---|
| 683 | - $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); |
|---|
| 684 | - |
|---|
| 685 | - switch ( $this->id ) { |
|---|
| 686 | - case 'widgets': |
|---|
| 687 | - $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; |
|---|
| 688 | - break; |
|---|
| 689 | - } |
|---|
| 690 | - |
|---|
| 691 | - if ( $this->_screen_settings || $this->_options ) |
|---|
| 692 | - $show_screen = true; |
|---|
| 693 | - |
|---|
| 694 | - $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); |
|---|
| 695 | - return $this->_show_screen_options; |
|---|
| 696 | - } |
|---|
| 697 | - |
|---|
| 698 | /** |
|---|
| 699 | - * Render the screen options tab. |
|---|
| 700 | - * |
|---|
| 701 | - * @since 3.3.0 |
|---|
| 702 | - */ |
|---|
| 703 | - public function render_screen_options() { |
|---|
| 704 | - global $wp_meta_boxes, $wp_list_table; |
|---|
| 705 | - |
|---|
| 706 | - $columns = get_column_headers( $this ); |
|---|
| 707 | - $hidden = get_hidden_columns( $this ); |
|---|
| 708 | - |
|---|
| 709 | - ?> |
|---|
| 710 | - <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>"> |
|---|
| 711 | - <form id="adv-settings" action="" method="post"> |
|---|
| 712 | - <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?> |
|---|
| 713 | - <h5><?php _e( 'Show on screen' ); ?></h5> |
|---|
| 714 | - <?php |
|---|
| 715 | - endif; |
|---|
| 716 | - |
|---|
| 717 | - if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?> |
|---|
| 718 | - <div class="metabox-prefs"> |
|---|
| 719 | - <?php |
|---|
| 720 | - meta_box_prefs( $this ); |
|---|
| 721 | - |
|---|
| 722 | - if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) { |
|---|
| 723 | - if ( isset( $_GET['welcome'] ) ) { |
|---|
| 724 | - $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; |
|---|
| 725 | - update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); |
|---|
| 726 | - } else { |
|---|
| 727 | - $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|---|
| 728 | - if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) |
|---|
| 729 | - $welcome_checked = false; |
|---|
| 730 | - } |
|---|
| 731 | - echo '<label for="wp_welcome_panel-hide">'; |
|---|
| 732 | - echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; |
|---|
| 733 | - echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; |
|---|
| 734 | - } |
|---|
| 735 | - ?> |
|---|
| 736 | - <br class="clear" /> |
|---|
| 737 | - </div> |
|---|
| 738 | - <?php endif; |
|---|
| 739 | - if ( $columns ) : |
|---|
| 740 | - if ( ! empty( $columns['_title'] ) ) : ?> |
|---|
| 741 | - <h5><?php echo $columns['_title']; ?></h5> |
|---|
| 742 | - <?php endif; ?> |
|---|
| 743 | - <div class="metabox-prefs"> |
|---|
| 744 | - <?php |
|---|
| 745 | - $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); |
|---|
| 746 | - |
|---|
| 747 | - foreach ( $columns as $column => $title ) { |
|---|
| 748 | - // Can't hide these for they are special |
|---|
| 749 | - if ( in_array( $column, $special ) ) |
|---|
| 750 | - continue; |
|---|
| 751 | - if ( empty( $title ) ) |
|---|
| 752 | - continue; |
|---|
| 753 | - |
|---|
| 754 | - if ( 'comments' == $column ) |
|---|
| 755 | - $title = __( 'Comments' ); |
|---|
| 756 | - $id = "$column-hide"; |
|---|
| 757 | - echo '<label for="' . $id . '">'; |
|---|
| 758 | - echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; |
|---|
| 759 | - echo "$title</label>\n"; |
|---|
| 760 | - } |
|---|
| 761 | - ?> |
|---|
| 762 | - <br class="clear" /> |
|---|
| 763 | - </div> |
|---|
| 764 | - <?php endif; |
|---|
| 765 | - |
|---|
| 766 | - $this->render_screen_layout(); |
|---|
| 767 | - $this->render_per_page_options(); |
|---|
| 768 | - echo $this->_screen_settings; |
|---|
| 769 | - |
|---|
| 770 | - ?> |
|---|
| 771 | - <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> |
|---|
| 772 | - </form> |
|---|
| 773 | - </div> |
|---|
| 774 | - <?php |
|---|
| 775 | - } |
|---|
| 776 | - |
|---|
| 777 | - /** |
|---|
| 778 | * Render the option for number of columns on the page |
|---|
| 779 | * |
|---|
| 780 | * @since 3.3.0 |
|---|
| 781 | */ |
|---|
| 782 | function render_screen_layout() { |
|---|
| 783 | - if ( ! $this->get_option('layout_columns') ) |
|---|
| 784 | - return; |
|---|
| 785 | - |
|---|
| 786 | - $screen_layout_columns = $this->get_columns(); |
|---|
| 787 | - $num = $this->get_option( 'layout_columns', 'max' ); |
|---|
| 788 | - |
|---|
| 789 | - ?> |
|---|
| 790 | - <h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5> |
|---|
| 791 | - <div class='columns-prefs'><?php |
|---|
| 792 | - _e('Number of Columns:'); |
|---|
| 793 | - for ( $i = 1; $i <= $num; ++$i ): |
|---|
| 794 | - ?> |
|---|
| 795 | - <label class="columns-prefs-<?php echo $i; ?>"> |
|---|
| 796 | - <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' |
|---|
| 797 | - <?php checked( $screen_layout_columns, $i ); ?> /> |
|---|
| 798 | - <?php echo esc_html( $i ); ?> |
|---|
| 799 | - </label> |
|---|
| 800 | - <?php |
|---|
| 801 | - endfor; ?> |
|---|
| 802 | - </div> |
|---|
| 803 | - <?php |
|---|
| 804 | + return; |
|---|
| 805 | } |
|---|
| 806 | |
|---|
| 807 | /** |
|---|
| 808 | @@ -1020,49 +1117,6 @@ |
|---|
| 809 | * @since 3.3.0 |
|---|
| 810 | */ |
|---|
| 811 | function render_per_page_options() { |
|---|
| 812 | - if ( ! $this->get_option( 'per_page' ) ) |
|---|
| 813 | - return; |
|---|
| 814 | - |
|---|
| 815 | - $per_page_label = $this->get_option( 'per_page', 'label' ); |
|---|
| 816 | - |
|---|
| 817 | - $option = $this->get_option( 'per_page', 'option' ); |
|---|
| 818 | - if ( ! $option ) |
|---|
| 819 | - $option = str_replace( '-', '_', "{$this->id}_per_page" ); |
|---|
| 820 | - |
|---|
| 821 | - $per_page = (int) get_user_option( $option ); |
|---|
| 822 | - if ( empty( $per_page ) || $per_page < 1 ) { |
|---|
| 823 | - $per_page = $this->get_option( 'per_page', 'default' ); |
|---|
| 824 | - if ( ! $per_page ) |
|---|
| 825 | - $per_page = 20; |
|---|
| 826 | - } |
|---|
| 827 | - |
|---|
| 828 | - if ( 'edit_comments_per_page' == $option ) { |
|---|
| 829 | - $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|---|
| 830 | - $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); |
|---|
| 831 | - } elseif ( 'categories_per_page' == $option ) { |
|---|
| 832 | - $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|---|
| 833 | - } else { |
|---|
| 834 | - $per_page = apply_filters( $option, $per_page ); |
|---|
| 835 | - } |
|---|
| 836 | - |
|---|
| 837 | - // Back compat |
|---|
| 838 | - if ( isset( $this->post_type ) ) |
|---|
| 839 | - $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); |
|---|
| 840 | - |
|---|
| 841 | - ?> |
|---|
| 842 | - <div class="screen-options"> |
|---|
| 843 | - <?php if ( $per_page_label ) : ?> |
|---|
| 844 | - <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" |
|---|
| 845 | - id="<?php echo esc_attr( $option ); ?>" maxlength="3" |
|---|
| 846 | - value="<?php echo esc_attr( $per_page ); ?>" /> |
|---|
| 847 | - <label for="<?php echo esc_attr( $option ); ?>"> |
|---|
| 848 | - <?php echo esc_html( $per_page_label ); ?> |
|---|
| 849 | - </label> |
|---|
| 850 | - <?php endif; |
|---|
| 851 | - |
|---|
| 852 | - echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?> |
|---|
| 853 | - <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' /> |
|---|
| 854 | - </div> |
|---|
| 855 | - <?php |
|---|
| 856 | + return; |
|---|
| 857 | } |
|---|
| 858 | } |
|---|
| 859 | Index: wp-admin/admin-header.php |
|---|
| 860 | =================================================================== |
|---|
| 861 | --- wp-admin/admin-header.php (revision 21736) |
|---|
| 862 | +++ wp-admin/admin-header.php (working copy) |
|---|
| 863 | @@ -115,6 +115,7 @@ |
|---|
| 864 | <div id="wpcontent"> |
|---|
| 865 | |
|---|
| 866 | <?php |
|---|
| 867 | +$current_screen->set_parentage( $parent_file ); |
|---|
| 868 | do_action('in_admin_header'); |
|---|
| 869 | ?> |
|---|
| 870 | |
|---|
| 871 | @@ -122,15 +123,11 @@ |
|---|
| 872 | <?php |
|---|
| 873 | unset($title_class, $blog_name, $total_update_count, $update_title); |
|---|
| 874 | |
|---|
| 875 | -$current_screen->set_parentage( $parent_file ); |
|---|
| 876 | - |
|---|
| 877 | ?> |
|---|
| 878 | |
|---|
| 879 | <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>"> |
|---|
| 880 | <?php |
|---|
| 881 | |
|---|
| 882 | -$current_screen->render_screen_meta(); |
|---|
| 883 | - |
|---|
| 884 | if ( is_network_admin() ) |
|---|
| 885 | do_action('network_admin_notices'); |
|---|
| 886 | elseif ( is_user_admin() ) |
|---|