Make WordPress Core

Ticket #16206: 16206.5.patch

File 16206.5.patch, 6.6 KB (added by afercia, 9 years ago)
  • src/wp-includes/comment-template.php

     
    12411241 * @global int        $user_ID
    12421242 * @global string     $user_identity
    12431243 * @global bool       $overridden_cpage
    1244  * @global bool       $withcomments 
     1244 * @global bool       $withcomments
    12451245 *
    12461246 * @param string $file              Optional. The file to load. Default '/comments.php'.
    12471247 * @param bool   $separate_comments Optional. Whether to separate the comments by comment type.
     
    21092109        if ( ! isset( $args['format'] ) )
    21102110                $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
    21112111
    2112         $req      = get_option( 'require_name_email' );
    2113         $aria_req = ( $req ? " aria-required='true'" : '' );
    2114         $html_req = ( $req ? " required='required'" : '' );
    2115         $html5    = 'html5' === $args['format'];
    2116         $fields   =  array(
    2117                 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    2118                             '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $aria_req . $html_req . ' /></p>',
    2119                 'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    2120                             '<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"' . $aria_req . $html_req  . ' /></p>',
     2112        $required_option      = get_option( 'require_name_email' );
     2113        $html5                = 'html5' === $args['format'];
     2114        $aria_required_attr   = ( $required_option ? ' aria-required="true"' : '' );
     2115        $required_attr_always = ( $html5 ? ' required' : ' required="required"' );
     2116        $required_attr        = ( $required_option ? $required_attr_always : '' );
     2117
     2118        $fields = array(
     2119                'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $required_option ? ' <span class="required">*</span>' : '' ) . '</label> ' .
     2120                            '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $aria_required_attr . $required_attr . ' /></p>',
     2121                'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $required_option ? ' <span class="required">*</span>' : '' ) . '</label> ' .
     2122                            '<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"' . $aria_required_attr . $required_attr  . ' /></p>',
    21212123                'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
    21222124                            '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    21232125        );
    21242126
    2125         $required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
     2127        $required_text = ' <span class="comment-required-message">' . sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . '</span>';
    21262128
    21272129        /**
    21282130         * Filter the default comment form fields.
     
    21342136        $fields = apply_filters( 'comment_form_default_fields', $fields );
    21352137        $defaults = array(
    21362138                'fields'               => $fields,
    2137                 '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" aria-required="true" required="required"></textarea></p>',
     2139                'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . ' <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true"' . $required_attr_always . '></textarea></p>',
    21382140                /** This filter is documented in wp-includes/link-template.php */
    21392141                'must_log_in'          => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
    21402142                /** This filter is documented in wp-includes/link-template.php */
    2141                 'logged_in_as'         => '<p class="logged-in-as">' . sprintf( __( '<a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
    2142                 'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>'. ( $req ? $required_text : '' ) . '</p>',
     2143                'logged_in_as'         => '<p class="logged-in-as">' . sprintf( __( '<a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . $required_text . '</p>',
     2144                'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>' . $required_text . '</p>',
    21432145                'comment_notes_after'  => '',
    21442146                'id_form'              => 'commentform',
    21452147                'id_submit'            => 'submit',
     
    22152217                                        do_action( 'comment_form_top' );
    22162218
    22172219                                        if ( is_user_logged_in() ) :
     2220
    22182221                                                /**
    22192222                                                 * Filter the 'logged in' message for the comment form for display.
    22202223                                                 *
  • src/wp-includes/comment.php

     
    28272827
    28282828        if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
    28292829                if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) {
    2830                         return new WP_Error( 'require_name_email', __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 );
     2830                        return new WP_Error( 'require_name_email', __( '<strong>ERROR</strong>: please fill the required fields.' ), 200 );
    28312831                } elseif ( ! is_email( $comment_author_email ) ) {
    28322832                        return new WP_Error( 'require_valid_email', __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 );
    28332833                }