From a415c29efee45520ae252d2aa28f1083a521cd7b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 09:56:49 +0200 Subject: Adding upstream version 6.4.3+dfsg1. Signed-off-by: Daniel Baumann --- wp-admin/customize.php | 306 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 wp-admin/customize.php (limited to 'wp-admin/customize.php') diff --git a/wp-admin/customize.php b/wp-admin/customize.php new file mode 100644 index 0000000..2f0bc87 --- /dev/null +++ b/wp-admin/customize.php @@ -0,0 +1,306 @@ +' . __( 'You need a higher level of permission.' ) . '' . + '

' . __( 'Sorry, you are not allowed to customize this site.' ) . '

', + 403 + ); +} + +/** + * @global WP_Scripts $wp_scripts + * @global WP_Customize_Manager $wp_customize + */ +global $wp_scripts, $wp_customize; + +if ( $wp_customize->changeset_post_id() ) { + $changeset_post = get_post( $wp_customize->changeset_post_id() ); + + if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) { + wp_die( + '

' . __( 'You need a higher level of permission.' ) . '

' . + '

' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '

', + 403 + ); + } + + $missed_schedule = ( + 'future' === $changeset_post->post_status && + get_post_time( 'G', true, $changeset_post ) < time() + ); + if ( $missed_schedule ) { + /* + * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`. + * + * Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false` + * argument, settings cannot be reliably saved. Some logic short-circuits if the current value is the + * same as the value being saved. This is particularly true for options via `update_option()`. + * + * By opening an Ajax request, this is avoided and the changeset is published. See #39221. + */ + $nonces = $wp_customize->get_nonces(); + $request_args = array( + 'nonce' => $nonces['save'], + 'customize_changeset_uuid' => $wp_customize->changeset_uuid(), + 'wp_customize' => 'on', + 'customize_changeset_status' => 'publish', + ); + ob_start(); + ?> + + + ' . __( 'Your scheduled changes just published' ) . '' . + '

' . __( 'Customize New Changes' ) . '

' . $script, + 200 + ); + } + + if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) { + wp_die( + '

' . __( 'Something went wrong.' ) . '

' . + '

' . __( 'This changeset 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; + +add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 ); +add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' ); +add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 ); + +/** + * Fires when Customizer controls are initialized, before scripts are enqueued. + * + * @since 3.4.0 + */ +do_action( 'customize_controls_init' ); + +wp_enqueue_script( 'heartbeat' ); +wp_enqueue_script( 'customize-controls' ); +wp_enqueue_style( 'customize-controls' ); + +/** + * Fires when enqueuing Customizer control scripts. + * + * @since 3.4.0 + */ +do_action( 'customize_controls_enqueue_scripts' ); + +// Let's roll. +header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); + +wp_user_settings(); +_wp_admin_html_begin(); + +$body_class = 'wp-core-ui wp-customizer js'; + +if ( wp_is_mobile() ) : + $body_class .= ' mobile'; + add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' ); +endif; + +if ( $wp_customize->is_ios() ) { + $body_class .= ' ios'; +} + +if ( is_rtl() ) { + $body_class .= ' rtl'; +} +$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); + +if ( wp_use_widgets_block_editor() ) { + $body_class .= ' wp-embed-responsive'; +} + +$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading…' ) ); + +?> +<?php echo esc_html( $admin_title ); ?> + + + + + + +
+
+
+ theme()->get( 'RequiresWP' ) ); + $compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) ); + ?> + + is_theme_active() ? __( 'Publish' ) : __( 'Activate & Publish' ); ?> +
+ + +
+ + +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ +
+
+
    +
    +
    +
    +
    + + ' . get_bloginfo( 'name', 'display' ) . '' ); + ?> + + +
    +
    +

    + +

    +

    + Documentation on Customizer' ); + ?> +

    +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    + +
    + + -- cgit v1.2.3