Changeset 17130
- Timestamp:
- 12/24/2010 05:41:36 PM (10 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-ms-themes-list-table.php
r17129 r17130 79 79 80 80 foreach ( (array) $themes['all'] as $key => $theme ) { 81 $theme_key = esc_html( $theme['Stylesheet'] );81 $theme_key = $theme['Stylesheet']; 82 82 83 83 if ( isset( $allowed_themes [ $theme_key ] ) ) { … … 277 277 ); 278 278 279 $theme_key = esc_html( $theme['Stylesheet'] );279 $theme_key = $theme['Stylesheet']; 280 280 281 281 if ( empty( $theme['enabled'] ) ) … … 286 286 if ( current_user_can('edit_themes') ) 287 287 $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme['Name'] ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>'; 288 289 if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes )288 289 if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $theme_key != get_option( 'stylesheet' ) && $theme_key != get_option( 'template' ) ) 290 290 $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&checked[]=' . $theme_key . '&theme_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 291 291 -
trunk/wp-admin/network/themes.php
r17127 r17130 29 29 30 30 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 31 $_SERVER['REQUEST_URI'] = remove_query_arg(array('enable', 'disable', 'enable-selected', 'disable-selected'), $_SERVER['REQUEST_URI']); 31 $temp_args = array( 'enabled', 'disabled', 'deleted', 'error', 'enabled', 'disabled', 'deleted', 'error' ); 32 $_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); 33 $referer = remove_query_arg( $temp_args, wp_get_referer() ); 32 34 33 35 if ( $action ) { … … 38 40 $allowed_themes[ $_GET['theme'] ] = true; 39 41 update_site_option( 'allowedthemes', $allowed_themes ); 40 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message41 exit; 42 wp_redirect( add_query_arg( 'enabled', '1', $referer ) ); 43 exit; 42 44 break; 43 45 case 'disable': … … 45 47 unset( $allowed_themes[ $_GET['theme'] ] ); 46 48 update_site_option( 'allowedthemes', $allowed_themes ); 47 wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message49 wp_redirect( add_query_arg( 'disabled', '1', $referer ) ); 48 50 exit; 49 51 break; … … 52 54 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 53 55 if ( empty($themes) ) { 54 wp_redirect( wp_get_referer() );55 exit; 56 } 56 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 57 exit; 58 } 57 59 foreach( (array) $themes as $theme ) 58 60 $allowed_themes[ $theme ] = true; 59 61 update_site_option( 'allowedthemes', $allowed_themes ); 62 wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); 63 exit; 60 64 break; 61 65 case 'disable-selected': … … 63 67 $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 64 68 if ( empty($themes) ) { 65 wp_redirect( wp_get_referer() );66 exit; 67 } 69 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 70 exit; 71 } 68 72 foreach( (array) $themes as $theme ) 69 73 unset( $allowed_themes[ $theme ] ); 70 74 update_site_option( 'allowedthemes', $allowed_themes ); 75 wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); 76 exit; 71 77 break; 72 78 case 'delete-selected': … … 76 82 77 83 $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); 84 85 if ( isset( $themes[ get_option( 'template' ) ] ) ) 86 unset( $themes[ get_option( 'template' ) ] ); 87 if ( isset( $themes[ get_option( 'stylesheet' ) ] ) ) 88 unset( $themes[ get_option( 'stylesheet' ) ] ); 89 78 90 if ( empty( $themes ) ) { 79 wp_redirect( wp_get_referer() );91 wp_redirect( add_query_arg( 'error', 'none', $referer ) ); 80 92 exit; 81 93 } … … 94 106 95 107 if ( empty( $themes ) ) { 96 wp_redirect( add_query_arg( 'error', 'main', wp_get_referer()) );108 wp_redirect( add_query_arg( 'error', 'main', $referer ) ); 97 109 exit; 98 110 } … … 150 162 foreach ( $themes as $theme ) 151 163 $delete_result = delete_theme( $theme ); 152 wp_redirect( network_admin_url( 'themes.php?deleted=true') );164 wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) ); 153 165 exit; 154 166 break; … … 175 187 require_once(ABSPATH . 'wp-admin/admin-header.php'); 176 188 177 if ( isset( $_GET['deleted'] ) ) : ?>178 <div class="updated"><p><?php _e('Theme deleted.') ?></p></div><?php179 elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) : ?>180 <div class="error"><p><?php _e( 'You cannot delete a theme while it is active on the main site.' ); ?></p></div><?php181 endif;182 189 ?> 183 190 … … 189 196 </h2> 190 197 198 <?php 199 if ( isset( $_GET['enabled'] ) ) { 200 $_GET['enabled'] = absint( $_GET['enabled'] ); 201 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>'; 202 } elseif ( isset( $_GET['disabled'] ) ) { 203 $_GET['disabled'] = absint( $_GET['disabled'] ); 204 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>'; 205 } elseif ( isset( $_GET['deleted'] ) ) { 206 $_GET['disabled'] = absint( $_GET['deleted'] ); 207 echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) ) . '</p></div>'; 208 } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { 209 echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>'; 210 } elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { 211 echo '<div class="error"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>'; 212 } 213 214 ?> 215 191 216 <form method="get" action=""> 192 217 <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.