WordPress.org

Make WordPress Core

Changeset 32758


Ignore:
Timestamp:
06/14/2015 05:00:27 AM (5 years ago)
Author:
jeremyfelt
Message:

Improve code readability in site-info.php

In advance of some other work here, clean up some braces and spaces.

See #22383.

File:
1 edited

Legend:

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

    r32152 r32758  
    1111require_once( dirname( __FILE__ ) . '/admin.php' );
    1212
    13 if ( ! is_multisite() )
     13if ( ! is_multisite() ) {
    1414    wp_die( __( 'Multisite support is not enabled.' ) );
     15}
    1516
    16 if ( ! current_user_can( 'manage_sites' ) )
     17if ( ! current_user_can( 'manage_sites' ) ) {
    1718    wp_die( __( 'You do not have sufficient permissions to edit this site.' ) );
     19}
    1820
    19     get_current_screen()->add_help_tab( array(
    20         'id'      => 'overview',
    21         'title'   => __('Overview'),
    22         'content' =>
    23             '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
    24             '<p>' . __('<strong>Info</strong> - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' .
    25             '<p>' . __('<strong>Users</strong> - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' .
    26             '<p>' . sprintf( __('<strong>Themes</strong> - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
    27             '<p>' . __('<strong>Settings</strong> - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>'
     21get_current_screen()->add_help_tab( array(
     22    'id'      => 'overview',
     23    'title'   => __( 'Overview' ),
     24    'content' =>
     25        '<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' .
     26        '<p>' . __( '<strong>Info</strong> - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' .
     27        '<p>' . __( '<strong>Users</strong> - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '</p>' .
     28        '<p>' . sprintf( __( '<strong>Themes</strong> - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
     29        '<p>' . __( '<strong>Settings</strong> - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '</p>'
    2830) );
    2931
    3032get_current_screen()->set_help_sidebar(
    31     '<p><strong>' . __('For more information:') . '</strong></p>' .
    32     '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
    33     '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
     33    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     34    '<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>' ) . '</p>' .
     35    '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>' ) . '</p>'
    3436);
    3537
    3638$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    3739
    38 if ( ! $id )
     40if ( ! $id ) {
    3941    wp_die( __('Invalid site ID.') );
     42}
    4043
    4144$details = get_blog_details( $id );
    42 if ( !can_edit_network( $details->site_id ) )
     45if ( ! can_edit_network( $details->site_id ) ) {
    4346    wp_die( __( 'You do not have permission to access this page.' ), 403 );
     47}
    4448
    4549$parsed = parse_url( $details->siteurl );
    4650$is_main_site = is_main_site( $id );
    4751
    48 if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
     52if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
    4953    check_admin_referer( 'edit-site' );
    5054
     
    5963    $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
    6064    foreach ( $blog_data_checkboxes as $c ) {
    61         if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) )
     65        if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) {
    6266            $blog_data[ $c ] = $existing_details->$c;
    63         else
     67        } else {
    6468            $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0;
     69        }
    6570    }
    6671    update_blog_details( $id, $blog_data );
     
    7883
    7984    restore_current_blog();
    80     wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') );
     85    wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php' ) );
    8186    exit;
    8287}
    8388
    84 if ( isset($_GET['update']) ) {
     89if ( isset( $_GET['update'] ) ) {
    8590    $messages = array();
    86     if ( 'updated' == $_GET['update'] )
    87         $messages[] = __('Site info updated.');
     91    if ( 'updated' == $_GET['update'] ) {
     92        $messages[] = __( 'Site info updated.' );
     93    }
    8894}
    8995
     
    117123<?php
    118124if ( ! empty( $messages ) ) {
    119     foreach ( $messages as $msg )
     125    foreach ( $messages as $msg ) {
    120126        echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
     127    }
    121128} ?>
    122129<form method="post" action="site-info.php?action=update-site">
Note: See TracChangeset for help on using the changeset viewer.