<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[15175] trunk/wp-admin: Make set_current_screen() taxonomy aware.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15175">15175</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-06-08 15:34:42 +0000 (Tue, 08 Jun 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make set_current_screen() taxonomy aware. Use current_screen when setting up table headers for edit-tags.php. see <a href="http://trac.wordpress.org/ticket/13783">#13783</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminphp">trunk/wp-admin/admin.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin.php (15174 => 15175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin.php        2010-06-08 15:12:15 UTC (rev 15174)
+++ trunk/wp-admin/admin.php        2010-06-08 15:34:42 UTC (rev 15175)
</span><span class="lines">@@ -81,10 +81,15 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> if ( isset($_GET['post_type']) )
</span><del>-        $typenow = sanitize_user($_GET['post_type'], true);
</del><ins>+        $typenow = sanitize_key($_GET['post_type']);
</ins><span class="cx"> else
</span><span class="cx">         $typenow = '';
</span><span class="cx"> 
</span><ins>+if ( isset($_GET['taxonomy']) )
+        $taxnow = sanitize_key($_GET['taxonomy']);
+else
+        $taxnow = '';
+
</ins><span class="cx"> require(ABSPATH . 'wp-admin/menu.php');
</span><span class="cx"> 
</span><span class="cx"> if ( current_user_can( 'manage_options' ) )
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (15174 => 15175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-06-08 15:12:15 UTC (rev 15174)
+++ trunk/wp-admin/edit-tags.php        2010-06-08 15:34:42 UTC (rev 15175)
</span><span class="lines">@@ -296,17 +296,16 @@
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
</span><del>-&lt;?php $table_type = ('category' == $taxonomy ? 'categories' : 'edit-tags'); ?&gt;
</del><span class="cx"> &lt;table class=&quot;widefat tag fixed&quot; cellspacing=&quot;0&quot;&gt;
</span><span class="cx">         &lt;thead&gt;
</span><span class="cx">         &lt;tr&gt;
</span><del>-&lt;?php print_column_headers($table_type); ?&gt;
</del><ins>+&lt;?php print_column_headers($current_screen); ?&gt;
</ins><span class="cx">         &lt;/tr&gt;
</span><span class="cx">         &lt;/thead&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;tfoot&gt;
</span><span class="cx">         &lt;tr&gt;
</span><del>-&lt;?php print_column_headers($table_type, false); ?&gt;
</del><ins>+&lt;?php print_column_headers($current_screen, false); ?&gt;
</ins><span class="cx">         &lt;/tr&gt;
</span><span class="cx">         &lt;/tfoot&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (15174 => 15175)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-06-08 15:12:15 UTC (rev 15174)
+++ trunk/wp-admin/includes/template.php        2010-06-08 15:34:42 UTC (rev 15175)
</span><span class="lines">@@ -396,7 +396,7 @@
</span><span class="cx">  * @return unknown
</span><span class="cx">  */
</span><span class="cx"> function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
</span><del>-                global $post_type;
</del><ins>+                global $post_type, $current_screen;
</ins><span class="cx">                 static $row_class = '';
</span><span class="cx">                 $row_class = ($row_class == '' ? ' class=&quot;alternate&quot;' : '');
</span><span class="cx"> 
</span><span class="lines">@@ -422,8 +422,8 @@
</span><span class="cx">                 $out .= '&lt;tr id=&quot;tag-' . $tag-&gt;term_id . '&quot;' . $row_class . '&gt;';
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                $columns = get_column_headers('edit-tags');
-                $hidden = get_hidden_columns('edit-tags');
</del><ins>+                $columns = get_column_headers($current_screen);
+                $hidden = get_hidden_columns($current_screen);
</ins><span class="cx">                 $default_term = get_option('default_' . $taxonomy);
</span><span class="cx">                 foreach ( $columns as $column_name =&gt; $column_display_name ) {
</span><span class="cx">                         $class = &quot;class=\&quot;$column_name column-$column_name\&quot;&quot;;
</span><span class="lines">@@ -3900,7 +3900,7 @@
</span><span class="cx">  * @param string $id Screen id, optional.
</span><span class="cx">  */
</span><span class="cx"> function set_current_screen( $id =  '' ) {
</span><del>-        global $current_screen, $hook_suffix, $typenow;
</del><ins>+        global $current_screen, $hook_suffix, $typenow, $taxnow;
</ins><span class="cx"> 
</span><span class="cx">         if ( empty($id) ) {
</span><span class="cx">                 $current_screen = $hook_suffix;
</span><span class="lines">@@ -3932,6 +3932,11 @@
</span><span class="cx">                         $typenow = 'post';
</span><span class="cx">                 $current_screen-&gt;id = $typenow;
</span><span class="cx">                 $current_screen-&gt;post_type = $typenow;
</span><ins>+        } elseif ( 'edit-tags' == $current_screen-&gt;id ) {
+                if ( empty($taxnow) )
+                        $taxnow = 'post_tag';
+                $current_screen-&gt;id = 'edit-' . $taxnow;
+                $current_screen-&gt;taxonomy = $taxnow;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $current_screen = apply_filters('current_screen', $current_screen);
</span></span></pre>
</div>
</div>

</body>
</html>