Ticket #27201: 27201.3.diff
File 27201.3.diff, 4.3 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/file.php
51 51 * 52 52 * @global array $wp_file_descriptions 53 53 * @param string $file Filesystem path or filename 54 * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist 54 * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist. 55 * Appends 'Page Template' to basename of $file if the file is a page template 55 56 */ 56 57 function get_file_description( $file ) { 57 global $wp_file_descriptions ;58 global $wp_file_descriptions, $allowed_files; 58 59 59 if ( isset( $wp_file_descriptions[basename( $file )] ) ) { 60 return $wp_file_descriptions[basename( $file )]; 60 $relative_pathinfo = pathinfo( $file ); 61 $file_path = $allowed_files[ $file ]; 62 if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $relative_pathinfo['dirname'] ) { 63 return $wp_file_descriptions[ basename( $file ) ]; 64 } elseif ( file_exists( $file_path ) && is_file( $file_path ) ) { 65 $template_data = implode( '', file( $file_path ) ); 66 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) { 67 return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) ); 68 } 61 69 } 62 elseif ( file_exists( $file ) && is_file( $file ) ) {63 $template_data = implode( '', file( $file ) );64 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))65 return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );66 }67 70 68 71 return trim( basename( $file ) ); 69 72 } -
src/wp-admin/theme-editor.php
25 25 'title' => __('Overview'), 26 26 'content' => 27 27 '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p> 28 <p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p>28 <p>' . __("Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of the theme's template files. Clicking once on any file name causes the file to appear in the large Editor box.") . '</p> 29 29 <p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '</p> 30 30 <p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p> 31 31 <p>' . __('After typing in your edits, click Update File.') . '</p> … … 125 125 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div> 126 126 <?php endif; 127 127 128 $description = get_file_description( $ file );128 $description = get_file_description( $relative_file ); 129 129 $file_show = array_search( $file, array_filter( $allowed_files ) ); 130 130 if ( $description != $file_show ) 131 131 $description .= ' <span>(' . $file_show . ')</span>'; … … 177 177 if ( 'style.css' == $filename ) 178 178 echo "\t</ul>\n\t<h2>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h2>\n\t<ul>\n"; 179 179 180 $file_description = get_file_description( $ absolute_filename );181 if ( $file _description != basename( $filename ) )180 $file_description = get_file_description( $filename ); 181 if ( $filename !== basename( $absolute_filename ) || $file_description !== $filename ) { 182 182 $file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>'; 183 } 183 184 184 if ( $absolute_filename == $file )185 if ( $absolute_filename === $file ) { 185 186 $file_description = '<span class="highlight">' . $file_description . '</span>'; 187 } 186 188 ?> 187 189 <li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li> 188 190 <?php