WordPress.org

Make WordPress Core

Changeset 13661


Ignore:
Timestamp:
03/11/2010 05:12:23 PM (10 years ago)
Author:
nacin
Message:

Use disabled() form helper. fixes #12581

Location:
trunk/wp-admin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r13577 r13661  
    915915<tr valign="top">
    916916<th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
    917 <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>
     917<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>
    918918</tr>
    919919
    920920<tr valign="top">
    921921<th scope="row"><label for="username"><?php _e('Username') ?></label></th>
    922 <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>
     922<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>
    923923</tr>
    924924
    925925<tr valign="top">
    926926<th scope="row"><label for="password"><?php _e('Password') ?></label></th>
    927 <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>
     927<td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></td>
    928928</tr>
    929929
     
    935935<label for="private_key"><?php _e('Private Key:') ?></label>
    936936</div></th>
    937 <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" />
     937<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" />
    938938<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>
    939939</tr>
     
    944944<td>
    945945<fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
    946 <?php
    947 
    948     $disabled = (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH) ? ' disabled="disabled"' : '';
    949 
    950     foreach ( $types as $name => $text ) : ?>
     946<?php foreach ( $types as $name => $text ) : ?>
    951947    <label for="<?php echo esc_attr($name) ?>">
    952         <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; ?>/>
     948        <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) ); ?> />
    953949        <?php echo $text ?>
    954950    </label>
  • trunk/wp-admin/includes/media.php

    r13612 r13661  
    859859            }
    860860
    861             $html = "<div class='image-size-item'><input type='radio' " . ( $enabled ? '' : "disabled='disabled' " ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
     861            $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 />";
    862862
    863863            $html .= "<label for='{$css_id}'>$label</label>";
  • trunk/wp-admin/includes/template.php

    r13659 r13661  
    207207
    208208        $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
    209         $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>';
     209        $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>';
    210210    }
    211211
  • trunk/wp-admin/ms-sites.php

    r13609 r13661  
    166166                                if ( $option->option_name == 'default_role' )
    167167                                    $editblog_default_role = $option->option_value;
    168                                 $disabled = '';
     168                                $disabled = false;
    169169                                if ( is_serialized($option->option_value) ) {
    170170                                    if ( is_serialized_string($option->option_value) ) {
     
    172172                                    } else {
    173173                                        $option->option_value = "SERIALIZED DATA";
    174                                         $disabled = ' disabled="disabled"';
     174                                        $disabled = true;
    175175                                    }
    176176                                }
     
    179179                                    <tr class="form-field">
    180180                                        <th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
    181                                         <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>
     181                                        <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>
    182182                                    </tr>
    183183                                <?php
     
    189189                                        <td><?php echo esc_attr( $option->option_value ) ?></td>
    190190<?php } else { ?>
    191                                         <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>
     191                                        <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>
    192192<?php } ?>
    193193                                    </tr>
  • trunk/wp-admin/options-general.php

    r13606 r13661  
    7676<tr valign="top">
    7777<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
    78 <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>
     78<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>
    7979</tr>
    8080<tr valign="top">
    8181<th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
    82 <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; ?> />
     82<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' ?>" />
    8383<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>
    8484</tr>
  • trunk/wp-admin/options.php

    r13646 r13661  
    174174
    175175foreach ( (array) $options as $option ) :
    176     $disabled = '';
     176    $disabled = false;
    177177    if ( $option->option_name == '' )
    178178        continue;
     
    185185        } else {
    186186            $value = 'SERIALIZED DATA';
    187             $disabled = ' disabled="disabled"';
     187            $disabled = true;
    188188            $class = 'all-options disabled';
    189189        }
     
    201201        echo "<textarea class='$class' name='$name' id='$name' cols='30' rows='5'>" . wp_htmledit_pre( $value ) . "</textarea>";
    202202    else
    203         echo "<input class='regular-text $class' type='text' name='$name' id='$name' value='" . esc_attr( $value ) . "'$disabled />";
     203        echo "<input class='regular-text $class' type='text' name='$name' id='$name' value='" . esc_attr( $value ) . "'" . disabled( $disabled, true, false ) . " />";
    204204    echo "</td>
    205205</tr>";
Note: See TracChangeset for help on using the changeset viewer.