23 * |
23 * |
24 * @since 2.8.0 |
24 * @since 2.8.0 |
25 */ |
25 */ |
26 public function __construct() { |
26 public function __construct() { |
27 $widget_ops = array( |
27 $widget_ops = array( |
28 'classname' => 'widget_meta', |
28 'classname' => 'widget_meta', |
29 'description' => __( 'Login, RSS, & WordPress.org links.' ), |
29 'description' => __( 'Login, RSS, & WordPress.org links.' ), |
30 'customize_selective_refresh' => true, |
30 'customize_selective_refresh' => true, |
31 ); |
31 ); |
32 parent::__construct( 'meta', __( 'Meta' ), $widget_ops ); |
32 parent::__construct( 'meta', __( 'Meta' ), $widget_ops ); |
33 } |
33 } |
34 |
34 |
50 echo $args['before_widget']; |
50 echo $args['before_widget']; |
51 |
51 |
52 if ( $title ) { |
52 if ( $title ) { |
53 echo $args['before_title'] . $title . $args['after_title']; |
53 echo $args['before_title'] . $title . $args['after_title']; |
54 } |
54 } |
55 ?> |
55 ?> |
56 <ul> |
56 <ul> |
57 <?php wp_register(); ?> |
57 <?php wp_register(); ?> |
58 <li><?php wp_loginout(); ?></li> |
58 <li><?php wp_loginout(); ?></li> |
59 <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> |
59 <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> |
60 <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> |
60 <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> |
61 <?php |
61 <?php |
62 /** |
62 /** |
63 * Filters the "Powered by WordPress" text in the Meta widget. |
63 * Filters the "Powered by WordPress" text in the Meta widget. |
64 * |
64 * |
65 * @since 3.6.0 |
65 * @since 3.6.0 |
66 * @since 4.9.0 Added the `$instance` parameter. |
66 * @since 4.9.0 Added the `$instance` parameter. |
67 * |
67 * |
68 * @param string $title_text Default title text for the WordPress.org link. |
68 * @param string $title_text Default title text for the WordPress.org link. |
69 * @param array $instance Array of settings for the current widget. |
69 * @param array $instance Array of settings for the current widget. |
70 */ |
70 */ |
71 echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', |
71 echo apply_filters( |
72 esc_url( __( 'https://wordpress.org/' ) ), |
72 'widget_meta_poweredby', |
73 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), |
73 sprintf( |
74 _x( 'WordPress.org', 'meta widget link text' ) |
74 '<li><a href="%s" title="%s">%s</a></li>', |
75 ), $instance ); |
75 esc_url( __( 'https://wordpress.org/' ) ), |
|
76 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), |
|
77 _x( 'WordPress.org', 'meta widget link text' ) |
|
78 ), |
|
79 $instance |
|
80 ); |
76 |
81 |
77 wp_meta(); |
82 wp_meta(); |
78 ?> |
83 ?> |
79 </ul> |
84 </ul> |
80 <?php |
85 <?php |
81 |
86 |
82 echo $args['after_widget']; |
87 echo $args['after_widget']; |
83 } |
88 } |
84 |
89 |
85 /** |
90 /** |
86 * Handles updating settings for the current Meta widget instance. |
91 * Handles updating settings for the current Meta widget instance. |
87 * |
92 * |
91 * WP_Widget::form(). |
96 * WP_Widget::form(). |
92 * @param array $old_instance Old settings for this instance. |
97 * @param array $old_instance Old settings for this instance. |
93 * @return array Updated settings to save. |
98 * @return array Updated settings to save. |
94 */ |
99 */ |
95 public function update( $new_instance, $old_instance ) { |
100 public function update( $new_instance, $old_instance ) { |
96 $instance = $old_instance; |
101 $instance = $old_instance; |
97 $instance['title'] = sanitize_text_field( $new_instance['title'] ); |
102 $instance['title'] = sanitize_text_field( $new_instance['title'] ); |
98 |
103 |
99 return $instance; |
104 return $instance; |
100 } |
105 } |
101 |
106 |
106 * |
111 * |
107 * @param array $instance Current settings. |
112 * @param array $instance Current settings. |
108 */ |
113 */ |
109 public function form( $instance ) { |
114 public function form( $instance ) { |
110 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); |
115 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); |
111 $title = sanitize_text_field( $instance['title'] ); |
116 ?> |
112 ?> |
117 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <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( $instance['title'] ); ?>" /></p> |
113 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <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> |
118 <?php |
114 <?php |
|
115 } |
119 } |
116 } |
120 } |