Changeset 11088
- Timestamp:
- 04/26/2009 05:34:06 AM (16 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-widgets.php
r11087 r11088 496 496 function WP_Widget_Recent_Posts() { 497 497 $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your blog") ); 498 $this->WP_Widget('recent_posts', __('Recent Posts'), $widget_ops); 498 $this->WP_Widget('recent-posts', __('Recent Posts'), $widget_ops); 499 $this->alt_option_name = 'widget_recent_entries'; 499 500 500 501 add_action( 'save_post', array(&$this, 'flush_widget_cache') ); … … 504 505 505 506 function widget($args, $instance) { 506 if ( $output = wp_cache_get('widget_recent_ entries', 'widget') )507 if ( $output = wp_cache_get('widget_recent_posts' . $args['widget_id'], 'widget') ) 507 508 return print($output); 508 509 509 510 ob_start(); 510 511 511 extract($args); 512 512 … … 518 518 else if ( $number > 15 ) 519 519 $number = 15; 520 520 521 521 $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); 522 522 if ($r->have_posts()) : … … 533 533 wp_reset_query(); // Restore global post data stomped by the_post(). 534 534 endif; 535 536 wp_cache_add('widget_recent_ entries', ob_get_flush(), 'widget');535 536 wp_cache_add('widget_recent_posts' . $args['widget_id'], ob_get_flush(), 'widget'); 537 537 } 538 538 … … 542 542 $instance['number'] = (int) $new_instance['number']; 543 543 $this->flush_widget_cache(); 544 545 $alloptions = wp_cache_get( 'alloptions', 'options' ); 546 if ( isset($alloptions['widget_recent_entries']) ) 547 delete_option('widget_recent_entries'); 544 548 545 549 return $instance; -
trunk/wp-includes/widgets.php
r11087 r11088 268 268 function get_settings() { 269 269 $settings = get_option($this->option_name); 270 271 if ( false === $settings && isset($this->alt_option_name) ) 272 $settings = get_option($this->alt_option_name); 270 273 271 274 if ( !is_array($settings) ) … … 977 980 $single = true; 978 981 } else { 979 if ( isset($settings['number']) )980 unset($settings['number']);981 982 foreach ( array_keys($settings) as $number ) { 983 if ( 'number' == $number ) 984 continue; 982 985 if ( !is_numeric($number) ) { 983 986 $single = true;
Note: See TracChangeset
for help on using the changeset viewer.