diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index 64a1ea7cca..4cf1c16419 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -203,7 +203,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { break; case 'latest_installed': case 'newer_installed': - $action_links[] = '' . __( 'Installed' ) . ''; + $action_links[] = '' . _x( 'Installed', 'plugin' ) . ''; break; } } diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php index 842a8ffc6d..be846991a8 100644 --- a/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/wp-admin/includes/class-wp-theme-install-list-table.php @@ -198,7 +198,27 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { 'action' => 'install-theme', 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); - $actions[] = '' . __( 'Install Now' ) . ''; + + $update_url = add_query_arg( array( + 'action' => 'upgrade-theme', + 'theme' => $theme->slug, + ), self_admin_url( 'update.php' ) ); + + $status = $this->_get_theme_status( $theme ); + + switch ( $status ) { + default: + case 'install': + $actions[] = '' . __( 'Install Now' ) . ''; + break; + case 'update_available': + $actions[] = '' . __( 'Update' ) . ''; + break; + case 'newer_installed': + case 'latest_installed': + $actions[] = '' . _x( 'Installed', 'theme' ) . ''; + break; + } $actions[] = '' . __( 'Preview' ) . ''; @@ -290,9 +310,28 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { 'theme' => $theme->slug, ), self_admin_url( 'update.php' ) ); + $update_url = add_query_arg( array( + 'action' => 'upgrade-theme', + 'theme' => $theme->slug, + ), self_admin_url( 'update.php' ) ); + + $status = $this->_get_theme_status( $theme ); + ?> -
- +
slug ) ) . '">' . __( 'Install' ) . ''; + break; + case 'update_available': + echo '' . __( 'Update' ) . ''; + break; + case 'newer_installed': + case 'latest_installed': + echo '' . _x( 'Installed', 'theme' ) . ''; + break; + } ?>

screenshot_url ) ): ?> @@ -328,4 +367,29 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { global $tab, $type; parent::_js_vars( compact( 'tab', 'type' ) ); } + + /** + * Check to see if the theme is already installed. + * + * @since 3.4 + * @access private + * + * @param object $theme - A WordPress.org Theme API object. + * @return string Theme status. + */ + private function _get_theme_status( $theme ) { + $status = 'install'; + + $installed_theme = wp_get_theme( $theme->slug ); + if ( $installed_theme->exists() ) { + if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) + $status = 'latest_installed'; + elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) + $status = 'newer_installed'; + else + $status = 'update_available'; + } + + return $status; + } }