<!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>[13487] trunk: Move Admin Colour Scheme picker to a hook.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13487">13487</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-02-28 06:34:31 +0000 (Sun, 28 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move Admin Colour Scheme picker to a hook. Props Jick. s/register_admin_color_themes()/register_admin_color_schemes/g. See <a href="http://trac.wordpress.org/ticket/11625">#11625</a>, Fixes <a href="http://trac.wordpress.org/ticket/6837">#6837</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmiscphp">trunk/wp-admin/includes/misc.php</a></li>
<li><a href="#trunkwpadminusereditphp">trunk/wp-admin/user-edit.php</a></li>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmiscphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/misc.php (13486 => 13487)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/misc.php        2010-02-28 05:59:39 UTC (rev 13486)
+++ trunk/wp-admin/includes/misc.php        2010-02-28 06:34:31 UTC (rev 13487)
</span><span class="lines">@@ -662,4 +662,32 @@
</span><span class="cx"> function send_nosniff_header() {
</span><span class="cx">         @header( 'X-Content-Type-Options: nosniff' ); 
</span><span class="cx"> }
</span><ins>+/**
+ * Display the default admin color scheme picker (Used in user-edit.php)
+ *
+ * @since 3.0
+ */
+function admin_color_scheme_picker() {
+        global $_wp_admin_css_colors, $user_id; ?&gt;
+&lt;fieldset&gt;&lt;legend class=&quot;screen-reader-text&quot;&gt;&lt;span&gt;&lt;?php _e('Admin Color Scheme')?&gt;&lt;/span&gt;&lt;/legend&gt;
+&lt;?php
+$current_color = get_user_option('admin_color', $user_id);
+if ( empty($current_color) )
+        $current_color = 'fresh';
+foreach ( $_wp_admin_css_colors as $color =&gt; $color_info ): ?&gt;
+&lt;div class=&quot;color-option&quot;&gt;&lt;input name=&quot;admin_color&quot; id=&quot;admin_color_&lt;?php echo $color; ?&gt;&quot; type=&quot;radio&quot; value=&quot;&lt;?php echo esc_attr($color) ?&gt;&quot; class=&quot;tog&quot; &lt;?php checked($color, $current_color); ?&gt; /&gt;
+        &lt;table class=&quot;color-palette&quot;&gt;
+        &lt;tr&gt;
+        &lt;?php foreach ( $color_info-&gt;colors as $html_color ): ?&gt;
+        &lt;td style=&quot;background-color: &lt;?php echo $html_color ?&gt;&quot; title=&quot;&lt;?php echo $color ?&gt;&quot;&gt;&amp;nbsp;&lt;/td&gt;
+        &lt;?php endforeach; ?&gt;
+        &lt;/tr&gt;
+        &lt;/table&gt;
+
+        &lt;label for=&quot;admin_color_&lt;?php echo $color; ?&gt;&quot;&gt;&lt;?php echo $color_info-&gt;name ?&gt;&lt;/label&gt;
+&lt;/div&gt;
+        &lt;?php endforeach; ?&gt;
+&lt;/fieldset&gt;
+&lt;?php
+}
</ins><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkwpadminusereditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/user-edit.php (13486 => 13487)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/user-edit.php        2010-02-28 05:59:39 UTC (rev 13486)
+++ trunk/wp-admin/user-edit.php        2010-02-28 06:34:31 UTC (rev 13487)
</span><span class="lines">@@ -184,31 +184,13 @@
</span><span class="cx">                 &lt;td&gt;&lt;label for=&quot;rich_editing&quot;&gt;&lt;input name=&quot;rich_editing&quot; type=&quot;checkbox&quot; id=&quot;rich_editing&quot; value=&quot;false&quot; &lt;?php checked('false', $profileuser-&gt;rich_editing); ?&gt; /&gt; &lt;?php _e('Disable the visual editor when writing'); ?&gt;&lt;/label&gt;&lt;/td&gt;
</span><span class="cx">         &lt;/tr&gt;
</span><span class="cx"> &lt;?php endif; ?&gt;
</span><del>-&lt;?php if ( count($_wp_admin_css_colors) &gt; 1 ) : ?&gt;
</del><ins>+&lt;?php if ( count($_wp_admin_css_colors) &gt; 1 &amp;&amp; has_action('admin_color_scheme_picker') ) : ?&gt;
</ins><span class="cx"> &lt;tr&gt;
</span><span class="cx"> &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Admin Color Scheme')?&gt;&lt;/th&gt;
</span><del>-&lt;td&gt;&lt;fieldset&gt;&lt;legend class=&quot;screen-reader-text&quot;&gt;&lt;span&gt;&lt;?php _e('Admin Color Scheme')?&gt;&lt;/span&gt;&lt;/legend&gt;
-&lt;?php
-$current_color = get_user_option('admin_color', $user_id);
-if ( empty($current_color) )
-        $current_color = 'fresh';
-foreach ( $_wp_admin_css_colors as $color =&gt; $color_info ): ?&gt;
-&lt;div class=&quot;color-option&quot;&gt;&lt;input name=&quot;admin_color&quot; id=&quot;admin_color_&lt;?php echo $color; ?&gt;&quot; type=&quot;radio&quot; value=&quot;&lt;?php echo esc_attr($color) ?&gt;&quot; class=&quot;tog&quot; &lt;?php checked($color, $current_color); ?&gt; /&gt;
-        &lt;table class=&quot;color-palette&quot;&gt;
-        &lt;tr&gt;
-        &lt;?php foreach ( $color_info-&gt;colors as $html_color ): ?&gt;
-        &lt;td style=&quot;background-color: &lt;?php echo $html_color ?&gt;&quot; title=&quot;&lt;?php echo $color ?&gt;&quot;&gt;&amp;nbsp;&lt;/td&gt;
-        &lt;?php endforeach; ?&gt;
-        &lt;/tr&gt;
-        &lt;/table&gt;
-
-        &lt;label for=&quot;admin_color_&lt;?php echo $color; ?&gt;&quot;&gt;&lt;?php echo $color_info-&gt;name ?&gt;&lt;/label&gt;
-&lt;/div&gt;
-        &lt;?php endforeach; ?&gt;
-&lt;/fieldset&gt;&lt;/td&gt;
</del><ins>+&lt;td&gt;&lt;?php do_action( 'admin_color_scheme_picker' ); ?&gt;&lt;/td&gt;
</ins><span class="cx"> &lt;/tr&gt;
</span><span class="cx"> &lt;?php
</span><del>-endif;
</del><ins>+endif; // $_wp_admin_css_colors
</ins><span class="cx"> if ( !( IS_PROFILE_PAGE &amp;&amp; !$user_can_edit ) ) : ?&gt;
</span><span class="cx"> &lt;tr&gt;
</span><span class="cx"> &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Keyboard Shortcuts' ); ?&gt;&lt;/th&gt;
</span></span></pre></div>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (13486 => 13487)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2010-02-28 05:59:39 UTC (rev 13486)
+++ trunk/wp-includes/default-filters.php        2010-02-28 06:34:31 UTC (rev 13487)
</span><span class="lines">@@ -238,5 +238,6 @@
</span><span class="cx"> // Timezone
</span><span class="cx"> add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
</span><span class="cx"> 
</span><del>-// Admin Themes
-add_action('admin_init', 'register_admin_color_themes', 1);
</del><ins>+// Admin Color Schemes
+add_action( 'admin_init', 'register_admin_color_schemes', 1);
+add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
</ins></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (13486 => 13487)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-02-28 05:59:39 UTC (rev 13486)
+++ trunk/wp-includes/general-template.php        2010-02-28 06:34:31 UTC (rev 13487)
</span><span class="lines">@@ -2029,11 +2029,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Registers the default Admin color themes
</del><ins>+ * Registers the default Admin color schemes
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><del>-function register_admin_color_themes() {
</del><ins>+function register_admin_color_schemes() {
</ins><span class="cx">         wp_admin_css_color('classic', __('Blue'), admin_url(&quot;css/colors-classic.css&quot;), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
</span><span class="cx">         wp_admin_css_color('fresh', __('Gray'), admin_url(&quot;css/colors-fresh.css&quot;), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));}
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>