3 * Widget API: WP_Widget_Meta class
11 * Core class used to implement a Meta widget.
13 * Displays log in/out, RSS feed links, etc.
19 class WP_Widget_Meta extends WP_Widget {
22 * Sets up a new Meta widget instance.
27 public function __construct() {
28 $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") );
29 parent::__construct('meta', __('Meta'), $widget_ops);
33 * Outputs the content for the current Meta widget instance.
38 * @param array $args Display arguments including 'before_title', 'after_title',
39 * 'before_widget', and 'after_widget'.
40 * @param array $instance Settings for the current Meta widget instance.
42 public function widget( $args, $instance ) {
43 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
44 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
46 echo $args['before_widget'];
48 echo $args['before_title'] . $title . $args['after_title'];
52 <?php wp_register(); ?>
53 <li><?php wp_loginout(); ?></li>
54 <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
55 <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
58 * Filter the "Powered by WordPress" text in the Meta widget.
62 * @param string $title_text Default title text for the WordPress.org link.
64 echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',
65 esc_url( __( 'https://wordpress.org/' ) ),
66 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
67 _x( 'WordPress.org', 'meta widget link text' )
74 echo $args['after_widget'];
78 * Handles updating settings for the current Meta widget instance.
83 * @param array $new_instance New settings for this instance as input by the user via
85 * @param array $old_instance Old settings for this instance.
86 * @return array Updated settings to save.
88 public function update( $new_instance, $old_instance ) {
89 $instance = $old_instance;
90 $instance['title'] = sanitize_text_field( $new_instance['title'] );
96 * Outputs the settings form for the Meta widget.
101 * @param array $instance Current settings.
103 public function form( $instance ) {
104 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
105 $title = sanitize_text_field( $instance['title'] );
107 <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>