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
This commit is contained in:
Sergey Biryukov 2019-09-10 19:23:55 +00:00
parent c9071ca2e6
commit dcb08f0637
15 changed files with 310 additions and 197 deletions

View File

@ -584,9 +584,11 @@ class Custom_Background {
if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) { if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $_POST['attachment_id'] ) ) {
exit; exit;
} }
$attachment_id = absint( $_POST['attachment_id'] ); $attachment_id = absint( $_POST['attachment_id'] );
/** This filter is documented in wp-admin/includes/media.php */
$sizes = array_keys( $sizes = array_keys(
/** This filter is documented in wp-admin/includes/media.php */
apply_filters( apply_filters(
'image_size_names_choose', 'image_size_names_choose',
array( array(
@ -597,12 +599,14 @@ class Custom_Background {
) )
) )
); );
$size = 'thumbnail';
$size = 'thumbnail';
if ( in_array( $_POST['size'], $sizes ) ) { if ( in_array( $_POST['size'], $sizes ) ) {
$size = esc_attr( $_POST['size'] ); $size = esc_attr( $_POST['size'] );
} }
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) ); update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option( 'stylesheet' ) );
$url = wp_get_attachment_image_src( $attachment_id, $size ); $url = wp_get_attachment_image_src( $attachment_id, $size );
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); set_theme_mod( 'background_image', esc_url_raw( $url[0] ) );

View File

@ -95,17 +95,17 @@ class Walker_Category_Checklist extends Walker {
$aria_checked = 'true'; $aria_checked = 'true';
} }
/** This filter is documented in wp-includes/category-template.php */
$output .= "\n" . '<li' . $class . '>' . $output .= "\n" . '<li' . $class . '>' .
'<div class="' . $inner_class . '" data-term-id=' . $category->term_id . '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' . ' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>'; esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
} else { } else {
/** This filter is documented in wp-includes/category-template.php */
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
/** This filter is documented in wp-includes/category-template.php */
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>'; esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
} }
} }

View File

@ -309,7 +309,6 @@ function get_inline_data( $post ) {
$title = esc_textarea( trim( $post->post_title ) ); $title = esc_textarea( trim( $post->post_title ) );
/** This filter is documented in wp-admin/edit-tag-form.php */
echo ' echo '
<div class="hidden" id="inline_' . $post->ID . '"> <div class="hidden" id="inline_' . $post->ID . '">
<div class="post_title">' . $title . '</div>' . <div class="post_title">' . $title . '</div>' .

View File

@ -59,7 +59,8 @@ get_header(); ?>
* *
* @param int The height and width avatar dimension in pixels. Default 60. * @param int The height and width avatar dimension in pixels. Default 60.
*/ */
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 60 ) ); $author_bio_avatar_size = apply_filters( 'twentyeleven_author_bio_avatar_size', 60 );
echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
?> ?>
</div><!-- #author-avatar --> </div><!-- #author-avatar -->
<div id="author-description"> <div id="author-description">

View File

@ -66,7 +66,8 @@
<div id="author-avatar"> <div id="author-avatar">
<?php <?php
/** This filter is documented in author.php */ /** This filter is documented in author.php */
echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); $author_bio_avatar_size = apply_filters( 'twentyeleven_author_bio_avatar_size', 68 );
echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
?> ?>
</div><!-- #author-avatar --> </div><!-- #author-avatar -->
<div id="author-description"> <div id="author-description">

View File

@ -47,7 +47,8 @@ if ( get_the_author_meta( 'description' ) ) :
* *
* @param int The height and width avatar dimensions in pixels. Default 60. * @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 );
?> ?>
</div><!-- #author-avatar --> </div><!-- #author-avatar -->
<div id="author-description"> <div id="author-description">

View File

@ -50,7 +50,8 @@ if ( have_posts() ) {
<div id="author-avatar"> <div id="author-avatar">
<?php <?php
/** This filter is documented in author.php */ /** This filter is documented in author.php */
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 );
?> ?>
</div><!-- #author-avatar --> </div><!-- #author-avatar -->
<div id="author-description"> <div id="author-description">

View File

