Ticket #16206: 16206.5.patch
File 16206.5.patch, 6.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment-template.php
1241 1241 * @global int $user_ID 1242 1242 * @global string $user_identity 1243 1243 * @global bool $overridden_cpage 1244 * @global bool $withcomments 1244 * @global bool $withcomments 1245 1245 * 1246 1246 * @param string $file Optional. The file to load. Default '/comments.php'. 1247 1247 * @param bool $separate_comments Optional. Whether to separate the comments by comment type. … … 2109 2109 if ( ! isset( $args['format'] ) ) 2110 2110 $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; 2111 2111 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>', 2121 2123 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . 2122 2124 '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', 2123 2125 ); 2124 2126 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>'; 2126 2128 2127 2129 /** 2128 2130 * Filter the default comment form fields. … … 2134 2136 $fields = apply_filters( 'comment_form_default_fields', $fields ); 2135 2137 $defaults = array( 2136 2138 '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>', 2138 2140 /** This filter is documented in wp-includes/link-template.php */ 2139 2141 '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>', 2140 2142 /** 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>', 2143 2145 'comment_notes_after' => '', 2144 2146 'id_form' => 'commentform', 2145 2147 'id_submit' => 'submit', … … 2215 2217 do_action( 'comment_form_top' ); 2216 2218 2217 2219 if ( is_user_logged_in() ) : 2220 2218 2221 /** 2219 2222 * Filter the 'logged in' message for the comment form for display. 2220 2223 * -
src/wp-includes/comment.php
2827 2827 2828 2828 if ( get_option( 'require_name_email' ) && ! $user->exists() ) { 2829 2829 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 ); 2831 2831 } elseif ( ! is_email( $comment_author_email ) ) { 2832 2832 return new WP_Error( 'require_valid_email', __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 ); 2833 2833 }