From 6f5c3fb7cf958736f3d73c8809d669708cfb605c Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 20 Oct 2009 16:11:59 +0000 Subject: [PATCH] Start roughing in GUU. see #10973 git-svn-id: http://svn.automattic.com/wordpress/trunk@12066 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/update.php | 30 +++++++++++++++ wp-admin/update-core.php | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index cbb06ac12..0d0e6604d 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -145,6 +145,20 @@ function update_right_now_message() { echo "$msg"; } +function get_plugin_updates() { + $all_plugins = get_plugins(); + $upgrade_plugins = array(); + $current = get_transient( 'update_plugins' ); + foreach ( (array)$all_plugins as $plugin_file => $plugin_data) { + if ( isset( $current->response[ $plugin_file ] ) ) { + $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; + $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; + } + } + + return $upgrade_plugins; +} + function wp_plugin_update_rows() { $plugins = get_transient( 'update_plugins' ); if ( isset($plugins->response) && is_array($plugins->response) ) { @@ -191,6 +205,22 @@ function wp_update_plugin($plugin, $feedback = '') { return $upgrader->upgrade($plugin); } +function get_theme_updates() { + $themes = get_themes(); + $current = get_transient('update_themes'); + $update_themes = array(); + + foreach ( $themes as $theme ) { + $theme = (object) $theme; + if ( isset($current->response[ $theme->Stylesheet ]) ) { + $update_themes[$theme->Stylesheet] = $theme; + $update_themes[$theme->Stylesheet]->update = $current->response[ $theme->Stylesheet ]; + } + } + + return $update_themes; +} + function wp_update_theme($theme, $feedback = '') { if ( !empty($feedback) ) diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 5bd44c7a9..9470a9a09 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -127,8 +127,80 @@ function core_upgrade_preamble() { echo ''; dismissed_updates(); echo ''; + + list_plugin_updates(); + list_theme_updates(); } +function list_plugin_updates() { + $plugins = get_plugin_updates(); + if ( empty($plugins) ) + return; +?> +

+ + + + + + + + + + + + + + + + $plugin_data) { + echo " + + + + "; + } +?> + +
{$plugin_data->Name}
+ +

+ + + + + + + + + + + + + + + + $theme_data) { + echo " + + + + "; + } +?> + +
{$theme_data->Name}
+