Changeset 52029
- Timestamp:
- 11/07/2021 09:13:11 PM (3 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r51837 r52029 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']; 2355 2356 // Define attributes in HTML5 or XHTML syntax. 2357 $required_attribute = ( $html5 ? ' required' : ' required="required"' ); 2358 $checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' ); 2359 2360 // Identify required fields visually. 2361 $required_indicator = ' <span class="required" aria-hidden="true">*</span>'; 2356 2362 2357 2363 $fields = array( … … 2361 2367 '<label for="author">%s%s</label>', 2362 2368 __( 'Name' ), 2363 ( $req ? ' <span class="required">*</span>': '' )2369 ( $req ? $required_indicator : '' ) 2364 2370 ), 2365 2371 sprintf( 2366 2372 '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />', 2367 2373 esc_attr( $commenter['comment_author'] ), 2368 $html_req2374 ( $req ? $required_attribute : '' ) 2369 2375 ) 2370 2376 ), … … 2374 2380 '<label for="email">%s%s</label>', 2375 2381 __( 'Email' ), 2376 ( $req ? ' <span class="required">*</span>': '' )2382 ( $req ? $required_indicator : '' ) 2377 2383 ), 2378 2384 sprintf( … … 2380 2386 ( $html5 ? 'type="email"' : 'type="text"' ), 2381 2387 esc_attr( $commenter['comment_author_email'] ), 2382 $html_req2388 ( $req ? $required_attribute : '' ) 2383 2389 ) 2384 2390 ), … … 2398 2404 2399 2405 if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) && get_option( 'show_comments_cookies_opt_in' ) ) { 2400 $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';2406 $consent = empty( $commenter['comment_author_email'] ) ? '' : $checked_attribute; 2401 2407 2402 2408 $fields['cookies'] = sprintf( … … 2420 2426 $required_text = sprintf( 2421 2427 /* translators: %s: Asterisk symbol (*). */ 2422 ' ' . __( 'Required fields are marked %s' ),2423 '<span class="required">*</span>'2428 ' <span class="comment-required-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>', 2429 trim( $required_indicator ) 2424 2430 ); 2425 2431 … … 2438 2444 '<p class="comment-form-comment">%s %s</p>', 2439 2445 sprintf( 2440 '<label for="comment">%s</label>', 2441 _x( 'Comment', 'noun' ) 2446 '<label for="comment">%s%s</label>', 2447 _x( 'Comment', 'noun' ), 2448 $required_indicator 2442 2449 ), 2443 '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>'2450 '<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525"' . $required_attribute . '></textarea>' 2444 2451 ), 2445 2452 'must_log_in' => sprintf( … … 2453 2460 ), 2454 2461 'logged_in_as' => sprintf( 2455 '<p class="logged-in-as">%s </p>',2462 '<p class="logged-in-as">%s%s</p>', 2456 2463 sprintf( 2457 2464 /* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ … … 2463 2470 /** This filter is documented in wp-includes/link-template.php */ 2464 2471 wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) 2465 ) 2472 ), 2473 $required_text 2466 2474 ), 2467 2475 'comment_notes_before' => sprintf( … … 2471 2479 __( 'Your email address will not be published.' ) 2472 2480 ), 2473 ( $req ? $required_text : '' )2481 $required_text 2474 2482 ), 2475 2483 'comment_notes_after' => '', -
trunk/src/wp-includes/comment.php
r51837 r52029 3550 3550 if ( get_option( 'require_name_email' ) && ! $user->exists() ) { 3551 3551 if ( '' == $comment_author_email || '' == $comment_author ) { 3552 return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields (name, email).' ), 200 );3552 return new WP_Error( 'require_name_email', __( '<strong>Error</strong>: Please fill the required fields.' ), 200 ); 3553 3553 } elseif ( ! is_email( $comment_author_email ) ) { 3554 3554 return new WP_Error( 'require_valid_email', __( '<strong>Error</strong>: Please enter a valid email address.' ), 200 );
Note: See TracChangeset
for help on using the changeset viewer.