From 5b8037afe64fa2a57b33b769be88c7a00b45f907 Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 29 Mar 2012 04:16:17 +0000 Subject: [PATCH] Always set WP_Theme->template even when there is an error and we have no idea what the template is. (Assume it is the stylesheet.) Prevents a number of issues including WP_Theme->is_child_theme() lying. Tidy the theme editor for broken themes and themes with no templates (PHP files), or no template (parent), or are broken. Allow broken themes to be edited. see #20103. git-svn-id: http://svn.automattic.com/wordpress/trunk@20315 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/theme-editor.php | 13 +++++++++---- wp-includes/class-wp-theme.php | 15 ++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index d464f541c..5f29a408b 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -55,6 +55,8 @@ if ( ! $theme ) wp_die( __( 'The requested theme does not exist.' ) ); $allowed_files = $theme->get_files( 'php', 1 ); +$has_templates = ! empty( $allowed_files ); + $style_files = $theme->get_files( 'css' ); if ( isset( $style_files['style.css'] ) ) { $allowed_files['style.css'] = $style_files['style.css']; @@ -132,7 +134,7 @@ default: (' . $file_show . ')'; ?> @@ -142,14 +144,14 @@ if ( $description != $file_show )
-

display('Name') . ': ' . $description; ?>

+

display('Name'); if ( $description ) echo ': ' . $description; ?>