- Timestamp:
- 11/08/2010 09:52:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-ms-themes-list-table.php
r16241 r16242 8 8 */ 9 9 class WP_MS_Themes_List_Table extends WP_List_Table { 10 11 var $site_id; 12 var $is_site_themes; 10 13 11 14 function WP_MS_Themes_List_Table() { … … 38 41 } 39 42 40 if ( !current_user_can('manage_network_themes') ) 41 wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); 43 if ( $this->is_site_themes && !current_user_can('manage_sites') ) 44 wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); 45 else if ( !$this->is_site_themes && !current_user_can('manage_network_themes') ) 46 wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) ); 42 47 } 43 48 … … 55 60 ); 56 61 57 $allowed_themes = get_site_allowed_themes(); 62 $site_allowed_themes = get_site_allowed_themes(); 63 if ( !$this->is_site_themes ) 64 $allowed_themes = $site_allowed_themes; 65 else 66 $allowed_themes = wpmu_get_blog_allowedthemes( $this->site_id ); 67 58 68 $current = get_site_transient( 'update_themes' ); 59 69 60 70 foreach ( (array) $themes['all'] as $key => $theme ) { 61 71 $theme_key = esc_html( $theme['Stylesheet'] ); 72 62 73 if ( isset( $allowed_themes [ $theme_key ] ) ) { 63 74 $themes['all'][$key]['enabled'] = true; … … 70 81 if ( isset( $current->response[ $theme['Template'] ] ) ) 71 82 $themes['upgrade'][$key] = $themes['all'][$key]; 83 84 if ( $this->is_site_themes && isset( $site_allowed_themes[$theme_key] ) ) { 85 unset( $themes['all'][$key] ); 86 unset( $themes['enabled'][$key] ); 87 unset( $themes['disabled'][$key] ); 88 } 72 89 } 73 90 … … 189 206 } 190 207 208 if ( $this->is_site_themes ) 209 $url = 'site-themes.php?id=' . $this->site_id; 210 else 211 $url = 'themes.php'; 212 191 213 $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", 192 add_query_arg('theme_status', $type, 'themes.php'),214 add_query_arg('theme_status', $type, $url), 193 215 ( $type == $status ) ? ' class="current"' : '', 194 216 sprintf( $text, number_format_i18n( $count ) ) … … 204 226 $actions = array(); 205 227 if ( 'enabled' != $status ) 206 $actions[' network-enable-selected'] = __( 'Enable' );228 $actions['enable-selected'] = __( 'Enable' ); 207 229 if ( 'disabled' != $status ) 208 $actions[' network-disable-selected'] = __( 'Disable' );230 $actions['disable-selected'] = __( 'Disable' ); 209 231 if ( current_user_can( 'update_themes' ) ) 210 232 $actions['update-selected'] = __( 'Update' ); … … 226 248 227 249 $context = $status; 250 251 if ( $this->is_site_themes ) 252 $url = "site-themes.php?id={$this->site_id}&"; 253 else 254 $url = 'themes.php?'; 228 255 229 256 foreach ( $this->items as $key => $theme ) { 230 257 // preorder 231 258 $actions = array( 232 ' network_enable' => '',233 ' network_disable' => '',259 'enable' => '', 260 'disable' => '', 234 261 'edit' => '' 235 262 ); … … 237 264 $theme_key = esc_html( $theme['Stylesheet'] ); 238 265 239 if ( empty( $theme['enabled'] ) ) { 240 if ( current_user_can( 'manage_network_themes' ) ) 241 $actions['network_enable'] = '<a href="' . wp_nonce_url('themes.php?action=network-enable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'enable-theme_' . $theme_key) . '" title="' . __('Enable this theme for all sites in this network') . '" class="edit">' . __('Enable') . '</a>'; 242 } else { 243 if ( current_user_can( 'manage_network_themes' ) ) 244 $actions['network_disable'] = '<a href="' . wp_nonce_url('themes.php?action=network-disable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'disable-theme_' . $theme_key) . '" title="' . __('Disable this theme') . '">' . __('Disable') . '</a>'; 245 } 266 if ( empty( $theme['enabled'] ) ) 267 $actions['enable'] = '<a href="' . wp_nonce_url($url . 'action=enable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'enable-theme_' . $theme_key) . '" title="' . __('Enable this theme') . '" class="edit">' . __('Enable') . '</a>'; 268 else 269 $actions['disable'] = '<a href="' . wp_nonce_url($url . 'action=disable&theme=' . $theme_key . '&paged=' . $page . '&s=' . $s, 'disable-theme_' . $theme_key) . '" title="' . __('Disable this theme') . '">' . __('Disable') . '</a>'; 246 270 247 271 if ( current_user_can('edit_themes') )
Note: See TracChangeset
for help on using the changeset viewer.