Make WordPress Core


Ignore:
Timestamp:
04/30/2012 03:46:17 PM (15 years ago)
Author:
koopersmith
Message:

Theme Customizer: Migrate to an ajax-based solution for refreshing the preview and saving. see #20507, #19910.

  • Use ajax-based saving, add saving indicator.
  • Use ajax-based refreshing instead of form targets.
  • Instead of using hidden inputs with prefixed names to track the canonical data, use the values stored in wp.customize. Encode the values as JSON before sending to avoid bugs with ids that contain square brackets (PHP mangles POST values with nested brackets).
  • Use wp.customize.Previewer solely for the purpose of previewing; move the postMessage connection with the parent frame and other unrelated code snippets into the 'ready' handler.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-setting.php

    r20585 r20645  
    2222        private $_post_value; // Cached, sanitized $_POST value.
    2323
    24         // Prefix for $_POST values to prevent naming conflicts.
    25         const name_prefix = 'customize_';
    26 
    2724        /**
    2825         * Constructor.
    … …  
    122119                        return $this->_post_value;
    123120
    124                 $base = self::name_prefix . $this->id_data[ 'base' ];
    125 
    126                 if ( ! isset( $_POST[ $base ] ) )
    127                         return $default;
    128 
    129                 $result = $this->multidimensional_get( $_POST[ $base ], $this->id_data[ 'keys' ] );
    130                 if ( ! isset( $result ) )
    131                         return $default;
    132 
    133                 $result = $this->sanitize( $result );
     121                $result = $this->manager->post_value( $this );
     122
    134123                if ( isset( $result ) )
    135124                        return $this->_post_value = $result;
Note: See TracChangeset for help on using the changeset viewer.