X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/53f4633144ed68c8b8fb5861f992b5489894a940..refs/heads/pristine:/wp-admin/customize.php?autofocus%5Bcontrol%5D=header_image diff --git a/wp-admin/customize.php b/wp-admin/customize.php index 6ee2de00..44654c00 100644 --- a/wp-admin/customize.php +++ b/wp-admin/customize.php @@ -13,24 +13,11 @@ define( 'IFRAME_REQUEST', true ); require_once( dirname( __FILE__ ) . '/admin.php' ); if ( ! current_user_can( 'customize' ) ) { - wp_die( __( 'Cheatin’ uh?' ), 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 ); -} -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(); - } + wp_die( + '
' . __( 'Sorry, you are not allowed to customize this site.' ) . '
', + 403 + ); } /** @@ -39,6 +26,36 @@ if ( ! $return ) { */ global $wp_scripts, $wp_customize; +if ( $wp_customize->changeset_post_id() ) { + if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() ) ) { + wp_die( + '' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '
', + 403 + ); + } + if ( in_array( get_post_status( $wp_customize->changeset_post_id() ), array( 'publish', 'trash' ), true ) ) { + wp_die( + '' . __( 'This changeset has already been published and cannot be further modified.' ) . '
' . + '' . __( 'Customize New Changes' ) . '
', + 403 + ); + } +} + + +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 ( ! empty( $autofocus ) && is_array( $autofocus ) ) { + $wp_customize->set_autofocus( wp_unslash( $autofocus ) ); +} + $registered = $wp_scripts->registered; $wp_scripts = new WP_Scripts; $wp_scripts->registered = $registered; @@ -78,9 +95,7 @@ if ( wp_is_mobile() ) : ?>is_ios() ) { $body_class .= ' ios'; } @@ -89,18 +104,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…' ) ); ?>