From 0116e778d9c315f686acf43642fab69cc385eb82 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 28 Mar 2014 17:08:05 +0000 Subject: [PATCH] Widget Customizer: Simplify conditions in setup_widget_addition_previews(). see #27534. git-svn-id: https://develop.svn.wordpress.org/trunk@27820 602fd350-edb4-49c9-b593-d223f7449a82 --- .../class-wp-customize-widgets.php | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php index e33208a5db..3a1321098f 100644 --- a/src/wp-includes/class-wp-customize-widgets.php +++ b/src/wp-includes/class-wp-customize-widgets.php @@ -118,31 +118,20 @@ final class WP_Customize_Widgets { * @global WP_Customize_Manager $wp_customize */ public function setup_widget_addition_previews() { - $is_customize_preview = ( - ( ! empty( $this->manager ) ) - && - ( ! is_admin() ) - && - ( 'on' === $this->get_post_value( 'wp_customize' ) ) - && - check_ajax_referer( 'preview-customize_' . $this->manager->get_stylesheet(), 'nonce', false ) - ); + $is_customize_preview = false; + if ( ! empty( $this->manager ) && ! is_admin() && 'on' === $this->get_post_value( 'wp_customize' ) ) { + $is_customize_preview = check_ajax_referer( 'preview-customize_' . $this->manager->get_stylesheet(), 'nonce', false ); + } - $is_ajax_widget_update = ( - ( defined( 'DOING_AJAX' ) && DOING_AJAX ) - && - $this->get_post_value( 'action' ) === 'update-widget' - && - check_ajax_referer( 'update-widget', 'nonce', false ) - ); + $is_ajax_widget_update = false; + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-widget' === $this->get_post_value( 'action' ) ) { + $is_ajax_widget_update = check_ajax_referer( 'update-widget', 'nonce', false ); + } - $is_ajax_customize_save = ( - ( defined( 'DOING_AJAX' ) && DOING_AJAX ) - && - $this->get_post_value( 'action' ) === 'customize_save' - && - check_ajax_referer( 'save-customize_' . $this->manager->get_stylesheet(), 'nonce', false ) - ); + $is_ajax_customize_save = false; + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'customize_save' === $this->get_post_value( 'action' ) ) { + $is_ajax_customize_save = check_ajax_referer( 'save-customize_' . $this->manager->get_stylesheet(), 'nonce', false ); + } $is_valid_request = ( $is_ajax_widget_update || $is_customize_preview || $is_ajax_customize_save ); if ( ! $is_valid_request ) {