Make WordPress Core

Ticket #29098: 29098.diff

File 29098.diff, 1.7 KB (added by westonruter, 12 years ago)

Initial patch. PR: https://github.com/x-team/wordpress-develop/pull/27

  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 5ea7aff..d9d7e28 100644
     
    10171017                                                }
    10181018
    10191019                                                // Check for cheaters.
    1020                                                 if ( '-1' === response ) {
     1020                                                if ( '-1' === response || 'cheatin' === response.data ) {
    10211021                                                        self.cheatin();
    10221022                                                        return;
    10231023                                                }
    10241024
    1025                                                 api.trigger( 'saved' );
     1025                                                api.trigger( 'saved', response.data );
    10261026                                        } );
    10271027                                };
    10281028
  • 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 5e2ba5d..c40933e 100644
    final class WP_Customize_Manager {  
    596596         * @since 3.4.0
    597597         */
    598598        public function save() {
    599                 if ( ! $this->is_preview() )
    600                         die;
     599                if ( ! $this->is_preview() ) {
     600                        wp_send_json_error( 'not_preview' );
     601                }
    601602
    602                 check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce' );
     603                $action = 'save-customize_' . $this->get_stylesheet();
     604                if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
     605                        wp_send_json_error( 'cheatin' );
     606                }
    603607
    604608                // Do we have to switch themes?
    605609                if ( ! $this->is_theme_active() ) {
    final class WP_Customize_Manager {  
    634638                 */
    635639                do_action( 'customize_save_after', $this );
    636640
    637                 die;
     641                /**
     642                 * Filter response data for customize_save Ajax request.
     643                 *
     644                 * @since 4.1.0
     645                 *
     646                 * @param array $data
     647                 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
     648                 */
     649                $response = apply_filters( 'wp_customize_save_response', array(), $this );
     650                wp_send_json_success( $response );
    638651        }
    639652
    640653        /**