Friendlier file names in theme editor - http://mosquito.wordpress.org/view.php?id=598

git-svn-id: http://svn.automattic.com/wordpress/trunk@2319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2005-02-14 04:24:25 +00:00
parent f46f90427d
commit df3a83a5fb
2 changed files with 10 additions and 6 deletions

View File

@ -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) {

View File

@ -100,9 +100,9 @@ default:
<div class="wrap">
<?php
if (is_writeable($real_file)) {
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file) . '</h2>';
} else {
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file) . '</h2>';
echo '<h2>' . sprintf(__('Browsing <code>%s</code>'), $file) . '</h2>';
}
?>
<div id="templateside">
@ -113,7 +113,7 @@ if ($allowed_files) :
?>
<ul>
<?php foreach($allowed_files as $allowed_file) : ?>
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description(basename($allowed_file)); ?></a></li>
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>