- $template_mapping = array();
- $template_dir = $themes[$theme]['Template Dir'];
- foreach ( $themes[$theme]['Template Files'] as $template_file ) {
- // Don't show parent templates.
- if ( $is_child_theme && strpos( $template_file, trailingslashit( $template_dir ) ) === 0 )
- continue;
-
- $description = trim( get_file_description($template_file) );
- $template_show = basename($template_file);
- $filedesc = ( $description != $template_file ) ? "$description<br /><span class='nonessential'>($template_show)</span>" : "$description";
- $filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description<br /><span class='nonessential'>($template_show)</span></span>" : $filedesc;
- $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc );
- }
- ksort( $template_mapping );
- while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) :
- ?>
- <li><a href="theme-editor.php?file=<?php echo urlencode( $template_file ) ?>&theme=<?php echo urlencode( $theme ) ?>&dir=theme"><?php echo $filedesc ?></a></li>
-<?php endwhile; ?>
- </ul>
- <h3><?php /* translators: Theme stylesheets in theme editor */ _ex('Styles', 'Theme stylesheets in theme editor'); ?></h3>
- <ul>
+ endif;
+
+ foreach ( $allowed_files as $filename => $absolute_filename ) :
+ if ( 'style.css' == $filename )
+ echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
+
+ $file_description = get_file_description( $absolute_filename );
+ if ( $file_description != basename( $filename ) )
+ $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
+
+ if ( $absolute_filename == $file )
+ $file_description = '<span class="highlight">' . $file_description . '</span>';
+?>
+ <li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li>