Changeset 10799
- Timestamp:
- 03/17/2009 02:33:08 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-widgets.php
r10798 r10799 334 334 <input type="hidden" id="calendar-submit" name="calendar-submit" value="1" /> 335 335 <?php 336 } 337 338 /** 339 * Calendar widget class 340 * 341 * @since 2.8.0 342 */ 343 class WP_Widget_Calendar extends WP_Widget { 344 345 function WP_Widget_Calendar() { 346 $widget_ops = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") ); 347 $this->WP_Widget('calendar', __('Calendar'), $widget_ops); 348 } 349 350 function widget( $args, $instance ) { 351 extract($args); 352 $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); 353 echo $before_widget . $before_title . $title . $after_title; 354 echo '<div id="calendar_wrap">'; 355 get_calendar(); 356 echo '</div>'; 357 echo $after_widget; 358 } 359 360 function update( $new_instance, $old_instance ) { 361 if ( !isset($new_instance['submit']) ) // user clicked cancel? 362 return false; 363 364 $instance = $old_instance; 365 $instance['title'] = strip_tags($new_instance['title']); 366 367 return $instance; 368 } 369 370 function form( $instance ) { 371 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 372 $title = strip_tags($instance['title']); 373 ?> 374 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> 375 <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" /> 376 <?php 377 } 336 378 } 337 379 … … 1330 1372 new WP_Widget_Pages(); 1331 1373 1332 $widget_ops = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") ); 1333 wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $widget_ops); 1334 wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control' ); 1374 new WP_Widget_Calendar(); 1335 1375 1336 1376 new WP_Widget_Archives();
Note: See TracChangeset
for help on using the changeset viewer.