Changeset 33130 for trunk/src/wp-includes/admin-bar.php
- Timestamp:
- 07/08/2015 08:02:44 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/admin-bar.php
r32917 r33130 317 317 wp_admin_bar_appearance_menu( $wp_admin_bar ); 318 318 } 319 } 320 321 /** 322 * Add the "Customize" link. 323 * 324 * @since 4.3.0 325 * 326 * @param WP_Admin_Bar $wp_admin_bar 327 */ 328 function wp_admin_bar_customize_menu( $wp_admin_bar ) { 329 // Don't show for users who can't access the customizer. 330 if ( ! current_user_can( 'customize' ) ) { 331 return; 332 } 333 334 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 335 $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); 336 337 $wp_admin_bar->add_menu( array( 338 'id' => 'customize', 339 'title' => __( 'Customize' ), 340 'href' => $customize_url, 341 'meta' => array( 342 'class' => 'hide-if-no-customize', 343 ), 344 ) ); 345 add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); 319 346 } 320 347 … … 665 692 $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) ); 666 693 667 $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];668 $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );669 670 694 if ( current_user_can( 'switch_themes' ) ) { 671 695 $wp_admin_bar->add_menu( array( … … 674 698 'title' => __( 'Themes' ), 675 699 'href' => admin_url( 'themes.php' ), 676 'meta' => array( 677 'class' => 'hide-if-customize', 678 ), 679 ) ); 680 681 if ( current_user_can( 'customize' ) ) { 682 $wp_admin_bar->add_menu( array( 683 'parent' => 'appearance', 684 'id' => 'customize-themes', 685 'title' => __( 'Themes' ), 686 'href' => add_query_arg( urlencode( 'autofocus[section]' ), 'themes', $customize_url ), // urlencode() needed due to #16859 687 'meta' => array( 688 'class' => 'hide-if-no-customize', 689 ), 690 ) ); 691 } 692 } 693 694 if ( current_user_can( 'customize' ) ) { 695 $wp_admin_bar->add_menu( array( 696 'parent' => 'appearance', 697 'id' => 'customize', 698 'title' => __('Customize'), 699 'href' => $customize_url, 700 'meta' => array( 701 'class' => 'hide-if-no-customize', 702 ), 703 ) ); 704 add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); 700 ) ); 705 701 } 706 702 … … 715 711 'title' => __( 'Widgets' ), 716 712 'href' => admin_url( 'widgets.php' ), 717 'meta' => array( 718 'class' => 'hide-if-customize', 719 ), 720 ) ); 721 722 if ( current_user_can( 'customize' ) ) { 723 $wp_admin_bar->add_menu( array( 724 'parent' => 'appearance', 725 'id' => 'customize-widgets', 726 'title' => __( 'Widgets' ), 727 'href' => add_query_arg( urlencode( 'autofocus[panel]' ), 'widgets', $customize_url ), // urlencode() needed due to #16859 728 'meta' => array( 729 'class' => 'hide-if-no-customize', 730 ), 731 ) ); 732 } 713 ) ); 733 714 } 734 715 … … 746 727 ), 747 728 ) ); 748 749 if ( current_user_can( 'customize' ) ) {750 $wp_admin_bar->add_menu( array(751 'parent' => 'appearance',752 'id' => 'customize-background',753 'title' => __( 'Background' ),754 'href' => add_query_arg( urlencode( 'autofocus[control]' ), 'background_image', $customize_url ), // urlencode() needed due to #16859755 'meta' => array(756 'class' => 'hide-if-no-customize',757 ),758 ) );759 }760 729 } 761 730 … … 770 739 ), 771 740 ) ); 772 773 if ( current_user_can( 'customize' ) ) {774 $wp_admin_bar->add_menu( array(775 'parent' => 'appearance',776 'id' => 'customize-header',777 'title' => __( 'Header' ),778 'href' => add_query_arg( urlencode( 'autofocus[control]' ), 'header_image', $customize_url ), // urlencode() needed due to #16859779 'meta' => array(780 'class' => 'hide-if-no-customize',781 ),782 ) );783 }784 741 } 785 742
Note: See TracChangeset
for help on using the changeset viewer.