This commit is contained in:
nikolark committed 2015-02-24 20:19:00 +01:00
1 parent f3b69c7bb3
commit 671f1ecdfc
66 files changed
+2430 -2425

No files matched your search

+24 -3
View File
@@ -103,12 +103,18 @@ class WP_Customize_Setting {
return $this;
}
protected $_original_value;
/**
* Handle previewing the setting.
*
* @since 3.4.0
*/
public function preview() {
if ( ! isset( $this->_original_value ) ) {
$this->_original_value = $this->value();
}
switch( $this->type ) {
case 'theme_mod' :
add_filter( 'theme_mod_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
@@ -159,7 +165,15 @@ class WP_Customize_Setting {
* @return mixed New or old value.
*/
public function _preview_filter( $original ) {
return $this->multidimensional_replace( $original, $this->id_data[ 'keys' ], $this->post_value() );
$undefined = new stdClass(); // symbol hack
$post_value = $this->manager->post_value( $this, $undefined );
if ( $undefined === $post_value ) {
$value = $this->_original_value;
} else {
$value = $post_value;
}
return $this->multidimensional_replace( $original, $this->id_data['keys'], $value );
}
/**
@@ -425,8 +439,15 @@ class WP_Customize_Setting {
$node = &$node[ $key ];
}
if ( $create && ! isset( $node[ $last ] ) )
$node[ $last ] = array();
if ( $create ) {
if ( ! is_array( $node ) ) {
// account for an array overriding a string or object value
$node = array();
}
if ( ! isset( $node[ $last ] ) ) {
$node[ $last ] = array();
}
}
if ( ! isset( $node[ $last ] ) )
return;