Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/src/wp-includes/class-wp-customize-setting.php

    r30676 r31410  
    104104        }
    105105
     106        protected $_original_value;
     107
    106108        /**
    107109         * Handle previewing the setting.
    … …  
    110112         */
    111113        public function preview() {
     114                if ( ! isset( $this->_original_value ) ) {
     115                        $this->_original_value = $this->value();
     116                }
     117
    112118                switch( $this->type ) {
    113119                        case 'theme_mod' :
    … …  
    160166         */
    161167        public function _preview_filter( $original ) {
    162                 return $this->multidimensional_replace( $original, $this->id_data[ 'keys' ], $this->post_value() );
     168                $undefined = new stdClass(); // symbol hack
     169                $post_value = $this->manager->post_value( $this, $undefined );
     170                if ( $undefined === $post_value ) {
     171                        $value = $this->_original_value;
     172                } else {
     173                        $value = $post_value;
     174                }
     175
     176                return $this->multidimensional_replace( $original, $this->id_data['keys'], $value );
    163177        }
    164178
    … …  
    426440                }
    427441
    428                 if ( $create && ! isset( $node[ $last ] ) )
    429                         $node[ $last ] = array();
     442                if ( $create ) {
     443                        if ( ! is_array( $node ) ) {
     444                                // account for an array overriding a string or object value
     445                                $node = array();
     446                        }
     447                        if ( ! isset( $node[ $last ] ) ) {
     448                                $node[ $last ] = array();
     449                        }
     450                }
    430451
    431452                if ( ! isset( $node[ $last ] ) )
Note: See TracChangeset for help on using the changeset viewer.