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 { |
140 | 140 | * @param mixed $message UI message |
141 | 141 | */ |
142 | 142 | protected function wp_die( $ajax_message, $message = null ) { |
143 | | if ( $this->doing_ajax() ) |
| 143 | if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) { |
144 | 144 | wp_die( $ajax_message ); |
| 145 | } |
145 | 146 | |
146 | | if ( ! $message ) |
| 147 | if ( ! $message ) { |
147 | 148 | $message = __( 'Cheatin’ uh?' ); |
| 149 | } |
148 | 150 | |
149 | 151 | wp_die( $message ); |
150 | 152 | } |
… |
… |
final class WP_Customize_Manager { |
157 | 159 | * @return string |
158 | 160 | */ |
159 | 161 | public function wp_die_handler() { |
160 | | if ( $this->doing_ajax() ) |
| 162 | if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) { |
161 | 163 | return '_ajax_wp_die_handler'; |
| 164 | } |
162 | 165 | |
163 | 166 | return '_default_wp_die_handler'; |
164 | 167 | } |
… |
… |
final class WP_Customize_Manager { |
173 | 176 | public function setup_theme() { |
174 | 177 | send_origin_headers(); |
175 | 178 | |
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 | } |
180 | 185 | |
181 | 186 | show_admin_bar( false ); |
182 | 187 | |
… |
… |
final class WP_Customize_Manager { |
194 | 199 | } else { |
195 | 200 | // If the requested theme is not the active theme and the user doesn't have the |
196 | 201 | // switch_themes cap, bail. |
197 | | if ( ! current_user_can( 'switch_themes' ) ) |
| 202 | if ( ! current_user_can( 'switch_themes' ) ) { |
198 | 203 | $this->wp_die( -1 ); |
| 204 | } |
199 | 205 | |
200 | 206 | // If the theme has errors while loading, bail. |
201 | | if ( $this->theme()->errors() ) |
| 207 | if ( $this->theme()->errors() ) { |
202 | 208 | $this->wp_die( -1 ); |
| 209 | } |
203 | 210 | |
204 | 211 | // If the theme isn't allowed per multisite settings, bail. |
205 | | if ( ! $this->theme()->is_allowed() ) |
| 212 | if ( ! $this->theme()->is_allowed() ) { |
206 | 213 | $this->wp_die( -1 ); |
| 214 | } |
207 | 215 | } |
208 | 216 | |
209 | 217 | $this->start_previewing_theme(); |
… |
… |
final class WP_Customize_Manager { |
215 | 223 | * @since 3.4.0 |
216 | 224 | */ |
217 | 225 | 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() ) { |
219 | 228 | wp_redirect( 'themes.php?broken=true' ); |
220 | 229 | exit; |
221 | 230 | } |
… |
… |
final class WP_Customize_Manager { |
229 | 238 | */ |
230 | 239 | public function start_previewing_theme() { |
231 | 240 | // Bail if we're already previewing. |
232 | | if ( $this->is_preview() ) |
| 241 | if ( $this->is_preview() ) { |
233 | 242 | return; |
| 243 | } |
234 | 244 | |
235 | 245 | $this->previewing = true; |
236 | 246 | |
… |
… |
final class WP_Customize_Manager { |
266 | 276 | * @since 3.4.0 |
267 | 277 | */ |
268 | 278 | public function stop_previewing_theme() { |
269 | | if ( ! $this->is_preview() ) |
| 279 | if ( ! $this->is_preview() ) { |
270 | 280 | return; |
| 281 | } |
271 | 282 | |
272 | 283 | $this->previewing = false; |
273 | 284 | |