Make WordPress Core

Changeset 41685


Ignore:
Timestamp:
10/02/2017 10:01:19 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Widgets: Pass $instance to widget argument filters:

  • widget_archives_dropdown_args
  • widget_archives_args
  • widget_categories_dropdown_args
  • widget_categories_args
  • widget_meta_poweredby
  • widget_pages_args
  • widget_comments_args
  • widget_posts_args
  • widget_tag_cloud_args

See [33971] for widget_links_args and [34662] for widget_nav_menu_args.

Props Takahashi_Fumiki.
Fixes #38017.

Location:
trunk/src/wp-includes/widgets
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-archives.php

    r41162 r41685  
    6262                         *
    6363                         * @since 2.8.0
     64                         * @since 4.9.0 Added the `$instance` parameter.
    6465                         *
    6566                         * @see wp_get_archives()
    6667                         *
    67                          * @param array $args An array of Archives widget drop-down arguments.
     68                         * @param array $args     An array of Archives widget drop-down arguments.
     69                         * @param array $instance Settings for the current Archives widget instance.
    6870                         */
    6971                        $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
    … …  
    7173                                'format'          => 'option',
    7274                                'show_post_count' => $c
    73                         ) );
     75                        ), $instance );
    7476
    7577                        switch ( $dropdown_args['type'] ) {
    … …  
    103105                 *
    104106                 * @since 2.8.0
     107                 * @since 4.9.0 Added the `$instance` parameter.
    105108                 *
    106109                 * @see wp_get_archives()
    107110                 *
    108                  * @param array $args An array of Archives option arguments.
     111                 * @param array $args     An array of Archives option arguments.
     112                 * @param array $instance Array of settings for the current widget.
    109113                 */
    110114                wp_get_archives( apply_filters( 'widget_archives_args', array(
    111115                        'type'            => 'monthly',
    112116                        'show_post_count' => $c
    113                 ) ) );
     117                ), $instance ) );
    114118                ?>
    115119                </ul>
  • trunk/src/wp-includes/widgets/class-wp-widget-categories.php

    r41547 r41685  
    7777                         *
    7878                         * @since 2.8.0
     79                         * @since 4.9.0 Added the `$instance` parameter.
    7980                         *
    8081                         * @see wp_dropdown_categories()
    8182                         *
    8283                         * @param array $cat_args An array of Categories widget drop-down arguments.
     84                         * @param array $instance Array of settings for the current widget.
    8385                         */
    84                         wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) );
     86                        wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) );
    8587
    8688                        echo '</form>';
    … …  
    112114                 *
    113115                 * @since 2.8.0
     116                 * @since 4.9.0 Added the `$instance` parameter.
    114117                 *
    115118                 * @param array $cat_args An array of Categories widget options.
     119                 * @param array $instance Array of settings for the current widget.
    116120                 */
    117                 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args ) );
     121                wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
    118122?>
    119123                </ul>
  • trunk/src/wp-includes/widgets/class-wp-widget-links.php

    r41162 r41685  
    7171                 *
    7272                 * @since 2.6.0
    73                  * @since 4.4.0 The `$instance` parameter was added.
     73                 * @since 4.4.0 Added the `$instance` parameter.
    7474                 *
    7575                 * @see wp_list_bookmarks()
  • trunk/src/wp-includes/widgets/class-wp-widget-meta.php

    r41162 r41685  
    6161                         *
    6262                         * @since 3.6.0
     63                         * @since 4.9.0 Added the `$instance` parameter.
    6364                         *
    6465                         * @param string $title_text Default title text for the WordPress.org link.
     66                         * @param array  $instance   Array of settings for the current widget.
    6567                         */
    6668                        echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',
    … …  
    6870                                esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
    6971                                _x( 'WordPress.org', 'meta widget link text' )
    70                         ) );
     72                        ), $instance );
    7173
    7274                        wp_meta();
  • trunk/src/wp-includes/widgets/class-wp-widget-pages.php

    r41162 r41685  
    4848                 *
    4949                 * @param string $title    The widget title. Default 'Pages'.
    50                  * @param array  $instance An array of the widget's settings.
     50                 * @param array  $instance Array of settings for the current widget.
    5151                 * @param mixed  $id_base  The widget ID.
    5252                 */
    … …  
    6363                 *
    6464                 * @since 2.8.0
     65                 * @since 4.9.0 Added the `$instance` parameter.
    6566                 *
    6667                 * @see wp_list_pages()
    6768                 *
    68                  * @param array $args An array of arguments to retrieve the pages list.
     69                 * @param array $args     An array of arguments to retrieve the pages list.
     70                 * @param array $instance Array of settings for the current widget.
    6971                 */
    7072                $out = wp_list_pages( apply_filters( 'widget_pages_args', array(
    … …  
    7375                        'sort_column' => $sortby,
    7476                        'exclude'     => $exclude
    75                 ) ) );
     77                ), $instance ) );
    7678
    7779                if ( ! empty( $out ) ) {
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php

    r41162 r41685  
    8686                 *
    8787                 * @since 3.4.0
     88                 * @since 4.9.0 Added the `$instance` parameter.
    8889                 *
    8990                 * @see WP_Comment_Query::query() for information on accepted arguments.
    9091                 *
    9192                 * @param array $comment_args An array of arguments used to retrieve the recent comments.
     93                 * @param array $instance     Array of settings for the current widget.
    9294                 */
    9395                $comments = get_comments( apply_filters( 'widget_comments_args', array(
    … …  
    9597                        'status'      => 'approve',
    9698                        'post_status' => 'publish'
    97                 ) ) );
     99                ), $instance ) );
    98100
    99101                $output .= $args['before_widget'];
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-posts.php

    r41162 r41685  
    6060                 *
    6161                 * @since 3.4.0
     62                 * @since 4.9.0 Added the `$instance` parameter.
    6263                 *
    6364                 * @see WP_Query::get_posts()
    6465                 *
    65                  * @param array $args An array of arguments used to retrieve the recent posts.
     66                 * @param array $args     An array of arguments used to retrieve the recent posts.
     67                 * @param array $instance Array of settings for the current widget.
    6668                 */
    6769                $r = new WP_Query( apply_filters( 'widget_posts_args', array(
    … …  
    7072                        'post_status'         => 'publish',
    7173                        'ignore_sticky_posts' => true
    72                 ) ) );
     74                ), $instance ) );
    7375
    7476                if ($r->have_posts()) :
  • trunk/src/wp-includes/widgets/class-wp-widget-tag-cloud.php

    r41162 r41685  
    5959                 * @since 2.8.0
    6060                 * @since 3.0.0 Added taxonomy drop-down.
     61                 * @since 4.9.0 Added the `$instance` parameter.
    6162                 *
    6263                 * @see wp_tag_cloud()
    6364                 *
    64                  * @param array $args Args used for the tag cloud widget.
     65                 * @param array $args     Args used for the tag cloud widget.
     66                 * @param array $instance Array of settings for the current widget.
    6567                 */
    6668                $tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
    … …  
    6870                        'echo'       => false,
    6971                        'show_count' => $show_count,
    70                 ) ) );
     72                ), $instance ) );
    7173
    7274                if ( empty( $tag_cloud ) ) {
Note: See TracChangeset for help on using the changeset viewer.