From b2041fc4d02016997f7532d6a24bd99b104ceca0 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 14 Feb 2005 04:24:25 +0000 Subject: [PATCH] Friendlier file names in theme editor - http://mosquito.wordpress.org/view.php?id=598 git-svn-id: https://develop.svn.wordpress.org/trunk@2319 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 10 +++++++--- wp-admin/theme-editor.php | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 9fe57bd7e8..5c01e7a5d5 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -902,11 +902,15 @@ $wp_file_descriptions = function get_file_description($file) { global $wp_file_descriptions; - if (isset($wp_file_descriptions[$file])) { - return $wp_file_descriptions[$file]; + if ( isset($wp_file_descriptions[basename($file)] ) ) { + return $wp_file_descriptions[basename($file)]; + } else { + $template_data = implode('', file(ABSPATH . $file)); + if ( preg_match("|Template Name:(.*)|i", $template_data, $name) ) + return $name[1]; } - return $file; + return basename( $file ); } function update_recently_edited($file) { diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index f65d91af17..d89376d852 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -100,9 +100,9 @@ default:
' . sprintf(__('Editing %s'), $file) . ''; + echo '

' . sprintf(__('Editing %s'), $file) . '

'; } else { - echo '

' . sprintf(__('Browsing %s'), $file) . '

'; + echo '

' . sprintf(__('Browsing %s'), $file) . '

'; } ?>
@@ -113,7 +113,7 @@ if ($allowed_files) : ?>