<!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>[13661] trunk/wp-admin: Use disabled() form helper.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13661">13661</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-03-11 17:12:23 +0000 (Thu, 11 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use disabled() form helper. fixes <a href="http://trac.wordpress.org/ticket/12581">#12581</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesfilephp">trunk/wp-admin/includes/file.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminmssitesphp">trunk/wp-admin/ms-sites.php</a></li>
<li><a href="#trunkwpadminoptionsgeneralphp">trunk/wp-admin/options-general.php</a></li>
<li><a href="#trunkwpadminoptionsphp">trunk/wp-admin/options.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/file.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/file.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/includes/file.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -914,17 +914,17 @@
</span><span class="cx"> <table class="form-table">
</span><span class="cx"> <tr valign="top">
</span><span class="cx"> <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
</span><del>-<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if ( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
</del><ins>+<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> size="40" /></td>
</ins><span class="cx"> </tr>
</span><span class="cx">
</span><span class="cx"> <tr valign="top">
</span><span class="cx"> <th scope="row"><label for="username"><?php _e('Username') ?></label></th>
</span><del>-<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php if ( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
</del><ins>+<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>
</ins><span class="cx"> </tr>
</span><span class="cx">
</span><span class="cx"> <tr valign="top">
</span><span class="cx"> <th scope="row"><label for="password"><?php _e('Password') ?></label></th>
</span><del>-<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
</del><ins>+<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></td>
</ins><span class="cx"> </tr>
</span><span class="cx">
</span><span class="cx"> <?php if ( isset($types['ssh']) ) : ?>
</span><span class="lines">@@ -934,7 +934,7 @@
</span><span class="cx"> <label for="public_key"><?php _e('Public Key:') ?></label ><br />
</span><span class="cx"> <label for="private_key"><?php _e('Private Key:') ?></label>
</span><span class="cx"> </div></th>
</span><del>-<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php if ( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if ( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
</del><ins>+<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> size="40" />
</ins><span class="cx"> <div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
</span><span class="cx"> </tr>
</span><span class="cx"> <?php endif; ?>
</span><span class="lines">@@ -943,13 +943,9 @@
</span><span class="cx"> <th scope="row"><?php _e('Connection Type') ?></th>
</span><span class="cx"> <td>
</span><span class="cx"> <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
</span><del>-<?php
-
-        $disabled = (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH) ? ' disabled="disabled"' : '';
-
-        foreach ( $types as $name => $text ) : ?>
</del><ins>+<?php foreach ( $types as $name => $text ) : ?>
</ins><span class="cx">         <label for="<?php echo esc_attr($name) ?>">
</span><del>-                <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>" <?php checked($name, $connection_type); echo $disabled; ?>/>
</del><ins>+                <input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>"<?php checked($name, $connection_type); disabled( $disabled, (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH) ); ?> />
</ins><span class="cx">                 <?php echo $text ?>
</span><span class="cx">         </label>
</span><span class="cx">         <?php endforeach; ?>
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/includes/media.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -858,7 +858,7 @@
</span><span class="cx">                                 $checked = " checked='checked'";
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        $html = "<div class='image-size-item'><input type='radio' " . ( $enabled ? '' : "disabled='disabled' " ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
</del><ins>+                        $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
</ins><span class="cx">
</span><span class="cx">                         $html .= "<label for='{$css_id}'>$label</label>";
</span><span class="cx">                         // only show the dimensions if that choice is available
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/includes/template.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx">                         $name = 'tax_input['.$taxonomy.']';
</span><span class="cx">
</span><span class="cx">                 $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
</span><del>-                $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . (!empty($args['disabled']) ? 'disabled="disabled"' : '') . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
</del><ins>+                $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function end_el(&$output, $category, $depth, $args) {
</span></span></pre></div>
<a id="trunkwpadminmssitesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/ms-sites.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-sites.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/ms-sites.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -165,20 +165,20 @@
</span><span class="cx">                                                         foreach ( $options as $option ) {
</span><span class="cx">                                                                 if ( $option->option_name == 'default_role' )
</span><span class="cx">                                                                         $editblog_default_role = $option->option_value;
</span><del>-                                                                $disabled = '';
</del><ins>+                                                                $disabled = false;
</ins><span class="cx">                                                                 if ( is_serialized($option->option_value) ) {
</span><span class="cx">                                                                         if ( is_serialized_string($option->option_value) ) {
</span><span class="cx">                                                                                 $option->option_value = esc_html(maybe_unserialize($option->option_value), 'single');
</span><span class="cx">                                                                         } else {
</span><span class="cx">                                                                                 $option->option_value = "SERIALIZED DATA";
</span><del>-                                                                                $disabled = ' disabled="disabled"';
</del><ins>+                                                                                $disabled = true;
</ins><span class="cx">                                                                         }
</span><span class="cx">                                                                 }
</span><span class="cx">                                                                 if ( stristr($option->option_value, "\r") || stristr($option->option_value, "\n") || stristr($option->option_value, "\r\n") ) {
</span><span class="cx">                                                                 ?>
</span><span class="cx">                                                                         <tr class="form-field">
</span><span class="cx">                                                                                 <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
</span><del>-                                                                                <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php echo $disabled ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
</del><ins>+                                                                                <td><textarea rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php disabled( $disabled ) ?>><?php echo esc_html( $option->option_value ) ?></textarea></td>
</ins><span class="cx">                                                                         </tr>
</span><span class="cx">                                                                 <?php
</span><span class="cx">                                                                 } else {
</span><span class="lines">@@ -188,7 +188,7 @@
</span><span class="cx"> <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
</span><span class="cx">                                                                                 <td><?php echo esc_attr( $option->option_value ) ?></td>
</span><span class="cx"> <?php } else { ?>
</span><del>-                                                                                <td><input name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php echo $disabled ?> /></td>
</del><ins>+                                                                                <td><input name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
</ins><span class="cx"> <?php } ?>
</span><span class="cx">                                                                         </tr>
</span><span class="cx">                                                                 <?php
</span></span></pre></div>
<a id="trunkwpadminoptionsgeneralphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/options-general.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/options-general.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/options-general.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -75,11 +75,11 @@
</span><span class="cx"> <?php if ( !is_multisite() ) { ?>
</span><span class="cx"> <tr valign="top">
</span><span class="cx"> <th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
</span><del>-<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
</del><ins>+<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>"<?php $disabled = disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( $disabled ) echo ' disabled' ?>" /></td>
</ins><span class="cx"> </tr>
</span><span class="cx"> <tr valign="top">
</span><span class="cx"> <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
</span><del>-<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> />
</del><ins>+<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>"<?php $disabled = disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( $disabled ) echo ' disabled' ?>" />
</ins><span class="cx"> <span class="description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td>
</span><span class="cx"> </tr>
</span><span class="cx"> <tr valign="top">
</span></span></pre></div>
<a id="trunkwpadminoptionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/options.php (13660 => 13661)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/options.php        2010-03-11 17:05:16 UTC (rev 13660)
+++ trunk/wp-admin/options.php        2010-03-11 17:12:23 UTC (rev 13661)
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx"> $options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );
</span><span class="cx">
</span><span class="cx"> foreach ( (array) $options as $option ) :
</span><del>-        $disabled = '';
</del><ins>+        $disabled = false;
</ins><span class="cx">         if ( $option->option_name == '' )
</span><span class="cx">                 continue;
</span><span class="cx">         if ( is_serialized( $option->option_value ) ) {
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx">                         $class = 'all-options';
</span><span class="cx">                 } else {
</span><span class="cx">                         $value = 'SERIALIZED DATA';
</span><del>-                        $disabled = ' disabled="disabled"';
</del><ins>+                        $disabled = true;
</ins><span class="cx">                         $class = 'all-options disabled';
</span><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx">         if ( strpos( $value, "\n" ) !== false )
</span><span class="cx">                 echo "<textarea class='$class' name='$name' id='$name' cols='30' rows='5'>" . wp_htmledit_pre( $value ) . "</textarea>";
</span><span class="cx">         else
</span><del>-                echo "<input class='regular-text $class' type='text' name='$name' id='$name' value='" . esc_attr( $value ) . "'$disabled />";
</del><ins>+                echo "<input class='regular-text $class' type='text' name='$name' id='$name' value='" . esc_attr( $value ) . "'" . disabled( $disabled, true, false ) . " />";
</ins><span class="cx">         echo "</td>
</span><span class="cx"> </tr>";
</span><span class="cx"> endforeach;
</span></span></pre>
</div>
</div>
</body>
</html>