Make WordPress Core

Ticket #27201: 27201-3.patch

File 27201-3.patch, 2.2 KB (added by bravokeyl, 11 years ago)
  • includes/file.php

     
    5353 * @uses _cleanup_header_comment
    5454 * @uses $wp_file_descriptions
    5555 * @param string $file Filesystem path or filename
    56  * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist
     56 * @return string Description of file from $wp_file_descriptions only for top level directory files of themes for others empty string or basename of $file if description doesn't exist
    5757 */
    5858function get_file_description( $file ) {
    5959        global $wp_file_descriptions;
    6060
    6161        if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
    62                 return $wp_file_descriptions[basename( $file )];
     62                if( basename( dirname( dirname( $file ) ) ) == 'themes'){
     63                   return $wp_file_descriptions[basename( $file )];
     64                }
     65                return '';
    6366        }
    6467        elseif ( file_exists( $file ) && is_file( $file ) ) {
    6568                $template_data = implode( '', file( $file ) );
     
    11081111</form>
    11091112<?php
    11101113        return false;
    1111 }
     1114}
     1115 No newline at end of file
  • theme-editor.php

     
    129129
    130130$description = get_file_description( $file );
    131131$file_show = array_search( $file, array_filter( $allowed_files ) );
    132 if ( $description != $file_show )
     132if ( $description != $file_show && basename( dirname( dirname( $file ) ) ) == 'themes' ) {
    133133        $description .= ' <span>(' . $file_show . ')</span>';
     134}
     135else {
     136        $description = basename( $file ).' <span>(' . $file_show . ')</span>';
     137}
    134138?>
    135139<div class="wrap">
    136140<h2><?php echo esc_html( $title ); ?></h2>
     
    180184                        echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
    181185
    182186                $file_description = get_file_description( $absolute_filename );
     187               
    183188                if ( $file_description != basename( $filename ) )
     189                        if( basename( dirname( dirname( $absolute_filename ) ) ) !== 'themes' ){
     190                                $file_description .= basename( $filename );     
     191                        }
    184192                        $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
    185193
    186194                if ( $absolute_filename == $file )