Escape Customizer links in the admin menu. Fix usage of `add_query_arg()`.

props iseulde.
fixes #30952.

git-svn-id: https://develop.svn.wordpress.org/trunk@31427 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2015-02-11 22:47:44 +00:00
parent d4c47d6364
commit a4eb4880b4
1 changed files with 7 additions and 7 deletions

View File

@ -147,24 +147,24 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options'; $appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); $menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' ); $submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' ); $customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', $customize_url, '', 'hide-if-no-customize' ); $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
$submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php'); $submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
} }
if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) { if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) {
$customize_header_url = add_query_arg( 'autofocus[control]', 'header_image', $customize_url ); $customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
$submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, $customize_header_url, '', 'hide-if-no-customize' ); $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
} }
if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) { if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) {
$customize_background_url = add_query_arg( 'autofocus[control]', 'background_image', $customize_url ); $customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, $customize_background_url, '', 'hide-if-no-customize' ); $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
} }
unset( $customize_url ); unset( $customize_url );