Changeset 34658
- Timestamp:
- 09/28/2015 03:10:08 AM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/file.php
r34566 r34658 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 59 if ( isset( $wp_file_descriptions[basename( $file )] ) ) { 60 return $wp_file_descriptions[basename( $file )]; 61 } 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]) ); 58 global $wp_file_descriptions, $allowed_files; 59 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 } 66 69 } 67 70 -
trunk/src/wp-admin/theme-editor.php
r34066 r34658 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> … … 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 ) … … 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 184 if ( $absolute_filename == $file ) 183 } 184 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>
Note: See TracChangeset
for help on using the changeset viewer.