wp/wp-admin/network/site-info.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     6  * @subpackage Multisite
     6  * @subpackage Multisite
     7  * @since 3.1.0
     7  * @since 3.1.0
     8  */
     8  */
     9 
     9 
    10 /** Load WordPress Administration Bootstrap */
    10 /** Load WordPress Administration Bootstrap */
    11 require_once( dirname( __FILE__ ) . '/admin.php' );
    11 require_once __DIR__ . '/admin.php';
    12 
    12 
    13 if ( ! current_user_can( 'manage_sites' ) ) {
    13 if ( ! current_user_can( 'manage_sites' ) ) {
    14 	wp_die( __( 'Sorry, you are not allowed to edit this site.' ) );
    14 	wp_die( __( 'Sorry, you are not allowed to edit this site.' ) );
    15 }
    15 }
    16 
    16 
    33 }
    33 }
    34 
    34 
    35 $parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME );
    35 $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 );
    37 
    37 
    38 if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) {
    38 if ( isset( $_REQUEST['action'] ) && 'update-site' === $_REQUEST['action'] ) {
    39 	check_admin_referer( 'edit-site' );
    39 	check_admin_referer( 'edit-site' );
    40 
    40 
    41 	switch_to_blog( $id );
    41 	switch_to_blog( $id );
    42 
    42 
    43 	// Rewrite rules can't be flushed during switch to blog.
    43 	// Rewrite rules can't be flushed during switch to blog.
    70 		$blog_data['path']   = $update_parsed_url['path'];
    70 		$blog_data['path']   = $update_parsed_url['path'];
    71 	}
    71 	}
    72 
    72 
    73 	$existing_details     = get_site( $id );
    73 	$existing_details     = get_site( $id );
    74 	$blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
    74 	$blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
       
    75 
    75 	foreach ( $blog_data_checkboxes as $c ) {
    76 	foreach ( $blog_data_checkboxes as $c ) {
    76 		if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) {
    77 		if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) {
    77 			$blog_data[ $c ] = $existing_details->$c;
    78 			$blog_data[ $c ] = $existing_details->$c;
    78 		} else {
    79 		} else {
    79 			$blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0;
    80 			$blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0;
    80 		}
    81 		}
    81 	}
    82 	}
   114 	exit;
   115 	exit;
   115 }
   116 }
   116 
   117 
   117 if ( isset( $_GET['update'] ) ) {
   118 if ( isset( $_GET['update'] ) ) {
   118 	$messages = array();
   119 	$messages = array();
   119 	if ( 'updated' == $_GET['update'] ) {
   120 	if ( 'updated' === $_GET['update'] ) {
   120 		$messages[] = __( 'Site info updated.' );
   121 		$messages[] = __( 'Site info updated.' );
   121 	}
   122 	}
   122 }
   123 }
   123 
   124 
   124 /* translators: %s: site name */
   125 /* translators: %s: Site title. */
   125 $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
   126 $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
   126 
   127 
   127 $parent_file  = 'sites.php';
   128 $parent_file  = 'sites.php';
   128 $submenu_file = 'sites.php';
   129 $submenu_file = 'sites.php';
   129 
   130 
   130 require( ABSPATH . 'wp-admin/admin-header.php' );
   131 require_once ABSPATH . 'wp-admin/admin-header.php';
   131 
   132 
   132 ?>
   133 ?>
   133 
   134 
   134 <div class="wrap">
   135 <div class="wrap">
   135 <h1 id="edit-site"><?php echo $title; ?></h1>
   136 <h1 id="edit-site"><?php echo $title; ?></h1>
   192 			<th scope="row"><?php _e( 'Attributes' ); ?></th>
   193 			<th scope="row"><?php _e( 'Attributes' ); ?></th>
   193 			<td>
   194 			<td>
   194 			<fieldset>
   195 			<fieldset>
   195 			<legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
   196 			<legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
   196 			<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
   197 			<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
   197 				<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
   198 				<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> />
   198 				<?php echo $field_label; ?></label><br/>
   199 				<?php echo $field_label; ?></label><br/>
   199 			<?php endforeach; ?>
   200 			<?php endforeach; ?>
   200 			<fieldset>
   201 			<fieldset>
   201 			</td>
   202 			</td>
   202 		</tr>
   203 		</tr>
   204 	<?php submit_button(); ?>
   205 	<?php submit_button(); ?>
   205 </form>
   206 </form>
   206 
   207 
   207 </div>
   208 </div>
   208 <?php
   209 <?php
   209 require( ABSPATH . 'wp-admin/admin-footer.php' );
   210 require_once ABSPATH . 'wp-admin/admin-footer.php';