From dcb08f063775135261bdab04ecd6d7a417991e83 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 Sep 2019 19:23:55 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@46088 git-svn-id: http://core.svn.wordpress.org/trunk@45900 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-custom-background.php | 8 +- .../class-walker-category-checklist.php | 4 +- wp-admin/includes/template.php | 1 - wp-content/themes/twentyeleven/author.php | 3 +- .../themes/twentyeleven/content-single.php | 3 +- wp-content/themes/twentyten/author.php | 3 +- wp-content/themes/twentyten/loop-single.php | 3 +- wp-includes/class-walker-category.php | 6 +- wp-includes/class-wp-image-editor-imagick.php | 2 +- wp-includes/class.wp-styles.php | 7 +- wp-includes/comment-template.php | 388 +++++++++++------- wp-includes/general-template.php | 69 +++- .../class-wp-rest-autosaves-controller.php | 4 +- wp-includes/user.php | 4 +- wp-includes/version.php | 2 +- 15 files changed, 310 insertions(+), 197 deletions(-) diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index 2a8e1d9f2b..ea74ef420c 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -584,9 +584,11 @@ class Custom_Background { if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) { exit; } + $attachment_id = absint( $_POST['attachment_id'] ); - /** This filter is documented in wp-admin/includes/media.php */ + $sizes = array_keys( + /** This filter is documented in wp-admin/includes/media.php */ apply_filters( 'image_size_names_choose', array( @@ -597,12 +599,14 @@ class Custom_Background { ) ) ); - $size = 'thumbnail'; + + $size = 'thumbnail'; if ( in_array( $_POST['size'], $sizes ) ) { $size = esc_attr( $_POST['size'] ); } update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); + $url = wp_get_attachment_image_src( $attachment_id, $size ); $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php index d8719debf4..76c4f2bcbd 100644 --- a/wp-admin/includes/class-walker-category-checklist.php +++ b/wp-admin/includes/class-walker-category-checklist.php @@ -95,17 +95,17 @@ class Walker_Category_Checklist extends Walker { $aria_checked = 'true'; } - /** This filter is documented in wp-includes/category-template.php */ $output .= "\n" . '' . ''; } else { - /** This filter is documented in wp-includes/category-template.php */ $output .= "\n
  • " . ''; } } diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index a77e700df3..ca23882f99 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -309,7 +309,6 @@ function get_inline_data( $post ) { $title = esc_textarea( trim( $post->post_title ) ); - /** This filter is documented in wp-admin/edit-tag-form.php */ echo '
    diff --git a/wp-content/themes/twentyeleven/content-single.php b/wp-content/themes/twentyeleven/content-single.php index 8969701b86..55e3e50559 100644 --- a/wp-content/themes/twentyeleven/content-single.php +++ b/wp-content/themes/twentyeleven/content-single.php @@ -66,7 +66,8 @@
    diff --git a/wp-content/themes/twentyten/author.php b/wp-content/themes/twentyten/author.php index 52996ca0d6..8383d24d18 100644 --- a/wp-content/themes/twentyten/author.php +++ b/wp-content/themes/twentyten/author.php @@ -47,7 +47,8 @@ if ( get_the_author_meta( 'description' ) ) : * * @param int The height and width avatar dimensions in pixels. Default 60. */ - echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); + $author_bio_avatar_size = apply_filters( 'twentyten_author_bio_avatar_size', 60 ); + echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size ); ?>
    diff --git a/wp-content/themes/twentyten/loop-single.php b/wp-content/themes/twentyten/loop-single.php index 8cf51ae475..4ae519be81 100644 --- a/wp-content/themes/twentyten/loop-single.php +++ b/wp-content/themes/twentyten/loop-single.php @@ -50,7 +50,8 @@ if ( have_posts() ) {
    diff --git a/wp-includes/class-walker-category.php b/wp-includes/class-walker-category.php index 19ccda56ef..e5fff0e6da 100644 --- a/wp-includes/class-walker-category.php +++ b/wp-includes/class-walker-category.php @@ -97,11 +97,7 @@ class Walker_Category extends Walker { */ public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { /** This filter is documented in wp-includes/category-template.php */ - $cat_name = apply_filters( - 'list_cats', - esc_attr( $category->name ), - $category - ); + $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category ); // Don't generate an element if the category name is empty. if ( '' === $cat_name ) { diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index aef93c2f04..eb5ee112fb 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -665,9 +665,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits chmod( $filename, $perms ); - /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */ return array( 'path' => $filename, + /** This filter is documented in wp-includes/class-wp-image-editor-gd.php */ 'file' => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ), 'width' => $this->size['width'], 'height' => $this->size['height'], diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php index f8bdd830dd..2d31717866 100644 --- a/wp-includes/class.wp-styles.php +++ b/wp-includes/class.wp-styles.php @@ -199,6 +199,8 @@ class WP_Styles extends WP_Dependencies { $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; $title = isset( $obj->extra['title'] ) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; + $tag = "\n"; + /** * Filters the HTML link tag of an enqueued style. * @@ -211,7 +213,7 @@ class WP_Styles extends WP_Dependencies { * @param string $href The stylesheet's source URL. * @param string $media The stylesheet's media attribute. */ - $tag = apply_filters( 'style_loader_tag', "\n", $handle, $href, $media ); + $tag = apply_filters( 'style_loader_tag', $tag, $handle, $href, $media ); if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) { if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) { @@ -221,8 +223,9 @@ class WP_Styles extends WP_Dependencies { $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" ); } + $rtl_tag = "\n"; /** This filter is documented in wp-includes/class.wp-styles.php */ - $rtl_tag = apply_filters( 'style_loader_tag', "\n", $handle, $rtl_href, $media ); + $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media ); if ( $obj->extra['rtl'] === 'replace' ) { $tag = $rtl_tag; diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index a792b67e91..766548f6a0 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -2274,19 +2274,63 @@ function comment_form( $args = array(), $post_id = null ) { $req = get_option( 'require_name_email' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = 'html5' === $args['format']; - $fields = array( - 'author' => '

    ' . ' ' . - '

    ', - 'email' => '', - 'url' => '

    ' . - '

    ', + + $fields = array( + 'author' => sprintf( + '

    %s %s

    ', + sprintf( + '', + __( 'Name' ), + ( $req ? ' *' : '' ) + ), + sprintf( + '', + esc_attr( $commenter['comment_author'] ), + $html_req + ) + ), + 'email' => sprintf( + '', + sprintf( + '', + __( 'Email' ), + ( $req ? ' *' : '' ) + ), + sprintf( + '', + ( $html5 ? 'type="email"' : 'type="text"' ), + esc_attr( $commenter['comment_author_email'] ), + $html_req + ) + ), + 'url' => sprintf( + '

    %s %s

    ', + sprintf( + '', + __( 'Website' ) + ), + sprintf( + '', + ( $html5 ? 'type="url"' : 'type="text"' ), + esc_attr( $commenter['comment_author_url'] ) + ) + ), ); if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { - $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; - $fields['cookies'] = ''; + $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; + + $fields['cookies'] = sprintf( + '', + sprintf( + '', + $consent + ), + sprintf( + '', + __( 'Save my name, email, and website in this browser for the next time I comment.' ) + ) + ); // Ensure that the passed fields include cookies consent. if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { @@ -2307,27 +2351,48 @@ function comment_form( $args = array(), $post_id = null ) { * * @param string[] $fields Array of the default comment fields. */ - $fields = apply_filters( 'comment_form_default_fields', $fields ); + $fields = apply_filters( 'comment_form_default_fields', $fields ); + $defaults = array( 'fields' => $fields, - 'comment_field' => '

    ', - /** This filter is documented in wp-includes/link-template.php */ - 'must_log_in' => '', - /** This filter is documented in wp-includes/link-template.php */ - 'logged_in_as' => '

    ' . sprintf( - /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ - __( 'Logged in as %3$s. Log out?' ), - get_edit_user_link(), - /* translators: %s: User name. */ - esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), - $user_identity, - wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) - ) . '

    ', - 'comment_notes_before' => '

    ' . __( 'Your email address will not be published.' ) . '' . ( $req ? $required_text : '' ) . '

    ', + 'comment_field' => sprintf( + '

    %s %s

    ', + sprintf( + '', + _x( 'Comment', 'noun' ) + ), + '' + ), + 'must_log_in' => sprintf( + '', + sprintf( + /* translators: %s: Login URL. */ + __( 'You must be logged in to post a comment.' ), + /** This filter is documented in wp-includes/link-template.php */ + wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) + ) + ), + 'logged_in_as' => sprintf( + '

    %s

    ', + sprintf( + /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ + __( 'Logged in as %3$s. Log out?' ), + get_edit_user_link(), + /* translators: %s: User name. */ + esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), + $user_identity, + /** This filter is documented in wp-includes/link-template.php */ + wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) + ) + ), + 'comment_notes_before' => sprintf( + '

    %s%s

    ', + sprintf( + '%s', + __( 'Your email address will not be published.' ) + ), + ( $req ? $required_text : '' ) + ), 'comment_notes_after' => '', 'action' => site_url( '/wp-comments-post.php' ), 'id_form' => 'commentform', @@ -2385,6 +2450,7 @@ function comment_form( $args = array(), $post_id = null ) { echo $args['title_reply_after']; if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) : + echo $args['must_log_in']; /** * Fires after the HTML-formatted 'must log in after' message in the comment form. @@ -2392,165 +2458,175 @@ function comment_form( $args = array(), $post_id = null ) { * @since 3.0.0 */ do_action( 'comment_form_must_log_in_after' ); + else : - ?> -
    > - ', + esc_url( $args['action'] ), + esc_attr( $args['id_form'] ), + esc_attr( $args['class_form'] ), + ( $html5 ? ' novalidate' : '' ) + ); + + /** + * Fires at the top of the comment form, inside the form tag. + * + * @since 3.0.0 + */ + do_action( 'comment_form_top' ); + + if ( is_user_logged_in() ) : + /** - * Fires at the top of the comment form, inside the form tag. + * Filters the 'logged in' message for the comment form for display. * * @since 3.0.0 + * + * @param string $args_logged_in The logged-in-as HTML-formatted message. + * @param array $commenter An array containing the comment author's + * username, email, and URL. + * @param string $user_identity If the commenter is a registered user, + * the display name, blank otherwise. */ - do_action( 'comment_form_top' ); - - if ( is_user_logged_in() ) : - /** - * Filters the 'logged in' message for the comment form for display. - * - * @since 3.0.0 - * - * @param string $args_logged_in The logged-in-as HTML-formatted message. - * @param array $commenter An array containing the comment author's - * username, email, and URL. - * @param string $user_identity If the commenter is a registered user, - * the display name, blank otherwise. - */ - echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); - - /** - * Fires after the is_user_logged_in() check in the comment form. - * - * @since 3.0.0 - * - * @param array $commenter An array containing the comment author's - * username, email, and URL. - * @param string $user_identity If the commenter is a registered user, - * the display name, blank otherwise. - */ - do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); - - else : - - echo $args['comment_notes_before']; - - endif; - - // Prepare an array of all fields, including the textarea - $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; + echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); /** - * Filters the comment form fields, including the textarea. + * Fires after the is_user_logged_in() check in the comment form. * - * @since 4.4.0 + * @since 3.0.0 * - * @param array $comment_fields The comment fields. + * @param array $commenter An array containing the comment author's + * username, email, and URL. + * @param string $user_identity If the commenter is a registered user, + * the display name, blank otherwise. */ - $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); + do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); - // Get an array of field names, excluding the textarea - $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); + else : - // Get the first and the last field name, excluding the textarea - $first_field = reset( $comment_field_keys ); - $last_field = end( $comment_field_keys ); + echo $args['comment_notes_before']; - foreach ( $comment_fields as $name => $field ) { + endif; - if ( 'comment' === $name ) { + // Prepare an array of all fields, including the textarea + $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; + /** + * Filters the comment form fields, including the textarea. + * + * @since 4.4.0 + * + * @param array $comment_fields The comment fields. + */ + $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); + + // Get an array of field names, excluding the textarea + $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); + + // Get the first and the last field name, excluding the textarea + $first_field = reset( $comment_field_keys ); + $last_field = end( $comment_field_keys ); + + foreach ( $comment_fields as $name => $field ) { + + if ( 'comment' === $name ) { + + /** + * Filters the content of the comment textarea field for display. + * + * @since 3.0.0 + * + * @param string $args_comment_field The content of the comment textarea field. + */ + echo apply_filters( 'comment_form_field_comment', $field ); + + echo $args['comment_notes_after']; + + } elseif ( ! is_user_logged_in() ) { + + if ( $first_field === $name ) { /** - * Filters the content of the comment textarea field for display. + * Fires before the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 - * - * @param string $args_comment_field The content of the comment textarea field. */ - echo apply_filters( 'comment_form_field_comment', $field ); + do_action( 'comment_form_before_fields' ); + } - echo $args['comment_notes_after']; - - } elseif ( ! is_user_logged_in() ) { - - if ( $first_field === $name ) { - /** - * Fires before the comment fields in the comment form, excluding the textarea. - * - * @since 3.0.0 - */ - do_action( 'comment_form_before_fields' ); - } + /** + * Filters a comment form field for display. + * + * The dynamic portion of the filter hook, `$name`, refers to the name + * of the comment form field. Such as 'author', 'email', or 'url'. + * + * @since 3.0.0 + * + * @param string $field The HTML-formatted output of the comment form field. + */ + echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; + if ( $last_field === $name ) { /** - * Filters a comment form field for display. - * - * The dynamic portion of the filter hook, `$name`, refers to the name - * of the comment form field. Such as 'author', 'email', or 'url'. + * Fires after the comment fields in the comment form, excluding the textarea. * * @since 3.0.0 - * - * @param string $field The HTML-formatted output of the comment form field. */ - echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; - - if ( $last_field === $name ) { - /** - * Fires after the comment fields in the comment form, excluding the textarea. - * - * @since 3.0.0 - */ - do_action( 'comment_form_after_fields' ); - } + do_action( 'comment_form_after_fields' ); } } + } - $submit_button = sprintf( - $args['submit_button'], - esc_attr( $args['name_submit'] ), - esc_attr( $args['id_submit'] ), - esc_attr( $args['class_submit'] ), - esc_attr( $args['label_submit'] ) - ); + $submit_button = sprintf( + $args['submit_button'], + esc_attr( $args['name_submit'] ), + esc_attr( $args['id_submit'] ), + esc_attr( $args['class_submit'] ), + esc_attr( $args['label_submit'] ) + ); - /** - * Filters the submit button for the comment form to display. - * - * @since 4.2.0 - * - * @param string $submit_button HTML markup for the submit button. - * @param array $args Arguments passed to comment_form(). - */ - $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); + /** + * Filters the submit button for the comment form to display. + * + * @since 4.2.0 + * + * @param string $submit_button HTML markup for the submit button. + * @param array $args Arguments passed to comment_form(). + */ + $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); - $submit_field = sprintf( - $args['submit_field'], - $submit_button, - get_comment_id_fields( $post_id ) - ); + $submit_field = sprintf( + $args['submit_field'], + $submit_button, + get_comment_id_fields( $post_id ) + ); - /** - * Filters the submit field for the comment form to display. - * - * The submit field includes the submit button, hidden fields for the - * comment form, and any wrapper markup. - * - * @since 4.2.0 - * - * @param string $submit_field HTML markup for the submit field. - * @param array $args Arguments passed to comment_form(). - */ - echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); + /** + * Filters the submit field for the comment form to display. + * + * The submit field includes the submit button, hidden fields for the + * comment form, and any wrapper markup. + * + * @since 4.2.0 + * + * @param string $submit_field HTML markup for the submit field. + * @param array $args Arguments passed to comment_form(). + */ + echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); - /** - * Fires at the bottom of the comment form, inside the closing
    tag. - * - * @since 1.5.0 - * - * @param int $post_id The post ID. - */ - do_action( 'comment_form', $post_id ); - ?> - - + /** + * Fires at the bottom of the comment form, inside the closing tag. + * + * @since 1.5.0 + * + * @param int $post_id The post ID. + */ + do_action( 'comment_form', $post_id ); + + echo ''; + + endif; + ?>
    ' . $args['prev_text'] . ''; + $page_links[] = sprintf( + '', + /** + * Filters the paginated links for the given archive pages. + * + * @since 3.0.0 + * + * @param string $link The paginated link URL. + */ + esc_url( apply_filters( 'paginate_links', $link ) ), + $args['prev_text'] + ); endif; + for ( $n = 1; $n <= $total; $n++ ) : if ( $n == $current ) : - $page_links[] = "" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . ''; + $page_links[] = sprintf( + '%s', + esc_attr( $args['aria_current'] ), + $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] + ); $dots = true; else : if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : @@ -4077,8 +4087,12 @@ function paginate_links( $args = '' ) { } $link .= $args['add_fragment']; - /** This filter is documented in wp-includes/general-template.php */ - $page_links[] = "" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . ''; + $page_links[] = sprintf( + '%s', + /** This filter is documented in wp-includes/general-template.php */ + esc_url( apply_filters( 'paginate_links', $link ) ), + $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] + ); $dots = true; elseif ( $dots && ! $args['show_all'] ) : $page_links[] = '' . __( '…' ) . ''; @@ -4086,6 +4100,7 @@ function paginate_links( $args = '' ) { endif; endif; endfor; + if ( $args['prev_next'] && $current && $current < $total ) : $link = str_replace( '%_%', $args['format'], $args['base'] ); $link = str_replace( '%#%', $current + 1, $link ); @@ -4094,9 +4109,14 @@ function paginate_links( $args = '' ) { } $link .= $args['add_fragment']; - /** This filter is documented in wp-includes/general-template.php */ - $page_links[] = ''; + $page_links[] = sprintf( + '', + /** This filter is documented in wp-includes/general-template.php */ + esc_url( apply_filters( 'paginate_links', $link ) ), + $args['next_text'] + ); endif; + switch ( $args['type'] ) { case 'array': return $page_links; @@ -4111,6 +4131,7 @@ function paginate_links( $args = '' ) { $r = join( "\n", $page_links ); break; } + return $r; } @@ -4322,18 +4343,25 @@ function wp_admin_css_uri( $file = 'wp-admin' ) { * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. */ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { - // For backward compatibility + // For backward compatibility. $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; if ( wp_styles()->query( $handle ) ) { - if ( $force_echo || did_action( 'wp_print_styles' ) ) { // we already printed the style queue. Print this one immediately + if ( $force_echo || did_action( 'wp_print_styles' ) ) { + // We already printed the style queue. Print this one immediately. wp_print_styles( $handle ); - } else { // Add to style queue + } else { + // Add to style queue. wp_enqueue_style( $handle ); } return; } + $stylesheet_link = sprintf( + "\n", + esc_url( wp_admin_css_uri( $file ) ) + ); + /** * Filters the stylesheet link to the specified CSS file. * @@ -4345,11 +4373,16 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { * @param string $file Style handle name or filename (without ".css" extension) * relative to wp-admin/. Defaults to 'wp-admin'. */ - echo apply_filters( 'wp_admin_css', "\n", $file ); + echo apply_filters( 'wp_admin_css', $stylesheet_link, $file ); if ( function_exists( 'is_rtl' ) && is_rtl() ) { + $rtl_stylesheet_link = sprintf( + "\n", + esc_url( wp_admin_css_uri( "$file-rtl" ) ) + ); + /** This filter is documented in wp-includes/general-template.php */ - echo apply_filters( 'wp_admin_css', "\n", "$file-rtl" ); + echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" ); } } diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php index 0d015519d3..7b2e4b223c 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php @@ -358,9 +358,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller { return new WP_Error( 'rest_autosave_no_changes', __( 'There is nothing to save. The autosave and the post content are the same.' ), array( 'status' => 400 ) ); } - /** - * This filter is documented in wp-admin/post.php. - */ + /** This filter is documented in wp-admin/post.php */ do_action( 'wp_creating_autosave', $new_autosave ); // wp_update_post expects escaped array. diff --git a/wp-includes/user.php b/wp-includes/user.php index d428590668..69b8c35208 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -2503,8 +2503,8 @@ function register_new_user( $user_login, $user_email ) { } else { /** This filter is documented in wp-includes/user.php */ - $illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) ); - if ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) { + $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() ); + if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) { $errors->add( 'invalid_username', __( 'ERROR: Sorry, that username is not allowed.' ) ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index a2b063d399..58c00e4d5f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46087'; +$wp_version = '5.3-alpha-46088'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.