Changeset 9131 for trunk/wp-admin/options-general.php
- Timestamp:
- 10/13/2008 06:32:16 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/options-general.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-general.php
r9032 r9131 12 12 $title = __('General Settings'); 13 13 $parent_file = 'options-general.php'; 14 15 /** 16 * Display JavaScript on the page. 17 * 18 * @package WordPress 19 * @subpackage General_Settings_Panel 20 */ 21 function add_js() { 22 ?> 23 <script type="text/javascript"> 24 //<![CDATA[ 25 jQuery(document).ready(function($){ 26 $("input[name='date_format']").click(function(){ 27 if ( "date_format_custom_radio" != $(this).attr("id") ) 28 $("input[name='date_format_custom']").val( $(this).val() ); 29 }); 30 $("input[name='date_format_custom']").focus(function(){ 31 $("#date_format_custom_radio").attr("checked", "checked"); 32 }); 33 34 $("input[name='time_format']").click(function(){ 35 if ( "time_format_custom_radio" != $(this).attr("id") ) 36 $("input[name='time_format_custom']").val( $(this).val() ); 37 }); 38 $("input[name='time_format_custom']").focus(function(){ 39 $("#time_format_custom_radio").attr("checked", "checked"); 40 }); 41 }); 42 //]]> 43 </script> 44 <?php 45 } 46 add_filter('admin_head', 'add_js'); 14 47 15 48 include('./admin-header.php'); … … 97 130 <tr> 98 131 <th scope="row"><label for="date_format"><?php _e('Date Format') ?></label></th> 99 <td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br /> 100 <?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td> 132 <td> 133 <fieldset><legend class="hidden"><?php _e('Date Format') ?></legend> 134 <?php 135 136 $date_formats = apply_filters( 'date_formats', array( 137 __('F j, Y'), 138 'Y/m/d', 139 'm/d/Y', 140 'd/m/Y', 141 ) ); 142 143 $custom = TRUE; 144 145 foreach ( $date_formats as $format ) { 146 echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='date_format' value='" . attribute_escape($format) . "'"; 147 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" 148 echo " checked='checked'"; 149 $custom = FALSE; 150 } 151 echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "</label><br />\n"; 152 } 153 154 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; 155 checked( $custom, TRUE ); 156 echo '/> ' . __('Custom') . ': </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" size="30" /> ' . gmdate( get_option('date_format'), current_time('timestamp') ) . "</label>\n"; 157 158 echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') . "</p>\n"; 159 ?> 160 </fieldset> 161 </td> 101 162 </tr> 102 163 <tr> 103 164 <th scope="row"><label for="time_format"><?php _e('Time Format') ?></label></th> 104 <td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br /> 105 <?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong><br /> 106 <?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') ?></td> 165 <td> 166 <fieldset><legend class="hidden"><?php _e('Time Format') ?></legend> 167 <?php 168 169 $time_formats = apply_filters( 'time_formats', array( 170 __('g:i a'), 171 'g:i A', 172 'H:i', 173 ) ); 174 175 $custom = TRUE; 176 177 foreach ( $time_formats as $format ) { 178 echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='time_format' value='" . attribute_escape($format) . "'"; 179 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "===" 180 echo " checked='checked'"; 181 $custom = FALSE; 182 } 183 echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "</label><br />\n"; 184 } 185 186 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; 187 checked( $custom, TRUE ); 188 echo '/> ' . __('Custom') . ': </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" size="30" /> ' . gmdate( get_option('time_format'), current_time('timestamp') ) . "</label>\n"; 189 ?> 190 </fieldset> 191 </td> 107 192 </tr> 108 193 <tr>
Note: See TracChangeset
for help on using the changeset viewer.