@ -97,11 +97,7 @@ class Walker_Category extends Walker {
*/ */
public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
/** This filter is documented in wp-includes/category-template.php */ /** This filter is documented in wp-includes/category-template.php */
$cat_name = apply_filters( $cat_name = apply_filters( 'list_cats', esc_attr( $category->name ), $category );
'list_cats',
esc_attr( $category->name ),
$category
);
// Don't generate an element if the category name is empty. // Don't generate an element if the category name is empty.
if ( '' === $cat_name ) { if ( '' === $cat_name ) {

View File

@ -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 $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
chmod( $filename, $perms ); chmod( $filename, $perms );
/** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
return array( return array(
'path' => $filename, '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 ) ), 'file' => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
'width' => $this->size['width'], 'width' => $this->size['width'],
'height' => $this->size['height'], 'height' => $this->size['height'],

View File

@ -199,6 +199,8 @@ class WP_Styles extends WP_Dependencies {
$rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; $rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
$title = isset( $obj->extra['title'] ) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; $title = isset( $obj->extra['title'] ) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
$tag = "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n";
/** /**
* Filters the HTML link tag of an enqueued style. * 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 $href The stylesheet's source URL.
* @param string $media The stylesheet's media attribute. * @param string $media The stylesheet's media attribute.
*/ */
$tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\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 ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) {
if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $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_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
} }
$rtl_tag = "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n";
/** This filter is documented in wp-includes/class.wp-styles.php */ /** This filter is documented in wp-includes/class.wp-styles.php */
$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 ); $rtl_tag = apply_filters( 'style_loader_tag', $rtl_tag, $handle, $rtl_href, $media );
if ( $obj->extra['rtl'] === 'replace' ) { if ( $obj->extra['rtl'] === 'replace' ) {
$tag = $rtl_tag; $tag = $rtl_tag;

View File

@ -2274,19 +2274,63 @@ function comment_form( $args = array(), $post_id = null ) {
$req = get_option( 'require_name_email' ); $req = get_option( 'require_name_email' );
$html_req = ( $req ? " required='required'" : '' ); $html_req = ( $req ? " required='required'" : '' );
$html5 = 'html5' === $args['format']; $html5 = 'html5' === $args['format'];
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . $fields = array(
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>', 'author' => sprintf(
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' . '<p class="comment-form-author">%s %s</p>',
'<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>', sprintf(
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . '<label for="author">%s%s</label>',
'<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', __( 'Name' ),
( $req ? ' <span class="required">*</span>' : '' )
),
sprintf(
'<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />',
esc_attr( $commenter['comment_author'] ),
$html_req
)
),
'email' => sprintf(
'<p class="comment-form-email">%s %s</p>',
sprintf(
'<label for="email">%s%s</label>',
__( 'Email' ),
( $req ? ' <span class="required">*</span>' : '' )
),
sprintf(
'<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />',
( $html5 ? 'type="email"' : 'type="text"' ),
esc_attr( $commenter['comment_author_email'] ),
$html_req
)
),
'url' => sprintf(
'<p class="comment-form-url">%s %s</p>',
sprintf(
'<label for="url">%s</label>',
__( 'Website' )
),
sprintf(
'<input id="url" name="url" %s value="%s" size="30" maxlength="200" />',
( $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' ) ) { 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"'; $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
'<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>'; $fields['cookies'] = sprintf(
'<p class="comment-form-cookies-consent">%s %s</p>',
sprintf(
'<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"%s />',
$consent
),
sprintf(
'<label for="wp-comment-cookies-consent">%s</label>',
__( 'Save my name, email, and website in this browser for the next time I comment.' )
)
);
// Ensure that the passed fields include cookies consent. // Ensure that the passed fields include cookies consent.
if ( isset( $args['fields'] ) && ! isset( $args['fields']['cookies'] ) ) { 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. * @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( $defaults = array(
'fields' => $fields, 'fields' => $fields,
'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>', 'comment_field' => sprintf(
/** This filter is documented in wp-includes/link-template.php */ '<p class="comment-form-comment">%s %s</p>',
'must_log_in' => '<p class="must-log-in">' . sprintf( sprintf(
/* translators: %s: Login URL. */ '<label for="comment">%s</label>',
__( 'You must be <a href="%s">logged in</a> to post a comment.' ), _x( 'Comment', 'noun' )
wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) ),
) . '</p>', '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>'
/** This filter is documented in wp-includes/link-template.php */ ),
'logged_in_as' => '<p class="logged-in-as">' . sprintf( 'must_log_in' => sprintf(
/* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ '<p class="must-log-in">%s</p>',
__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ), sprintf(
get_edit_user_link(), /* translators: %s: Login URL. */
/* translators: %s: User name. */ __( 'You must be <a href="%s">logged in</a> to post a comment.' ),
esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), /** This filter is documented in wp-includes/link-template.php */
$user_identity, wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) )
) . '</p>', ),
'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>' . ( $req ? $required_text : '' ) . '</p>', 'logged_in_as' => sprintf(
'<p class="logged-in-as">%s</p>',
sprintf(
/* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */
__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
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(
'<p class="comment-notes">%s%s</p>',
sprintf(
'<span id="email-notes">%s</span>',
__( 'Your email address will not be published.' )
),
( $req ? $required_text : '' )
),
'comment_notes_after' => '', 'comment_notes_after' => '',
'action' => site_url( '/wp-comments-post.php' ), 'action' => site_url( '/wp-comments-post.php' ),
'id_form' => 'commentform', 'id_form' => 'commentform',
@ -2385,6 +2450,7 @@ function comment_form( $args = array(), $post_id = null ) {
echo $args['title_reply_after']; echo $args['title_reply_after'];
if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) : if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) :
echo $args['must_log_in']; echo $args['must_log_in'];
/** /**
* Fires after the HTML-formatted 'must log in after' message in the comment form. * 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 * @since 3.0.0
*/ */
do_action( 'comment_form_must_log_in_after' ); do_action( 'comment_form_must_log_in_after' );
else : else :
?>
<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' : ''; ?>> printf(
<?php '<form action="%s" method="post" id="%s" class="%s"%s>',
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 * @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' ); echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
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'];
/** /**
* 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 else :
$comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) );
// Get the first and the last field name, excluding the textarea echo $args['comment_notes_before'];
$first_field = reset( $comment_field_keys );
$last_field = end( $comment_field_keys );
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 * @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']; /**
* Filters a comment form field for display.
} elseif ( ! is_user_logged_in() ) { *
* The dynamic portion of the filter hook, `$name`, refers to the name
if ( $first_field === $name ) { * of the comment form field. Such as 'author', 'email', or 'url'.
/** *
* Fires before the comment fields in the comment form, excluding the textarea. * @since 3.0.0
* *
* @since 3.0.0 * @param string $field The HTML-formatted output of the comment form field.
*/ */
do_action( 'comment_form_before_fields' ); echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
}
if ( $last_field === $name ) {
/** /**
* Filters a comment form field for display. * Fires after the comment fields in the comment form, excluding the textarea.
*
* 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 * @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"; do_action( 'comment_form_after_fields' );
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' );
}
} }
} }
}
$submit_button = sprintf( $submit_button = sprintf(
$args['submit_button'], $args['submit_button'],
esc_attr( $args['name_submit'] ), esc_attr( $args['name_submit'] ),
esc_attr( $args['id_submit'] ), esc_attr( $args['id_submit'] ),
esc_attr( $args['class_submit'] ), esc_attr( $args['class_submit'] ),
esc_attr( $args['label_submit'] ) esc_attr( $args['label_submit'] )
); );
/** /**
* Filters the submit button for the comment form to display. * Filters the submit button for the comment form to display.
* *
* @since 4.2.0 * @since 4.2.0
* *
* @param string $submit_button HTML markup for the submit button. * @param string $submit_button HTML markup for the submit button.
* @param array $args Arguments passed to comment_form(). * @param array $args Arguments passed to comment_form().
*/ */
$submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args ); $submit_button = apply_filters( 'comment_form_submit_button', $submit_button, $args );
$submit_field = sprintf( $submit_field = sprintf(
$args['submit_field'], $args['submit_field'],
$submit_button, $submit_button,
get_comment_id_fields( $post_id ) get_comment_id_fields( $post_id )
); );
/** /**
* Filters the submit field for the comment form to display. * Filters the submit field for the comment form to display.
* *
* The submit field includes the submit button, hidden fields for the * The submit field includes the submit button, hidden fields for the
* comment form, and any wrapper markup. * comment form, and any wrapper markup.
* *
* @since 4.2.0 * @since 4.2.0
* *
* @param string $submit_field HTML markup for the submit field. * @param string $submit_field HTML markup for the submit field.
* @param array $args Arguments passed to comment_form(). * @param array $args Arguments passed to comment_form().
*/ */
echo apply_filters( 'comment_form_submit_field', $submit_field, $args ); echo apply_filters( 'comment_form_submit_field', $submit_field, $args );
/** /**
* Fires at the bottom of the comment form, inside the closing </form> tag. * Fires at the bottom of the comment form, inside the closing </form> tag.
* *
* @since 1.5.0 * @since 1.5.0
* *
* @param int $post_id The post ID. * @param int $post_id The post ID.
*/ */
do_action( 'comment_form', $post_id ); do_action( 'comment_form', $post_id );
?>
</form> echo '</form>';
<?php endif; ?>
endif;
?>
</div><!-- #respond --> </div><!-- #respond -->
<?php <?php

View File

@ -4042,6 +4042,7 @@ function paginate_links( $args = '' ) {
if ( $mid_size < 0 ) { if ( $mid_size < 0 ) {
$mid_size = 2; $mid_size = 2;
} }
$add_args = $args['add_args']; $add_args = $args['add_args'];
$r = ''; $r = '';
$page_links = array(); $page_links = array();
@ -4055,18 +4056,27 @@ function paginate_links( $args = '' ) {
} }
$link .= $args['add_fragment']; $link .= $args['add_fragment'];
/** $page_links[] = sprintf(
* Filters the paginated links for the given archive pages. '<a class="prev page-numbers" href="%s">%s</a>',
* /**
* @since 3.0.0 * Filters the paginated links for the given archive pages.
* *
* @param string $link The paginated link URL. * @since 3.0.0
*/ *
$page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; * @param string $link The paginated link URL.
*/
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['prev_text']
);
endif; endif;
for ( $n = 1; $n <= $total; $n++ ) : for ( $n = 1; $n <= $total; $n++ ) :
if ( $n == $current ) : if ( $n == $current ) :
$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>'; $page_links[] = sprintf(
'<span aria-current="%s" class="page-numbers current">%s</span>',
esc_attr( $args['aria_current'] ),
$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
);
$dots = true; $dots = true;
else : else :
if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : 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']; $link .= $args['add_fragment'];
/** This filter is documented in wp-includes/general-template.php */ $page_links[] = sprintf(
$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>'; '<a class="page-numbers" href="%s">%s</a>',
/** 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; $dots = true;
elseif ( $dots && ! $args['show_all'] ) : elseif ( $dots && ! $args['show_all'] ) :
$page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>'; $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
@ -4086,6 +4100,7 @@ function paginate_links( $args = '' ) {
endif; endif;
endif; endif;
endfor; endfor;
if ( $args['prev_next'] && $current && $current < $total ) : if ( $args['prev_next'] && $current && $current < $total ) :
$link = str_replace( '%_%', $args['format'], $args['base'] ); $link = str_replace( '%_%', $args['format'], $args['base'] );
$link = str_replace( '%#%', $current + 1, $link ); $link = str_replace( '%#%', $current + 1, $link );
@ -4094,9 +4109,14 @@ function paginate_links( $args = '' ) {
} }
$link .= $args['add_fragment']; $link .= $args['add_fragment'];
/** This filter is documented in wp-includes/general-template.php */ $page_links[] = sprintf(
$page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; '<a class="next page-numbers" href="%s">%s</a>',
/** This filter is documented in wp-includes/general-template.php */
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['next_text']
);
endif; endif;
switch ( $args['type'] ) { switch ( $args['type'] ) {
case 'array': case 'array':
return $page_links; return $page_links;
@ -4111,6 +4131,7 @@ function paginate_links( $args = '' ) {
$r = join( "\n", $page_links ); $r = join( "\n", $page_links );
break; break;
} }
return $r; 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. * @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 ) { 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; $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
if ( wp_styles()->query( $handle ) ) { 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 ); wp_print_styles( $handle );
} else { // Add to style queue } else {
// Add to style queue.
wp_enqueue_style( $handle ); wp_enqueue_style( $handle );
} }
return; return;
} }
$stylesheet_link = sprintf(
"<link rel='stylesheet' href='%s' type='text/css' />\n",
esc_url( wp_admin_css_uri( $file ) )
);
/** /**
* Filters the stylesheet link to the specified CSS 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) * @param string $file Style handle name or filename (without ".css" extension)
* relative to wp-admin/. Defaults to 'wp-admin'. * relative to wp-admin/. Defaults to 'wp-admin'.
*/ */
echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file ); echo apply_filters( 'wp_admin_css', $stylesheet_link, $file );
if ( function_exists( 'is_rtl' ) && is_rtl() ) { if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$rtl_stylesheet_link = sprintf(
"<link rel='stylesheet' href='%s' type='text/css' />\n",
esc_url( wp_admin_css_uri( "$file-rtl" ) )
);
/** This filter is documented in wp-includes/general-template.php */ /** This filter is documented in wp-includes/general-template.php */
echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" ); echo apply_filters( 'wp_admin_css', $rtl_stylesheet_link, "$file-rtl" );
} }
} }

View File

@ -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 ) ); 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 ); do_action( 'wp_creating_autosave', $new_autosave );
// wp_update_post expects escaped array. // wp_update_post expects escaped array.

View File

@ -2503,8 +2503,8 @@ function register_new_user( $user_login, $user_email ) {
} else { } else {
/** This filter is documented in wp-includes/user.php */ /** This filter is documented in wp-includes/user.php */
$illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) ); $illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
if ( in_array( strtolower( $sanitized_user_login ), $illegal_user_logins ) ) { if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) {
$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) ); $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
} }
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.