Changeset 31707 for trunk/src/wp-includes/class-wp-customize-setting.php
- Timestamp:
- 03/10/2015 11:04:12 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-setting.php
r31705 r31707 115 115 } 116 116 117 /** 118 * The ID for the current blog when the preview() method was called. 119 * 120 * @since 4.2.0 121 * @var int 122 */ 123 protected $_previewed_blog_id; 124 125 /** 126 * Return true if the current blog is not the same as the previewed blog. 127 * 128 * @since 4.2.0 129 * @return bool|null Returns null if preview() has not been called yet. 130 */ 131 public function is_current_blog_previewed() { 132 if ( ! isset( $this->_previewed_blog_id ) ) { 133 return null; 134 } 135 return ( get_current_blog_id() === $this->_previewed_blog_id ); 136 } 137 138 /** 139 * Original non-previewed value stored by the preview method. 140 * 141 * @see WP_Customize_Setting::preview() 142 * @since 4.1.1 143 * @var mixed 144 */ 117 145 protected $_original_value; 118 146 … … 125 153 if ( ! isset( $this->_original_value ) ) { 126 154 $this->_original_value = $this->value(); 155 } 156 if ( ! isset( $this->_previewed_blog_id ) ) { 157 $this->_previewed_blog_id = get_current_blog_id(); 127 158 } 128 159 … … 170 201 * Callback function to filter the theme mods and options. 171 202 * 203 * If switch_to_blog() was called after the preview() method, and the current 204 * blog is now not the same blog, then this method does a no-op and returns 205 * the original value. 206 * 172 207 * @since 3.4.0 173 208 * @uses WP_Customize_Setting::multidimensional_replace() … … 177 212 */ 178 213 public function _preview_filter( $original ) { 214 if ( ! $this->is_current_blog_previewed() ) { 215 return $original; 216 } 217 179 218 $undefined = new stdClass(); // symbol hack 180 219 $post_value = $this->post_value( $undefined );
Note: See TracChangeset
for help on using the changeset viewer.