Ticket #21583: 21583.6.diff
File 21583.6.diff, 19.4 KB (added by , 12 years ago) |
---|
-
wp-includes/js/admin-bar.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
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 16 }, … … 20 20 timeout: 180, 21 21 sensitivity: 7, 22 22 interval: 100 23 }); 24 25 $('.sticky', '#wpadminbar').click(function(e){ 26 e.preventDefault(); 27 $(this).toggleClass('hover'); 23 28 }); 24 29 25 30 $('#wp-admin-bar-get-shortlink').click(function(e){ -
wp-admin/admin-header.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
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 132 $current_screen->render_screen_meta();133 130 134 131 if ( is_network_admin() ) 135 132 do_action('network_admin_notices'); -
wp-includes/admin-bar.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
656 656 ) ); 657 657 } 658 658 659 function wp_admin_bar_screen_options( $wp_admin_bar ) { 660 661 $wp_admin_bar->add_menu( array( 662 'parent' => 'top-secondary', 663 'id' => 'screen-options', 664 'title' => '(cog)', 665 'href' => '', 666 ) ); 667 668 get_current_screen()->render_options( 'screen-options', $wp_admin_bar ); 669 } 659 670 /** 660 671 * Add secondary menus. 661 672 * -
wp-admin/includes/screen.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
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 } 77 } 52 return; 53 } 78 54 79 55 /** 80 56 * Get Hidden Meta Boxes … … 870 846 * @since 3.3.0 871 847 */ 872 848 public function render_screen_options() { 873 global $wp_meta_boxes, $wp_list_table; 849 return; 850 } 874 851 852 /* 853 * Render screen options in the admin bar 854 * 855 */ 856 function render_options( $parent, $wp_admin_bar ) { 857 $this->render_show_on_screen( $parent, $wp_admin_bar ); 858 $this->render_layout( $parent, $wp_admin_bar ); 859 $this->render_per_page( $parent, $wp_admin_bar ); 860 // @todo $this->_screen_settings 861 } 862 863 function render_show_on_screen( $parent, $wp_admin_bar ) { 864 global $wp_meta_boxes; 865 866 if ( ! $this->show_screen_options() ) 867 return; 868 875 869 $columns = get_column_headers( $this ); 876 $hidden = get_hidden_columns( $this );877 870 878 ?> 879 <div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>"> 880 <form id="adv-settings" action="" method="post"> 881 <?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?> 882 <h5><?php _e( 'Show on screen' ); ?></h5> 883 <?php 884 endif; 871 if ( ! isset( $wp_meta_boxes[ $this->id ] ) && ( ! $columns || isset( $columns['_title'] ) ) ) 872 return; 885 873 886 if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?> 887 <div class="metabox-prefs"> 888 <?php 889 meta_box_prefs( $this ); 874 $wp_admin_bar->add_menu( array( 875 'id' => 'show-on-screen', 876 'parent' => $parent, 877 'href' => '', 878 'meta' => array( 'html' => '<h5 class="ab-item">' . __( 'Show on screen' ) . '</h5>' ), 879 ) ); 890 880 891 if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) { 892 if ( isset( $_GET['welcome'] ) ) { 893 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; 894 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); 895 } else { 896 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); 897 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) 898 $welcome_checked = false; 899 } 900 echo '<label for="wp_welcome_panel-hide">'; 901 echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; 902 echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; 903 } 904 ?> 905 <br class="clear" /> 906 </div> 907 <?php endif; 908 if ( $columns ) : 909 if ( ! empty( $columns['_title'] ) ) : ?> 910 <h5><?php echo $columns['_title']; ?></h5> 911 <?php endif; ?> 912 <div class="metabox-prefs"> 913 <?php 914 $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); 915 916 foreach ( $columns as $column => $title ) { 917 // Can't hide these for they are special 918 if ( in_array( $column, $special ) ) 919 continue; 920 if ( empty( $title ) ) 921 continue; 922 923 if ( 'comments' == $column ) 924 $title = __( 'Comments' ); 925 $id = "$column-hide"; 926 echo '<label for="' . $id . '">'; 927 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />'; 928 echo "$title</label>\n"; 929 } 930 ?> 931 <br class="clear" /> 932 </div> 933 <?php endif; 881 // Render meta box show/hide. 882 if ( isset( $wp_meta_boxes[ $this->id ] ) ) { 883 $hidden = get_hidden_meta_boxes($this); 884 885 foreach ( array_keys($wp_meta_boxes[$this->id]) as $context ) { 886 foreach ( array_keys($wp_meta_boxes[$this->id][$context]) as $priority ) { 887 foreach ( $wp_meta_boxes[$this->id][$context][$priority] as $box ) { 888 if ( false == $box || ! $box['title'] ) 889 continue; 890 // Submit box cannot be hidden 891 if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) 892 continue; 893 $box_id = $box['id']; 894 $html = '<label class="ab-item" for="' . $box_id . '-hide">' . 895 '<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"' : '') . ' />' . 896 "{$box['title']}</label>\n"; 897 $wp_admin_bar->add_menu( array( 898 'id' => 'show-on-screen-' . $box_id, 899 'parent' => $parent, 900 'href' => '', 901 'meta' => array( 'html' => $html ), 902 ) ); 903 } 904 } 905 } 906 907 if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) { 908 if ( isset( $_GET['welcome'] ) ) { 909 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; 910 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); 911 } else { 912 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); 913 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) 914 $welcome_checked = false; 915 } 916 $html = '<label class="ab-item" for="wp_welcome_panel-hide">' . 917 '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />' . 918 _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; 919 $wp_admin_bar->add_menu( array( 920 'id' => 'show-on-screen-' . $box_id, 921 'parent' => $parent, 922 'href' => '', 923 'meta' => array( 'html' => $html ), 924 ) ); 925 } 926 } 927 928 // Render column show/hide. 929 if ( $columns ) { 930 $hidden = get_hidden_columns( $this ); 931 932 if ( ! empty( $columns['_title'] ) ) { 933 echo '<h5>' . $columns['_title'] . '</h5>'; 934 } 935 936 $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); 937 938 foreach ( $columns as $column => $title ) { 939 // Can't hide these for they are special 940 if ( in_array( $column, $special ) ) 941 continue; 942 if ( empty( $title ) ) 943 continue; 944 945 if ( 'comments' == $column ) 946 $title = __( 'Comments' ); 947 $id = "$column-hide"; 948 $html = '<label class="ab-item" for="' . $id . '">' . 949 '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />' . 950 "$title</label>\n"; 951 $wp_admin_bar->add_menu( array( 952 'id' => 'show-on-screen-' . $column, 953 'parent' => $parent, 954 'href' => '', 955 'meta' => array( 'html' => $html ), 956 ) ); 957 } 958 } 959 } 934 960 935 $this->render_screen_layout();936 $this->render_per_page_options();937 echo $this->_screen_settings;961 function render_layout( $parent, $wp_admin_bar ) { 962 // Back compat for plugins using the filter instead of add_screen_option() 963 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); 938 964 939 ?> 940 <div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div> 941 </form> 942 </div> 943 <?php 944 } 965 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) 966 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 967 968 if ( $this->get_option( 'layout_columns' ) ) { 969 $this->columns = (int) get_user_option("screen_layout_$this->id"); 970 971 if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) 972 $this->columns = $this->get_option( 'layout_columns', 'default' ); 973 } 974 $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. 945 975 946 /**947 * Render the option for number of columns on the page948 *949 * @since 3.3.0950 */951 function render_screen_layout() {952 976 if ( ! $this->get_option('layout_columns') ) 953 977 return; 954 978 955 979 $screen_layout_columns = $this->get_columns(); 956 980 $num = $this->get_option( 'layout_columns', 'max' ); 957 981 958 ?> 959 <h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5> 960 <div class='columns-prefs'><?php 961 _e('Number of Columns:'); 962 for ( $i = 1; $i <= $num; ++$i ): 963 ?> 964 <label class="columns-prefs-<?php echo $i; ?>"> 965 <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' 966 <?php checked( $screen_layout_columns, $i ); ?> /> 967 <?php echo esc_html( $i ); ?> 968 </label> 969 <?php 970 endfor; ?> 971 </div> 972 <?php 973 } 982 $wp_admin_bar->add_menu( array( 983 'id' => 'column-layout', 984 'parent' => $parent, 985 'href' => '', 986 'meta' => array( 'html' => '<h5 class="ab-item">' . __( 'Column Layout' ) . '</h5>' ), 987 ) ); 988 989 for ( $i = 1; $i <= $num; ++$i ) { 990 $html = '<label class="ab-item" class="columns-prefs-' . $i . '">' . 991 "<input type='radio' name='screen_columns' value='" . $i . "'" . 992 checked( $screen_layout_columns, $i, false ) . '/>' . 993 esc_html( $i ) . 994 '</label>'; 995 996 $wp_admin_bar->add_menu( array( 997 'id' => 'column-layout-' . $i, 998 'parent' => $parent, 999 'href' => '', 1000 'meta' => array( 'html' => $html ), 1001 ) ); 1002 } 1003 } 974 1004 975 1005 /** 976 1006 * Render the items per page option 977 1007 * 978 * @since 3. 3.01008 * @since 3.5.0 979 1009 */ 980 function render_per_page_options() { 1010 function render_per_page( $parent, $wp_admin_bar ) { 1011 // @todo form and nonce 1012 // wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); 1013 981 1014 if ( ! $this->get_option( 'per_page' ) ) 982 1015 return; 983 1016 … … 1007 1040 if ( isset( $this->post_type ) ) 1008 1041 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); 1009 1042 1010 ?> 1011 <div class="screen-options"> 1012 <?php if ( $per_page_label ) : ?> 1013 <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" 1014 id="<?php echo esc_attr( $option ); ?>" maxlength="3" 1015 value="<?php echo esc_attr( $per_page ); ?>" /> 1016 <label for="<?php echo esc_attr( $option ); ?>"> 1017 <?php echo esc_html( $per_page_label ); ?> 1018 </label> 1019 <?php endif; 1043 $wp_admin_bar->add_menu( array( 1044 'id' => 'per-page', 1045 'parent' => $parent, 1046 'href' => '', 1047 'meta' => array( 'html' => '<h5 class="ab-item">' . __( 'Items Per Page' ) . '</h5>' ), 1048 ) ); 1020 1049 1021 echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?> 1022 <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' /> 1023 </div> 1024 <?php 1050 if ( $per_page_label ) { 1051 $html = '<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" 1052 id="' . esc_attr( $option ) . '" maxlength="3" value="' . esc_attr( $per_page ) . '" />' . 1053 '<label class="ab-item" for="' . esc_attr( $option ) . '">' . 1054 esc_html( $per_page_label ) . 1055 '</label>'; 1056 $wp_admin_bar->add_menu( array( 1057 'id' => 'per-page-1', 1058 'parent' => $parent, 1059 'href' => '', 1060 'meta' => array( 'html' => $html ), 1061 ) ); 1062 } 1063 1064 $html = get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ) . 1065 "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />"; 1066 1067 $wp_admin_bar->add_menu( array( 1068 'id' => 'per-page-submit', 1069 'parent' => $parent, 1070 'href' => '', 1071 'meta' => array( 'html' => $html ), 1072 ) ); 1073 } 1074 1075 /** 1076 * Render the option for number of columns on the page 1077 * 1078 * @since 3.3.0 1079 */ 1080 function render_screen_layout() { 1081 return; 1082 } 1083 1084 /** 1085 * Render the items per page option 1086 * 1087 * @since 3.3.0 1088 */ 1089 function render_per_page_options() { 1090 return; 1025 1091 } 1026 1092 } -
wp-includes/css/admin-bar.css
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
517 517 } 518 518 519 519 /** 520 * Sticky menu toggle arrows 521 */ 522 #wpadminbar .sticky .sticky-indicator { 523 position: relative; 524 float: right; 525 width: 20px; 526 height: 16px; 527 margin-top: 6px; 528 background-image: url("../images/admin-bar-sprite.png"); 529 background-position: 0 -254px; 530 background-repeat: no-repeat; 531 cursor: pointer; 532 } 533 534 #wpadminbar .sticky.hover .sticky-indicator { 535 background-position: 0 -228px; 536 } 537 538 /** 520 539 * WP Logo icon 521 540 */ 522 541 #wp-admin-bar-wp-logo > .ab-item .ab-icon { … … 590 609 #wp-admin-bar-wp-logo > .ab-item .ab-icon, 591 610 #wp-admin-bar-updates > .ab-item .ab-icon, 592 611 #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=20120516); 595 background-size: 20px 220px; 612 #wpadminbar #wp-admin-bar-new-content > .ab-item .ab-icon, 613 #wpadminbar .sticky .sticky-indicator { 614 background-image: url("../images/admin-bar-sprite-2x.png?d=20120516"); 615 background-size: 20px 276px; 596 616 } 597 617 } 598 618 -
wp-includes/class-wp-admin-bar.php
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
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 423 endif; 424 if ( ! empty( $node->meta['target'] ) ) : 425 ?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php 426 endif; 427 if ( ! empty( $node->meta['title'] ) ) : 428 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 429 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'] ); ?>"<?php 435 endif; 436 ?>><?php 437 endif; 438 439 echo $node->title; 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 433 endif; 434 if ( ! empty( $node->meta['title'] ) ) : 435 ?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php 436 endif; 437 ?>><?php 438 else: 439 ?><div 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 444 endif; 445 446 echo $node->title; 440 447 441 if ( $has_link ) : 442 ?></a><?php 443 else: 444 ?></div><?php 445 endif; 448 if ( $is_sticky ) : 449 ?><span class="sticky-indicator"></span><?php 450 endif; 451 452 if ( $has_link ) : 453 ?></a><?php 454 else: 455 ?></div><?php 456 endif; 457 endif; 446 458 447 459 if ( $is_parent ) : 448 460 ?><div class="ab-sub-wrapper"><?php … … 482 494 add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 ); 483 495 } 484 496 add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); 497 498 if ( is_admin() ) 499 add_action( 'admin_bar_menu', 'wp_admin_bar_screen_options', 90 ); 485 500 486 501 add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 ); 487 502