Ticket #6531: 6531.2.diff
File 6531.2.diff, 3.7 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/plugin.php
182 182 * @param string $plugin Plugin ID 183 183 * @return array List of files relative to the plugin root. 184 184 */ 185 function get_plugin_files( $plugin) {185 function get_plugin_files( $plugin ) { 186 186 $plugin_file = WP_PLUGIN_DIR . '/' . $plugin; 187 $dir = dirname($plugin_file);188 $plugin_files = array( $plugin);189 if ( is_dir( $dir) && $dir != WP_PLUGIN_DIR ) {187 $dir = WP_PLUGIN_DIR . '/' . current( explode( '/', $plugin, 2 ) ); 188 $plugin_files = array( $plugin ); 189 if ( is_dir( $dir ) && $dir != WP_PLUGIN_DIR ) { 190 190 $plugins_dir = @ opendir( $dir ); 191 191 if ( $plugins_dir ) { 192 while ( ($file = readdir( $plugins_dir ) ) !== false ) {193 if ( substr( $file, 0, 1) == '.' )192 while ( ( $file = readdir( $plugins_dir ) ) !== false ) { 193 if ( substr( $file, 0, 1 ) == '.' ) 194 194 continue; 195 195 if ( is_dir( $dir . '/' . $file ) ) { 196 $plugins_subdir = @ opendir( $dir . '/' . $file ); 197 if ( $plugins_subdir ) { 198 while (($subfile = readdir( $plugins_subdir ) ) !== false ) { 199 if ( substr($subfile, 0, 1) == '.' ) 200 continue; 201 $plugin_files[] = plugin_basename("$dir/$file/$subfile"); 202 } 203 @closedir( $plugins_subdir ); 204 } 196 $subfiles = get_plugin_sub_files( $dir . '/' . $file ); 197 $plugin_files = array_merge( $plugin_files, $subfiles ); 205 198 } else { 206 if ( plugin_basename( "$dir/$file") != $plugin )207 $plugin_files[] = plugin_basename( "$dir/$file");199 if ( plugin_basename( "$dir/$file" ) != $plugin ) 200 $plugin_files[] = plugin_basename( "$dir/$file" ); 208 201 } 209 202 } 210 @ closedir( $plugins_dir );203 @ closedir( $plugins_dir ); 211 204 } 212 205 } 206 return $plugin_files; 207 } 213 208 209 function get_plugin_sub_files( $subdir ) { 210 $plugins_subdir = @ opendir( $subdir ); 211 if ( $plugins_subdir ) { 212 $plugin_files = array(); 213 while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) { 214 if ( substr( $subfile, 0, 1 ) == '.' ) 215 continue; 216 if ( is_dir( $subdir . '/' . $subfile ) ) { 217 $subfiles = get_plugin_sub_files( $subdir . '/' . $subfile ); 218 $plugin_files = array_merge( $plugin_files, $subfiles ); 219 } else { 220 $plugin_files[] = plugin_basename( "$subdir/$subfile" ); 221 } 222 } 223 @ closedir( $plugins_subdir ); 224 } 214 225 return $plugin_files; 215 226 } 216 227 -
wp-admin/theme-editor.php
176 176 endif; 177 177 178 178 foreach ( $allowed_files as $filename => $absolute_filename ) : 179 if ( 'style.css' == $filename ) 179 if ( 'style.css' == $filename ) { 180 180 echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n"; 181 } 181 182 183 $relative_file = explode( $theme->offsetGet( 'Template' ) . '/', $absolute_filename ); 184 $relative_file = $relative_file[1]; 185 182 186 $file_description = get_file_description( $absolute_filename ); 183 if ( $file_description != basename( $filename ) )184 $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';185 187 186 if ( $absolute_filename == $file ) 188 if ( $file_description != $relative_file ) { 189 $file_description .= '<br /><span class="nonessential">(' . $relative_file . ')</span>'; 190 } 191 if ( $absolute_filename == $file ) { 187 192 $file_description = '<span class="highlight">' . $file_description . '</span>'; 193 } 188 194 ?> 189 195 <li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li> 190 196 <?php