﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
20718,Function get_file_description() Always Returns File Name Instead of Template Name,arieputranto,ryan,"When there's a custom page template named ""something.php"" defined with
{{{
/*
Template Name: Something
*/
}}}
On the theme editor, the file list supposed to returns:
{{{
""Something""
(something.php)
}}}
where it is displaying only the file name:
{{{
""something.php""
}}}
Well it doesn't affect the functionality but it IS annoying.

I found the problem is on the:

file: wp-admin/includes/file.php
line: 62

where:
{{{
	elseif ( file_exists( $file ) && is_file( $file ) ) {
		$template_data = implode( '', file( $file ) );
		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
			return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );
}}}
Well, it will always returns the filename instead of the template name since it will never find the $file on the defined path.

It should be something like:
{{{
	elseif ( file_exists( get_template_directory() . '/' . $file ) && is_file( get_template_directory() . '/' . $file ) ) {
		$template_data = implode( '', file( get_template_directory() . '/' . $file ) );
		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
			return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );

}}}
Again, it's nothing but annoying",defect (bug),closed,normal,3.4,Themes,3.4,trivial,fixed,has-patch commit,
