Make WordPress Core

Ticket #38017: 38017.diff

File 38017.diff, 6.4 KB (added by Takahashi_Fumiki, 9 years ago)

Add extra param $instance to widget's filters.

  • src/wp-includes/widgets/class-wp-widget-archives.php

     
    6767                         * @see wp_get_archives()
    6868                         *
    6969                         * @param array $args An array of Archives widget drop-down arguments.
     70                         * @param array $instance Settings for the current Archives widget instance.
    7071                         */
    7172                        $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
    7273                                'type'            => 'monthly',
    7374                                'format'          => 'option',
    7475                                'show_post_count' => $c
    75                         ) );
     76                        ), $instance );
    7677
    7778                        switch ( $dropdown_args['type'] ) {
    7879                                case 'yearly':
     
    107108                 *
    108109                 * @see wp_get_archives()
    109110                 *
    110                  * @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.
    111113                 */
    112114                wp_get_archives( apply_filters( 'widget_archives_args', array(
    113115                        'type'            => 'monthly',
    114116                        'show_post_count' => $c
    115                 ) ) );
     117                ), $instance ) );
    116118                ?>
    117119                </ul>
    118120                <?php
  • src/wp-includes/widgets/class-wp-widget-categories.php

     
    7979                         * @see wp_dropdown_categories()
    8080                         *
    8181                         * @param array $cat_args An array of Categories widget drop-down arguments.
     82                         * @param array $instance Array of settings for the current widget.
    8283                         */
    83                         wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) );
     84                        wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) );
    8485                        ?>
    8586
    8687<script type='text/javascript'>
     
    110111                 * @since 2.8.0
    111112                 *
    112113                 * @param array $cat_args An array of Categories widget options.
     114                 * @param array $instance Array of settings for the current widget.
    113115                 */
    114                 wp_list_categories( apply_filters( 'widget_categories_args', $cat_args ) );
     116                wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
    115117?>
    116118                </ul>
    117119<?php
  • src/wp-includes/widgets/class-wp-widget-meta.php

     
    6464                         * @since 3.6.0
    6565                         *
    6666                         * @param string $title_text Default title text for the WordPress.org link.
     67                         * @param array  $instance   Array of settings for the current widget.
    6768                         */
    6869                        echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',
    6970                                esc_url( __( 'https://wordpress.org/' ) ),
    7071                                esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
    7172                                _x( 'WordPress.org', 'meta widget link text' )
    72                         ) );
     73                        ), $instance );
    7374
    7475                        wp_meta();
    7576                        ?>
  • src/wp-includes/widgets/class-wp-widget-pages.php

     
    6767                 *
    6868                 * @see wp_list_pages()
    6969                 *
    70                  * @param array $args An array of arguments to retrieve the pages list.
     70                 * @param array $args     An array of arguments to retrieve the pages list.
     71                 * @param array $instance Array of settings for the current widget.
    7172                 */
    7273                $out = wp_list_pages( apply_filters( 'widget_pages_args', array(
    7374                        'title_li'    => '',
     
    7475                        'echo'        => 0,
    7576                        'sort_column' => $sortby,
    7677                        'exclude'     => $exclude
    77                 ) ) );
     78                ), $instance ) );
    7879
    7980                if ( ! empty( $out ) ) {
    8081                        echo $args['before_widget'];
  • src/wp-includes/widgets/class-wp-widget-recent-comments.php

     
    9292                 * @see WP_Comment_Query::query() for information on accepted arguments.
    9393                 *
    9494                 * @param array $comment_args An array of arguments used to retrieve the recent comments.
     95                 * @param array $instance     Array of settings for the current widget.
    9596                 */
    9697                $comments = get_comments( apply_filters( 'widget_comments_args', array(
    9798                        'number'      => $number,
    9899                        'status'      => 'approve',
    99100                        'post_status' => 'publish'
    100                 ) ) );
     101                ), $instance ) );
    101102
    102103                $output .= $args['before_widget'];
    103104                if ( $title ) {
  • src/wp-includes/widgets/class-wp-widget-recent-posts.php

     
    6464                 *
    6565                 * @see WP_Query::get_posts()
    6666                 *
    67                  * @param array $args An array of arguments used to retrieve the recent posts.
     67                 * @param array $args     An array of arguments used to retrieve the recent posts.
     68                 * @param array $instance Array of settings for the current widget.
    6869                 */
    6970                $r = new WP_Query( apply_filters( 'widget_posts_args', array(
    7071                        'posts_per_page'      => $number,
     
    7172                        'no_found_rows'       => true,
    7273                        'post_status'         => 'publish',
    7374                        'ignore_sticky_posts' => true
    74                 ) ) );
     75                ), $instance ) );
    7576
    7677                if ($r->have_posts()) :
    7778                ?>
  • src/wp-includes/widgets/class-wp-widget-tag-cloud.php

     
    6262                 * @see wp_tag_cloud()
    6363                 *
    6464                 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
     65                 * @param array $instance         Array of settings for the current widget.
    6566                 */
    6667                $tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
    6768                        'taxonomy' => $current_taxonomy,
    6869                        'echo' => false
    69                 ) ) );
     70                ), $instance ) );
    7071
    7172                if ( empty( $tag_cloud ) ) {
    7273                        return;