diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-includes/class-wp-customize-manager.php --- a/wp/wp-includes/class-wp-customize-manager.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-includes/class-wp-customize-manager.php Fri Sep 05 18:40:08 2025 +0200 @@ -20,6 +20,7 @@ * * @since 3.4.0 */ +#[AllowDynamicProperties] final class WP_Customize_Manager { /** * An instance of the theme being previewed. @@ -99,7 +100,7 @@ * @since 4.5.0 * @var array */ - protected $components = array( 'widgets', 'nav_menus' ); + protected $components = array( 'nav_menus' ); /** * Registered instances of WP_Customize_Section. @@ -270,8 +271,10 @@ $args['changeset_uuid'] = wp_generate_uuid4(); } - // The theme and messenger_channel should be supplied via $args, - // but they are also looked at in the $_REQUEST global here for back-compat. + /* + * The theme and messenger_channel should be supplied via $args, + * but they are also looked at in the $_REQUEST global here for back-compat. + */ if ( ! isset( $args['theme'] ) ) { if ( isset( $_REQUEST['customize_theme'] ) ) { $args['theme'] = wp_unslash( $_REQUEST['customize_theme'] ); @@ -283,6 +286,11 @@ $args['messenger_channel'] = sanitize_key( wp_unslash( $_REQUEST['customize_messenger_channel'] ) ); } + // Do not load 'widgets' component if a block theme is activated. + if ( ! wp_is_block_theme() ) { + $this->components[] = 'widgets'; + } + $this->original_stylesheet = get_stylesheet(); $this->theme = wp_get_theme( 0 === validate_file( $args['theme'] ) ? $args['theme'] : null ); $this->messenger_channel = $args['messenger_channel']; @@ -461,6 +469,8 @@ ), 'error' => $ajax_message, ); + $message .= ob_get_clean(); + ob_start(); ?> wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) ); } @@ -904,8 +916,10 @@ */ public function wp_loaded() { - // Unconditionally register core types for panels, sections, and controls - // in case plugin unhooks all customize_register actions. + /* + * Unconditionally register core types for panels, sections, and controls + * in case plugin unhooks all customize_register actions. + */ $this->register_panel_type( 'WP_Customize_Panel' ); $this->register_panel_type( 'WP_Customize_Themes_Panel' ); $this->register_section_type( 'WP_Customize_Section' ); @@ -1070,7 +1084,7 @@ continue; } if ( update_post_meta( $autosave_autodraft_post->ID, '_customize_restore_dismissed', true ) ) { - $dismissed++; + ++$dismissed; } } return $dismissed; @@ -1472,7 +1486,7 @@ if ( ! $nav_menu_term_id ) { while ( isset( $changeset_data[ sprintf( 'nav_menu[%d]', $placeholder_id ) ] ) ) { - $placeholder_id--; + --$placeholder_id; } $nav_menu_term_id = $placeholder_id; $nav_menu_setting_id = sprintf( 'nav_menu[%d]', $placeholder_id ); @@ -1902,6 +1916,7 @@ if ( ! headers_sent() ) { nocache_headers(); header( 'X-Robots: noindex, nofollow, noarchive' ); + header( 'X-Robots-Tag: noindex, nofollow, noarchive' ); } add_filter( 'wp_robots', 'wp_robots_no_robots' ); add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' ) ); @@ -1980,7 +1995,7 @@ && $parsed_allowed_url['host'] === $parsed_original_url['host'] && - 0 === strpos( $parsed_original_url['path'], $parsed_allowed_url['path'] ) + str_starts_with( $parsed_original_url['path'], $parsed_allowed_url['path'] ) ); if ( $is_allowed ) { break; @@ -2075,29 +2090,22 @@ if ( ! $this->messenger_channel ) { return; } + ob_start(); ?> __( 'Shift-click to edit this element.' ), 'linkUnpreviewable' => __( 'This link is not live-previewable.' ), @@ -2158,7 +2166,7 @@ ), 'url' => array( 'self' => $self_url, - 'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ), + 'allowed' => array_map( 'sanitize_url', $this->get_allowed_urls() ), 'allowedHosts' => array_unique( $allowed_hosts ), 'isCrossDomain' => $this->is_cross_domain(), ), @@ -2193,8 +2201,9 @@ } } + ob_start(); ?> - post_status; + /** This filter is documented in wp-includes/post.php */ - $check = apply_filters( 'pre_trash_post', null, $post ); + $check = apply_filters( 'pre_trash_post', null, $post, $previous_status ); if ( null !== $check ) { return $check; } /** This action is documented in wp-includes/post.php */ - do_action( 'wp_trash_post', $post_id ); - - add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status ); + do_action( 'wp_trash_post', $post_id, $previous_status ); + + add_post_meta( $post_id, '_wp_trash_meta_status', $previous_status ); add_post_meta( $post_id, '_wp_trash_meta_time', time() ); - $old_status = $post->post_status; $new_status = 'trash'; $wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $post->ID ) ); clean_post_cache( $post->ID ); $post->post_status = $new_status; - wp_transition_post_status( $new_status, $old_status, $post ); + wp_transition_post_status( $new_status, $previous_status, $post ); /** This action is documented in wp-includes/post.php */ do_action( "edit_post_{$post->post_type}", $post->ID, $post ); @@ -3114,7 +3125,7 @@ wp_trash_post_comments( $post_id ); /** This action is documented in wp-includes/post.php */ - do_action( 'trashed_post', $post_id ); + do_action( 'trashed_post', $post_id, $previous_status ); return $post; } @@ -3427,12 +3438,12 @@ * @since 4.7.0 * * @param bool $post_has_changed Whether the post has changed. - * @param WP_Post $last_revision The last revision post object. + * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. * @return bool Whether a revision should be made. */ - public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) { - unset( $last_revision ); + public function _filter_revision_post_has_changed( $post_has_changed, $latest_revision, $post ) { + unset( $latest_revision ); if ( 'customize_changeset' === $post->post_type ) { $post_has_changed = $this->store_changeset_revision; } @@ -3609,7 +3620,7 @@ */ $revisions = wp_get_post_revisions( $changeset_post_id, array( 'check_enabled' => false ) ); foreach ( $revisions as $revision ) { - if ( false !== strpos( $revision->post_name, "{$changeset_post_id}-autosave" ) ) { + if ( str_contains( $revision->post_name, "{$changeset_post_id}-autosave" ) ) { $wpdb->update( $wpdb->posts, array( @@ -4284,7 +4295,12 @@
  • {{{ data.message || data.code }}}
    <# if ( data.dismissible ) { #> - + <# } #>
  • @@ -4351,10 +4367,20 @@