Ticket #54394: 53494.4.patch
| File 53494.4.patch, 9.2 KB (added by , 4 years ago) |
|---|
-
src/wp-admin/includes/media.php
1714 1714 <tr><td colspan='2' class='imgedit-response' id='imgedit-response-$post->ID'></td></tr>\n 1715 1715 <tr><td style='display:none' colspan='2' class='image-editor' id='image-editor-$post->ID'></td></tr>\n 1716 1716 <tr><td colspan='2'><p class='media-types media-types-required-info'>" . 1717 /* translators: %s: Asterisk symbol (*). */ 1718 sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . 1717 wp_required_field_message( '' ) . 1719 1718 "</p></td></tr>\n"; 1720 1719 1721 1720 $defaults = array( … … 1795 1794 continue; 1796 1795 } 1797 1796 1798 $required = $field['required'] ? '<span class="required">*</span>': '';1797 $required = $field['required'] ? wp_required_field_indicator( '' ) : ''; 1799 1798 $required_attr = $field['required'] ? ' required' : ''; 1800 1799 $class = $id; 1801 1800 $class .= $field['required'] ? ' form-required' : ''; … … 1986 1985 } 1987 1986 1988 1987 $readonly = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : ''; 1989 $required = $field['required'] ? '<span class="required">*</span>': '';1988 $required = $field['required'] ? wp_required_field_indicator( '' ) : ''; 1990 1989 $required_attr = $field['required'] ? ' required' : ''; 1991 1990 $class = 'compat-field-' . $id; 1992 1991 $class .= $field['required'] ? ' form-required' : ''; … … 2042 2041 2043 2042 if ( $item ) { 2044 2043 $item = '<p class="media-types media-types-required-info">' . 2045 /* translators: %s: Asterisk symbol (*). */ 2046 sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . 2044 wp_required_field_message( '' ) . 2047 2045 '</p>' . 2048 2046 '<table class="compat-attachment-fields">' . $item . '</table>'; 2049 2047 } … … 2940 2938 return ' 2941 2939 <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p> 2942 2940 <p class="media-types media-types-required-info">' . 2943 /* translators: %s: Asterisk symbol (*). */ 2944 sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . 2941 wp_required_field_message( '' ) . 2945 2942 '</p> 2946 2943 <table class="describe ' . $table_class . '"><tbody> 2947 2944 <tr> 2948 2945 <th scope="row" class="label" style="width:130px;"> 2949 <label for="src"><span class="alignleft">' . __( 'URL' ) . '</span> <span class="required">*</span></label>2946 <label for="src"><span class="alignleft">' . __( 'URL' ) . '</span>' . wp_required_field_indicator() . '</label> 2950 2947 <span class="alignright" id="status_img"></span> 2951 2948 </th> 2952 2949 <td class="field"><input id="src" name="src" value="" type="text" required onblur="addExtImage.getImageData()" /></td> … … 2954 2951 2955 2952 <tr> 2956 2953 <th scope="row" class="label"> 2957 <label for="title"><span class="alignleft">' . __( 'Title' ) . '</span> <span class="required">*</span></label>2954 <label for="title"><span class="alignleft">' . __( 'Title' ) . '</span>' . wp_required_field_indicator() . '</label> 2958 2955 </th> 2959 2956 <td class="field"><input id="title" name="title" value="" type="text" required /></td> 2960 2957 </tr> … … 2963 2960 2964 2961 <tr class="image-only"> 2965 2962 <th scope="row" class="label"> 2966 <label for="alt"><span class="alignleft">' . __( 'Alternative Text' ) . '</span> </label>2963 <label for="alt"><span class="alignleft">' . __( 'Alternative Text' ) . '</span>' . wp_required_field_indicator() . '</label> 2967 2964 </th> 2968 2965 <td class="field"><input id="alt" name="alt" value="" type="text" required /> 2969 2966 <p class="help">' . __( 'Alt text for the image, e.g. “The Mona Lisa”' ) . '</p></td> -
src/wp-admin/network/site-new.php
194 194 } 195 195 ?> 196 196 <p> 197 <?php 198 printf( 199 /* translators: %s: Asterisk symbol (*). */ 200 __( 'Required fields are marked %s' ), 201 '<span class="required">*</span>' 202 ); 203 ?> 197 <?php wp_required_field_message( '', true ); ?> 204 198 </p> 205 199 <form method="post" action="<?php echo esc_url( network_admin_url( 'site-new.php?action=add-site' ) ); ?>" novalidate="novalidate"> 206 200 <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ); ?> 207 201 <table class="form-table" role="presentation"> 208 202 <tr class="form-field form-required"> 209 <th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); ?> <span class="required">*</span></label></th>203 <th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ); wp_required_field_indicator( ' ', true ); ?></label></th> 210 204 <td> 211 205 <?php if ( is_subdomain_install() ) { ?> 212 206 <input name="blog[domain]" type="text" class="regular-text ltr" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" required /><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span> … … 222 216 </td> 223 217 </tr> 224 218 <tr class="form-field form-required"> 225 <th scope="row"><label for="site-title"><?php _e( 'Site Title' ); ?> <span class="required">*</span></label></th>219 <th scope="row"><label for="site-title"><?php _e( 'Site Title' ); wp_required_field_indicator( ' ', true ); ?></label></th> 226 220 <td><input name="blog[title]" type="text" class="regular-text" id="site-title" required /></td> 227 221 </tr> 228 222 <?php … … 257 251 </tr> 258 252 <?php endif; // Languages. ?> 259 253 <tr class="form-field form-required"> 260 <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ); ?> <span class="required">*</span></label></th>254 <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ); wp_required_field_indicator( ' ', true ); ?></label></th> 261 255 <td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" aria-describedby="site-admin-email" required /></td> 262 256 </tr> 263 257 <tr class="form-field"> -
src/wp-includes/comment-template.php
2359 2359 $required_attribute = ( $html5 ? ' required' : ' required="required"' ); 2360 2360 $checked_attribute = ( $html5 ? ' checked' : ' checked="checked"' ); 2361 2361 2362 // Identify required fields visually. 2363 $required_indicator = ' <span class="required" aria-hidden="true">*</span>'; 2362 // Identify required fields visually and create a message about the indicator. 2363 $required_indicator = wp_required_field_indicator(); 2364 $required_text = wp_required_field_message(); 2364 2365 2365 2366 $fields = array( 2366 2367 'author' => sprintf( … … 2425 2426 } 2426 2427 } 2427 2428 2428 $required_text = sprintf(2429 /* translators: %s: Asterisk symbol (*). */2430 ' <span class="required-field-message" aria-hidden="true">' . __( 'Required fields are marked %s' ) . '</span>',2431 trim( $required_indicator )2432 );2433 2434 2429 /** 2435 2430 * Filters the default comment form fields. 2436 2431 * -
src/wp-includes/functions.php
8442 8442 } 8443 8443 8444 8444 /** 8445 * Assign a visual indicator for required form fields. 8446 * 8447 * @since 6.0.0 8448 * 8449 * @param string $space_before Space character, entity or empty string to add before glyph. Default ' '. 8450 * @param bool $echo Whether to output the result or instead return it. Default false. 8451 * @return string Indicator glyph wrapped in a `span` tag. 8452 */ 8453 function wp_required_field_indicator( $space_before = ' ', $echo = false ) { 8454 /* translators: Character to identify required form fields. */ 8455 $glyph = __( '*' ); 8456 $indicator = sprintf( 8457 '%1$s<span class="required" aria-hidden="true">%2$s</span>', 8458 esc_html( $space_before ), 8459 esc_html( $glyph ), 8460 ); 8461 8462 if ( ! $echo ) { 8463 return $indicator; 8464 } 8465 echo $indicator; 8466 } 8467 8468 /** 8469 * Create a message to explain required form fields. 8470 * 8471 * @since 6.0.0 8472 * 8473 * @param string $space_before Space character, entity or empty string to add before glyph. Default ' '. 8474 * @param bool $echo Whether to output the result or instead return it. Default false. 8475 * @return string Message text and glyph wrapped in a `span` tag. 8476 */ 8477 function wp_required_field_message( $space_before = ' ', $echo = false ) { 8478 $message = sprintf( 8479 '%1$s<span class="required-field-message" aria-hidden="true">%2$s</span>', 8480 esc_html( $space_before ), 8481 /* translators: %s: Asterisk symbol (*). */ 8482 sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator( '' ) ), 8483 ); 8484 8485 if ( ! $echo ) { 8486 return $message; 8487 } 8488 echo $message; 8489 } 8490 8491 /** 8445 8492 * Sorts the keys of an array alphabetically. 8446 8493 * The array is passed by reference so it doesn't get returned 8447 8494 * which mimics the behaviour of ksort.