Ticket #16206: 16206.6.patch
File 16206.6.patch, 3.4 KB (added by , 4 years ago) |
---|
-
src/wp-includes/comment-template.php
2350 2350 $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; 2351 2351 } 2352 2352 2353 $req = get_option( 'require_name_email' ); 2354 $html_req = ( $req ? " required='required'" : '' ); 2355 $html5 = 'html5' === $args['format']; 2353 $req = get_option( 'require_name_email' ); 2354 $html5 = 'html5' === $args['format']; 2356 2355 2356 // Glyph to identify required fields visually. 2357 $required_glyph = ( $req ? '<span class="required" aria-hidden="true">*</span>' : '' ); 2358 2359 // HTML required attribute. 2360 $html_req = ''; 2361 if ( $req && $html5 ) { 2362 $html_req = ' required'; 2363 } elseif ( $req ) { 2364 // XHTML syntax 2365 $html_req = ' required="required"'; 2366 } 2367 2357 2368 $fields = array( 2358 2369 'author' => sprintf( 2359 2370 '<p class="comment-form-author">%s %s</p>', 2360 2371 sprintf( 2361 '<label for="author">%s %s</label>',2372 '<label for="author">%s %s</label>', 2362 2373 __( 'Name' ), 2363 ( $req ? ' <span class="required">*</span>' : '' )2374 $required_glyph 2364 2375 ), 2365 2376 sprintf( 2366 2377 '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />', … … 2371 2382 'email' => sprintf( 2372 2383 '<p class="comment-form-email">%s %s</p>', 2373 2384 sprintf( 2374 '<label for="email">%s %s</label>',2385 '<label for="email">%s %s</label>', 2375 2386 __( 'Email' ), 2376 ( $req ? ' <span class="required">*</span>' : '' )2387 $required_glyph 2377 2388 ), 2378 2389 sprintf( 2379 2390 '<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />', … … 2419 2430 2420 2431 $required_text = sprintf( 2421 2432 /* translators: %s: Asterisk symbol (*). */ 2422 ' ' . __( 'Required fields are marked %s' ),2423 '<span class="required">*</span>'2433 ' <span class="comment-required-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>', 2434 $required_glyph 2424 2435 ); 2425 2436 2426 2437 /** … … 2437 2448 'comment_field' => sprintf( 2438 2449 '<p class="comment-form-comment">%s %s</p>', 2439 2450 sprintf( 2440 '<label for="comment">%s</label>', 2441 _x( 'Comment', 'noun' ) 2451 '<label for="comment">%s %s</label>', 2452 _x( 'Comment', 'noun' ), 2453 $required_glyph 2442 2454 ), 2443 '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>'2455 '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525"' . $html_req . '></textarea>' 2444 2456 ), 2445 2457 'must_log_in' => sprintf( 2446 2458 '<p class="must-log-in">%s</p>', -
src/wp-includes/comment.php
3529 3529 3530 3530 if ( get_option( 'require_name_email' ) && ! $user->exists() ) { 3531 3531 if ( '' == $comment_author_email || '' == $comment_author ) { 3532 return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields (name, email).' ), 200 );3532 return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields.' ), 200 ); 3533 3533 } elseif ( ! is_email( $comment_author_email ) ) { 3534 3534 return new WP_Error( 'require_valid_email', __( '<strong>Error</strong>: Please enter a valid email address.' ), 200 ); 3535 3535 }