equal
deleted
inserted
replaced
21 * |
21 * |
22 * @since 2.8.0 |
22 * @since 2.8.0 |
23 */ |
23 */ |
24 public function __construct() { |
24 public function __construct() { |
25 $widget_ops = array( |
25 $widget_ops = array( |
26 'classname' => 'widget_search', |
26 'classname' => 'widget_search', |
27 'description' => __( 'A search form for your site.' ), |
27 'description' => __( 'A search form for your site.' ), |
28 'customize_selective_refresh' => true, |
28 'customize_selective_refresh' => true, |
29 ); |
29 ); |
30 parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); |
30 parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops ); |
31 } |
31 } |
32 |
32 |
62 * @since 2.8.0 |
62 * @since 2.8.0 |
63 * |
63 * |
64 * @param array $instance Current settings. |
64 * @param array $instance Current settings. |
65 */ |
65 */ |
66 public function form( $instance ) { |
66 public function form( $instance ) { |
67 $instance = wp_parse_args( (array) $instance, array( 'title' => '') ); |
67 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); |
68 $title = $instance['title']; |
68 $title = $instance['title']; |
69 ?> |
69 ?> |
70 <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 esc_attr($title); ?>" /></label></p> |
70 <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 esc_attr( $title ); ?>" /></label></p> |
71 <?php |
71 <?php |
72 } |
72 } |
73 |
73 |
74 /** |
74 /** |
75 * Handles updating settings for the current Search widget instance. |
75 * Handles updating settings for the current Search widget instance. |
80 * WP_Widget::form(). |
80 * WP_Widget::form(). |
81 * @param array $old_instance Old settings for this instance. |
81 * @param array $old_instance Old settings for this instance. |
82 * @return array Updated settings. |
82 * @return array Updated settings. |
83 */ |
83 */ |
84 public function update( $new_instance, $old_instance ) { |
84 public function update( $new_instance, $old_instance ) { |
85 $instance = $old_instance; |
85 $instance = $old_instance; |
86 $new_instance = wp_parse_args((array) $new_instance, array( 'title' => '')); |
86 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) ); |
87 $instance['title'] = sanitize_text_field( $new_instance['title'] ); |
87 $instance['title'] = sanitize_text_field( $new_instance['title'] ); |
88 return $instance; |
88 return $instance; |
89 } |
89 } |
90 |
90 |
91 } |
91 } |