<!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>[20151] trunk/wp-admin: In multisite, list broken themes on network/themes.php instead of on individual Manage Themes pages.</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/20151">20151</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-03-08 07:32:42 +0000 (Thu, 08 Mar 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>In multisite, list broken themes on network/themes.php instead of on individual Manage Themes pages. see <a href="http://core.trac.wordpress.org/ticket/20103">#20103</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpmsthemeslisttablephp">trunk/wp-admin/includes/class-wp-ms-themes-list-table.php</a></li>
<li><a href="#trunkwpadminnetworkthemesphp">trunk/wp-admin/network/themes.php</a></li>
<li><a href="#trunkwpadminthemesphp">trunk/wp-admin/themes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpmsthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-ms-themes-list-table.php (20150 => 20151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-03-08 07:00:38 UTC (rev 20150)
+++ trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-03-08 07:32:42 UTC (rev 20151)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">                 global $status, $page;
</span><span class="cx">
</span><span class="cx">                 $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
</span><del>-                if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search' ) ) )
</del><ins>+                if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) )
</ins><span class="cx">                         $status = 'all';
</span><span class="cx">
</span><span class="cx">                 $page = $this->get_pagenum();
</span><span class="lines">@@ -59,7 +59,8 @@
</span><span class="cx">                         'search' => array(),
</span><span class="cx">                         'enabled' => array(),
</span><span class="cx">                         'disabled' => array(),
</span><del>-                        'upgrade' => array()
</del><ins>+                        'upgrade' => array(),
+                        'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ),
</ins><span class="cx">                 );
</span><span class="cx">
</span><span class="cx">                 if ( $this->is_site_themes ) {
</span><span class="lines">@@ -70,7 +71,7 @@
</span><span class="cx">                         $allowed_where = 'network';
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $current = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' );
</del><ins>+                $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' );
</ins><span class="cx">
</span><span class="cx">                 foreach ( (array) $themes['all'] as $key => $theme ) {
</span><span class="cx">                         if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) {
</span><span class="lines">@@ -81,7 +82,7 @@
</span><span class="cx">                         $filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled';
</span><span class="cx">                         $themes[ $filter ][ $key ] = $themes['all'][ $key ];
</span><span class="cx">
</span><del>-                        if ( $current && isset( $current->response[ $key ] ) )
</del><ins>+                        if ( $maybe_update && isset( $current->response[ $key ] ) )
</ins><span class="cx">                                 $themes['upgrade'][ $key ] = $themes['all'][ $key ];
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -206,6 +207,9 @@
</span><span class="cx">                                 case 'upgrade':
</span><span class="cx">                                         $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
</span><span class="cx">                                         break;
</span><ins>+                                case 'broken' :
+                                        $text = _n( 'Broken <span class="count">(%s)</span>', 'Broken <span class="count">(%s)</span>', $count );
+                                        break;
</ins><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         if ( $this->is_site_themes )
</span><span class="lines">@@ -297,8 +301,6 @@
</span><span class="cx">                 $checkbox_id = "checkbox_" . md5( $theme->get('Name') );
</span><span class="cx">                 $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $theme_key ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";
</span><span class="cx">
</span><del>-                $description = '<p>' . $theme->display( 'Description' ) . '</p>';
-
</del><span class="cx">                 $id = sanitize_html_class( $theme->get_stylesheet() );
</span><span class="cx">
</span><span class="cx">                 echo "<tr id='$id' class='$class'>";
</span><span class="lines">@@ -320,8 +322,10 @@
</span><span class="cx">                                         echo "</td>";
</span><span class="cx">                                         break;
</span><span class="cx">                                 case 'description':
</span><del>-                                        echo "<td class='column-description desc'$style>
-                                                <div class='theme-description'>" . $theme->display( 'Description' ) . "</div>
</del><ins>+                                        echo "<td class='column-description desc'$style>";
+                                        if ( $theme->errors() )
+                                                echo '<p><strong>' . $theme->errors()->get_error_message() . '</strong></p>';
+                                        echo "<div class='theme-description'><p>" . $theme->display( 'Description' ) . "</p></div>
</ins><span class="cx">                                                 <div class='$class second theme-version-author-uri'>";
</span><span class="cx">
</span><span class="cx">                                         $theme_meta = array();
</span></span></pre></div>
<a id="trunkwpadminnetworkthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/themes.php (20150 => 20151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/themes.php        2012-03-08 07:00:38 UTC (rev 20150)
+++ trunk/wp-admin/network/themes.php        2012-03-08 07:32:42 UTC (rev 20151)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">                         check_admin_referer('enable-theme_' . $_GET['theme']);
</span><span class="cx">                         $allowed_themes[ $_GET['theme'] ] = true;
</span><span class="cx">                         update_site_option( 'allowedthemes', $allowed_themes );
</span><del>-                        wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
</del><ins>+                        wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
</ins><span class="cx">                         exit;
</span><span class="cx">                         break;
</span><span class="cx">                 case 'disable':
</span><span class="lines">@@ -244,8 +244,13 @@
</span><span class="cx"> <?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
</span><span class="cx"> </form>
</span><span class="cx">
</span><del>-<?php $wp_list_table->views(); ?>
</del><ins>+<?php
+$wp_list_table->views();
</ins><span class="cx">
</span><ins>+if ( 'broken' == $status )
+        echo '<p class="clear">' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '</p>';
+?>
+
</ins><span class="cx"> <form method="post" action="">
</span><span class="cx"> <input type="hidden" name="theme_status" value="<?php echo esc_attr($status) ?>" />
</span><span class="cx"> <input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
</span></span></pre></div>
<a id="trunkwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/themes.php (20150 => 20151)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/themes.php        2012-03-08 07:00:38 UTC (rev 20150)
+++ trunk/wp-admin/themes.php        2012-03-08 07:32:42 UTC (rev 20151)
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx">
</span><span class="cx"> <?php
</span><span class="cx"> // List broken themes, if any.
</span><del>-if ( current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
</del><ins>+if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
</ins><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx"> <h3><?php _e('Broken Themes'); ?></h3>
</span></span></pre>
</div>
</div>
</body>
</html>