Changeset 27966 for trunk/src/wp-includes/widgets.php
- Timestamp:
- 04/06/2014 06:47:46 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/widgets.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets.php
r27870 r27966 162 162 function _get_form_callback() { 163 163 return array($this, 'form_callback'); 164 } 165 166 /** 167 * Determine if we're in the Customizer; if true, then the object cache gets 168 * suspended and widgets should check this to decide whether they should 169 * store anything persistently to the object cache, to transients, or 170 * anywhere else. 171 * 172 * @since 3.9.0 173 * 174 * @return bool True if Customizer is on, false if not. 175 */ 176 function is_preview() { 177 global $wp_customize; 178 return ( isset( $wp_customize ) && $wp_customize->is_preview() ) ; 164 179 } 165 180 … … 190 205 */ 191 206 $instance = apply_filters( 'widget_display_callback', $instance, $this, $args ); 192 if ( false !== $instance ) 193 $this->widget($args, $instance); 207 208 if ( false === $instance ) { 209 return; 210 } 211 212 $was_cache_addition_suspended = wp_suspend_cache_addition(); 213 if ( $this->is_preview() && ! $was_cache_addition_suspended ) { 214 wp_suspend_cache_addition( true ); 215 } 216 217 $this->widget( $args, $instance ); 218 219 if ( $this->is_preview() ) { 220 wp_suspend_cache_addition( $was_cache_addition_suspended ); 221 } 194 222 } 195 223 } … … 242 270 $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array(); 243 271 244 $instance = $this->update($new_instance, $old_instance); 272 $was_cache_addition_suspended = wp_suspend_cache_addition(); 273 if ( $this->is_preview() && ! $was_cache_addition_suspended ) { 274 wp_suspend_cache_addition( true ); 275 } 276 277 $instance = $this->update( $new_instance, $old_instance ); 278 279 if ( $this->is_preview() ) { 280 wp_suspend_cache_addition( $was_cache_addition_suspended ); 281 } 245 282 246 283 /** … … 258 295 */ 259 296 $instance = apply_filters( 'widget_update_callback', $instance, $new_instance, $old_instance, $this ); 260 if ( false !== $instance ) 297 if ( false !== $instance ) { 261 298 $all_instances[$number] = $instance; 299 } 262 300 263 301 break; // run only once
Note: See TracChangeset
for help on using the changeset viewer.