X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/af50974463450c98503e763a7836a50e260461a9..607b7e02d77e7326161e8ec15639052d2040f745:/wp-admin/customize.php?ds=sidebyside diff --git a/wp-admin/customize.php b/wp-admin/customize.php index 178db282..bd8e1181 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -13,26 +13,28 @@ define( 'IFRAME_REQUEST', true ); require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'customize' ) ) { - wp_die( __( 'Cheatin’ uh?' ), 403 ); + wp_die( + '
' . __( 'Sorry, you are not allowed to customize this site.' ) . '
', + 403 + ); } -wp_reset_vars( array( 'url', 'return' ) ); -$url = wp_unslash( $url ); -$url = wp_validate_redirect( $url, home_url( '/' ) ); -if ( $return ) { - $return = wp_unslash( $return ); - $return = wp_validate_redirect( $return ); +wp_reset_vars( array( 'url', 'return', 'autofocus' ) ); +if ( ! empty( $url ) ) { + $wp_customize->set_preview_url( wp_unslash( $url ) ); +} +if ( ! empty( $return ) ) { + $wp_customize->set_return_url( wp_unslash( $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(); - } +if ( ! empty( $autofocus ) && is_array( $autofocus ) ) { + $wp_customize->set_autofocus( wp_unslash( $autofocus ) ); } +/** + * @global WP_Scripts $wp_scripts + * @global WP_Customize_Manager $wp_customize + */ global $wp_scripts, $wp_customize; $registered = $wp_scripts->registered; @@ -71,12 +73,10 @@ $body_class = 'wp-core-ui wp-customizer js'; if ( wp_is_mobile() ) : $body_class .= ' mobile'; - ?>is_ios() ) { $body_class .= ' ios'; } @@ -85,18 +85,12 @@ if ( is_rtl() ) { } $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); -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…' ) ); +$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading…' ) ); ?>