WP_Widget_Meta

Core class used to implement a Meta widget.

Defined (1)

The class is defined in the following location(s).

/wp-includes/widgets/class-wp-widget-meta.php  
  1. class WP_Widget_Meta extends WP_Widget { 
  2.  
  3. /** 
  4. * Sets up a new Meta widget instance. 
  5. * @since 2.8.0 
  6. * @access public 
  7. */ 
  8. public function __construct() { 
  9. $widget_ops = array( 
  10. 'classname' => 'widget_meta',  
  11. 'description' => __( 'Login, RSS, & WordPress.org links.' ),  
  12. 'customize_selective_refresh' => true,  
  13. ); 
  14. parent::__construct( 'meta', __( 'Meta' ), $widget_ops ); 
  15.  
  16. /** 
  17. * Outputs the content for the current Meta widget instance. 
  18. * @since 2.8.0 
  19. * @access public 
  20. * @param array $args Display arguments including 'before_title', 'after_title',  
  21. * 'before_widget', and 'after_widget'. 
  22. * @param array $instance Settings for the current Meta widget instance. 
  23. */ 
  24. public function widget( $args, $instance ) { 
  25. /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 
  26. $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); 
  27.  
  28. echo $args['before_widget']; 
  29. if ( $title ) { 
  30. echo $args['before_title'] . $title . $args['after_title']; 
  31. ?> 
  32. <ul> 
  33. <?php wp_register(); ?> 
  34. <li><?php wp_loginout(); ?></li> 
  35. <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 
  36. <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 
  37. <?php 
  38. /** 
  39. * Filters the "Powered by WordPress" text in the Meta widget. 
  40. * @since 3.6.0 
  41. * @param string $title_text Default title text for the WordPress.org link. 
  42. */ 
  43. echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',  
  44. esc_url( __( 'https://wordpress.org/' ) ),  
  45. esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),  
  46. _x( 'WordPress.org', 'meta widget link text' ) 
  47. ) ); 
  48.  
  49. wp_meta(); 
  50. ?> 
  51. </ul> 
  52. <?php 
  53. echo $args['after_widget']; 
  54.  
  55. /** 
  56. * Handles updating settings for the current Meta widget instance. 
  57. * @since 2.8.0 
  58. * @access public 
  59. * @param array $new_instance New settings for this instance as input by the user via 
  60. * WP_Widget::form(). 
  61. * @param array $old_instance Old settings for this instance. 
  62. * @return array Updated settings to save. 
  63. */ 
  64. public function update( $new_instance, $old_instance ) { 
  65. $instance = $old_instance; 
  66. $instance['title'] = sanitize_text_field( $new_instance['title'] ); 
  67.  
  68. return $instance; 
  69.  
  70. /** 
  71. * Outputs the settings form for the Meta widget. 
  72. * @since 2.8.0 
  73. * @access public 
  74. * @param array $instance Current settings. 
  75. */ 
  76. public function form( $instance ) { 
  77. $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); 
  78. $title = sanitize_text_field( $instance['title'] ); 
  79. ?> 
  80. <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> 
  81. <?php