From e3acc800f824589af5fe31b8ea58bc93e33129e2 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 13 Apr 2009 16:24:37 +0000 Subject: [PATCH] Theme insall cleanups. Props DD32. fixes #9508 git-svn-id: http://svn.automattic.com/wordpress/trunk@10923 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/theme-install.php | 30 ++++++++++++++--------------- wp-admin/themes.php | 7 ++++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index a3751d4429..ea52789d38 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -97,6 +97,8 @@ add_action('install_themes_search', 'install_theme_search', 10, 1); * @param string $page */ function install_theme_search($page) { + global $theme_field_defaults; + $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; @@ -398,16 +400,12 @@ function display_themes($themes, $page = 1, $totalpages = 1) { ?> $cols ) { ?> @@ -419,10 +417,10 @@ function display_themes($themes, $page = 1, $totalpages = 1) { if ( $col == 1 ) $class[] = 'left'; if ( $row == $rows ) $class[] = 'bottom'; if ( $col == 3 ) $class[] = 'right'; - $theme = $themes[$theme_index]; ?> @@ -467,20 +465,20 @@ function install_theme_information() { exit; } - if ( version_compare($GLOBALS['wp_version'], $api->tested, '>') ) + if ( !empty($api->tested) && version_compare($GLOBALS['wp_version'], $api->tested, '>') ) echo '

' . __('Warning: This theme has not been tested with your current version of WordPress.') . '

'; - else if ( version_compare($GLOBALS['wp_version'], $api->requires, '<') ) + else if ( !empty($api->requires) && version_compare($GLOBALS['wp_version'], $api->requires, '<') ) echo '

' . __('Warning: This theme has not been marked as compatible with your version of WordPress.') . '

'; // Default to a "new" theme $type = 'install'; // Check to see if this theme is known to be installed, and has an update awaiting it. $update_themes = get_transient('update_themes'); - if ( is_object($update_themes) ) { - foreach ( (array)$update_themes->response as $file => $theme ) { - if ( $theme->slug === $api->slug ) { + if ( is_object($update_themes) && isset($update_themes->response) ) { + foreach ( (array)$update_themes->response as $theme_slug => $theme_info ) { + if ( $theme_slug === $api->slug ) { $type = 'update_available'; - $update_file = $file; + $update_file = $theme_slug; break; } } diff --git a/wp-admin/themes.php b/wp-admin/themes.php index ebf601d390..2e2f5efdc0 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -93,15 +93,16 @@ function theme_update_available( $theme ) { if ( isset($themes_update->response[ $stylesheet ]) ) { $update = $themes_update->response[ $stylesheet ]; + $theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : ''); $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list. $update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet); if ( ! current_user_can('update_themes') ) - printf( __('

There is a new version of %1$s available. View version %3$s Details.

'), $ct->name, $details_url, $update['new_version']); + printf( __('

There is a new version of %1$s available. View version %3$s Details.

'), $theme_name, $details_url, $update['new_version']); else if ( empty($update->package) ) - printf( __('

There is a new version of %1$s available. View version %3$s Details automatic upgrade unavailable for this theme.

'), $ct->name, $details_url, $update['new_version']); + printf( __('

There is a new version of %1$s available. View version %3$s Details automatic upgrade unavailable for this theme.

'), $theme_name, $details_url, $update['new_version']); else - printf( __('

There is a new version of %1$s available. View version %3$s Details or upgrade automatically.

'), $ct->name, $details_url, $update['new_version'], $update_url ); + printf( __('

There is a new version of %1$s available. View version %3$s Details or upgrade automatically.

'), $theme_name, $details_url, $update['new_version'], $update_url ); } }