Make WordPress Core

Ticket #51899: 51899.3.diff

File 51899.3.diff, 6.3 KB (added by SergeyBiryukov, 5 years ago)
  • src/wp-admin/user-edit.php

     
    728728                </td>
    729729        </tr>
    730730<?php endif; ?>
    731 
    732731        </table>
    733732
     733                <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
     734        <h2><?php _e( 'Application Passwords' ); ?></h2>
    734735
    735                 <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
    736         <div class="application-passwords hide-if-no-js" id="application-passwords-section">
    737                 <h2><?php _e( 'Application Passwords' ); ?></h2>
    738                 <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p>
    739                         <?php
    740                         if ( is_multisite() ) {
    741                                 $blogs       = get_blogs_of_user( $user_id, true );
    742                                 $blogs_count = count( $blogs );
    743                                 if ( $blogs_count > 1 ) {
    744                                         ?>
    745                                         <p>
    746                                                 <?php
    747                                                 printf(
    748                                                         /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */
    749                                                         _n(
    750                                                                 'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.',
    751                                                                 'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.',
    752                                                                 $blogs_count
    753                                                         ),
    754                                                         admin_url( 'my-sites.php' ),
    755                                                         number_format_i18n( $blogs_count )
    756                                                 );
    757                                                 ?>
    758                                         </p>
     736        <table class="form-table" role="presentation">
     737                <tr>
     738                        <th><?php _e( 'Application Passwords' ); ?></th>
     739                        <td>
     740                                <div class="application-passwords hide-if-no-js" id="application-passwords-section">
     741                                        <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p>
    759742                                        <?php
    760                                 }
    761                         }
     743                                        if ( is_multisite() ) {
     744                                                $blogs       = get_blogs_of_user( $user_id, true );
     745                                                $blogs_count = count( $blogs );
     746                                                if ( $blogs_count > 1 ) {
     747                                                        ?>
     748                                                        <p>
     749                                                                <?php
     750                                                                printf(
     751                                                                        /* translators: 1: URL to my-sites.php, 2: Number of blogs the user has. */
     752                                                                        _n(
     753                                                                                'Application passwords grant access to <a href="%1$s">the %2$s blog in this installation that you have permissions on</a>.',
     754                                                                                'Application passwords grant access to <a href="%1$s">all %2$s blogs in this installation that you have permissions on</a>.',
     755                                                                                $blogs_count
     756                                                                        ),
     757                                                                        admin_url( 'my-sites.php' ),
     758                                                                        number_format_i18n( $blogs_count )
     759                                                                );
     760                                                                ?>
     761                                                        </p>
     762                                                        <?php
     763                                                }
     764                                        }
    762765
    763                         if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) {
    764                                 ?>
    765                         <div class="create-application-password form-wrap">
    766                                 <div class="form-field">
    767                                         <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
    768                                         <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
    769                                         <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
    770                                 </div>
     766                                        if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) {
     767                                                ?>
     768                                                <div class="create-application-password form-wrap">
     769                                                        <div class="form-field">
     770                                                                <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label>
     771                                                                <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
     772                                                                <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
     773                                                        </div>
    771774
    772                                 <?php
    773                                 /**
    774                                 * Fires in the create Application Passwords form.
    775                                 *
    776                                 * @since 5.6.0
    777                                 *
    778                                 * @param WP_User $profileuser The current WP_User object.
    779                                 */
    780                                 do_action( 'wp_create_application_password_form', $profileuser );
    781                                 ?>
     775                                                        <?php
     776                                                        /**
     777                                                        * Fires in the create Application Passwords form.
     778                                                        *
     779                                                        * @since 5.6.0
     780                                                        *
     781                                                        * @param WP_User $profileuser The current WP_User object.
     782                                                        */
     783                                                        do_action( 'wp_create_application_password_form', $profileuser );
     784                                                        ?>
    782785
    783                                 <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
    784                         </div>
    785                 <?php } else { ?>
    786                         <div class="notice notice-error inline">
    787                                 <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
    788                         </div>
    789                 <?php } ?>
     786                                                        <?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
     787                                                </div>
     788                                        <?php } else { ?>
     789                                                <div class="notice notice-error inline">
     790                                                        <p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
     791                                                </div>
     792                                        <?php } ?>
    790793
    791                 <div class="application-passwords-list-table-wrapper">
    792                         <?php
    793                         $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
    794                         $application_passwords_list_table->prepare_items();
    795                         $application_passwords_list_table->display();
    796                         ?>
    797                 </div>
    798         </div>
    799 <?php endif; ?>
     794                                        <div class="application-passwords-list-table-wrapper">
     795                                                <?php
     796                                                $application_passwords_list_table = _get_list_table( 'WP_Application_Passwords_List_Table', array( 'screen' => 'application-passwords-user' ) );
     797                                                $application_passwords_list_table->prepare_items();
     798                                                $application_passwords_list_table->display();
     799                                                ?>
     800                                        </div>
     801                                </div>
     802                        </td>
     803                </tr>
     804        </table>
     805                <?php endif; ?>
    800806
    801807                <?php
    802808                if ( IS_PROFILE_PAGE ) {