Changeset 35724 for trunk/src/wp-includes/class-wp-customize-setting.php
- Timestamp:
- 11/21/2015 02:51:57 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-setting.php
r35383 r35724 83 83 84 84 /** 85 * Whether or not preview() was called. 86 * 87 * @since 4.4.0 88 * @access protected 89 * @var bool 90 */ 91 protected $is_previewed = false; 92 93 /** 85 94 * Cache of multidimensional values to improve performance. 86 95 * … … 192 201 193 202 if ( ! empty( $this->id_data['keys'] ) ) { 203 // Note the preview-applied flag is cleared at priority 9 to ensure it is cleared before a deferred-preview runs. 204 add_action( "customize_post_value_set_{$this->id}", array( $this, '_clear_aggregated_multidimensional_preview_applied_flag' ), 9 ); 194 205 $this->is_multidimensional_aggregated = true; 195 206 } … … 246 257 $this->_previewed_blog_id = get_current_blog_id(); 247 258 } 259 260 // Prevent re-previewing an already-previewed setting. 261 if ( $this->is_previewed ) { 262 return true; 263 } 264 248 265 $id_base = $this->id_data['base']; 249 266 $is_multidimensional = ! empty( $this->id_data['keys'] ); … … 274 291 } 275 292 293 // If the setting does not need previewing now, defer to when it has a value to preview. 276 294 if ( ! $needs_preview ) { 295 if ( ! has_action( "customize_post_value_set_{$this->id}", array( $this, 'preview' ) ) ) { 296 add_action( "customize_post_value_set_{$this->id}", array( $this, 'preview' ) ); 297 } 277 298 return false; 278 299 } … … 328 349 do_action( "customize_preview_{$this->type}", $this ); 329 350 } 351 352 $this->is_previewed = true; 353 330 354 return true; 355 } 356 357 /** 358 * Clear out the previewed-applied flag for a multidimensional-aggregated value whenever its post value is updated. 359 * 360 * This ensures that the new value will get sanitized and used the next time 361 * that <code>WP_Customize_Setting::_multidimensional_preview_filter()</code> 362 * is called for this setting. 363 * 364 * @since 4.4.0 365 * @access private 366 * @see WP_Customize_Manager::set_post_value() 367 * @see WP_Customize_Setting::_multidimensional_preview_filter() 368 */ 369 final public function _clear_aggregated_multidimensional_preview_applied_flag() { 370 unset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['preview_applied_instances'][ $this->id ] ); 331 371 } 332 372 … … 370 410 * 371 411 * @since 4.4.0 372 * @access p ublic412 * @access private 373 413 * 374 414 * @see WP_Customize_Setting::$aggregated_multidimensionals … … 376 416 * @return mixed New or old value. 377 417 */ 378 public function _multidimensional_preview_filter( $original ) {418 final public function _multidimensional_preview_filter( $original ) { 379 419 if ( ! $this->is_current_blog_previewed() ) { 380 420 return $original;
Note: See TracChangeset
for help on using the changeset viewer.