Changeset 42343 for trunk/src/wp-admin/network/site-themes.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/network/site-themes.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/network/site-themes.php
r41065 r42343 11 11 require_once( dirname( __FILE__ ) . '/admin.php' ); 12 12 13 if ( ! current_user_can( 'manage_sites' ) ) 13 if ( ! current_user_can( 'manage_sites' ) ) { 14 14 wp_die( __( 'Sorry, you are not allowed to manage themes for this site.' ) ); 15 } 15 16 16 17 get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); 17 18 get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); 18 19 19 get_current_screen()->set_screen_reader_content( array( 20 'heading_views' => __( 'Filter site themes list' ), 21 'heading_pagination' => __( 'Site themes list navigation' ), 22 'heading_list' => __( 'Site themes list' ), 23 ) ); 24 25 $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); 20 get_current_screen()->set_screen_reader_content( 21 array( 22 'heading_views' => __( 'Filter site themes list' ), 23 'heading_pagination' => __( 'Site themes list navigation' ), 24 'heading_list' => __( 'Site themes list' ), 25 ) 26 ); 27 28 $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); 26 29 27 30 $action = $wp_list_table->current_action(); 28 31 29 $s = isset( $_REQUEST['s']) ? $_REQUEST['s'] : '';32 $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; 30 33 31 34 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 32 $temp_args = array( 'enabled', 'disabled', 'error' );35 $temp_args = array( 'enabled', 'disabled', 'error' ); 33 36 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); 34 $referer = remove_query_arg( $temp_args, wp_get_referer() );37 $referer = remove_query_arg( $temp_args, wp_get_referer() ); 35 38 36 39 if ( ! empty( $_REQUEST['paged'] ) ) { … … 40 43 $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 41 44 42 if ( ! $id ) 43 wp_die( __('Invalid site ID.') ); 45 if ( ! $id ) { 46 wp_die( __( 'Invalid site ID.' ) ); 47 } 44 48 45 49 $wp_list_table->prepare_items(); … … 50 54 } 51 55 52 if ( ! can_edit_network( $details->site_id ) )56 if ( ! can_edit_network( $details->site_id ) ) { 53 57 wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); 58 } 54 59 55 60 $is_main_site = is_main_site( $id ); … … 62 67 case 'enable': 63 68 check_admin_referer( 'enable-theme_' . $_GET['theme'] ); 64 $theme = $_GET['theme'];69 $theme = $_GET['theme']; 65 70 $action = 'enabled'; 66 $n = 1;67 if ( ! $allowed_themes )71 $n = 1; 72 if ( ! $allowed_themes ) { 68 73 $allowed_themes = array( $theme => true ); 69 else 70 $allowed_themes[$theme] = true; 74 } else { 75 $allowed_themes[ $theme ] = true; 76 } 71 77 break; 72 78 case 'disable': 73 79 check_admin_referer( 'disable-theme_' . $_GET['theme'] ); 74 $theme = $_GET['theme'];80 $theme = $_GET['theme']; 75 81 $action = 'disabled'; 76 $n = 1;77 if ( ! $allowed_themes )82 $n = 1; 83 if ( ! $allowed_themes ) { 78 84 $allowed_themes = array(); 79 else 80 unset( $allowed_themes[$theme] ); 85 } else { 86 unset( $allowed_themes[ $theme ] ); 87 } 81 88 break; 82 89 case 'enable-selected': … … 85 92 $themes = (array) $_POST['checked']; 86 93 $action = 'enabled'; 87 $n = count( $themes );88 foreach ( (array) $themes as $theme ) 94 $n = count( $themes ); 95 foreach ( (array) $themes as $theme ) { 89 96 $allowed_themes[ $theme ] = true; 97 } 90 98 } else { 91 99 $action = 'error'; 92 $n = 'none';100 $n = 'none'; 93 101 } 94 102 break; … … 98 106 $themes = (array) $_POST['checked']; 99 107 $action = 'disabled'; 100 $n = count( $themes );101 foreach ( (array) $themes as $theme ) 108 $n = count( $themes ); 109 foreach ( (array) $themes as $theme ) { 102 110 unset( $allowed_themes[ $theme ] ); 111 } 103 112 } else { 104 113 $action = 'error'; 105 $n = 'none';114 $n = 'none'; 106 115 } 107 116 break; … … 110 119 check_admin_referer( 'bulk-themes' ); 111 120 $themes = (array) $_POST['checked']; 112 $n = count( $themes );121 $n = count( $themes ); 113 122 $screen = get_current_screen()->id; 114 123 … … 131 140 } else { 132 141 $action = 'error'; 133 $n = 'none';142 $n = 'none'; 134 143 } 135 144 } … … 138 147 restore_current_blog(); 139 148 140 wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n ), $referer ) ); 149 wp_safe_redirect( 150 add_query_arg( 151 array( 152 'id' => $id, 153 $action => $n, 154 ), $referer 155 ) 156 ); 141 157 exit; 142 158 } … … 153 169 $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); 154 170 155 $parent_file = 'sites.php';171 $parent_file = 'sites.php'; 156 172 $submenu_file = 'sites.php'; 157 173 … … 163 179 <?php 164 180 165 network_edit_site_nav( array( 166 'blog_id' => $id, 167 'selected' => 'site-themes' 168 ) ); 181 network_edit_site_nav( 182 array( 183 'blog_id' => $id, 184 'selected' => 'site-themes', 185 ) 186 ); 169 187 170 188 if ( isset( $_GET['enabled'] ) ) { … … 186 204 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { 187 205 echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; 188 } ?> 189 190 <p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> 206 } 207 ?> 208 209 <p><?php _e( 'Network enabled themes are not shown on this screen.' ); ?></p> 191 210 192 211 <form method="get"> 193 212 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> 194 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />213 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 195 214 </form> 196 215 … … 198 217 199 218 <form method="post" action="site-themes.php?action=update-site"> 200 <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />219 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 201 220 202 221 <?php $wp_list_table->display(); ?> … … 205 224 206 225 </div> 207 <?php include( ABSPATH . 'wp-admin/admin-footer.php'); ?>226 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.