From e6d9f04bcc56a2330924914ab70a9c71e43c25d9 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Tue, 25 Mar 2014 08:53:14 +0000 Subject: [PATCH] Inline documentation for hooks in wp-includes/default-widgets.php. Props janw.oostendorp and kpdesign. Fixes #25638. Built from https://develop.svn.wordpress.org/trunk@27697 git-svn-id: http://core.svn.wordpress.org/trunk@27536 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-widgets.php | 227 +++++++++++++++++++++++++++++--- 1 file changed, 206 insertions(+), 21 deletions(-) diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 2cc34dd4fb..68048c3173 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -21,14 +21,38 @@ class WP_Widget_Pages extends WP_Widget { function widget( $args, $instance ) { extract( $args ); - $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base); + /** + * Filter the widget title. + * + * @since 2.6.0 + * + * @param string $title The widget title. Default 'Pages'. + * @param array $instance An array of the widget's settings. + * @param mixed $id_base The widget ID. + */ + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base ); + $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; if ( $sortby == 'menu_order' ) $sortby = 'menu_order, post_title'; - $out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) ); + /** + * Filter the arguments for the Pages widget. + * + * @since 2.8.0 + * + * @see wp_list_pages() + * + * @param array $args An array of arguments to retrieve the pages list. + */ + $out = wp_list_pages( apply_filters( 'widget_pages_args', array( + 'title_li' => '', + 'echo' => 0, + 'sort_column' => $sortby, + 'exclude' => $exclude + ) ) ); if ( !empty( $out ) ) { echo $before_widget; @@ -107,7 +131,17 @@ class WP_Widget_Links extends WP_Widget { $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1; $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); - wp_list_bookmarks(apply_filters('widget_links_args', array( + + /** + * Filter the arguments for the Links widget. + * + * @since 2.6.0 + * + * @see wp_list_bookmarks() + * + * @param array $args An array of arguments to retrieve the links list. + */ + wp_list_bookmarks( apply_filters( 'widget_links_args', array( 'title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'show_images' => $show_images, 'show_description' => $show_description, @@ -115,7 +149,7 @@ class WP_Widget_Links extends WP_Widget { 'category' => $category, 'class' => 'linkcat widget', 'orderby' => $orderby, 'order' => $order, 'limit' => $limit, - ))); + ) ) ); } function update( $new_instance, $old_instance ) { @@ -196,6 +230,8 @@ class WP_Widget_Search extends WP_Widget { function widget( $args, $instance ) { extract($args); + + /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $before_widget; @@ -241,7 +277,9 @@ class WP_Widget_Archives extends WP_Widget { extract($args); $c = ! empty( $instance['count'] ) ? '1' : '0'; $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; - $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); + + /** This filter is documented in wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', empty($instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); echo $before_widget; if ( $title ) @@ -249,12 +287,45 @@ class WP_Widget_Archives extends WP_Widget { if ( $d ) { ?> - + id_base); + + /** This filter is documented in wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base ); echo $before_widget; if ( $title ) @@ -315,12 +388,22 @@ class WP_Widget_Meta extends WP_Widget {
  • RSS'); ?>
  • RSS'); ?>
  • - %s', +%s', esc_url( __( 'https://wordpress.org/' ) ), esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), _x( 'WordPress.org', 'meta widget link text' ) - ) ); ?> - + ) ); + + wp_meta(); +?> id_base); + + /** This filter is documented in wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); + echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; @@ -398,7 +484,18 @@ class WP_Widget_Text extends WP_Widget { function widget( $args, $instance ) { extract($args); + + /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); + + /** + * Filter the content of the Text widget. + * + * @since 2.3.0 + * + * @param string $widget_text The widget content. + * @param WP_Widget $instance WP_Widget instance. + */ $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); echo $before_widget; if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?> @@ -448,7 +545,9 @@ class WP_Widget_Categories extends WP_Widget { function widget( $args, $instance ) { extract( $args ); - $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); + /** This filter is documented in wp-includes/default-widgets.php */ + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); + $c = ! empty( $instance['count'] ) ? '1' : '0'; $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; @@ -461,7 +560,17 @@ class WP_Widget_Categories extends WP_Widget { if ( $d ) { $cat_args['show_option_none'] = __('Select Category'); - wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); + + /** + * Filter the arguments for the Categories widget drop-down. + * + * @since 2.8.0 + * + * @see wp_dropdown_categories() + * + * @param array $cat_args An array of Categories widget drop-down arguments. + */ + wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) ); ?>