diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index c9dc52d..9030964 100644
|
|
final class WP_Customize_Manager { |
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
402 | | * Decode the $_POST['customized'] values for a specific Customize Setting. |
| 402 | * Decode the $_POST['customized'] values, and cache in _post_values array. |
403 | 403 | * |
404 | | * @since 3.4.0 |
405 | | * |
406 | | * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object |
407 | | * @return string $post_value Sanitized value |
| 404 | * @since 4.1.1 |
408 | 405 | */ |
409 | | public function post_value( $setting ) { |
| 406 | protected function parse_post_data() { |
410 | 407 | if ( ! isset( $this->_post_values ) ) { |
411 | | if ( isset( $_POST['customized'] ) ) |
| 408 | if ( isset( $_POST['customized'] ) ) { |
412 | 409 | $this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true ); |
413 | | else |
| 410 | } else { |
414 | 411 | $this->_post_values = false; |
| 412 | } |
415 | 413 | } |
| 414 | } |
416 | 415 | |
417 | | if ( isset( $this->_post_values[ $setting->id ] ) ) |
| 416 | /** |
| 417 | * Get the post data value for a specific Customize Setting. |
| 418 | * |
| 419 | * @since 3.4.0 |
| 420 | * |
| 421 | * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object |
| 422 | * @param mixed $default Value to return when setting value is posted |
| 423 | * @return mixed $post_value Sanitized value |
| 424 | */ |
| 425 | public function post_value( $setting, $default = null ) { |
| 426 | $this->parse_post_data(); |
| 427 | if ( is_array( $this->_post_values ) && array_key_exists( $setting->id, $this->_post_values ) ) { |
418 | 428 | return $setting->sanitize( $this->_post_values[ $setting->id ] ); |
| 429 | } else { |
| 430 | return $default; |
| 431 | } |
419 | 432 | } |
420 | 433 | |
421 | 434 | /** |
diff --git src/wp-includes/class-wp-customize-setting.php src/wp-includes/class-wp-customize-setting.php
index 7a7be45..5eeb41a 100644
|
|
class WP_Customize_Setting { |
151 | 151 | * |
152 | 152 | * @since 3.4.0 |
153 | 153 | * @uses WP_Customize_Setting::multidimensional_replace() |
| 154 | * @uses WP_Customize_Setting::multidimensional_isset() |
154 | 155 | * |
155 | 156 | * @param mixed $original Old value. |
156 | 157 | * @return mixed New or old value. |
157 | 158 | */ |
158 | 159 | public function _preview_filter( $original ) { |
159 | | return $this->multidimensional_replace( $original, $this->id_data[ 'keys' ], $this->post_value() ); |
| 160 | $undefined = new stdClass(); |
| 161 | $value = $this->manager->post_value( $this, $undefined ); |
| 162 | if ( $undefined === $value ) { |
| 163 | $is_default_option_filter = ( 'option' === $this->type && 'default_option_' . $this->id_data['base'] === current_filter() ); |
| 164 | if ( $is_default_option_filter || ! $this->multidimensional_isset( $original, $this->id_data['keys'] ) ) { |
| 165 | $replaced = $this->multidimensional_replace( $original, $this->id_data['keys'], $this->default ); |
| 166 | } else { |
| 167 | $replaced = $original; |
| 168 | } |
| 169 | } else { |
| 170 | $replaced = $this->multidimensional_replace( $original, $this->id_data['keys'], $value ); |
| 171 | } |
| 172 | return $replaced; |
160 | 173 | } |
161 | 174 | |
162 | 175 | /** |