<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20140] trunk/wp-admin: Theme Customizer: Make theme installer no-js compatible.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20140">20140</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2012-03-07 18:24:34 +0000 (Wed, 07 Mar 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Theme Customizer: Make theme installer no-js compatible. Fix JS click handler that caught clicks on the 'Activate' link. Relocate display_theme() to WP_Theme_Install_List_Table-&gt;single_row(). see <a href="http://core.trac.wordpress.org/ticket/19910">#19910</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesclasswpthemeinstalllisttablephp">trunk/wp-admin/includes/class-wp-theme-install-list-table.php</a></li>
<li><a href="#trunkwpadminincludesthemeinstallphp">trunk/wp-admin/includes/theme-install.php</a></li>
<li><a href="#trunkwpadminjsthemedevjs">trunk/wp-admin/js/theme.dev.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20139 => 20140)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-03-07 17:45:21 UTC (rev 20139)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-03-07 18:24:34 UTC (rev 20140)
</span><span class="lines">@@ -5366,10 +5366,17 @@
</span><span class="cx">         display: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#theme-installer.single-theme {
+        display: block;
+}
+
</ins><span class="cx"> .install-theme-info {
</span><span class="cx">         display: none;
</span><span class="cx">         padding: 45px 20px 15px;
</span><span class="cx"> }
</span><ins>+.single-theme .install-theme-info {
+        padding-top: 15px;
+}
</ins><span class="cx"> 
</span><span class="cx"> #theme-installer .install-theme-info {
</span><span class="cx">         display: block;
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpthemeinstalllisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-theme-install-list-table.php (20139 => 20140)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-theme-install-list-table.php        2012-03-07 17:45:21 UTC (rev 20139)
+++ trunk/wp-admin/includes/class-wp-theme-install-list-table.php        2012-03-07 18:24:34 UTC (rev 20140)
</span><span class="lines">@@ -151,15 +151,71 @@
</span><span class="cx">                 $theme_names = array_keys( $themes );
</span><span class="cx"> 
</span><span class="cx">                 foreach ( $theme_names as $theme_name ) {
</span><del>-                                $class = array( 'available-theme' );
</del><span class="cx">                                 ?&gt;
</span><del>-                                &lt;div class=&quot;&lt;?php echo join( ' ', $class ); ?&gt;&quot;&gt;&lt;?php
</del><ins>+                                &lt;div class=&quot;available-theme installable-theme&quot;&gt;&lt;?php
</ins><span class="cx">                                         if ( isset( $themes[$theme_name] ) )
</span><span class="cx">                                                 display_theme( $themes[$theme_name] );
</span><span class="cx">                                 ?&gt;&lt;/div&gt;
</span><span class="cx">                 &lt;?php } // end foreach $theme_names
</span><span class="cx"> 
</span><ins>+                $this-&gt;theme_installer();
+        }
+
+
+
+        /*
+         * Prints a theme from the WordPress.org API.
+         *
+         * @param object $theme An object that contains theme data returned by the WordPress.org API.
+         *
+         * Example theme data:
+         *   object(stdClass)[59]
+         *     public 'name' =&gt; string 'Magazine Basic' (length=14)
+         *     public 'slug' =&gt; string 'magazine-basic' (length=14)
+         *     public 'version' =&gt; string '1.1' (length=3)
+         *     public 'author' =&gt; string 'tinkerpriest' (length=12)
+         *     public 'preview_url' =&gt; string 'http://wp-themes.com/?magazine-basic' (length=36)
+         *     public 'screenshot_url' =&gt; string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
+         *     public 'rating' =&gt; float 80
+         *     public 'num_ratings' =&gt; int 1
+         *     public 'homepage' =&gt; string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
+         *     public 'description' =&gt; string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by &lt;a href=&quot;http://bavotasan.com&quot;&gt;c.bavota&lt;/a&gt; of &lt;a href=&quot;http://tinkerpriestmedia.com&quot;&gt;Tinker Priest Media&lt;/a&gt;.' (length=214)
+         *     public 'download_link' =&gt; string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
+         */
+        function single_row( $theme ) {
+                global $themes_allowedtags;
+
+                if ( empty( $theme ) )
+                        return;
+
+                $name   = wp_kses( $theme-&gt;name,   $themes_allowedtags );
+                $author = wp_kses( $theme-&gt;author, $themes_allowedtags );
+
+                $preview_title = sprintf( __('Preview &amp;#8220;%s&amp;#8221;'), $name );
+                $preview_url   = add_query_arg( array(
+                        'tab'   =&gt; 'theme-information',
+                        'theme' =&gt; $theme-&gt;slug,
+                ) );
+
</ins><span class="cx">                 ?&gt;
</span><ins>+                &lt;a class=&quot;screenshot&quot; href=&quot;&lt;?php echo esc_url( $preview_url ); ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( $preview_title ); ?&gt;&quot;&gt;
+                        &lt;img src='&lt;?php echo esc_url( $theme-&gt;screenshot_url ); ?&gt;' width='150' /&gt;
+                &lt;/a&gt;
+
+                &lt;h3&gt;&lt;?php
+                        /* translators: 1: theme name, 2: author name */
+                        printf( __( '%1$s &lt;span&gt;by %2$s&lt;/span&gt;' ), $name, $author );
+                ?&gt;&lt;/h3&gt;
+
+                &lt;?php
+                $this-&gt;install_theme_info( $theme );
+        }
+
+        /*
+         * Prints the wrapper for the theme installer.
+         */
+        function theme_installer() {
+                ?&gt;
</ins><span class="cx">                 &lt;div id=&quot;theme-installer&quot; class=&quot;wp-full-overlay&quot;&gt;
</span><span class="cx">                         &lt;a href=&quot;#&quot; class=&quot;close-full-overlay&quot;&gt;&lt;?php printf( __( '&amp;larr; Return to %s' ), get_admin_page_title() ); ?&gt;&lt;/a&gt;
</span><span class="cx">                         &lt;a href=&quot;#&quot; class=&quot;collapse-sidebar button-secondary&quot; title=&quot;&lt;?php esc_attr_e('Collapse Sidebar'); ?&gt;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;
</span><span class="lines">@@ -172,6 +228,73 @@
</span><span class="cx">                 &lt;?php
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /*
+         * Prints the wrapper for the theme installer with a provided theme's data.
+         * Used to make the theme installer work for no-js.
+         *
+         * @param object $theme - A WordPress.org Theme API object.
+         */
+        function theme_installer_single( $theme ) {
+                $class = 'wp-full-overlay';
+                if ( $theme )
+                        $class .= ' single-theme';
+
+                ?&gt;
+                &lt;div id=&quot;theme-installer&quot; class=&quot;wp-full-overlay single-theme&quot;&gt;
+                        &lt;div class=&quot;wp-full-overlay-sidebar&quot;&gt;
+                                &lt;?php $this-&gt;install_theme_info( $theme ); ?&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;wp-full-overlay-main&quot;&gt;
+                                &lt;iframe src=&quot;&lt;?php echo esc_url( $theme-&gt;preview_url ); ?&gt;&quot;&gt;&lt;/iframe&gt;
+                        &lt;/div&gt;
+                &lt;/div&gt;
+                &lt;?php
+        }
+
+        /*
+         * Prints the info for a theme (to be used in the theme installer modal).
+         *
+         * @param object $theme - A WordPress.org Theme API object.
+         */
+        function install_theme_info( $theme ) {
+                global $themes_allowedtags;
+
+                if ( empty( $theme ) )
+                        return;
+
+                $name   = wp_kses( $theme-&gt;name,   $themes_allowedtags );
+                $author = wp_kses( $theme-&gt;author, $themes_allowedtags );
+
+                $num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme-&gt;num_ratings ), number_format_i18n( $theme-&gt;num_ratings ) );
+
+                $install_url = add_query_arg( array(
+                        'action' =&gt; 'install-theme',
+                        'theme'  =&gt; $theme-&gt;slug,
+                ), self_admin_url( 'update.php' ) );
+
+                ?&gt;
+                &lt;div class=&quot;install-theme-info&quot;&gt;
+                        &lt;a class=&quot;theme-install button-primary&quot; href=&quot;&lt;?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme-&gt;slug ); ?&gt;&quot;&gt;&lt;?php _e( 'Install' ); ?&gt;&lt;/a&gt;
+                        &lt;h3 class=&quot;theme-name&quot;&gt;&lt;?php echo $name; ?&gt;&lt;/h3&gt;
+                        &lt;span class=&quot;theme-by&quot;&gt;&lt;?php printf( __( 'By %s' ), $author ); ?&gt;&lt;/span&gt;
+                        &lt;?php if ( isset( $theme-&gt;screenshot_url ) ): ?&gt;
+                                &lt;img class=&quot;theme-screenshot&quot; src=&quot;&lt;?php echo esc_url( $theme-&gt;screenshot_url ); ?&gt;&quot; /&gt;
+                        &lt;?php endif; ?&gt;
+                        &lt;div class=&quot;theme-rating&quot; title=&quot;&lt;?php echo esc_attr( $num_ratings ); ?&gt;&quot;&gt;
+                                &lt;div style=&quot;width:&lt;?php echo esc_attr( intval( $theme-&gt;rating ) . 'px' ); ?&gt;;&quot;&gt;&lt;/div&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;theme-version&quot;&gt;
+                                &lt;strong&gt;&lt;?php _e('Version:') ?&gt; &lt;/strong&gt;
+                                &lt;?php echo wp_kses( $theme-&gt;version, $themes_allowedtags ); ?&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;theme-description&quot;&gt;
+                                &lt;?php echo wp_kses( $theme-&gt;description, $themes_allowedtags ); ?&gt;
+                        &lt;/div&gt;
+                        &lt;input class=&quot;theme-preview-url&quot; type=&quot;hidden&quot; value=&quot;&lt;?php echo esc_url( $theme-&gt;preview_url ); ?&gt;&quot; /&gt;
+                &lt;/div&gt;
+                &lt;?php
+        }
+
</ins><span class="cx">         /**
</span><span class="cx">          * Send required variables to JavaScript land
</span><span class="cx">          *
</span></span></pre></div>
<a id="trunkwpadminincludesthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme-install.php (20139 => 20140)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme-install.php        2012-03-07 17:45:21 UTC (rev 20139)
+++ trunk/wp-admin/includes/theme-install.php        2012-03-07 18:24:34 UTC (rev 20140)
</span><span class="lines">@@ -131,68 +131,11 @@
</span><span class="cx">  * Prints a theme on the Install Themes pages.
</span><span class="cx">  *
</span><span class="cx">  * @param object $theme An object that contains theme data returned by the WordPress.org API.
</span><del>- *
- * Example theme data:
- *   object(stdClass)[59]
- *     public 'name' =&gt; string 'Magazine Basic' (length=14)
- *     public 'slug' =&gt; string 'magazine-basic' (length=14)
- *     public 'version' =&gt; string '1.1' (length=3)
- *     public 'author' =&gt; string 'tinkerpriest' (length=12)
- *     public 'preview_url' =&gt; string 'http://wp-themes.com/?magazine-basic' (length=36)
- *     public 'screenshot_url' =&gt; string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
- *     public 'rating' =&gt; float 80
- *     public 'num_ratings' =&gt; int 1
- *     public 'homepage' =&gt; string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
- *     public 'description' =&gt; string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by &lt;a href=&quot;http://bavotasan.com&quot;&gt;c.bavota&lt;/a&gt; of &lt;a href=&quot;http://tinkerpriestmedia.com&quot;&gt;Tinker Priest Media&lt;/a&gt;.' (length=214)
- *     public 'download_link' =&gt; string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
</del><span class="cx">  */
</span><span class="cx"> function display_theme( $theme ) {
</span><del>-        global $themes_allowedtags;
</del><ins>+        global $wp_list_table;
</ins><span class="cx"> 
</span><del>-        if ( empty( $theme ) )
-                return;
-
-        $name   = wp_kses( $theme-&gt;name,   $themes_allowedtags );
-        $author = wp_kses( $theme-&gt;author, $themes_allowedtags );
-
-        $num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme-&gt;num_ratings ), number_format_i18n( $theme-&gt;num_ratings ) );
-
-        $preview_url   = add_query_arg( 'theme_preview', '1' );
-        $preview_title = sprintf( __('Preview &amp;#8220;%s&amp;#8221;'), $name );
-
-        $install_url = add_query_arg( array(
-                'action' =&gt; 'install-theme',
-                'theme'  =&gt; $theme-&gt;slug,
-        ), self_admin_url( 'update.php' ) );
-
-        ?&gt;
-        &lt;a class=&quot;screenshot&quot; href=&quot;&lt;?php echo esc_url( $preview_url ); ?&gt;&quot; title=&quot;&lt;?php echo esc_attr( $preview_title ); ?&gt;&quot;&gt;
-                &lt;img src='&lt;?php echo esc_url( $theme-&gt;screenshot_url ); ?&gt;' width='150' /&gt;
-        &lt;/a&gt;
-
-        &lt;h3&gt;&lt;?php
-                /* translators: 1: theme name, 2: author name */
-                printf( __( '%1$s &lt;span&gt;by %2$s&lt;/span&gt;' ), $name, $author );
-        ?&gt;&lt;/h3&gt;
-
-        &lt;div class=&quot;install-theme-info&quot;&gt;
-                &lt;a class=&quot;theme-install button-primary&quot; href=&quot;&lt;?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme-&gt;slug ); ?&gt;&quot;&gt;&lt;?php _e( 'Install' ); ?&gt;&lt;/a&gt;
-                &lt;h3 class=&quot;theme-name&quot;&gt;&lt;?php echo $name; ?&gt;&lt;/h3&gt;
-                &lt;span class=&quot;theme-by&quot;&gt;&lt;?php printf( __( 'By %s' ), $author ); ?&gt;&lt;/span&gt;
-                &lt;img class=&quot;theme-screenshot&quot; src=&quot;&lt;?php echo esc_url( $theme-&gt;screenshot_url ); ?&gt;&quot; /&gt;
-                &lt;div class=&quot;theme-rating&quot; title=&quot;&lt;?php echo esc_attr( $num_ratings ); ?&gt;&quot;&gt;
-                        &lt;div style=&quot;width:&lt;?php echo esc_attr( intval( $theme-&gt;rating ) . 'px' ); ?&gt;;&quot;&gt;&lt;/div&gt;
-                &lt;/div&gt;
-                &lt;div class=&quot;theme-version&quot;&gt;
-                        &lt;strong&gt;&lt;?php _e('Version:') ?&gt; &lt;/strong&gt;
-                        &lt;?php echo wp_kses( $theme-&gt;version, $themes_allowedtags ); ?&gt;
-                &lt;/div&gt;
-                &lt;div class=&quot;theme-description&quot;&gt;
-                        &lt;?php echo wp_kses( $theme-&gt;description, $themes_allowedtags ); ?&gt;
-                &lt;/div&gt;
-                &lt;input class=&quot;theme-preview-url&quot; type=&quot;hidden&quot; value=&quot;&lt;?php echo esc_url( $theme-&gt;preview_url ); ?&gt;&quot; /&gt;
-        &lt;/div&gt;
-        &lt;?php
</del><ins>+        return $wp_list_table-&gt;single_row( $theme );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -216,104 +159,13 @@
</span><span class="cx">  * @since 2.8.0
</span><span class="cx">  */
</span><span class="cx"> function install_theme_information() {
</span><del>-        //TODO: This function needs a LOT of UI work :)
-        global $tab, $themes_allowedtags;
</del><ins>+        global $tab, $themes_allowedtags, $wp_list_table;
</ins><span class="cx"> 
</span><del>-        $api = themes_api('theme_information', array('slug' =&gt; stripslashes( $_REQUEST['theme'] ) ));
</del><ins>+        $theme = themes_api( 'theme_information', array( 'slug' =&gt; stripslashes( $_REQUEST['theme'] ) ) );
</ins><span class="cx"> 
</span><del>-        if ( is_wp_error($api) )
-                wp_die($api);
</del><ins>+        if ( is_wp_error( $theme ) )
+                wp_die( $theme );
</ins><span class="cx"> 
</span><del>-        // Sanitize HTML
-        foreach ( (array)$api-&gt;sections as $section_name =&gt; $content )
-                $api-&gt;sections[$section_name] = wp_kses($content, $themes_allowedtags);
-
-        foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key ) {
-                if ( isset($api-&gt;$key) )
-                        $api-&gt;$key = wp_kses($api-&gt;$key, $themes_allowedtags);
-        }
-
-        iframe_header( __('Theme Install') );
-
-        if ( empty($api-&gt;download_link) ) {
-                echo '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('&lt;strong&gt;ERROR:&lt;/strong&gt; This theme is currently not available. Please try again later.') . '&lt;/p&gt;&lt;/div&gt;';
-                iframe_footer();
-                exit;
-        }
-
-        if ( !empty($api-&gt;tested) &amp;&amp; version_compare($GLOBALS['wp_version'], $api-&gt;tested, '&gt;') )
-                echo '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('&lt;strong&gt;Warning:&lt;/strong&gt; This theme has &lt;strong&gt;not been tested&lt;/strong&gt; with your current version of WordPress.') . '&lt;/p&gt;&lt;/div&gt;';
-        else if ( !empty($api-&gt;requires) &amp;&amp; version_compare($GLOBALS['wp_version'], $api-&gt;requires, '&lt;') )
-                echo '&lt;div class=&quot;updated&quot;&gt;&lt;p&gt;' . __('&lt;strong&gt;Warning:&lt;/strong&gt; This theme has not been marked as &lt;strong&gt;compatible&lt;/strong&gt; with your version of WordPress.') . '&lt;/p&gt;&lt;/div&gt;';
-
-        // Default to a &quot;new&quot; theme
-        $type = 'install';
-        // Check to see if this theme is known to be installed, and has an update awaiting it.
-        $update_themes = get_site_transient('update_themes');
-        if ( is_object($update_themes) &amp;&amp; isset($update_themes-&gt;response) ) {
-                foreach ( (array)$update_themes-&gt;response as $theme_slug =&gt; $theme_info ) {
-                        if ( $theme_slug === $api-&gt;slug ) {
-                                $type = 'update_available';
-                                $update_file = $theme_slug;
-                                break;
-                        }
-                }
-        }
-
-        $theme = wp_get_theme( $api-&gt;slug );
-        if ( is_a( $theme, 'WP_Theme' ) ) {
-                switch ( version_compare( $theme-&gt;get('Version'), $api-&gt;version ) ) {
-                        case 0; // equal
-                                $type = 'latest_installed';
-                        case 1: // installed theme &gt; api version
-                                $type = 'newer_installed';
-                                $newer_version = $theme-&gt;get('Version');
-                }
-        }
-?&gt;
-
-&lt;div class='available-theme'&gt;
-&lt;img src='&lt;?php echo esc_url($api-&gt;screenshot_url) ?&gt;' width='300' class=&quot;theme-preview-img&quot; /&gt;
-&lt;h3&gt;&lt;?php echo $api-&gt;name; ?&gt;&lt;/h3&gt;
-&lt;p&gt;&lt;?php printf(__('by %s'), $api-&gt;author); ?&gt;&lt;/p&gt;
-&lt;p&gt;&lt;?php printf(__('Version: %s'), $api-&gt;version); ?&gt;&lt;/p&gt;
-
-&lt;?php
-$buttons = '&lt;a class=&quot;button&quot; id=&quot;cancel&quot; href=&quot;#&quot; onclick=&quot;tb_close();return false;&quot;&gt;' . __('Cancel') . '&lt;/a&gt; ';
-
-switch ( $type ) {
-default:
-case 'install':
-        if ( current_user_can('install_themes') ) :
-        $buttons .= '&lt;a class=&quot;button-primary&quot; id=&quot;install&quot; href=&quot;' . wp_nonce_url(self_admin_url('update.php?action=install-theme&amp;theme=' . $api-&gt;slug), 'install-theme_' . $api-&gt;slug) . '&quot; target=&quot;_parent&quot;&gt;' . __('Install Now') . '&lt;/a&gt;';
-        endif;
-        break;
-case 'update_available':
-        if ( current_user_can('update_themes') ) :
-        $buttons .= '&lt;a class=&quot;button-primary&quot; id=&quot;install&quot;        href=&quot;' . wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&amp;theme=' . $update_file), 'upgrade-theme_' . $update_file) . '&quot; target=&quot;_parent&quot;&gt;' . __('Install Update Now') . '&lt;/a&gt;';
-        endif;
-        break;
-case 'newer_installed':
-        if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
-        ?&gt;&lt;p&gt;&lt;?php printf(__('Newer version (%s) is installed.'), $newer_version); ?&gt;&lt;/p&gt;&lt;?php
-        endif;
-        break;
-case 'latest_installed':
-        if ( current_user_can('install_themes') || current_user_can('update_themes') ) :
-        ?&gt;&lt;p&gt;&lt;?php _e('This version is already installed.'); ?&gt;&lt;/p&gt;&lt;?php
-        endif;
-        break;
-} ?&gt;
-&lt;br class=&quot;clear&quot; /&gt;
-&lt;/div&gt;
-
-&lt;p class=&quot;action-button&quot;&gt;
-&lt;?php echo $buttons; ?&gt;
-&lt;br class=&quot;clear&quot; /&gt;
-&lt;/p&gt;
-
-&lt;?php
-        iframe_footer();
-        exit;
</del><ins>+        $wp_list_table-&gt;theme_installer_single( $theme );
</ins><span class="cx"> }
</span><span class="cx"> add_action('install_themes_pre_theme-information', 'install_theme_information');
</span></span></pre></div>
<a id="trunkwpadminjsthemedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/theme.dev.js (20139 => 20140)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/theme.dev.js        2012-03-07 17:45:21 UTC (rev 20139)
+++ trunk/wp-admin/js/theme.dev.js        2012-03-07 18:24:34 UTC (rev 20140)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">                 event.preventDefault();
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-        $('#availablethemes').on( 'click', '.available-theme', function( event ) {
</del><ins>+        $('#availablethemes').on( 'click', '.installable-theme', function( event ) {
</ins><span class="cx">                 var src;
</span><span class="cx"> 
</span><span class="cx">                 info.html( $(this).find('.install-theme-info').html() );
</span></span></pre>
</div>
</div>

</body>
</html>