Changeset 29856 for trunk/src/wp-admin/network/themes.php
- Timestamp:
- 10/08/2014 07:04:05 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/network/themes.php
r29839 r29856 97 97 exit; 98 98 case 'delete-selected': 99 if ( ! current_user_can( 'delete_themes' ) ) 99 if ( ! current_user_can( 'delete_themes' ) ) { 100 100 wp_die( __('You do not have sufficient permissions to delete themes for this site.') ); 101 } 102 101 103 check_admin_referer( 'bulk-themes' ); 102 104 … … 116 118 117 119 $files_to_delete = $theme_info = array(); 120 $theme_translations = wp_get_installed_translations( 'themes' ); 118 121 foreach ( $themes as $key => $theme ) { 119 122 $theme_info[ $theme ] = wp_get_theme( $theme ); 120 $files_to_delete = array_merge( $files_to_delete, list_files( $theme_info[ $theme ]->get_stylesheet_directory() ) ); 123 124 // Locate all the files in that folder. 125 $files = list_files( $theme_info[ $theme ]->get_stylesheet_directory() ); 126 if ( $files ) { 127 $files_to_delete = array_merge( $files_to_delete, $files ); 128 } 129 130 // Add translation files. 131 $theme_slug = $theme_info[ $theme ]->get_stylesheet(); 132 if ( ! empty( $theme_translations[ $theme_slug ] ) ) { 133 $translations = $theme_translations[ $theme_slug ]; 134 135 foreach ( $translations as $translation => $data ) { 136 $files_to_delete[] = $theme_slug . '-' . $translation . '.po'; 137 $files_to_delete[] = $theme_slug . '-' . $translation . '.mo'; 138 } 139 } 121 140 } 122 141 … … 137 156 <p><?php echo _n( 'You are about to remove the following theme:', 'You are about to remove the following themes:', $themes_to_delete ); ?></p> 138 157 <ul class="ul-disc"> 139 <?php foreach ( $theme_info as $theme ) 140 echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>'; /* translators: 1: theme name, 2: theme author */ ?> 158 <?php 159 foreach ( $theme_info as $theme ) { 160 /* translators: 1: theme name, 2: theme author */ 161 echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>'; 162 } 163 ?> 141 164 </ul> 142 165 <p><?php _e('Are you sure you wish to delete these themes?'); ?></p> … … 145 168 <input type="hidden" name="action" value="delete-selected" /> 146 169 <?php 147 foreach ( (array) $themes as $theme ) 170 foreach ( (array) $themes as $theme ) { 148 171 echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />'; 172 } 149 173 ?> 150 174 <?php wp_nonce_field('bulk-themes') ?> … … 159 183 <ul class="code"> 160 184 <?php 161 foreach ( (array) $files_to_delete as $file ) 162 echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . "/themes", '', $file) ) . '</li>'; 185 foreach ( (array) $files_to_delete as $file ) { 186 echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . '/themes', '', $file ) ) . '</li>'; 187 } 163 188 ?> 164 189 </ul>
Note: See TracChangeset
for help on using the changeset viewer.