X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..53f4633144ed68c8b8fb5861f992b5489894a940:/wp-admin/customize.php diff --git a/wp-admin/customize.php b/wp-admin/customize.php index b1485d1f..6ee2de00 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -12,17 +12,31 @@ define( 'IFRAME_REQUEST', true ); /** Load WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -if ( ! current_user_can( 'edit_theme_options' ) ) - wp_die( __( 'Cheatin’ uh?' ) ); +if ( ! current_user_can( 'customize' ) ) { + wp_die( __( 'Cheatin’ uh?' ), 403 ); +} wp_reset_vars( array( 'url', 'return' ) ); -$url = urldecode( $url ); +$url = wp_unslash( $url ); $url = wp_validate_redirect( $url, home_url( '/' ) ); -if ( $return ) - $return = wp_validate_redirect( urldecode( $return ) ); -if ( ! $return ) - $return = $url; +if ( $return ) { + $return = wp_unslash( $return ); + $return = wp_validate_redirect( $return ); +} +if ( ! $return ) { + if ( $url ) { + $return = $url; + } elseif ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) { + $return = admin_url( 'themes.php' ); + } else { + $return = admin_url(); + } +} +/** + * @global WP_Scripts $wp_scripts + * @global WP_Customize_Manager $wp_customize + */ global $wp_scripts, $wp_customize; $registered = $wp_scripts->registered; @@ -43,8 +57,6 @@ do_action( 'customize_controls_init' ); wp_enqueue_script( 'customize-controls' ); wp_enqueue_style( 'customize-controls' ); -wp_enqueue_script( 'accordion' ); - /** * Enqueue Customizer control scripts. * @@ -63,19 +75,28 @@ $body_class = 'wp-core-ui wp-customizer js'; if ( wp_is_mobile() ) : $body_class .= ' mobile'; - ?>theme()->display('Name') ) ) ); +if ( $wp_customize->is_theme_active() ) { + $document_title_tmpl = _x( 'Customize: %s', 'Placeholder is the document title from the preview' ); +} else { + $document_title_tmpl = _x( 'Live Preview: %s', 'Placeholder is the document title from the preview' ); +} +$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // because exported to JS and assigned to document.title +$admin_title = sprintf( $document_title_tmpl, __( 'Loading…' ) ); + ?><?php echo $admin_title; ?>