Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/site-info.php

    r41065 r42343  
    2121
    2222if ( ! $id ) {
    23     wp_die( __('Invalid site ID.') );
     23    wp_die( __( 'Invalid site ID.' ) );
    2424}
    2525
     
    3434
    3535$parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME );
    36 $is_main_site = is_main_site( $id );
     36$is_main_site  = is_main_site( $id );
    3737
    3838if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
     
    4444    delete_option( 'rewrite_rules' );
    4545
    46     $blog_data = wp_unslash( $_POST['blog'] );
     46    $blog_data           = wp_unslash( $_POST['blog'] );
    4747    $blog_data['scheme'] = $parsed_scheme;
    4848
     
    5050        // On the network's main site, don't allow the domain or path to change.
    5151        $blog_data['domain'] = $details->domain;
    52         $blog_data['path'] = $details->path;
     52        $blog_data['path']   = $details->path;
    5353    } else {
    5454        // For any other site, the scheme, domain, and path can all be changed. We first
     
    6868        $blog_data['scheme'] = $update_parsed_url['scheme'];
    6969        $blog_data['domain'] = $update_parsed_url['host'];
    70         $blog_data['path'] = $update_parsed_url['path'];
    71     }
    72 
    73     $existing_details = get_site( $id );
     70        $blog_data['path']   = $update_parsed_url['path'];
     71    }
     72
     73    $existing_details     = get_site( $id );
    7474    $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
    7575    foreach ( $blog_data_checkboxes as $c ) {
     
    8686    $new_details = get_site( $id );
    8787
    88     $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) );
     88    $old_home_url    = trailingslashit( esc_url( get_option( 'home' ) ) );
    8989    $old_home_parsed = parse_url( $old_home_url );
    9090
     
    9494    }
    9595
    96     $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) );
     96    $old_site_url    = trailingslashit( esc_url( get_option( 'siteurl' ) ) );
    9797    $old_site_parsed = parse_url( $old_site_url );
    9898
     
    103103
    104104    restore_current_blog();
    105     wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php' ) );
     105    wp_redirect(
     106        add_query_arg(
     107            array(
     108                'update' => 'updated',
     109                'id'     => $id,
     110            ), 'site-info.php'
     111        )
     112    );
    106113    exit;
    107114}
     
    117124$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
    118125
    119 $parent_file = 'sites.php';
     126$parent_file  = 'sites.php';
    120127$submenu_file = 'sites.php';
    121128
     
    129136<?php
    130137
    131 network_edit_site_nav( array(
    132     'blog_id'  => $id,
    133     'selected' => 'site-info'
    134 ) );
     138network_edit_site_nav(
     139    array(
     140        'blog_id'  => $id,
     141        'selected' => 'site-info',
     142    )
     143);
    135144
    136145if ( ! empty( $messages ) ) {
     
    142151<form method="post" action="site-info.php?action=update-site">
    143152    <?php wp_nonce_field( 'edit-site' ); ?>
    144     <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
     153    <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
    145154    <table class="form-table">
    146155        <?php
    147156        // The main site of the network should not be updated on this page.
    148         if ( $is_main_site ) : ?>
     157        if ( $is_main_site ) :
     158        ?>
    149159        <tr class="form-field">
    150160            <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th>
     
    153163        <?php
    154164        // For any other site, the scheme, domain, and path can all be changed.
    155         else : ?>
     165        else :
     166        ?>
    156167        <tr class="form-field form-required">
    157168            <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th>
     
    161172
    162173        <tr class="form-field">
    163             <th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ) ?></label></th>
    164             <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td>
     174            <th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ); ?></label></th>
     175            <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ); ?>" /></td>
    165176        </tr>
    166177        <tr class="form-field">
    167178            <th scope="row"><label for="blog_last_updated"><?php _e( 'Last Updated' ); ?></label></th>
    168             <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td>
     179            <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ); ?>" /></td>
    169180        </tr>
    170181        <?php
     
    181192            <td>
    182193            <fieldset>
    183             <legend class="screen-reader-text"><?php _e( 'Set site attributes' ) ?></legend>
     194            <legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
    184195            <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
    185                 <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
     196                <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1"
     197                                                                    <?php
     198                                                                    checked( (bool) $details->$field_key, true );
     199                                                                    disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) );
     200?>
     201 />
    186202                <?php echo $field_label; ?></label><br/>
    187203            <?php endforeach; ?>
Note: See TracChangeset for help on using the changeset viewer.