Ticket #21583: 21583.13.1.diff
File 21583.13.1.diff, 34.2 KB (added by , 12 years ago) |
---|
-
wp-includes/admin-bar.php
657 657 ) ); 658 658 } 659 659 660 function wp_admin_bar_screen_options( $wp_admin_bar ) { 661 662 if ( get_current_screen()->show_screen_options() ) { 663 $wp_admin_bar->add_menu( array( 664 'parent' => 'top-secondary', 665 'id' => 'screen-options', 666 'title' => '<span class="ab-icon"></span>', 667 'href' => '', 668 ) ); 669 670 get_current_screen()->render_options( 'screen-options', $wp_admin_bar ); 671 } 672 673 $wp_admin_bar->add_menu( array( 674 'parent' => 'top-secondary', 675 'id' => 'screen-help', 676 'title' => 'Help<span class="ab-icon"></span>', 677 'href' => '', 678 ) ); 679 680 get_current_screen()->render_help( 'screen-help', $wp_admin_bar ); 681 } 660 682 /** 661 683 * Add secondary menus. 662 684 * -
wp-includes/js/admin-bar.js
10 10 node.attr('tabindex', '0').attr('tabindex', tab); 11 11 }; 12 12 13 $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop'). hoverIntent({13 $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').not('.sticky').hoverIntent({ 14 14 over: function(e){ 15 15 $(this).addClass('hover'); 16 heightCheck($(this)); 16 17 }, 17 18 out: function(e){ 18 19 $(this).removeClass('hover'); … … 22 23 interval: 100 23 24 }); 24 25 26 $('.sticky', '#wpadminbar').click(function(e){ 27 e.preventDefault(); 28 $(this).toggleClass('hover'); 29 }); 30 25 31 $('#wp-admin-bar-get-shortlink').click(function(e){ 26 32 e.preventDefault(); 27 33 $(this).addClass('selected').children('.shortlink-input').blur(function(){ … … 66 72 e.preventDefault(); 67 73 $('html, body').animate({ scrollTop: 0 }, 'fast'); 68 74 }); 75 76 69 77 70 78 }); 79 80 function heightCheck( menu ) { 81 // Add overflow if sub menu height exceeds window height 82 var wHeight = jQuery(window).height(), 83 toolbarPlusPadding = 28 + 23, 84 subWrapper = menu.find('.ab-sub-wrapper'), 85 subMenuHeight = subWrapper.height() + toolbarPlusPadding; 86 87 if ( subMenuHeight > wHeight ) 88 subWrapper.css({ 'overflow-y': 'auto', 'overflow-x': 'hidden', 'height': wHeight - toolbarPlusPadding + 'px'}); 89 } 90 71 91 } else { 72 92 (function(d, w) { 73 93 var addEvent = function( obj, type, fn ) { -
wp-includes/css/admin-bar.css
10 10 font: normal 13px/28px sans-serif; 11 11 color: #ccc; 12 12 text-shadow: #444 0px -1px 0px; 13 } 13 } 14 14 15 15 #wpadminbar ul li:before, 16 16 #wpadminbar ul li:after { … … 135 135 left: auto; 136 136 margin: 0 -1px 0 0; 137 137 } 138 #wpadminbar .ab-top-secondary .menupop#wp-admin-bar-screen-help .ab-sub-wrapper { 139 right: -171px; 140 } 138 141 139 142 #wpadminbar .ab-sub-wrapper > .ab-submenu:first-child { 140 143 border-top: none; … … 310 313 } 311 314 312 315 /** 316 * Screen Options 317 */ 318 #wp-admin-bar-screen-options *, 319 #wp-admin-bar-screen-help * { 320 line-height: inherit; 321 text-shadow: none; 322 } 323 324 #wpadminbar #wp-admin-bar-screen-options ul { 325 min-width: 200px; 326 padding: 0 0 15px; 327 } 328 329 #wpadminbar #wp-admin-bar-screen-options li { 330 padding: 0 12px; 331 } 332 333 #wpadminbar #wp-admin-bar-screen-options h5 { 334 padding: 15px 0 0; 335 color: #888; 336 font-size: 11px; 337 text-transform: uppercase; 338 } 339 340 #wpadminbar #wp-admin-bar-screen-options label { 341 display: block; 342 } 343 344 #wpadminbar #wp-admin-bar-per-page-1 label { 345 display: inline; 346 } 347 348 #wpadminbar li.ab-title:hover, 349 #wpadminbar li.ab-title:focus, 350 #wpadminbar li.ab-inline:hover, 351 #wpadminbar li.ab-inline:focus { 352 background: transparent; 353 } 354 355 #wpadminbar li#wp-admin-bar-column-layout, 356 #wpadminbar li#wp-admin-bar-per-page { 357 margin-top: 15px; 358 border-top: 1px solid #e0e0e0; 359 } 360 361 #wpadminbar li.ab-inline { 362 display: inline-block; 363 padding-right: 5px !important; 364 } 365 366 #wpadminbar #wp-admin-bar-screen-options li.ab-inline * { 367 display: inline; 368 } 369 370 #wpadminbar #wp-admin-bar-screen-options input[type=checkbox] { 371 float: left; 372 margin: 7px 10px 1px 0; 373 } 374 375 #wpadminbar #wp-admin-bar-screen-options input[type=radio] { 376 float: left; 377 margin: 7px 5px 1px 0; 378 } 379 380 #wpadminbar #wp-admin-bar-screen-options .postbox-title-action { 381 display: none; 382 } 383 384 #wpadminbar input[type='number'] { 385 padding-left: 7px; 386 color: #888; 387 text-shadow: none; 388 } 389 390 /** 391 * Help 392 */ 393 #wp-admin-bar-screen-help .ab-sub-wrapper > ul { 394 width: 900px; 395 padding: 0; 396 background: #f1f1f1; 397 } 398 #wp-admin-bar-screen-help #wp-admin-bar-contextual-help-content:hover, 399 #wp-admin-bar-screen-help #wp-admin-bar-contextual-help-content:focus, 400 #wp-admin-bar-screen-help #contextual-help-columns li:hover, 401 #wp-admin-bar-screen-help #contextual-help-columns li:focus { 402 background: none; 403 } 404 405 #wpadminbar #contextual-help-columns { 406 position: relative; 407 } 408 409 #wpadminbar #contextual-help-back { 410 position: absolute; 411 top: 0; 412 bottom: 0; 413 left: 150px; 414 right: 170px; 415 border-width: 0 1px; 416 border-style: solid; 417 } 418 419 #wpadminbar #contextual-help-wrap.no-sidebar #contextual-help-back { 420 right: 0; 421 422 border-right-width: 0; 423 -webkit-border-bottom-right-radius: 2px; 424 border-bottom-right-radius: 2px; 425 } 426 427 #wpadminbar #wp-admin-bar-contextual-help-content * { 428 font-size: 12px; 429 line-height: 18px; 430 } 431 432 #wpadminbar .contextual-help-tabs { 433 float: left; 434 width: 150px; 435 margin: 0; 436 } 437 438 #wpadminbar .contextual-help-tabs ul { 439 margin: 1em 0; 440 } 441 442 #wpadminbar .contextual-help-tabs li { 443 margin-bottom: 0; 444 list-style-type: none; 445 border-style: solid; 446 border-width: 1px 0; 447 border-color: transparent; 448 } 449 450 #wpadminbar .contextual-help-tabs a { 451 display: block; 452 height: auto; 453 padding: 5px 5px 5px 12px; 454 line-height: 18px; 455 text-decoration: none; 456 } 457 458 #wpadminbar .contextual-help-tabs .active { 459 padding: 0; 460 margin: 0 -1px 0 2px; 461 border-width: 1px 0 1px 1px; 462 border-style: solid; 463 border-color: inherit; 464 background: white !important; 465 } 466 467 #wpadminbar .contextual-help-tabs-wrap { 468 padding: 0 20px; 469 overflow: auto; 470 } 471 472 #wpadminbar .contextual-help-tabs-wrap * { 473 color: #333; 474 } 475 476 #wpadminbar .help-tab-content { 477 display: none; 478 margin: 0 22px 12px 0; 479 } 480 481 #wpadminbar .help-tab-content a { 482 display: inline; 483 padding: 0; 484 margin: 0; 485 } 486 487 #wpadminbar .help-tab-content p, 488 #wpadminbar .help-tab-content li { 489 margin: 1em 0; 490 } 491 492 #wpadminbar .help-tab-content strong, 493 #wpadminbar .help-tab-content b { 494 font-weight: bold; 495 } 496 497 #wpadminbar .help-tab-content em, 498 #wpadminbar .help-tab-content i { 499 font-style: italic; 500 } 501 502 #wpadminbar .help-tab-content.active { 503 display: block; 504 } 505 506 #wpadminbar .help-tab-content li { 507 list-style-type: disc; 508 margin-left: 18px; 509 } 510 511 #wpadminbar .contextual-help-sidebar { 512 width: 150px; 513 float: right; 514 padding: 0px 8px 0 12px; 515 overflow: auto; 516 } 517 518 #wpadminbar .contextual-help-sidebar * { 519 color: #333; 520 } 521 522 #wpadminbar .contextual-help-sidebar p { 523 margin: 1em 0; 524 } 525 526 #wpadminbar .contextual-help-sidebar a { 527 display: inline; 528 height: auto; 529 padding: 0; 530 text-decoration: underline; 531 } 532 533 #wpadminbar .contextual-help-sidebar strong { 534 font-weight: bold; 535 } 536 537 /** 313 538 * My Account 314 539 */ 315 540 #wp-admin-bar-my-account > ul { … … 517 742 } 518 743 519 744 /** 745 * Sticky menu toggle arrows 746 */ 747 #wpadminbar .sticky .sticky-indicator { 748 position: relative; 749 float: right; 750 width: 20px; 751 height: 16px; 752 margin-top: 6px; 753 background-image: url("../images/admin-bar-sprite.png"); 754 background-position: 0 -254px; 755 background-repeat: no-repeat; 756 cursor: pointer; 757 } 758 759 #wpadminbar .sticky.hover .sticky-indicator { 760 background-position: 0 -228px; 761 } 762 763 /** 520 764 * WP Logo icon 521 765 */ 522 766 #wp-admin-bar-wp-logo > .ab-item .ab-icon { … … 573 817 } 574 818 575 819 /** 820 * Screen Settings icon 821 */ 822 #wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon { 823 background-image: url(../images/admin-bar-sprite.png?d=20111130); 824 background-position: -3px -252px; 825 background-repeat: no-repeat; 826 } 827 828 #wpadminbar.nojs #wp-admin-bar-screen-options:hover > .ab-item .ab-icon, 829 #wpadminbar #wp-admin-bar-screen-options.hover > .ab-item .ab-icon { 830 background-image: url(../images/admin-bar-sprite.png?d=20111130); 831 background-position: -3px -228px; 832 background-repeat: no-repeat; 833 } 834 835 /** 576 836 * Customize support classes 577 837 */ 578 838 .no-customize-support .hide-if-no-customize, … … 590 850 #wp-admin-bar-wp-logo > .ab-item .ab-icon, 591 851 #wp-admin-bar-updates > .ab-item .ab-icon, 592 852 #wp-admin-bar-comments > .ab-item .ab-icon, 593 #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon { 594 background-image: url(../images/admin-bar-sprite-2x.png?d=20120830); 595 background-size: 20px 220px; 853 #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon, 854 #wpadminbar #wp-admin-bar-screen-options > .ab-item .ab-icon, 855 #wpadminbar .sticky .sticky-indicator { 856 background-image: url( "../images/admin-bar-sprite-2x.png?d=20120830" ); 857 background-size: 20px 276px; 596 858 } 597 859 } 598 860 -
wp-includes/class-wp-admin-bar.php
104 104 'parent' => false, 105 105 'href' => false, 106 106 'group' => false, 107 'sticky' => false, 107 108 'meta' => array(), 108 109 ); 109 110 … … 396 397 397 398 $is_parent = ! empty( $node->children ); 398 399 $has_link = ! empty( $node->href ); 400 $has_title = ! empty( $node->title ); 401 $is_sticky = $node->sticky === true ? true : false; 399 402 400 403 $tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : ''; 401 404 $aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : ''; … … 410 413 if ( ! empty( $node->meta['class'] ) ) 411 414 $menuclass .= $node->meta['class']; 412 415 416 if ( $is_sticky ) 417 $menuclass .= 'sticky'; 418 413 419 if ( $menuclass ) 414 420 $menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"'; 415 421 416 422 ?> 417 423 418 424 <li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php 419 if ( $has_link ): 420 ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php 421 if ( ! empty( $node->meta['onclick'] ) ) : 422 ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php 425 if ( $has_title ): 426 if ( $has_link ): 427 ?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php 428 if ( ! empty( $node->meta['onclick'] ) ) : 429 ?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php 430 endif; 431 if ( ! empty( $node->meta['target'] ) ) : 432 ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php 423 433 endif; 424 if ( ! empty( $node->meta['target'] ) ) : 425 ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php 434 if ( ! empty( $node->meta['title'] ) ) : 435 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 436 endif; 437 ?>><?php 438 else: 439 ?><a href="#" onclick="return false;" class="ab-item ab-empty-item" <?php echo $aria_attributes; 440 if ( ! empty( $node->meta['title'] ) ) : 441 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 442 endif; 443 ?>><?php 426 444 endif; 427 if ( ! empty( $node->meta['title'] ) ) : 428 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 445 446 echo $node->title; 447 448 if ( $is_sticky ) : 449 ?><span class="sticky-indicator"></span><?php 429 450 endif; 430 ?>><?php 431 else:432 ?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;433 if ( ! empty( $node->meta['title'] ) ):434 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php451 452 if ( $has_link ) : 453 ?></a><?php 454 else: 455 ?></a><?php 435 456 endif; 436 ?>><?php437 457 endif; 438 458 439 echo $node->title;440 441 if ( $has_link ) :442 ?></a><?php443 else:444 ?></div><?php445 endif;446 447 459 if ( $is_parent ) : 448 460 ?><div class="ab-sub-wrapper"><?php 449 461 foreach ( $node->children as $group ) { … … 455 467 if ( ! empty( $node->meta['html'] ) ) 456 468 echo $node->meta['html']; 457 469 470 if ( ! empty( $node->meta['html_callback'] ) ) 471 call_user_func( $node->meta['html_callback'] ); 458 472 ?> 459 473 </li><?php 460 474 } … … 483 497 } 484 498 add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); 485 499 500 if ( is_admin() ) 501 add_action( 'admin_bar_menu', 'wp_admin_bar_screen_options', 90 ); 502 486 503 add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); 487 504 488 505 do_action( 'add_admin_bar_menus' ); -
wp-admin/includes/screen.php
49 49 * @param string|WP_Screen $screen 50 50 */ 51 51 function meta_box_prefs( $screen ) { 52 global $wp_meta_boxes; 53 54 if ( is_string( $screen ) ) 55 $screen = convert_to_screen( $screen ); 56 57 if ( empty($wp_meta_boxes[$screen->id]) ) 58 return; 59 60 $hidden = get_hidden_meta_boxes($screen); 61 62 foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { 63 foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { 64 foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { 65 if ( false == $box || ! $box['title'] ) 66 continue; 67 // Submit box cannot be hidden 68 if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) 69 continue; 70 $box_id = $box['id']; 71 echo '<label for="' . $box_id . '-hide">'; 72 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"' : '') . ' />'; 73 echo "{$box['title']}</label>\n"; 74 } 75 } 76 } 52 return; 77 53 } 78 54 79 55 /** … … 754 730 * @since 3.3.0 755 731 */ 756 732 public function render_screen_meta() { 733 return; 734 } 757 735 736 public function show_screen_options() { 737 global $wp_meta_boxes; 738 739 if ( is_bool( $this->_show_screen_options ) ) 740 return $this->_show_screen_options; 741 742 $columns = get_column_headers( $this ); 743 744 $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); 745 746 $this->_screen_settings = apply_filters( 'screen_settings', '', $this ); 747 748 switch ( $this->id ) { 749 case 'widgets': 750 $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"; 751 break; 752 } 753 754 if ( $this->_screen_settings || $this->_options ) 755 $show_screen = true; 756 757 $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); 758 return $this->_show_screen_options; 759 } 760 761 /** 762 * Render the screen options tab. 763 * 764 * @since 3.3.0 765 */ 766 public function render_screen_options() { 767 return; 768 } 769 770 /* 771 * Render screen options in the admin bar 772 * 773 */ 774 function render_options( $parent, $wp_admin_bar ) { 775 $this->render_show_on_screen( $parent, $wp_admin_bar ); 776 $this->render_layout( $parent, $wp_admin_bar ); 777 $this->render_per_page( $parent, $wp_admin_bar ); 778 // @todo $this->_screen_settings 779 } 780 781 function render_show_on_screen( $parent, $wp_admin_bar ) { 782 global $wp_meta_boxes; 783 784 if ( ! $this->show_screen_options() ) 785 return; 786 787 $columns = get_column_headers( $this ); 788 789 if ( ! isset( $wp_meta_boxes[ $this->id ] ) && ( ! $columns || isset( $columns['_title'] ) ) ) 790 return; 791 792 $wp_admin_bar->add_menu( array( 793 'id' => 'show-on-screen', 794 'parent' => $parent, 795 'href' => '', 796 'meta' => array( 797 'html' => '<h5 class="ab-item">' . __( 'Show on screen' ) . '</h5>', 798 'class' => 'ab-title' 799 ), 800 ) ); 801 802 // Render meta box show/hide. 803 if ( isset( $wp_meta_boxes[ $this->id ] ) ) { 804 $hidden = get_hidden_meta_boxes($this); 805 806 foreach ( array_keys($wp_meta_boxes[$this->id]) as $context ) { 807 foreach ( array_keys($wp_meta_boxes[$this->id][$context]) as $priority ) { 808 foreach ( $wp_meta_boxes[$this->id][$context][$priority] as $box ) { 809 if ( false == $box || ! $box['title'] ) 810 continue; 811 // Submit box cannot be hidden 812 if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) 813 continue; 814 $box_id = $box['id']; 815 $html = '<label class="ab-item" for="' . $box_id . '-hide">' . 816 '<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"' : '') . ' />' . 817 "{$box['title']}</label>\n"; 818 $wp_admin_bar->add_menu( array( 819 'id' => 'show-on-screen-' . $box_id, 820 'parent' => $parent, 821 'href' => '', 822 'meta' => array( 'html' => $html ), 823 ) ); 824 } 825 } 826 } 827 828 if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) { 829 if ( isset( $_GET['welcome'] ) ) { 830 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; 831 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); 832 } else { 833 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); 834 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) 835 $welcome_checked = false; 836 } 837 $html = '<label class="ab-item" for="wp_welcome_panel-hide">' . 838 '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />' . 839 _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; 840 $wp_admin_bar->add_menu( array( 841 'id' => 'show-on-screen-' . $box_id, 842 'parent' => $parent, 843 'href' => '', 844 'meta' => array( 'html' => $html ), 845 ) ); 846 } 847 } 848 849 // Render column show/hide. 850 if ( $columns ) { 851 $hidden = get_hidden_columns( $this ); 852 853 if ( ! empty( $columns['_title'] ) ) { 854 echo '<h5>' . $columns['_title'] . '</h5>'; 855 } 856 857 $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); 858 859 foreach ( $columns as $column => $title ) { 860 // Can't hide these for they are special 861 if ( in_array( $column, $special ) ) 862 continue; 863 if ( empty( $title ) ) 864 continue; 865 866 if ( 'comments' == $column ) 867 $title = __( 'Comments' ); 868 $id = "$column-hide"; 869 $html = '<label class="ab-item" for="' . $id . '">' . 870 '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />' . 871 "$title</label>\n"; 872 $wp_admin_bar->add_menu( array( 873 'id' => 'show-on-screen-' . $column, 874 'parent' => $parent, 875 'href' => '', 876 'meta' => array( 'html' => $html ), 877 ) ); 878 } 879 } 880 } 881 882 function render_layout( $parent, $wp_admin_bar ) { 883 // Back compat for plugins using the filter instead of add_screen_option() 884 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); 885 886 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) 887 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 888 889 if ( $this->get_option( 'layout_columns' ) ) { 890 $this->columns = (int) get_user_option("screen_layout_$this->id"); 891 892 if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) 893 $this->columns = $this->get_option( 'layout_columns', 'default' ); 894 } 895 $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. 896 897 if ( ! $this->get_option('layout_columns') ) 898 return; 899 900 $screen_layout_columns = $this->get_columns(); 901 $num = $this->get_option( 'layout_columns', 'max' ); 902 903 $wp_admin_bar->add_menu( array( 904 'id' => 'column-layout', 905 'parent' => $parent, 906 'href' => '', 907 'meta' => array( 908 'html' => '<h5 class="ab-item">' . __( 'Column Layout' ) . '</h5>', 909 'class' => 'ab-title' 910 ), 911 ) ); 912 913 for ( $i = 1; $i <= $num; ++$i ) { 914 $html = '<label class="ab-item columns-prefs columns-prefs-' . $i . '">' . 915 "<input type='radio' name='screen_columns' value='" . $i . "'" . 916 checked( $screen_layout_columns, $i, false ) . '/>' . 917 esc_html( $i ) . 918 '</label>'; 919 920 $wp_admin_bar->add_menu( array( 921 'id' => 'column-layout-' . $i, 922 'parent' => $parent, 923 'href' => '', 924 'meta' => array( 925 'html' => $html, 926 'class' => 'ab-inline' 927 ), 928 ) ); 929 } 930 } 931 932 /** 933 * Render the items per page option 934 * 935 * @since 3.5.0 936 */ 937 function render_per_page( $parent, $wp_admin_bar ) { 938 // @todo form and nonce 939 // wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); 940 941 if ( ! $this->get_option( 'per_page' ) ) 942 return; 943 944 $per_page_label = $this->get_option( 'per_page', 'label' ); 945 946 $option = $this->get_option( 'per_page', 'option' ); 947 if ( ! $option ) 948 $option = str_replace( '-', '_', "{$this->id}_per_page" ); 949 950 $per_page = (int) get_user_option( $option ); 951 if ( empty( $per_page ) || $per_page < 1 ) { 952 $per_page = $this->get_option( 'per_page', 'default' ); 953 if ( ! $per_page ) 954 $per_page = 20; 955 } 956 957 if ( 'edit_comments_per_page' == $option ) { 958 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; 959 $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); 960 } elseif ( 'categories_per_page' == $option ) { 961 $per_page = apply_filters( 'edit_categories_per_page', $per_page ); 962 } else { 963 $per_page = apply_filters( $option, $per_page ); 964 } 965 966 // Back compat 967 if ( isset( $this->post_type ) ) 968 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); 969 970 $wp_admin_bar->add_menu( array( 971 'id' => 'per-page', 972 'parent' => $parent, 973 'href' => '', 974 'meta' => array( 975 'html' => '<h5 class="ab-item">' . __( 'Items Per Page' ) . '</h5>', 976 'class' => 'ab-title' 977 ), 978 ) ); 979 980 if ( $per_page_label ) { 981 $html = '<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" 982 id="' . esc_attr( $option ) . '" maxlength="3" value="' . esc_attr( $per_page ) . '" />'; 983 $wp_admin_bar->add_menu( array( 984 'id' => 'per-page-1', 985 'parent' => $parent, 986 'href' => '', 987 'meta' => array( 988 'html' => $html, 989 'class' => 'ab-inline' 990 ), 991 ) ); 992 } 993 994 $html = get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ) . 995 "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />"; 996 997 $wp_admin_bar->add_menu( array( 998 'id' => 'per-page-submit', 999 'parent' => $parent, 1000 'href' => '', 1001 'meta' => array( 1002 'html' => $html, 1003 'class' => 'ab-inline' 1004 ), 1005 ) ); 1006 } 1007 1008 function render_help( $parent, $wp_admin_bar ) { 758 1009 // Call old contextual_help_list filter. 759 1010 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); 760 1011 … … 776 1027 ) ); 777 1028 } 778 1029 1030 $wp_admin_bar->add_menu( array( 1031 'id' => 'contextual-help-content', 1032 'parent' => $parent, 1033 'href' => '', 1034 'meta' => array( 'html_callback' => array( $this, '_render_help' ) ), 1035 ) ); 1036 } 1037 1038 function _render_help() { 779 1039 $help_sidebar = $this->get_help_sidebar(); 1040 $help_class = ''; 780 1041 781 $help_class = 'hidden';782 1042 if ( ! $help_sidebar ) 783 1043 $help_class .= ' no-sidebar'; 784 1044 785 1045 // Time to render! 786 1046 ?> 787 <div id="screen-meta" class="metabox-prefs">788 789 1047 <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> 790 1048 <div id="contextual-help-back"></div> 791 1049 <div id="contextual-help-columns"> … … 841 1099 </div> 842 1100 </div> 843 1101 <?php 844 // Setup layout columns845 846 // Back compat for plugins using the filter instead of add_screen_option()847 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this );848 849 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )850 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );851 852 if ( $this->get_option( 'layout_columns' ) ) {853 $this->columns = (int) get_user_option("screen_layout_$this->id");854 855 if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) )856 $this->columns = $this->get_option( 'layout_columns', 'default' );857 }858 $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat.859 860 // Add screen options861 if ( $this->show_screen_options() )862 $this->render_screen_options();863 ?>864 </div>865 <?php866 if ( ! $this->get_help_tabs() && ! $this->show_screen_options() )867 return;868 ?>869 <div id="screen-meta-links">870 <?php if ( $this->get_help_tabs() ) : ?>871 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">872 <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a>873 </div>874 <?php endif;875 if ( $this->show_screen_options() ) : ?>876 <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">877 <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>878 </div>879 <?php endif; ?>880 </div>881 <?php882 1102 } 883 1103 884 public function show_screen_options() {885 global $wp_meta_boxes;886 887 if ( is_bool( $this->_show_screen_options ) )888 return $this->_show_screen_options;889 890 $columns = get_column_headers( $this );891 892 $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );893 894 $this->_screen_settings = apply_filters( 'screen_settings', '', $this );895 896 switch ( $this->id ) {897 case 'widgets':898 $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";899 break;900 }901 902 if ( $this->_screen_settings || $this->_options )903 $show_screen = true;904 905 $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );906 return $this->_show_screen_options;907 }908 909 1104 /** 910 * Render the screen options tab.911 *912 * @since 3.3.0913 */914 public function render_screen_options() {915 global $wp_meta_boxes, $wp_list_table;916 917 $columns = get_column_headers( $this );918 $hidden = get_hidden_columns( $this );919 920 ?>921 <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">922 <form id="adv-settings" action="" method="post">923 <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>924 <h5><?php _e( 'Show on screen' ); ?></h5>925 <?php926 endif;927 928 if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?>929 <div class="metabox-prefs">930 <?php931 meta_box_prefs( $this );932 933 if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) {934 if ( isset( $_GET['welcome'] ) ) {935 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;936 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );937 } else {938 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );939 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) )940 $welcome_checked = false;941 }942 echo '<label for="wp_welcome_panel-hide">';943 echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';944 echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";945 }946 ?>947 <br class="clear" />948 </div>949 <?php endif;950 if ( $columns ) :951 if ( ! empty( $columns['_title'] ) ) : ?>952 <h5><?php echo $columns['_title']; ?></h5>953 <?php endif; ?>954 <div class="metabox-prefs">955 <?php956 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');957 958 foreach ( $columns as $column => $title ) {959 // Can't hide these for they are special960 if ( in_array( $column, $special ) )961 continue;962 if ( empty( $title ) )963 continue;964 965 if ( 'comments' == $column )966 $title = __( 'Comments' );967 $id = "$column-hide";968 echo '<label for="' . $id . '">';969 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />';970 echo "$title</label>\n";971 }972 ?>973 <br class="clear" />974 </div>975 <?php endif;976 977 $this->render_screen_layout();978 $this->render_per_page_options();979 echo $this->_screen_settings;980 981 ?>982 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>983 </form>984 </div>985 <?php986 }987 988 /**989 1105 * Render the option for number of columns on the page 990 1106 * 991 1107 * @since 3.3.0 992 1108 */ 993 1109 function render_screen_layout() { 994 if ( ! $this->get_option('layout_columns') ) 995 return; 996 997 $screen_layout_columns = $this->get_columns(); 998 $num = $this->get_option( 'layout_columns', 'max' ); 999 1000 ?> 1001 <h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5> 1002 <div class='columns-prefs'><?php 1003 _e('Number of Columns:'); 1004 for ( $i = 1; $i <= $num; ++$i ): 1005 ?> 1006 <label class="columns-prefs-<?php echo $i; ?>"> 1007 <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' 1008 <?php checked( $screen_layout_columns, $i ); ?> /> 1009 <?php echo esc_html( $i ); ?> 1010 </label> 1011 <?php 1012 endfor; ?> 1013 </div> 1014 <?php 1110 return; 1015 1111 } 1016 1112 1017 1113 /** … … 1020 1116 * @since 3.3.0 1021 1117 */ 1022 1118 function render_per_page_options() { 1023 if ( ! $this->get_option( 'per_page' ) ) 1024 return; 1025 1026 $per_page_label = $this->get_option( 'per_page', 'label' ); 1027 1028 $option = $this->get_option( 'per_page', 'option' ); 1029 if ( ! $option ) 1030 $option = str_replace( '-', '_', "{$this->id}_per_page" ); 1031 1032 $per_page = (int) get_user_option( $option ); 1033 if ( empty( $per_page ) || $per_page < 1 ) { 1034 $per_page = $this->get_option( 'per_page', 'default' ); 1035 if ( ! $per_page ) 1036 $per_page = 20; 1037 } 1038 1039 if ( 'edit_comments_per_page' == $option ) { 1040 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; 1041 $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); 1042 } elseif ( 'categories_per_page' == $option ) { 1043 $per_page = apply_filters( 'edit_categories_per_page', $per_page ); 1044 } else { 1045 $per_page = apply_filters( $option, $per_page ); 1046 } 1047 1048 // Back compat 1049 if ( isset( $this->post_type ) ) 1050 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); 1051 1052 ?> 1053 <div class="screen-options"> 1054 <?php if ( $per_page_label ) : ?> 1055 <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" 1056 id="<?php echo esc_attr( $option ); ?>" maxlength="3" 1057 value="<?php echo esc_attr( $per_page ); ?>" /> 1058 <label for="<?php echo esc_attr( $option ); ?>"> 1059 <?php echo esc_html( $per_page_label ); ?> 1060 </label> 1061 <?php endif; 1062 1063 echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?> 1064 <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' /> 1065 </div> 1066 <?php 1119 return; 1067 1120 } 1068 1121 } -
wp-admin/admin-header.php
115 115 <div id="wpcontent"> 116 116 117 117 <?php 118 $current_screen->set_parentage( $parent_file ); 118 119 do_action('in_admin_header'); 119 120 ?> 120 121 … … 122 123 <?php 123 124 unset($title_class, $blog_name, $total_update_count, $update_title); 124 125 125 $current_screen->set_parentage( $parent_file );126 127 126 ?> 128 127 129 128 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>"> 130 129 <?php 131 130 132 $current_screen->render_screen_meta();133 134 131 if ( is_network_admin() ) 135 132 do_action('network_admin_notices'); 136 133 elseif ( is_user_admin() ) -
wp-admin/css/wp-admin.css
1118 1118 #screen-options-wrap, 1119 1119 #contextual-help-wrap { 1120 1120 margin: 0; 1121 padding: 8px 20px 12px;1122 1121 position: relative; 1123 1122 overflow: auto; 1124 1123 } … … 1217 1216 display: none; 1218 1217 } 1219 1218 1220 /*------------------------------------------------------------------------------1221 6.2 - Help Menu1222 ------------------------------------------------------------------------------*/1223 1219 1224 #contextual-help-wrap {1225 padding: 0;1226 margin-left: -4px;1227 }1228 1229 #contextual-help-columns {1230 position: relative;1231 }1232 1233 #contextual-help-back {1234 position: absolute;1235 top: 0;1236 bottom: 0;1237 left: 150px;1238 right: 170px;1239 border-width: 0 1px;1240 border-style: solid;1241 }1242 1243 #contextual-help-wrap.no-sidebar #contextual-help-back {1244 right: 0;1245 1246 border-right-width: 0;1247 -webkit-border-bottom-right-radius: 2px;1248 border-bottom-right-radius: 2px;1249 }1250 1251 .contextual-help-tabs {1252 float: left;1253 width: 150px;1254 margin: 0;1255 }1256 1257 .contextual-help-tabs ul {1258 margin: 1em 0;1259 }1260 1261 .contextual-help-tabs li {1262 margin-bottom: 0;1263 list-style-type: none;1264 border-style: solid;1265 border-width: 1px 0;1266 border-color: transparent;1267 }1268 1269 .contextual-help-tabs a {1270 display: block;1271 padding: 5px 5px 5px 12px;1272 line-height: 18px;1273 text-decoration: none;1274 }1275 1276 .contextual-help-tabs .active {1277 padding: 0;1278 margin: 0 -1px 0 0;1279 border-width: 1px 0 1px 1px;1280 border-style: solid;1281 }1282 1283 .contextual-help-tabs-wrap {1284 padding: 0 20px;1285 overflow: auto;1286 }1287 1288 .help-tab-content {1289 display: none;1290 margin: 0 22px 12px 0;1291 line-height: 1.6em;1292 }1293 1294 .help-tab-content.active {1295 display: block;1296 }1297 1298 .help-tab-content li {1299 list-style-type: disc;1300 margin-left: 18px;1301 }1302 1303 .contextual-help-sidebar {1304 width: 150px;1305 float: right;1306 padding: 0 8px 0 12px;1307 overflow: auto;1308 }1309 1310 1311 1220 /*------------------------------------------------------------------------------ 1312 1221 7.0 - Main Navigation (Left Menu) 1313 1222 ------------------------------------------------------------------------------*/