Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (6 years ago)
Author:
pento
Message:

Coding Standards: Upgrade WPCS to 1.0.0

WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:

  • Multiline function calls must now put each parameter on a new line.
  • Auto-formatting files is now part of the grunt precommit script.
  • Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r42856 r43571  
    185185
    186186        include( ABSPATH . 'wp-admin/admin-header.php' );
    187     ?>
    188 
    189     <?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
     187        ?>
     188
     189        <?php if ( ! IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
    190190    <div class="notice notice-info"><p><strong><?php _e( 'Important:' ); ?></strong> <?php _e( 'This user has super admin privileges.' ); ?></p></div>
    191191<?php } ?>
    192 <?php if ( isset( $_GET['updated'] ) ) : ?>
     192        <?php if ( isset( $_GET['updated'] ) ) : ?>
    193193<div id="message" class="updated notice is-dismissible">
    194     <?php if ( IS_PROFILE_PAGE ) : ?>
     194            <?php if ( IS_PROFILE_PAGE ) : ?>
    195195    <p><strong><?php _e( 'Profile updated.' ); ?></strong></p>
    196196    <?php else : ?>
    197197    <p><strong><?php _e( 'User updated.' ); ?></strong></p>
    198198    <?php endif; ?>
    199     <?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
     199            <?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
    200200    <p><a href="<?php echo esc_url( wp_validate_redirect( esc_url_raw( $wp_http_referer ), self_admin_url( 'users.php' ) ) ); ?>"><?php _e( '&larr; Back to Users' ); ?></a></p>
    201201    <?php endif; ?>
    202202</div>
    203 <?php endif; ?>
    204 <?php if ( isset( $_GET['error'] ) ) : ?>
     203        <?php endif; ?>
     204        <?php if ( isset( $_GET['error'] ) ) : ?>
    205205<div class="notice notice-error">
    206     <?php if ( 'new-email' == $_GET['error'] ) : ?>
     206            <?php if ( 'new-email' == $_GET['error'] ) : ?>
    207207    <p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
    208208    <?php endif; ?>
    209209</div>
    210 <?php endif; ?>
    211 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
     210        <?php endif; ?>
     211        <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
    212212<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
    213 <?php endif; ?>
     213        <?php endif; ?>
    214214
    215215<div class="wrap" id="profile-page">
    216216<h1 class="wp-heading-inline">
    217 <?php
    218 echo esc_html( $title );
    219 ?>
     217        <?php
     218        echo esc_html( $title );
     219        ?>
    220220</h1>
    221221
    222 <?php
    223 if ( ! IS_PROFILE_PAGE ) {
    224     if ( current_user_can( 'create_users' ) ) {
    225     ?>
     222        <?php
     223        if ( ! IS_PROFILE_PAGE ) {
     224            if ( current_user_can( 'create_users' ) ) {
     225                ?>
    226226        <a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
    227227    <?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
    228228        <a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
    229     <?php
    230 }
    231 }
    232 ?>
     229                <?php
     230}
     231        }
     232        ?>
    233233
    234234<hr class="wp-header-end">
     
    242242                                             */
    243243                                            do_action( 'user_edit_form_tag' );
    244     ?>
     244                                            ?>
    245245    >
    246     <?php wp_nonce_field( 'update-user_' . $user_id ); ?>
    247 <?php if ( $wp_http_referer ) : ?>
     246        <?php wp_nonce_field( 'update-user_' . $user_id ); ?>
     247        <?php if ( $wp_http_referer ) : ?>
    248248    <input type="hidden" name="wp_http_referer" value="<?php echo esc_url( $wp_http_referer ); ?>" />
    249 <?php endif; ?>
     249        <?php endif; ?>
    250250<p>
    251251<input type="hidden" name="from" value="profile" />
     
    256256
    257257<table class="form-table">
    258 <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
     258        <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
    259259    <tr class="user-rich-editing-wrap">
    260260        <th scope="row"><?php _e( 'Visual Editor' ); ?></th>
    261261        <td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
    262262    </tr>
    263 <?php endif; ?>
    264 <?php
    265 $show_syntax_highlighting_preference = (
    266     // For Custom HTML widget and Additional CSS in Customizer.
    267     user_can( $profileuser, 'edit_theme_options' )
    268     ||
    269     // Edit plugins.
    270     user_can( $profileuser, 'edit_plugins' )
    271     ||
    272     // Edit themes.
    273     user_can( $profileuser, 'edit_themes' )
    274     );
    275     ?>
    276     <?php if ( $show_syntax_highlighting_preference ) : ?>
     263        <?php endif; ?>
     264        <?php
     265        $show_syntax_highlighting_preference = (
     266        // For Custom HTML widget and Additional CSS in Customizer.
     267        user_can( $profileuser, 'edit_theme_options' )
     268        ||
     269        // Edit plugins.
     270        user_can( $profileuser, 'edit_plugins' )
     271        ||
     272        // Edit themes.
     273        user_can( $profileuser, 'edit_themes' )
     274        );
     275        ?>
     276        <?php if ( $show_syntax_highlighting_preference ) : ?>
    277277    <tr class="user-syntax-highlighting-wrap">
    278278        <th scope="row"><?php _e( 'Syntax Highlighting' ); ?></th>
     
    282282    </tr>
    283283<?php endif; ?>
    284 <?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picker' ) ) : ?>
     284        <?php if ( count( $_wp_admin_css_colors ) > 1 && has_action( 'admin_color_scheme_picker' ) ) : ?>
    285285<tr class="user-admin-color-wrap">
    286286<th scope="row"><?php _e( 'Admin Color Scheme' ); ?></th>
    287287<td>
    288 <?php
    289     /**
    290     * Fires in the 'Admin Color Scheme' section of the user editing screen.
    291     *
    292     * The section is only enabled if a callback is hooked to the action,
    293     * and if there is more than one defined color scheme for the admin.
    294     *
    295     * @since 3.0.0
    296     * @since 3.8.1 Added `$user_id` parameter.
    297     *
    298     * @param int $user_id The user ID.
    299     */
    300     do_action( 'admin_color_scheme_picker', $user_id );
    301 ?>
     288            <?php
     289            /**
     290            * Fires in the 'Admin Color Scheme' section of the user editing screen.
     291            *
     292            * The section is only enabled if a callback is hooked to the action,
     293            * and if there is more than one defined color scheme for the admin.
     294            *
     295            * @since 3.0.0
     296            * @since 3.8.1 Added `$user_id` parameter.
     297            *
     298            * @param int $user_id The user ID.
     299            */
     300            do_action( 'admin_color_scheme_picker', $user_id );
     301            ?>
    302302</td>
    303303</tr>
    304 <?php
     304            <?php
    305305endif; // $_wp_admin_css_colors
    306306if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) :
    307 ?>
     307    ?>
    308308<tr class="user-comment-shortcuts-wrap">
    309309<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
     
    316316<label for="admin_bar_front">
    317317<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
    318 <?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
     318        <?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
    319319</fieldset>
    320320</td>
    321321</tr>
    322322
    323 <?php
    324 $languages = get_available_languages();
    325 if ( $languages ) :
    326 ?>
     323        <?php
     324        $languages = get_available_languages();
     325        if ( $languages ) :
     326            ?>
    327327<tr class="user-language-wrap">
    328328    <th scope="row">
    329         <?php /* translators: The user language selection field label */ ?>
     329            <?php /* translators: The user language selection field label */ ?>
    330330        <label for="locale"><?php _e( 'Language' ); ?></label>
    331331    </th>
    332332    <td>
    333         <?php
    334         $user_locale = $profileuser->locale;
    335 
    336         if ( 'en_US' === $user_locale ) {
    337             $user_locale = '';
    338         } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
    339             $user_locale = 'site-default';
    340         }
    341 
    342         wp_dropdown_languages(
    343             array(
    344                 'name'                        => 'locale',
    345                 'id'                          => 'locale',
    346                 'selected'                    => $user_locale,
    347                 'languages'                   => $languages,
    348                 'show_available_translations' => false,
    349                 'show_option_site_default'    => true,
    350             )
    351         );
    352         ?>
     333            <?php
     334                $user_locale = $profileuser->locale;
     335
     336            if ( 'en_US' === $user_locale ) {
     337                $user_locale = '';
     338            } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {
     339                $user_locale = 'site-default';
     340            }
     341
     342            wp_dropdown_languages(
     343                array(
     344                    'name'                        => 'locale',
     345                    'id'                          => 'locale',
     346                    'selected'                    => $user_locale,
     347                    'languages'                   => $languages,
     348                    'show_available_translations' => false,
     349                    'show_option_site_default'    => true,
     350                )
     351            );
     352            ?>
    353353    </td>
    354354</tr>
    355 <?php
     355            <?php
    356356endif;
    357 ?>
    358 
    359 <?php
    360 /**
    361  * Fires at the end of the 'Personal Options' settings table on the user editing screen.
    362  *
    363  * @since 2.7.0
    364  *
    365  * @param WP_User $profileuser The current WP_User object.
    366  */
    367 do_action( 'personal_options', $profileuser );
    368 ?>
     357        ?>
     358
     359        <?php
     360        /**
     361        * Fires at the end of the 'Personal Options' settings table on the user editing screen.
     362        *
     363        * @since 2.7.0
     364        *
     365        * @param WP_User $profileuser The current WP_User object.
     366        */
     367        do_action( 'personal_options', $profileuser );
     368        ?>
    369369
    370370</table>
    371 <?php
    372 if ( IS_PROFILE_PAGE ) {
    373     /**
    374     * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
    375     *
    376     * The action only fires if the current user is editing their own profile.
    377     *
    378     * @since 2.0.0
    379     *
    380     * @param WP_User $profileuser The current WP_User object.
    381     */
    382     do_action( 'profile_personal_options', $profileuser );
    383 }
    384 ?>
     371        <?php
     372        if ( IS_PROFILE_PAGE ) {
     373            /**
     374            * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
     375            *
     376            * The action only fires if the current user is editing their own profile.
     377            *
     378            * @since 2.0.0
     379            *
     380            * @param WP_User $profileuser The current WP_User object.
     381            */
     382            do_action( 'profile_personal_options', $profileuser );
     383        }
     384        ?>
    385385
    386386<h2><?php _e( 'Name' ); ?></h2>
     
    392392    </tr>
    393393
    394 <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profileuser->ID ) ) : ?>
     394        <?php if ( ! IS_PROFILE_PAGE && ! is_network_admin() && current_user_can( 'promote_user', $profileuser->ID ) ) : ?>
    395395<tr class="user-role-wrap"><th><label for="role"><?php _e( 'Role' ); ?></label></th>
    396396<td><select name="role" id="role">
    397 <?php
    398 // Compare user role against currently editable roles
    399 $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
    400 $user_role  = reset( $user_roles );
    401 
    402 // print the full list of roles with the primary one selected.
    403 wp_dropdown_roles( $user_role );
    404 
    405 // print the 'no role' option. Make it selected if the user has no role yet.
    406 if ( $user_role ) {
    407     echo '<option value="">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
    408 } else {
    409     echo '<option value="" selected="selected">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
    410 }
    411 ?>
     397            <?php
     398            // Compare user role against currently editable roles
     399            $user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
     400            $user_role  = reset( $user_roles );
     401
     402            // print the full list of roles with the primary one selected.
     403            wp_dropdown_roles( $user_role );
     404
     405            // print the 'no role' option. Make it selected if the user has no role yet.
     406            if ( $user_role ) {
     407                echo '<option value="">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
     408            } else {
     409                echo '<option value="" selected="selected">' . __( '&mdash; No role for this site &mdash;' ) . '</option>';
     410            }
     411            ?>
    412412</select></td></tr>
    413 <?php
     413            <?php
    414414endif; //!IS_PROFILE_PAGE
    415415
    416416if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) ) {
    417 ?>
     417    ?>
    418418<tr class="user-super-admin-wrap"><th><?php _e( 'Super Admin' ); ?></th>
    419419<td>
    420 <?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
     420    <?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
    421421<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
    422422<?php else : ?>
     
    471471
    472472        foreach ( $public_display as $id => $item ) {
    473         ?>
     473            ?>
    474474        <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
    475         <?php
     475            <?php
    476476        }
    477477        ?>
     
    489489        <?php
    490490        if ( $profileuser->ID == $current_user->ID ) :
    491         ?>
     491            ?>
    492492        <p class="description" id="email-description">
    493493            <?php _e( 'If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
    494494        </p>
    495         <?php
     495            <?php
    496496        endif;
    497497
    498498        $new_email = get_user_meta( $current_user->ID, '_new_email', true );
    499499        if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) :
    500         ?>
     500            ?>
    501501        <div class="updated inline">
    502502        <p>
    503         <?php
    504         printf(
    505             /* translators: %s: new email */
    506             __( 'There is a pending change of your email to %s.' ),
    507             '<code>' . esc_html( $new_email['newemail'] ) . '</code>'
    508         );
    509         printf(
    510             ' <a href="%1$s">%2$s</a>',
    511             esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
    512             __( 'Cancel' )
    513         );
    514         ?>
     503            <?php
     504            printf(
     505                /* translators: %s: new email */
     506                __( 'There is a pending change of your email to %s.' ),
     507                '<code>' . esc_html( $new_email['newemail'] ) . '</code>'
     508            );
     509            printf(
     510                ' <a href="%1$s">%2$s</a>',
     511                esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
     512                __( 'Cancel' )
     513            );
     514            ?>
    515515        </p>
    516516        </div>
     
    524524    </tr>
    525525
    526     <?php
    527     foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
    528     ?>
     526        <?php
     527        foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
     528            ?>
    529529    <tr class="user-<?php echo $name; ?>-wrap">
    530530<th><label for="<?php echo $name; ?>">
    531     <?php
    532     /**
    533     * Filters a user contactmethod label.
    534     *
    535     * The dynamic portion of the filter hook, `$name`, refers to
    536     * each of the keys in the contactmethods array.
    537     *
    538     * @since 2.9.0
    539     *
    540     * @param string $desc The translatable label for the contactmethod.
    541     */
    542     echo apply_filters( "user_{$name}_label", $desc );
    543     ?>
     531            <?php
     532            /**
     533            * Filters a user contactmethod label.
     534            *
     535            * The dynamic portion of the filter hook, `$name`, refers to
     536            * each of the keys in the contactmethods array.
     537            *
     538            * @since 2.9.0
     539            *
     540            * @param string $desc The translatable label for the contactmethod.
     541            */
     542            echo apply_filters( "user_{$name}_label", $desc );
     543            ?>
    544544    </label></th>
    545545    <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" /></td>
    546546    </tr>
    547     <?php
    548     }
    549     ?>
     547            <?php
     548        }
     549        ?>
    550550    </table>
    551551
     
    559559</tr>
    560560
    561 <?php if ( get_option( 'show_avatars' ) ) : ?>
     561        <?php if ( get_option( 'show_avatars' ) ) : ?>
    562562<tr class="user-profile-picture">
    563563    <th><?php _e( 'Profile Picture' ); ?></th>
    564564    <td>
    565         <?php echo get_avatar( $user_id ); ?>
     565            <?php echo get_avatar( $user_id ); ?>
    566566        <p class="description">
    567         <?php
    568         if ( IS_PROFILE_PAGE ) {
    569             /* translators: %s: Gravatar URL */
    570             $description = sprintf(
    571                 __( 'You can change your profile picture on <a href="%s">Gravatar</a>.' ),
    572                 __( 'https://en.gravatar.com/' )
    573             );
    574         } else {
    575             $description = '';
    576         }
     567            <?php
     568            if ( IS_PROFILE_PAGE ) {
     569                /* translators: %s: Gravatar URL */
     570                $description = sprintf(
     571                    __( 'You can change your profile picture on <a href="%s">Gravatar</a>.' ),
     572                    __( 'https://en.gravatar.com/' )
     573                );
     574            } else {
     575                $description = '';
     576            }
    577577
    578578            /**
     
    586586             */
    587587            echo apply_filters( 'user_profile_picture_description', $description, $profileuser );
    588         ?>
     588            ?>
    589589        </p>
    590590    </td>
     
    592592<?php endif; ?>
    593593
    594     <?php
    595     /**
    596     * Filters the display of the password fields.
    597     *
    598     * @since 1.5.1
    599     * @since 2.8.0 Added the `$profileuser` parameter.
    600     * @since 4.4.0 Now evaluated only in user-edit.php.
    601     *
    602     * @param bool    $show        Whether to show the password fields. Default true.
    603     * @param WP_User $profileuser User object for the current user to edit.
    604     */
    605     if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
    606     ?>
     594        <?php
     595        /**
     596        * Filters the display of the password fields.
     597        *
     598        * @since 1.5.1
     599        * @since 2.8.0 Added the `$profileuser` parameter.
     600        * @since 4.4.0 Now evaluated only in user-edit.php.
     601        *
     602        * @param bool    $show        Whether to show the password fields. Default true.
     603        * @param WP_User $profileuser User object for the current user to edit.
     604        */
     605        if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
     606            ?>
    607607    </table>
    608608
     
    645645    </td>
    646646</tr>
    647 <?php endif; ?>
    648 
    649 <?php
    650 if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) :
    651 ?>
     647    <?php endif; ?>
     648
     649        <?php
     650        if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) :
     651            ?>
    652652    <tr class="user-sessions-wrap hide-if-no-js">
    653653        <th><?php _e( 'Sessions' ); ?></th>
     
    686686    </table>
    687687
    688     <?php
    689     if ( IS_PROFILE_PAGE ) {
     688        <?php
     689        if ( IS_PROFILE_PAGE ) {
     690            /**
     691             * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
     692             *
     693             * The action only fires if the current user is editing their own profile.
     694             *
     695             * @since 2.0.0
     696             *
     697             * @param WP_User $profileuser The current WP_User object.
     698             */
     699            do_action( 'show_user_profile', $profileuser );
     700        } else {
     701            /**
     702             * Fires after the 'About the User' settings table on the 'Edit User' screen.
     703             *
     704             * @since 2.0.0
     705             *
     706             * @param WP_User $profileuser The current WP_User object.
     707             */
     708            do_action( 'edit_user_profile', $profileuser );
     709        }
     710        ?>
     711
     712        <?php
    690713        /**
    691          * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
     714         * Filters whether to display additional capabilities for the user.
    692715         *
    693          * The action only fires if the current user is editing their own profile.
     716         * The 'Additional Capabilities' section will only be enabled if
     717         * the number of the user's capabilities exceeds their number of
     718         * roles.
    694719         *
    695          * @since 2.0.0
     720         * @since 2.8.0
    696721         *
     722         * @param bool    $enable      Whether to display the capabilities. Default true.
    697723         * @param WP_User $profileuser The current WP_User object.
    698724         */
    699         do_action( 'show_user_profile', $profileuser );
    700     } else {
    701         /**
    702          * Fires after the 'About the User' settings table on the 'Edit User' screen.
    703          *
    704          * @since 2.0.0
    705          *
    706          * @param WP_User $profileuser The current WP_User object.
    707          */
    708         do_action( 'edit_user_profile', $profileuser );
    709     }
    710     ?>
    711 
    712     <?php
    713     /**
    714      * Filters whether to display additional capabilities for the user.
    715      *
    716      * The 'Additional Capabilities' section will only be enabled if
    717      * the number of the user's capabilities exceeds their number of
    718      * roles.
    719      *
    720      * @since 2.8.0
    721      *
    722      * @param bool    $enable      Whether to display the capabilities. Default true.
    723      * @param WP_User $profileuser The current WP_User object.
    724      */
    725     if ( count( $profileuser->caps ) > count( $profileuser->roles )
    726     && apply_filters( 'additional_capabilities_display', true, $profileuser )
    727     ) :
    728     ?>
     725        if ( count( $profileuser->caps ) > count( $profileuser->roles )
     726        && apply_filters( 'additional_capabilities_display', true, $profileuser )
     727        ) :
     728            ?>
    729729    <h2><?php _e( 'Additional Capabilities' ); ?></h2>
    730730<table class="form-table">
     
    732732    <th scope="row"><?php _e( 'Capabilities' ); ?></th>
    733733    <td>
    734 <?php
    735     $output = '';
    736 foreach ( $profileuser->caps as $cap => $value ) {
    737     if ( ! $wp_roles->is_role( $cap ) ) {
    738         if ( '' != $output ) {
    739             $output .= ', ';
    740         }
    741         $output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
    742     }
    743 }
    744     echo $output;
    745 ?>
     734            <?php
     735            $output = '';
     736            foreach ( $profileuser->caps as $cap => $value ) {
     737                if ( ! $wp_roles->is_role( $cap ) ) {
     738                    if ( '' != $output ) {
     739                        $output .= ', ';
     740                    }
     741                    $output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
     742                }
     743            }
     744            echo $output;
     745            ?>
    746746    </td>
    747747</tr>
    748748</table>
    749 <?php endif; ?>
     749    <?php endif; ?>
    750750
    751751<input type="hidden" name="action" value="update" />
    752752<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $user_id ); ?>" />
    753753
    754 <?php submit_button( IS_PROFILE_PAGE ? __( 'Update Profile' ) : __( 'Update User' ) ); ?>
     754        <?php submit_button( IS_PROFILE_PAGE ? __( 'Update Profile' ) : __( 'Update User' ) ); ?>
    755755
    756756</form>
    757757</div>
    758 <?php
     758        <?php
    759759        break;
    760760}
Note: See TracChangeset for help on using the changeset viewer.