Make WordPress Core

Ticket #31294: 31294.diff

File 31294.diff, 3.1 KB (added by westonruter, 10 years ago)

https://github.com/xwp/wordpress-develop/pull/69

  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index 4a776be..6f19c49 100644
    final class WP_Customize_Manager { 
    140140         * @param mixed $message UI message
    141141         */
    142142        protected function wp_die( $ajax_message, $message = null ) {
    143                 if ( $this->doing_ajax() )
     143                if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
    144144                        wp_die( $ajax_message );
     145                }
    145146
    146                 if ( ! $message )
     147                if ( ! $message ) {
    147148                        $message = __( 'Cheatin’ uh?' );
     149                }
    148150
    149151                wp_die( $message );
    150152        }
    final class WP_Customize_Manager { 
    157159         * @return string
    158160         */
    159161        public function wp_die_handler() {
    160                 if ( $this->doing_ajax() )
     162                if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
    161163                        return '_ajax_wp_die_handler';
     164                }
    162165
    163166                return '_default_wp_die_handler';
    164167        }
    final class WP_Customize_Manager { 
    173176        public function setup_theme() {
    174177                send_origin_headers();
    175178
    176                 if ( is_admin() && ! $this->doing_ajax() )
    177                     auth_redirect();
    178                 elseif ( $this->doing_ajax() && ! is_user_logged_in() )
    179                     $this->wp_die( 0 );
     179                $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
     180                if ( is_admin() && ! $doing_ajax_or_is_customized ) {
     181                        auth_redirect();
     182                } elseif ( $doing_ajax_or_is_customized && ! is_user_logged_in() ) {
     183                        $this->wp_die( 0 );
     184                }
    180185
    181186                show_admin_bar( false );
    182187
    final class WP_Customize_Manager { 
    194199                } else {
    195200                        // If the requested theme is not the active theme and the user doesn't have the
    196201                        // switch_themes cap, bail.
    197                         if ( ! current_user_can( 'switch_themes' ) )
     202                        if ( ! current_user_can( 'switch_themes' ) ) {
    198203                                $this->wp_die( -1 );
     204                        }
    199205
    200206                        // If the theme has errors while loading, bail.
    201                         if ( $this->theme()->errors() )
     207                        if ( $this->theme()->errors() ) {
    202208                                $this->wp_die( -1 );
     209                        }
    203210
    204211                        // If the theme isn't allowed per multisite settings, bail.
    205                         if ( ! $this->theme()->is_allowed() )
     212                        if ( ! $this->theme()->is_allowed() ) {
    206213                                $this->wp_die( -1 );
     214                        }
    207215                }
    208216
    209217                $this->start_previewing_theme();
    final class WP_Customize_Manager { 
    215223         * @since 3.4.0
    216224         */
    217225        public function after_setup_theme() {
    218                 if ( ! $this->doing_ajax() && ! validate_current_theme() ) {
     226                $doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_SERVER['customized'] ) );
     227                if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
    219228                        wp_redirect( 'themes.php?broken=true' );
    220229                        exit;
    221230                }
    final class WP_Customize_Manager { 
    229238         */
    230239        public function start_previewing_theme() {
    231240                // Bail if we're already previewing.
    232                 if ( $this->is_preview() )
     241                if ( $this->is_preview() ) {
    233242                        return;
     243                }
    234244
    235245                $this->previewing = true;
    236246
    final class WP_Customize_Manager { 
    266276         * @since 3.4.0
    267277         */
    268278        public function stop_previewing_theme() {
    269                 if ( ! $this->is_preview() )
     279                if ( ! $this->is_preview() ) {
    270280                        return;
     281                }
    271282
    272283                $this->previewing = false;
    273284