wp/wp-admin/network/site-themes.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    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>'
    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>'
    28 ) );
    28 ) );
    29 
    29 
    30 get_current_screen()->set_help_sidebar(
    30 get_current_screen()->set_help_sidebar(
    31 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    31 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    32 	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</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="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
    33 	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
    34 );
    34 );
    35 
    35 
    36 $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
    36 $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
    37 
    37 
    38 $action = $wp_list_table->current_action();
    38 $action = $wp_list_table->current_action();
    42 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
    42 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
    43 $temp_args = array( 'enabled', 'disabled', 'error' );
    43 $temp_args = array( 'enabled', 'disabled', 'error' );
    44 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
    44 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
    45 $referer = remove_query_arg( $temp_args, wp_get_referer() );
    45 $referer = remove_query_arg( $temp_args, wp_get_referer() );
    46 
    46 
       
    47 if ( ! empty( $_REQUEST['paged'] ) ) {
       
    48 	$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer );
       
    49 }
       
    50 
    47 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    51 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    48 
    52 
    49 if ( ! $id )
    53 if ( ! $id )
    50 	wp_die( __('Invalid site ID.') );
    54 	wp_die( __('Invalid site ID.') );
    51 
    55 
    52 $wp_list_table->prepare_items();
    56 $wp_list_table->prepare_items();
    53 
    57 
    54 $details = get_blog_details( $id );
    58 $details = get_blog_details( $id );
    55 if ( !can_edit_network( $details->site_id ) )
    59 if ( !can_edit_network( $details->site_id ) )
    56 	wp_die( __( 'You do not have permission to access this page.' ) );
    60 	wp_die( __( 'You do not have permission to access this page.' ), 403 );
    57 
    61 
    58 $is_main_site = is_main_site( $id );
    62 $is_main_site = is_main_site( $id );
    59 
    63 
    60 if ( $action ) {
    64 if ( $action ) {
    61 	switch_to_blog( $id );
    65 	switch_to_blog( $id );
   121 	wp_safe_redirect( $referer );
   125 	wp_safe_redirect( $referer );
   122 	exit();
   126 	exit();
   123 }
   127 }
   124 
   128 
   125 add_thickbox();
   129 add_thickbox();
   126 add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
   130 add_screen_option( 'per_page' );
   127 
   131 
   128 $site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
   132 $site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
   129 $title_site_url_linked = sprintf( __('Edit Site: <a href="%1$s">%2$s</a>'), get_blogaddress_by_id( $id ), $site_url_no_http );
   133 $title_site_url_linked = sprintf( __( 'Edit Site: %s' ), '<a href="' . get_blogaddress_by_id( $id ) . '">' . $site_url_no_http . '</a>' );
   130 $title = sprintf( __('Edit Site: %s'), $site_url_no_http );
   134 $title = sprintf( __( 'Edit Site: %s' ), $site_url_no_http );
   131 
   135 
   132 $parent_file = 'sites.php';
   136 $parent_file = 'sites.php';
   133 $submenu_file = 'sites.php';
   137 $submenu_file = 'sites.php';
   134 
   138 
   135 require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
   139 require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
   136 
   140 
   137 <div class="wrap">
   141 <div class="wrap">
   138 <?php screen_icon('ms-admin'); ?>
       
   139 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
   142 <h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
   140 <h3 class="nav-tab-wrapper">
   143 <h3 class="nav-tab-wrapper">
   141 <?php
   144 <?php
   142 $tabs = array(
   145 $tabs = array(
   143 	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
   146 	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
   151 }
   154 }
   152 ?>
   155 ?>
   153 </h3><?php
   156 </h3><?php
   154 
   157 
   155 if ( isset( $_GET['enabled'] ) ) {
   158 if ( isset( $_GET['enabled'] ) ) {
   156 	$_GET['enabled'] = absint( $_GET['enabled'] );
   159 	$enabled = absint( $_GET['enabled'] );
   157 	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
   160 	if ( 1 == $enabled ) {
       
   161 		$message = __( 'Theme enabled.' );
       
   162 	} else {
       
   163 		$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
       
   164 	}
       
   165 	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
   158 } elseif ( isset( $_GET['disabled'] ) ) {
   166 } elseif ( isset( $_GET['disabled'] ) ) {
   159 	$_GET['disabled'] = absint( $_GET['disabled'] );
   167 	$disabled = absint( $_GET['disabled'] );
   160 	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
   168 	if ( 1 == $disabled ) {
       
   169 		$message = __( 'Theme disabled.' );
       
   170 	} else {
       
   171 		$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
       
   172 	}
       
   173 	echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
   161 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
   174 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
   162 	echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
   175 	echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>';
   163 } ?>
   176 } ?>
   164 
   177 
   165 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
   178 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
   166 
   179 
   167 <form method="get" action="">
   180 <form method="get">
   168 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
   181 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
   169 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
   182 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
   170 </form>
   183 </form>
   171 
   184 
   172 <?php $wp_list_table->views(); ?>
   185 <?php $wp_list_table->views(); ?>