75
* @param array $new_instance
76
* @param array $old_instance
70
79
public function update( $new_instance, $old_instance ) {
71
80
$instance = $old_instance;
72
81
$instance['title'] = strip_tags($new_instance['title']);
118
130
parent::__construct('links', __('Links'), $widget_ops);
135
* @param array $instance
121
137
public function widget( $args, $instance ) {
123
138
$show_description = isset($instance['description']) ? $instance['description'] : false;
124
139
$show_name = isset($instance['name']) ? $instance['name'] : false;
125
140
$show_rating = isset($instance['rating']) ? $instance['rating'] : false;
170
* @param array $new_instance
171
* @param array $old_instance
154
174
public function update( $new_instance, $old_instance ) {
155
175
$new_instance = (array) $new_instance;
156
176
$instance = array( 'images' => 0, 'name' => 0, 'description' => 0, 'rating' => 0 );
227
250
parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
255
* @param array $instance
230
257
public function widget( $args, $instance ) {
232
258
/** This filter is documented in wp-includes/default-widgets.php */
233
259
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
243
269
echo $args['after_widget'];
273
* @param array $instance
246
275
public function form( $instance ) {
247
276
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
248
277
$title = $instance['title'];
284
* @param array $new_instance
285
* @param array $old_instance
254
288
public function update( $new_instance, $old_instance ) {
255
289
$instance = $old_instance;
256
290
$new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
272
306
parent::__construct('archives', __('Archives'), $widget_ops);
311
* @param array $instance
275
313
public function widget( $args, $instance ) {
276
314
$c = ! empty( $instance['count'] ) ? '1' : '0';
277
315
$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
354
392
echo $args['after_widget'];
396
* @param array $new_instance
397
* @param array $old_instance
357
400
public function update( $new_instance, $old_instance ) {
358
401
$instance = $old_instance;
359
402
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
364
407
return $instance;
411
* @param array $instance
367
413
public function form( $instance ) {
368
414
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'count' => 0, 'dropdown' => '') );
369
415
$title = strip_tags($instance['title']);
394
440
parent::__construct('meta', __('Meta'), $widget_ops);
445
* @param array $instance
397
447
public function widget( $args, $instance ) {
399
448
/** This filter is documented in wp-includes/default-widgets.php */
400
449
$title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
430
479
echo $args['after_widget'];
483
* @param array $new_instance
484
* @param array $old_instance
433
487
public function update( $new_instance, $old_instance ) {
434
488
$instance = $old_instance;
435
489
$instance['title'] = strip_tags($new_instance['title']);
458
515
parent::__construct('calendar', __('Calendar'), $widget_ops);
520
* @param array $instance
461
522
public function widget( $args, $instance ) {
463
523
/** This filter is documented in wp-includes/default-widgets.php */
464
524
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
473
533
echo $args['after_widget'];
537
* @param array $new_instance
538
* @param array $old_instance
476
541
public function update( $new_instance, $old_instance ) {
477
542
$instance = $old_instance;
478
543
$instance['title'] = strip_tags($new_instance['title']);
503
571
parent::__construct('text', __('Text'), $widget_ops, $control_ops);
576
* @param array $instance
506
578
public function widget( $args, $instance ) {
508
579
/** This filter is documented in wp-includes/default-widgets.php */
509
580
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
526
597
echo $args['after_widget'];
601
* @param array $new_instance
602
* @param array $old_instance
529
605
public function update( $new_instance, $old_instance ) {
530
606
$instance = $old_instance;
531
607
$instance['title'] = strip_tags($new_instance['title']);
545
624
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
546
625
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
548
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
627
<p><label for="<?php echo $this->get_field_id( 'text' ); ?>"><?php _e( 'Content:' ); ?></label>
628
<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea></p>
550
630
<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
564
644
parent::__construct('categories', __('Categories'), $widget_ops);
648
* @staticvar bool $first_dropdown
651
* @param array $instance
567
653
public function widget( $args, $instance ) {
654
static $first_dropdown = true;
569
656
/** This filter is documented in wp-includes/default-widgets.php */
570
657
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
644
729
echo $args['after_widget'];
733
* @param array $new_instance
734
* @param array $old_instance
647
737
public function update( $new_instance, $old_instance ) {
648
738
$instance = $old_instance;
649
739
$instance['title'] = strip_tags($new_instance['title']);
695
788
add_action( 'switch_theme', array($this, 'flush_widget_cache') );
698
public function widget($args, $instance) {
793
* @param array $instance
795
public function widget( $args, $instance ) {
699
796
$cache = array();
700
797
if ( ! $this->is_preview() ) {
701
798
$cache = wp_cache_get( 'widget_recent_posts', 'widget' );
874
* @param array $new_instance
875
* @param array $old_instance
776
878
public function update( $new_instance, $old_instance ) {
777
879
$instance = $old_instance;
778
880
$instance['title'] = strip_tags($new_instance['title']);
787
889
return $instance;
790
895
public function flush_widget_cache() {
791
896
wp_cache_delete('widget_recent_posts', 'widget');
900
* @param array $instance
794
902
public function form( $instance ) {
795
903
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
796
904
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
849
962
public function flush_widget_cache() {
850
963
wp_cache_delete('widget_recent_comments', 'widget');
967
* @global array $comments
968
* @global object $comment
971
* @param array $instance
853
973
public function widget( $args, $instance ) {
854
974
global $comments, $comment;
903
1023
$output .= '<ul id="recentcomments">';
1024
if ( is_array( $comments ) && $comments ) {
905
1025
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
906
1026
$post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
907
1027
_prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
1051
* @param array $new_instance
1052
* @param array $old_instance
930
1055
public function update( $new_instance, $old_instance ) {
931
1056
$instance = $old_instance;
932
1057
$instance['title'] = strip_tags($new_instance['title']);
966
1094
parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
969
public function widget($args, $instance) {
1098
* @param array $args
1099
* @param array $instance
1101
public function widget( $args, $instance ) {
971
1102
if ( isset($instance['error']) && $instance['error'] )
1022
public function update($new_instance, $old_instance) {
1154
* @param array $new_instance
1155
* @param array $old_instance
1158
public function update( $new_instance, $old_instance ) {
1023
1159
$testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
1024
1160
return wp_widget_rss_process( $new_instance, $testurl );
1027
public function form($instance) {
1029
if ( empty($instance) )
1164
* @param array $instance
1166
public function form( $instance ) {
1167
if ( empty( $instance ) ) {
1030
1168
$instance = array( 'title' => '', 'url' => '', 'items' => 10, 'error' => false, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0 );
1031
1170
$instance['number'] = $this->number;
1033
1172
wp_widget_rss_form( $instance );
1261
1400
parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
1404
* @param array $args
1405
* @param array $instance
1264
1407
public function widget( $args, $instance ) {
1265
1408
$current_taxonomy = $this->_get_current_taxonomy($instance);
1266
1409
if ( !empty($instance['title']) ) {
1301
1444
echo $args['after_widget'];
1448
* @param array $new_instance
1449
* @param array $old_instance
1304
1452
public function update( $new_instance, $old_instance ) {
1305
1453
$instance = array();
1306
1454
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
1345
1500
parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
1348
public function widget($args, $instance) {
1504
* @param array $args
1505
* @param array $instance
1507
public function widget( $args, $instance ) {
1350
1509
$nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
1384
1543
echo $args['after_widget'];
1547
* @param array $new_instance
1548
* @param array $old_instance
1387
1551
public function update( $new_instance, $old_instance ) {
1388
1552
$instance = array();
1389
1553
if ( ! empty( $new_instance['title'] ) ) {
1403
1570
$menus = wp_get_nav_menus();
1405
1572
// If no menus exists, direct the user to go and create some.
1407
echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
1412
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
1413
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $title ); ?>" />
1416
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
1417
<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
1418
<option value="0"><?php _e( '— Select —' ) ?></option>
1420
foreach ( $menus as $menu ) {
1421
echo '<option value="' . $menu->term_id . '"'
1422
. selected( $nav_menu, $menu->term_id, false )
1423
. '>'. esc_html( $menu->name ) . '</option>';
1574
<p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>>
1576
if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) {
1577
// @todo When expanding a panel, the JS should be smart enough to collapse any existing panels and sections.
1578
$url = 'javascript: wp.customize.section.each(function( section ){ section.collapse(); }); wp.customize.panel( "nav_menus" ).focus();';
1580
$url = admin_url( 'nav-menus.php' );
1583
<?php echo sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_attr( $url ) ); ?>
1585
<div class="nav-menu-widget-form-controls" <?php if ( empty( $menus ) ) { echo ' style="display:none" '; } ?>>
1587
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ) ?></label>
1588
<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>"/>
1591
<label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label>
1592
<select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>">
1593
<option value="0"><?php _e( '— Select —' ); ?></option>
1594
<?php foreach ( $menus as $menu ) : ?>
1595
<option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>>
1596
<?php echo esc_html( $menu->name ); ?>
1598
<?php endforeach; ?>