WordPress.org

Make WordPress Core

Changeset 46088


Ignore:
Timestamp:
09/10/2019 07:22:07 PM (10 days ago)
Author:
SergeyBiryukov
Message:

Docs: Fix placement of some duplicate hook references.

Hook documentation should be on the line directly above the line containing the do_action() or apply_filters() call. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of duplicate hook references.

Includes minor code layout fixes.

See #47110.

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-custom-background.php

    r45932 r46088  
    585585            exit;
    586586        }
     587
    587588        $attachment_id = absint( $_POST['attachment_id'] );
    588         /** This filter is documented in wp-admin/includes/media.php */
     589
    589590        $sizes = array_keys(
     591            /** This filter is documented in wp-admin/includes/media.php */
    590592            apply_filters(
    591593                'image_size_names_choose',
     
    598600            )
    599601        );
    600         $size  = 'thumbnail';
     602
     603        $size = 'thumbnail';
    601604        if ( in_array( $_POST['size'], $sizes ) ) {
    602605            $size = esc_attr( $_POST['size'] );
     
    604607
    605608        update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) );
     609
    606610        $url       = wp_get_attachment_image_src( $attachment_id, $size );
    607611        $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
  • trunk/src/wp-admin/includes/class-walker-category-checklist.php

    r42343 r46088  
    9696            }
    9797
    98             /** This filter is documented in wp-includes/category-template.php */
    9998            $output .= "\n" . '<li' . $class . '>' .
    10099                '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
    101100                ' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
     101                /** This filter is documented in wp-includes/category-template.php */
    102102                esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
    103103        } else {
    104             /** This filter is documented in wp-includes/category-template.php */
    105104            $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
    106105                '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
    107106                checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
    108107                disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
     108                /** This filter is documented in wp-includes/category-template.php */
    109109                esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
    110110        }
  • trunk/src/wp-admin/includes/template.php

    r46083 r46088  
    310310    $title = esc_textarea( trim( $post->post_title ) );
    311311
    312     /** This filter is documented in wp-admin/edit-tag-form.php */
    313312    echo '
    314313<div class="hidden" id="inline_' . $post->ID . '">
  • trunk/src/wp-content/themes/twentyeleven/author.php

    r45932 r46088  
    6060                         * @param int The height and width avatar dimension in pixels. Default 60.
    6161                         */
    62                         echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 60 ) );
     62                        $author_bio_avatar_size = apply_filters( 'twentyeleven_author_bio_avatar_size', 60 );
     63                        echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
    6364                        ?>
    6465                    </div><!-- #author-avatar -->
  • trunk/src/wp-content/themes/twentyeleven/content-single.php

    r45932 r46088  
    6767                <?php
    6868                /** This filter is documented in author.php */
    69                 echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) );
     69                $author_bio_avatar_size = apply_filters( 'twentyeleven_author_bio_avatar_size', 68 );
     70                echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
    7071                ?>
    7172            </div><!-- #author-avatar -->
  • trunk/src/wp-content/themes/twentyten/author.php

    r45932 r46088  
    4848                             * @param int The height and width avatar dimensions in pixels. Default 60.
    4949                             */
    50                             echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) );
     50                            $author_bio_avatar_size = apply_filters( 'twentyten_author_bio_avatar_size', 60 );
     51                            echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
    5152                            ?>
    5253                        </div><!-- #author-avatar -->
  • trunk/src/wp-content/themes/twentyten/loop-single.php

    r45932 r46088  
    5151                            <?php
    5252                            /** This filter is documented in author.php */
    53                             echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) );
     53                            $author_bio_avatar_size = apply_filters( 'twentyten_author_bio_avatar_size', 60 );
     54                            echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
    5455                            ?>
    5556                            </div><!-- #author-avatar -->
  • trunk/src/wp-includes/class-walker-category.php

    r45932 r46088  
    9898    public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
    9999        /** This filter is documented in wp-includes/category-template.php */
    100         $cat_name = apply_filters(
    101             'list_cats',
    102             esc_attr( $category->name ),
    103             $category
    104         );
     100        $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category );
    105101
    106102        // Don't generate an element if the category name is empty.
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r45932 r46088  
    666666        chmod( $filename, $perms );
    667667
    668         /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
    669668        return array(
    670669            'path'      => $filename,
     670            /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
    671671            'file'      => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
    672672            'width'     => $this->size['width'],
  • trunk/src/wp-includes/class.wp-styles.php

    r45590 r46088  
    200200        $title = isset( $obj->extra['title'] ) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
    201201
     202        $tag = "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n";
     203
    202204        /**
    203205         * Filters the HTML link tag of an enqueued style.
     
    212214         * @param string $media  The stylesheet's media attribute.
    213215         */
    214         $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle, $href, $media );
     216        $tag = apply_filters( 'style_loader_tag', $tag, $handle, $href, $media );
    215217
    216218        if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) {
     
    222224            }
    223225
     226            $rtl_tag = "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n";
    224227            /** This filter is documented in wp-includes/class.wp-styles.php */
    225             $rtl_tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle, $rtl_href, $media );
     228            $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media );
    226229
    227230            if ( $obj->extra['rtl'] === 'replace' ) {
  • trunk/src/wp-includes/comment-template.php

    r45932 r46088  
    22752275    $html_req = ( $req ? " required='required'" : '' );
    22762276    $html5    = 'html5' === $args['format'];
    2277     $fields   = array(
    2278         'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    2279                     '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>',
    2280         'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    2281                     '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>',
    2282         'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
    2283                     '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
     2277
     2278    $fields = array(
     2279        'author' => sprintf(
     2280            '<p class="comment-form-author">%s %s</p>',
     2281            sprintf(
     2282                '<label for="author">%s%s</label>',
     2283                __( 'Name' ),
     2284                ( $req ? ' <span class="required">*</span>' : '' )
     2285            ),
     2286            sprintf(
     2287                '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />',
     2288                esc_attr( $commenter['comment_author'] ),
     2289                $html_req
     2290            )
     2291        ),
     2292        'email'  => sprintf(
     2293            '<p class="comment-form-email">%s %s</p>',
     2294            sprintf(
     2295                '<label for="email">%s%s</label>',
     2296                __( 'Email' ),
     2297                ( $req ? ' <span class="required">*</span>' : '' )
     2298            ),
     2299            sprintf(
     2300                '<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />',
     2301                ( $html5 ? 'type="email"' : 'type="text"' ),
     2302                esc_attr( $commenter['comment_author_email'] ),
     2303                $html_req
     2304            )
     2305        ),
     2306        'url'    => sprintf(
     2307            '<p class="comment-form-url">%s %s</p>',
     2308            sprintf(
     2309                '<label for="url">%s</label>',
     2310                __( 'Website' )
     2311            ),
     2312            sprintf(
     2313                '<input id="url" name="url" %s value="%s" size="30" maxlength="200" />',
     2314                ( $html5 ? 'type="url"' : 'type="text"' ),
     2315                esc_attr( $commenter['comment_author_url'] )
     2316            )
     2317        ),
    22842318    );
    22852319
    22862320    if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) {
    2287         $consent           = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    2288         $fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
    2289                             '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>';
     2321        $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
     2322
     2323        $fields['cookies'] = sprintf(
     2324            '<p class="comment-form-cookies-consent">%s %s</p>',
     2325            sprintf(
     2326                '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"%s />',
     2327                $consent
     2328            ),
     2329            sprintf(
     2330                '<label for="wp-comment-cookies-consent">%s</label>',
     2331                __( 'Save my name, email, and website in this browser for the next time I comment.' )
     2332            )
     2333        );
    22902334
    22912335        // Ensure that the passed fields include cookies consent.
     
    23082352     * @param string[] $fields Array of the default comment fields.
    23092353     */
    2310     $fields   = apply_filters( 'comment_form_default_fields', $fields );
     2354    $fields = apply_filters( 'comment_form_default_fields', $fields );
     2355
    23112356    $defaults = array(
    23122357        'fields'               => $fields,
    2313         'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p>',
    2314         /** This filter is documented in wp-includes/link-template.php */
    2315         'must_log_in'          => '<p class="must-log-in">' . sprintf(
    2316             /* translators: %s: Login URL. */
    2317             __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
    2318             wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
    2319         ) . '</p>',
    2320         /** This filter is documented in wp-includes/link-template.php */
    2321         'logged_in_as'         => '<p class="logged-in-as">' . sprintf(
    2322             /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */
    2323             __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
    2324             get_edit_user_link(),
    2325             /* translators: %s: User name. */
    2326             esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
    2327             $user_identity,
    2328             wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
    2329         ) . '</p>',
    2330         'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>' . ( $req ? $required_text : '' ) . '</p>',
     2358        'comment_field'        => sprintf(
     2359            '<p class="comment-form-comment">%s %s</p>',
     2360            sprintf(
     2361                '<label for="comment">%s</label>',
     2362                _x( 'Comment', 'noun' )
     2363            ),
     2364            '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>'
     2365        ),
     2366        'must_log_in'          => sprintf(
     2367            '<p class="must-log-in">%s</p>',
     2368            sprintf(
     2369                /* translators: %s: Login URL. */
     2370                __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
     2371                /** This filter is documented in wp-includes/link-template.php */
     2372                wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
     2373            )
     2374        ),
     2375        'logged_in_as'         => sprintf(
     2376            '<p class="logged-in-as">%s</p>',
     2377            sprintf(
     2378                /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */
     2379                __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
     2380                get_edit_user_link(),
     2381                /* translators: %s: User name. */
     2382                esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
     2383                $user_identity,
     2384                /** This filter is documented in wp-includes/link-template.php */
     2385                wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
     2386            )
     2387        ),
     2388        'comment_notes_before' => sprintf(
     2389            '<p class="comment-notes">%s%s</p>',
     2390            sprintf(
     2391                '<span id="email-notes">%s</span>',
     2392                __( 'Your email address will not be published.' )
     2393            ),
     2394            ( $req ? $required_text : '' )
     2395        ),
    23312396        'comment_notes_after'  => '',
    23322397        'action'               => site_url( '/wp-comments-post.php' ),
     
    23862451
    23872452        if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) :
     2453
    23882454            echo $args['must_log_in'];
    23892455            /**
     
    23932459             */
    23942460            do_action( 'comment_form_must_log_in_after' );
     2461
    23952462        else :
    2396             ?>
    2397             <form action="<?php echo esc_url( $args['action'] ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="<?php echo esc_attr( $args['class_form'] ); ?>"<?php echo $html5 ? ' novalidate' : ''; ?>>
    2398                 <?php
     2463
     2464            printf(
     2465                '<form action="%s" method="post" id="%s" class="%s"%s>',
     2466                esc_url( $args['action'] ),
     2467                esc_attr( $args['id_form'] ),
     2468                esc_attr( $args['class_form'] ),
     2469                ( $html5 ? ' novalidate' : '' )
     2470            );
     2471
     2472            /**
     2473             * Fires at the top of the comment form, inside the form tag.
     2474             *
     2475             * @since 3.0.0
     2476             */
     2477            do_action( 'comment_form_top' );
     2478
     2479            if ( is_user_logged_in() ) :
     2480
    23992481                /**
    2400                  * Fires at the top of the comment form, inside the form tag.
     2482                 * Filters the 'logged in' message for the comment form for display.
    24012483                 *
    24022484                 * @since 3.0.0
     2485                 *
     2486                 * @param string $args_logged_in The logged-in-as HTML-formatted message.
     2487                 * @param array  $commenter      An array containing the comment author's
     2488                 *                               username, email, and URL.
     2489                 * @param string $user_identity  If the commenter is a registered user,
     2490                 *                               the display name, blank otherwise.
    24032491                 */
    2404                 do_action( 'comment_form_top' );
    2405 
    2406                 if ( is_user_logged_in() ) :
     2492                echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
     2493
     2494                /**
     2495                 * Fires after the is_user_logged_in() check in the comment form.
     2496                 *
     2497                 * @since 3.0.0
     2498                 *
     2499                 * @param array  $commenter     An array containing the comment author's
     2500                 *                              username, email, and URL.
     2501                 * @param string $user_identity If the commenter is a registered user,
     2502                 *                              the display name, blank otherwise.
     2503                 */
     2504                do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
     2505
     2506            else :
     2507
     2508                echo $args['comment_notes_before'];
     2509
     2510            endif;
     2511
     2512            // Prepare an array of all fields, including the textarea
     2513            $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields'];
     2514
     2515            /**
     2516             * Filters the comment form fields, including the textarea.
     2517             *
     2518             * @since 4.4.0
     2519             *
     2520             * @param array $comment_fields The comment fields.
     2521             */
     2522            $comment_fields = apply_filters( 'comment_form_fields', $comment_fields );
     2523
     2524            // Get an array of field names, excluding the textarea
     2525            $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
     2526
     2527            // Get the first and the last field name, excluding the textarea
     2528            $first_field = reset( $comment_field_keys );
     2529            $last_field  = end( $comment_field_keys );
     2530
     2531            foreach ( $comment_fields as $name => $field ) {
     2532
     2533                if ( 'comment' === $name ) {
     2534
    24072535                    /**
    2408                      * Filters the 'logged in' message for the comment form for display.
     2536                     * Filters the content of the comment textarea field for display.
    24092537                     *
    24102538                     * @since 3.0.0
    24112539                     *
    2412                      * @param string $args_logged_in The logged-in-as HTML-formatted message.
    2413                      * @param array  $commenter      An array containing the comment author's
    2414                      *                               username, email, and URL.
    2415                      * @param string $user_identity  If the commenter is a registered user,
    2416                      *                               the display name, blank otherwise.
     2540                     * @param string $args_comment_field The content of the comment textarea field.
    24172541                     */
    2418                     echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
     2542                    echo apply_filters( 'comment_form_field_comment', $field );
     2543
     2544                    echo $args['comment_notes_after'];
     2545
     2546                } elseif ( ! is_user_logged_in() ) {
     2547
     2548                    if ( $first_field === $name ) {
     2549                        /**
     2550                         * Fires before the comment fields in the comment form, excluding the textarea.
     2551                         *
     2552                         * @since 3.0.0
     2553                         */
     2554                        do_action( 'comment_form_before_fields' );
     2555                    }
    24192556
    24202557                    /**
    2421                      * Fires after the is_user_logged_in() check in the comment form.
     2558                     * Filters a comment form field for display.
     2559                     *
     2560                     * The dynamic portion of the filter hook, `$name`, refers to the name
     2561                     * of the comment form field. Such as 'author', 'email', or 'url'.
    24222562                     *
    24232563                     * @since 3.0.0
    24242564                     *
    2425                      * @param array  $commenter     An array containing the comment author's
    2426                      *                              username, email, and URL.
    2427                      * @param string $user_identity If the commenter is a registered user,
    2428                      *                              the display name, blank otherwise.
     2565                     * @param string $field The HTML-formatted output of the comment form field.
    24292566                     */
    2430                     do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
    2431 
    2432                 else :
    2433 
    2434                     echo $args['comment_notes_before'];
    2435 
    2436                 endif;
    2437 
    2438                 // Prepare an array of all fields, including the textarea
    2439                 $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields'];
    2440 
    2441                 /**
    2442                  * Filters the comment form fields, including the textarea.
    2443                  *
    2444                  * @since 4.4.0
    2445                  *
    2446                  * @param array $comment_fields The comment fields.
    2447                  */
    2448                 $comment_fields = apply_filters( 'comment_form_fields', $comment_fields );
    2449 
    2450                 // Get an array of field names, excluding the textarea
    2451                 $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
    2452 
    2453                 // Get the first and the last field name, excluding the textarea
    2454                 $first_field = reset( $comment_field_keys );
    2455                 $last_field  = end( $comment_field_keys );
    2456 
    2457                 foreach ( $comment_fields as $name => $field ) {
    2458 
    2459                     if ( 'comment' === $name ) {
    2460 
     2567                    echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
     2568
     2569                    if ( $last_field === $name ) {
    24612570                        /**
    2462                          * Filters the content of the comment textarea field for display.
     2571                         * Fires after the comment fields in the comment form, excluding the textarea.
    24632572                         *
    24642573                         * @since 3.0.0
    2465                          *
    2466                          * @param string $args_comment_field The content of the comment textarea field.
    24672574                         */
    2468                         echo apply_filters( 'comment_form_field_comment', $field );
    2469 
    2470                         echo $args['comment_notes_after'];
    2471 
    2472                     } elseif ( ! is_user_logged_in() ) {
    2473 
    2474                         if ( $first_field === $name ) {
    2475                             /**
    2476                              * Fires before the comment fields in the comment form, excluding the textarea.
    2477                              *
    2478                              * @since 3.0.0
    2479                              */
    2480                             do_action( 'comment_form_before_fields' );
    2481                         }
    2482 
    2483                         /**
    2484                          * Filters a comment form field for display.
    2485                          *
    2486                          * The dynamic portion of the filter hook, `$name`, refers to the name
    2487                          * of the comment form field. Such as 'author', 'email', or 'url'.
    2488                          *
    2489                          * @since 3.0.0
    2490                          *
    2491                          * @param string $field The HTML-formatted output of the comment form field.
    2492                          */
    2493                         echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
    2494 
    2495                         if ( $last_field === $name ) {
    2496                             /**
    2497                              * Fires after the comment fields in the comment form, excluding the textarea.
    2498                              *
    2499                              * @since 3.0.0
    2500                              */
    2501                             do_action( 'comment_form_after_fields' );
    2502                         }
     2575                        do_action( 'comment_form_after_fields' );
    25032576                    }
    25042577                }
    2505 
    2506                 $submit_button = sprintf(
    2507                     $args['submit_button'],
    2508                     esc_attr( $args['name_submit'] ),
    2509                     esc_attr( $args['id_submit'] ),
    2510                     esc_attr( $args['class_submit'] ),
    2511                     esc_attr( $args['label_submit'] )
    2512                 );
    2513 
    2514                 /**
    2515                  * Filters the submit button for the comment form to display.
    2516                  *
    2517                  * @since 4.2.0
    2518                  *
    2519                  * @param string $submit_button HTML markup for the submit button.
    2520                  * @param array  $args          Arguments passed to comment_form().
    2521                  */
    2522                 $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );
    2523 
    2524                 $submit_field = sprintf(
    2525                     $args['submit_field'],
    2526                     $submit_button,
    2527                     get_comment_id_fields( $post_id )
    2528                 );
    2529 
    2530                 /**
    2531                  * Filters the submit field for the comment form to display.
    2532                  *
    2533                  * The submit field includes the submit button, hidden fields for the
    2534                  * comment form, and any wrapper markup.
    2535                  *
    2536                  * @since 4.2.0
    2537                  *
    2538                  * @param string $submit_field HTML markup for the submit field.
    2539                  * @param array  $args         Arguments passed to comment_form().
    2540                  */
    2541                 echo apply_filters( 'comment_form_submit_field', $submit_field, $args );
    2542 
    2543                 /**
    2544                  * Fires at the bottom of the comment form, inside the closing </form> tag.
    2545                  *
    2546                  * @since 1.5.0
    2547                  *
    2548                  * @param int $post_id The post ID.
    2549                  */
    2550                 do_action( 'comment_form', $post_id );
    2551                 ?>
    2552             </form>
    2553         <?php endif; ?>
     2578            }
     2579
     2580            $submit_button = sprintf(
     2581                $args['submit_button'],
     2582                esc_attr( $args['name_submit'] ),
     2583                esc_attr( $args['id_submit'] ),
     2584                esc_attr( $args['class_submit'] ),
     2585                esc_attr( $args['label_submit'] )
     2586            );
     2587
     2588            /**
     2589             * Filters the submit button for the comment form to display.
     2590             *
     2591             * @since 4.2.0
     2592             *
     2593             * @param string $submit_button HTML markup for the submit button.
     2594             * @param array  $args          Arguments passed to comment_form().
     2595             */
     2596            $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );
     2597
     2598            $submit_field = sprintf(
     2599                $args['submit_field'],
     2600                $submit_button,
     2601                get_comment_id_fields( $post_id )
     2602            );
     2603
     2604            /**
     2605             * Filters the submit field for the comment form to display.
     2606             *
     2607             * The submit field includes the submit button, hidden fields for the
     2608             * comment form, and any wrapper markup.
     2609             *
     2610             * @since 4.2.0
     2611             *
     2612             * @param string $submit_field HTML markup for the submit field.
     2613             * @param array  $args         Arguments passed to comment_form().
     2614             */
     2615            echo apply_filters( 'comment_form_submit_field', $submit_field, $args );
     2616
     2617            /**
     2618             * Fires at the bottom of the comment form, inside the closing </form> tag.
     2619             *
     2620             * @since 1.5.0
     2621             *
     2622             * @param int $post_id The post ID.
     2623             */
     2624            do_action( 'comment_form', $post_id );
     2625
     2626            echo '</form>';
     2627
     2628        endif;
     2629        ?>
    25542630    </div><!-- #respond -->
    25552631    <?php
  • trunk/src/wp-includes/general-template.php

    r45932 r46088  
    40434043        $mid_size = 2;
    40444044    }
     4045
    40454046    $add_args   = $args['add_args'];
    40464047    $r          = '';
     
    40564057        $link .= $args['add_fragment'];
    40574058
    4058         /**
    4059          * Filters the paginated links for the given archive pages.
    4060          *
    4061          * @since 3.0.0
    4062          *
    4063          * @param string $link The paginated link URL.
    4064          */
    4065         $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>';
     4059        $page_links[] = sprintf(
     4060            '<a class="prev page-numbers" href="%s">%s</a>',
     4061            /**
     4062             * Filters the paginated links for the given archive pages.
     4063             *
     4064             * @since 3.0.0
     4065             *
     4066             * @param string $link The paginated link URL.
     4067             */
     4068            esc_url( apply_filters( 'paginate_links', $link ) ),
     4069            $args['prev_text']
     4070        );
    40664071    endif;
     4072
    40674073    for ( $n = 1; $n <= $total; $n++ ) :
    40684074        if ( $n == $current ) :
    4069             $page_links[] = "<span aria-current='" . esc_attr( $args['aria_current'] ) . "' class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . '</span>';
     4075            $page_links[] = sprintf(
     4076                '<span aria-current="%s" class="page-numbers current">%s</span>',
     4077                esc_attr( $args['aria_current'] ),
     4078                $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
     4079            );
    40704080            $dots         = true;
    40714081        else :
     
    40784088                $link .= $args['add_fragment'];
    40794089
    4080                 /** This filter is documented in wp-includes/general-template.php */
    4081                 $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . '</a>';
     4090                $page_links[] = sprintf(
     4091                    '<a class="page-numbers" href="%s">%s</a>',
     4092                    /** This filter is documented in wp-includes/general-template.php */
     4093                    esc_url( apply_filters( 'paginate_links', $link ) ),
     4094                    $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
     4095                );
    40824096                $dots         = true;
    40834097            elseif ( $dots && ! $args['show_all'] ) :
     
    40874101        endif;
    40884102    endfor;
     4103
    40894104    if ( $args['prev_next'] && $current && $current < $total ) :
    40904105        $link = str_replace( '%_%', $args['format'], $args['base'] );
     
    40954110        $link .= $args['add_fragment'];
    40964111
    4097         /** This filter is documented in wp-includes/general-template.php */
    4098         $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>';
     4112        $page_links[] = sprintf(
     4113            '<a class="next page-numbers" href="%s">%s</a>',
     4114            /** This filter is documented in wp-includes/general-template.php */
     4115            esc_url( apply_filters( 'paginate_links', $link ) ),
     4116            $args['next_text']
     4117        );
    40994118    endif;
     4119
    41004120    switch ( $args['type'] ) {
    41014121        case 'array':
     
    41124132            break;
    41134133    }
     4134
    41144135    return $r;
    41154136}
     
    43234344 */
    43244345function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
    4325     // For backward compatibility
     4346    // For backward compatibility.
    43264347    $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
    43274348
    43284349    if ( wp_styles()->query( $handle ) ) {
    4329         if ( $force_echo || did_action( 'wp_print_styles' ) ) { // we already printed the style queue. Print this one immediately
     4350        if ( $force_echo || did_action( 'wp_print_styles' ) ) {
     4351            // We already printed the style queue. Print this one immediately.
    43304352            wp_print_styles( $handle );
    4331         } else { // Add to style queue
     4353        } else {
     4354            // Add to style queue.
    43324355            wp_enqueue_style( $handle );
    43334356        }
    43344357        return;
    43354358    }
     4359
     4360    $stylesheet_link = sprintf(
     4361        "<link rel='stylesheet' href='%s' type='text/css' />\n",
     4362        esc_url( wp_admin_css_uri( $file ) )
     4363    );
    43364364
    43374365    /**
     
    43464374     *                                relative to wp-admin/. Defaults to 'wp-admin'.
    43474375     */
    4348     echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
     4376    echo apply_filters( 'wp_admin_css', $stylesheet_link, $file );
    43494377
    43504378    if ( function_exists( 'is_rtl' ) && is_rtl() ) {
     4379        $rtl_stylesheet_link = sprintf(
     4380            "<link rel='stylesheet' href='%s' type='text/css' />\n",
     4381            esc_url( wp_admin_css_uri( "$file-rtl" ) )
     4382        );
     4383
    43514384        /** This filter is documented in wp-includes/general-template.php */
    4352         echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
     4385        echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" );
    43534386    }
    43544387}
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

    r45811 r46088  
    359359            }
    360360
    361             /**
    362              * This filter is documented in wp-admin/post.php.
    363              */
     361            /** This filter is documented in wp-admin/post.php */
    364362            do_action( 'wp_creating_autosave', $new_autosave );
    365363
  • trunk/src/wp-includes/user.php

    r45932 r46088  
    25042504    } else {
    25052505        /** This filter is documented in wp-includes/user.php */
    2506         $illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) );
    2507         if ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) {
     2506        $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
     2507        if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) {
    25082508            $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
    25092509        }
  • trunk/tests/phpunit/tests/general/paginateLinks.php

    r43571 r46088  
    1717
    1818        $expected = <<<EXPECTED
    19 <span aria-current='page' class='page-numbers current'>1</span>
    20 <a class='page-numbers' href='$page2'>2</a>
    21 <a class='page-numbers' href='$page3'>3</a>
     19<span aria-current="page" class="page-numbers current">1</span>
     20<a class="page-numbers" href="$page2">2</a>
     21<a class="page-numbers" href="$page3">3</a>
    2222<span class="page-numbers dots">&hellip;</span>
    23 <a class='page-numbers' href='$page50'>50</a>
     23<a class="page-numbers" href="$page50">50</a>
    2424<a class="next page-numbers" href="$page2">Next &raquo;</a>
    2525EXPECTED;
     
    3535
    3636        $expected = <<<EXPECTED
    37 <span aria-current='page' class='page-numbers current'>1</span>
    38 <a class='page-numbers' href='$page2'>2</a>
    39 <a class='page-numbers' href='$page3'>3</a>
     37<span aria-current="page" class="page-numbers current">1</span>
     38<a class="page-numbers" href="$page2">2</a>
     39<a class="page-numbers" href="$page3">3</a>
    4040<span class="page-numbers dots">&hellip;</span>
    41 <a class='page-numbers' href='$page50'>50</a>
     41<a class="page-numbers" href="$page50">50</a>
    4242<a class="next page-numbers" href="$page2">Next &raquo;</a>
    4343EXPECTED;
     
    5959
    6060        $expected = <<<EXPECTED
    61 <a class='page-numbers' href='$home'>1</a>
    62 <span aria-current='page' class='page-numbers current'>2</span>
    63 <a class='page-numbers' href='$page3'>3</a>
    64 <a class='page-numbers' href='$page4'>4</a>
     61<a class="page-numbers" href="$home">1</a>
     62<span aria-current="page" class="page-numbers current">2</span>
     63<a class="page-numbers" href="$page3">3</a>
     64<a class="page-numbers" href="$page4">4</a>
    6565<span class="page-numbers dots">&hellip;</span>
    66 <a class='page-numbers' href='$page50'>50</a>
     66<a class="page-numbers" href="$page50">50</a>
    6767EXPECTED;
    6868
     
    8585        $expected = <<<EXPECTED
    8686<a class="prev page-numbers" href="$home">&laquo; Previous</a>
    87 <a class='page-numbers' href='$home'>1</a>
    88 <span aria-current='page' class='page-numbers current'>2</span>
    89 <a class='page-numbers' href='$page3'>3</a>
    90 <a class='page-numbers' href='$page4'>4</a>
     87<a class="page-numbers" href="$home">1</a>
     88<span aria-current="page" class="page-numbers current">2</span>
     89<a class="page-numbers" href="$page3">3</a>
     90<a class="page-numbers" href="$page4">4</a>
    9191<span class="page-numbers dots">&hellip;</span>
    92 <a class='page-numbers' href='$page50'>50</a>
     92<a class="page-numbers" href="$page50">50</a>
    9393<a class="next page-numbers" href="$page3">Next &raquo;</a>
    9494EXPECTED;
     
    334334        );
    335335
    336         $this->assertContains( "<span aria-current='page' class='page-numbers current'>3</span>", $links );
     336        $this->assertContains( '<span aria-current="page" class="page-numbers current">3</span>', $links );
    337337    }
    338338
     
    356356
    357357        $page_2_url = home_url() . '?foo=2';
    358         $this->assertContains( "<a class='page-numbers' href='$page_2_url'>2</a>", $links );
     358        $this->assertContains( "<a class=\"page-numbers\" href=\"$page_2_url\">2</a>", $links );
    359359    }
    360360}
Note: See TracChangeset for help on using the changeset viewer.