<!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>[12911] trunk/wp-admin/ms-options.php: Fix PHP Notices: Use checked()
  template function &amp; initialise variables.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12911">12911</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-01-31 12:23:50 +0000 (Sun, 31 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix PHP Notices: Use checked() template function &amp; initialise variables. s/WP/WordPress/ &amp; some code formatting. See <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmsoptionsphp">trunk/wp-admin/ms-options.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmsoptionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-options.php (12910 => 12911)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-options.php        2010-01-31 11:55:39 UTC (rev 12910)
+++ trunk/wp-admin/ms-options.php        2010-01-31 12:23:50 UTC (rev 12911)
</span><span class="lines">@@ -51,13 +51,13 @@
</span><span class="cx">                                         update_site_option( 'registration', 'all' );
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;td&gt;
</span><del>-                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration1&quot; value='none' &lt;?php echo get_site_option('registration') == 'none' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Disabled'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration2&quot; value='all' &lt;?php echo get_site_option('registration') == 'all' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Enabled. Blogs and user accounts can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration3&quot; value='user' &lt;?php echo get_site_option('registration') == 'user' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Only user account can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration4&quot; value='blog' &lt;?php echo get_site_option('registration') == 'blog' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Only logged in users can create new blogs.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
</del><ins>+                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration1&quot; value='none' &lt;?php checked( get_site_option('registration'), 'none') ?&gt; /&gt; &lt;?php _e('Disabled'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration2&quot; value='all' &lt;?php  checked( get_site_option('registration'), 'all') ?&gt; /&gt; &lt;?php _e('Enabled. Blogs and user accounts can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration3&quot; value='user' &lt;?php checked( get_site_option('registration'), 'user') ?&gt; /&gt; &lt;?php _e('Only user account can be created.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                        &lt;label&gt;&lt;input name=&quot;registration&quot; type=&quot;radio&quot; id=&quot;registration4&quot; value='blog' &lt;?php checked( get_site_option('registration'), 'blog') ?&gt; /&gt; &lt;?php _e('Only logged in users can create new blogs.'); ?&gt;&lt;/label&gt;&lt;br /&gt;
</ins><span class="cx">                                         &lt;p&gt;&lt;?php _e('Disable or enable registration and who or what can be registered. (Default=all)'); ?&gt;&lt;/p&gt;
</span><span class="cx">                                         &lt;?php if ( is_subdomain_install() ) {
</span><del>-                                                echo &quot;&lt;p&gt;&quot; . __('If registration is disabled, please set &quot;NOBLOGREDIRECT&quot; in wp-config.php to a url you will redirect visitors to if they visit a non existant blog.') . &quot;&lt;/p&gt;&quot;;
</del><ins>+                                                echo '&lt;p&gt;' . __('If registration is disabled, please set &quot;NOBLOGREDIRECT&quot; in wp-config.php to a url you will redirect visitors to if they visit a non existant blog.') . '&lt;/p&gt;';
</ins><span class="cx">                                         } ?&gt;
</span><span class="cx">                                 &lt;/td&gt;
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="lines">@@ -69,8 +69,8 @@
</span><span class="cx">                                         update_site_option( 'registrationnotification', 'yes' );
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;td&gt;
</span><del>-                                        &lt;input name=&quot;registrationnotification&quot; type=&quot;radio&quot; id=&quot;registrationnotification1&quot; value='yes' &lt;?php echo get_site_option('registrationnotification') == 'yes' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Yes'); ?&gt;&lt;br /&gt;
-                                        &lt;input name=&quot;registrationnotification&quot; type=&quot;radio&quot; id=&quot;registrationnotification2&quot; value='no' &lt;?php echo get_site_option('registrationnotification') == 'no' ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('No'); ?&gt;&lt;br /&gt;
</del><ins>+                                        &lt;input name=&quot;registrationnotification&quot; type=&quot;radio&quot; id=&quot;registrationnotification1&quot; value='yes' &lt;?php checked( get_site_option('registrationnotification'), 'yes') ?&gt; /&gt; &lt;?php _e('Yes'); ?&gt;&lt;br /&gt;
+                                        &lt;input name=&quot;registrationnotification&quot; type=&quot;radio&quot; id=&quot;registrationnotification2&quot; value='no' &lt;?php checked( get_site_option('registrationnotification'), 'no') ?&gt; /&gt; &lt;?php _e('No'); ?&gt;&lt;br /&gt;
</ins><span class="cx">                                         &lt;?php _e('Send the site admin an email notification every time someone registers a blog or user account.') ?&gt;
</span><span class="cx">                                 &lt;/td&gt;
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="lines">@@ -79,8 +79,8 @@
</span><span class="cx">                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Add New Users') ?&gt;&lt;/th&gt;
</span><span class="cx">                                 &lt;td&gt;
</span><span class="cx">                                         &lt;a name='addnewusers'&gt;&lt;/a&gt;
</span><del>-                                        &lt;input name=&quot;add_new_users&quot; type=&quot;radio&quot; id=&quot;add_new_users1&quot; value='1' &lt;?php echo get_site_option('add_new_users') == 1 ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('Yes'); ?&gt;&lt;br /&gt;
-                                        &lt;input name=&quot;add_new_users&quot; type=&quot;radio&quot; id=&quot;add_new_users2&quot; value='0' &lt;?php echo get_site_option('add_new_users') == 0 ? 'checked=&quot;checked&quot;' : ''; ?&gt; /&gt; &lt;?php _e('No'); ?&gt;&lt;br /&gt;
</del><ins>+                                        &lt;input name=&quot;add_new_users&quot; type=&quot;radio&quot; id=&quot;add_new_users1&quot; value='1' &lt;?php checked( get_site_option('add_new_users') ) ?&gt; /&gt; &lt;?php _e('Yes'); ?&gt;&lt;br /&gt;
+                                        &lt;input name=&quot;add_new_users&quot; type=&quot;radio&quot; id=&quot;add_new_users2&quot; value='0' &lt;?php checked( get_site_option('add_new_users'), false) ?&gt; /&gt; &lt;?php _e('No'); ?&gt;&lt;br /&gt;
</ins><span class="cx">                                         &lt;?php _e('Allow blog administrators to add new users to their blog via the Users-&gt;Add New page.') ?&gt;
</span><span class="cx">                                 &lt;/td&gt;
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="lines">@@ -202,16 +202,16 @@
</span><span class="cx">                         &lt;tr valign=&quot;top&quot;&gt;
</span><span class="cx">                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Upload media button') ?&gt;&lt;/th&gt;
</span><span class="cx">                                 &lt;?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?&gt;
</span><del>-                                &lt;td&gt;&lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_image&quot; name=&quot;mu_media_buttons[image]&quot; value='1' &lt;?php if ( $mu_media_buttons[ 'image' ] ) { echo 'checked=checked '; } ?&gt;/&gt; &lt;?php _e( 'Images' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                &lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_video&quot; name=&quot;mu_media_buttons[video]&quot; value='1' &lt;?php if ( $mu_media_buttons[ 'video' ] ) { echo 'checked=checked '; } ?&gt;/&gt; &lt;?php _e( 'Videos' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                &lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_audio&quot; name=&quot;mu_media_buttons[audio]&quot; value='1' &lt;?php if ( $mu_media_buttons[ 'audio' ] ) { echo 'checked=checked '; } ?&gt;/&gt; &lt;?php _e( 'Music' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
</del><ins>+                                &lt;td&gt;&lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_image&quot; name=&quot;mu_media_buttons[image]&quot; value='1' &lt;?php checked( !empty($mu_media_buttons[ 'image' ]) ) ?&gt;/&gt; &lt;?php _e( 'Images' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                &lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_video&quot; name=&quot;mu_media_buttons[video]&quot; value='1' &lt;?php checked( !empty($mu_media_buttons[ 'video' ]) ) ?&gt;/&gt; &lt;?php _e( 'Videos' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                &lt;label&gt;&lt;input type='checkbox' id=&quot;mu_media_buttons_audio&quot; name=&quot;mu_media_buttons[audio]&quot; value='1' &lt;?php checked( !empty($mu_media_buttons[ 'audio' ]) ) ?&gt;/&gt; &lt;?php _e( 'Music' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
</ins><span class="cx">                                 &lt;?php _e( 'The media upload buttons to display on the &quot;Write Post&quot; page. Make sure you update the &quot;Upload File Types&quot; below as well.' ); ?&gt;&lt;/td&gt;
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="cx">                         &lt;tr valign=&quot;top&quot;&gt;
</span><span class="cx">                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e('Blog upload space check') ?&gt;&lt;/th&gt;
</span><span class="cx">                                 &lt;td&gt;
</span><del>-                                &lt;label&gt;&lt;input type='radio' id=&quot;upload_space_check_disabled&quot; name=&quot;upload_space_check_disabled&quot; value='0' &lt;?php if ( !get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?&gt;/&gt; &lt;?php _e( 'Enabled' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                &lt;label&gt;&lt;input type='radio' id=&quot;upload_space_check_disabled&quot; name=&quot;upload_space_check_disabled&quot; value='1' &lt;?php if ( get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?&gt;/&gt; &lt;?php _e( 'Disabled' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
</del><ins>+                                &lt;label&gt;&lt;input type='radio' id=&quot;upload_space_check_disabled&quot; name=&quot;upload_space_check_disabled&quot; value='0' &lt;?php checked( get_site_option( 'upload_space_check_disabled' ), false ) ?&gt;/&gt; &lt;?php _e( 'Enabled' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                &lt;label&gt;&lt;input type='radio' id=&quot;upload_space_check_disabled&quot; name=&quot;upload_space_check_disabled&quot; value='1' &lt;?php checked( get_site_option( 'upload_space_check_disabled' ) ) ?&gt;/&gt; &lt;?php _e( 'Disabled' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
</ins><span class="cx">                                 &lt;?php _e( 'By default there is a limit on the total size of files uploaded but it can be disabled here.' ); ?&gt;&lt;/td&gt;
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="cx">                         &lt;tr valign=&quot;top&quot;&gt;
</span><span class="lines">@@ -252,12 +252,13 @@
</span><span class="cx">                 &lt;h3&gt;&lt;?php _e('Site Wide Settings &lt;em&gt;(These settings may be overridden by blog owners)&lt;/em&gt;') ?&gt;&lt;/h3&gt;
</span><span class="cx">                 &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">                         &lt;?php
</span><ins>+                        $lang_files = array();
</ins><span class="cx">                         if ( is_dir( ABSPATH . LANGDIR ) &amp;&amp; $dh = opendir( ABSPATH . LANGDIR ) )
</span><span class="cx">                                 while( ( $lang_file = readdir( $dh ) ) !== false )
</span><span class="cx">                                         if ( substr( $lang_file, -3 ) == '.mo' )
</span><span class="cx">                                                 $lang_files[] = $lang_file;
</span><span class="cx">                         $lang = get_site_option('WPLANG');
</span><del>-                        if ( is_array($lang_files) &amp;&amp; !empty($lang_files) ) {
</del><ins>+                        if ( !empty($lang_files) ) {
</ins><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;tr valign=&quot;top&quot;&gt;
</span><span class="cx">                                         &lt;th width=&quot;33%&quot;&gt;&lt;?php _e('Default Language') ?&gt;&lt;/th&gt;
</span><span class="lines">@@ -272,7 +273,7 @@
</span><span class="cx">                         ?&gt;
</span><span class="cx">                 &lt;/table&gt;
</span><span class="cx"> 
</span><del>-                &lt;h3&gt;&lt;?php _e('Menus &lt;em&gt;(Enable or disable WP Backend Menus)&lt;/em&gt;') ?&gt;&lt;/h3&gt;
</del><ins>+                &lt;h3&gt;&lt;?php _e('Menus &lt;em&gt;(Enable or disable WordPress Backend Menus)&lt;/em&gt;') ?&gt;&lt;/h3&gt;
</ins><span class="cx">                 &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">                         &lt;tr&gt;
</span><span class="cx">                                 &lt;th scope=&quot;row&quot;&gt;&lt;?php _e(&quot;Menu&quot;); ?&gt;&lt;/th&gt;
</span><span class="lines">@@ -280,10 +281,10 @@
</span><span class="cx">                         &lt;/tr&gt;
</span><span class="cx">                         &lt;a name='menu'&gt;&lt;/a&gt;
</span><span class="cx">                         &lt;?php
</span><del>-                        $menu_perms = get_site_option( &quot;menu_items&quot; );
</del><ins>+                        $menu_perms = get_site_option( 'menu_items' );
</ins><span class="cx">                         $menu_items = apply_filters( 'mu_menu_items', array('plugins' =&gt; __('Plugins')) );
</span><span class="cx">                         foreach ( (array) $menu_items as $key =&gt; $val ) {
</span><del>-                                echo &quot;&lt;tr&gt;&lt;th scope='row'&gt;&quot; . wp_specialchars($val) . &quot;&lt;/th&gt;&lt;td&gt;&lt;input type='checkbox' name='menu_items[&quot; . $key . &quot;]' value='1'&quot; . (( $menu_perms[$key] == '1' ) ? ' checked=&quot;checked&quot;' : '') . &quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&quot;;
</del><ins>+                                echo &quot;&lt;tr&gt;&lt;th scope='row'&gt;&quot; . wp_specialchars($val) . &quot;&lt;/th&gt;&lt;td&gt;&lt;input type='checkbox' name='menu_items[&quot; . $key . &quot;]' value='1'&quot; . checked($menu_perms[$key], '1', false) . &quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&quot;;
</ins><span class="cx">                         }
</span><span class="cx">                         ?&gt;
</span><span class="cx">                 &lt;/table&gt;
</span></span></pre>
</div>
</div>

</body>
</html>