Ticket #10660: datetime-and-timezone-suggest.patch
File datetime-and-timezone-suggest.patch, 22.2 KB (added by , 15 years ago) |
---|
-
wp-admin.css
3114 3114 border-bottom-style: solid; 3115 3115 } 3116 3116 3117 #utc-time, #local-time { 3118 padding-left: 25px; 3117 #timezone_suggest_working { 3118 padding-bottom: 4px; 3119 vertical-align: bottom; 3120 display: none; 3121 } 3122 3123 #timezone_suggest_result { 3124 display: none; 3125 color: #f00; 3126 } 3127 3128 #time-info { 3129 -moz-border-radius: 4px; 3130 -khtml-border-radius: 4px; 3131 -webkit-border-radius: 4px; 3132 border-radius: 4px; 3133 background-color: rgb(223, 223, 223); 3134 color: rgb(102, 102, 102); 3135 margin: 10px 0; 3136 float: left; 3137 } 3138 3139 #time-info caption { 3140 line-height: 1.2em; 3141 padding: 4px 6px; 3142 margin: 0; 3143 font-weight: bold; 3144 text-align: left; 3145 } 3146 3147 #time-info th { 3148 line-height: 1.2em; 3149 padding: 0 2px 4px 6px; 3150 margin: 0; 3151 text-align: right; 3152 width: auto; 3153 text-shadow: none; 3154 color: rgb(102, 102, 102); 3155 } 3156 3157 #time-info td { 3158 line-height: 1.2em; 3159 padding: 0 6px 4px 0; 3160 margin: 0; 3119 3161 font-style: italic; 3120 font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;3121 3162 } 3122 3163 3123 3164 ul#dismissed-updates { -
options-general.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('./admin.php'); 11 11 12 if ( ! current_user_can('manage_options') )13 wp_die(__('You do not have sufficient permissions to manage options for this blog.'));14 15 12 $title = __('General Settings'); 16 13 $parent_file = 'options-general.php'; 17 /* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */18 $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');19 14 20 /**21 * Display JavaScript on the page.22 *23 * @package WordPress24 * @subpackage General_Settings_Panel25 */26 function add_js() {27 ?>28 <script type="text/javascript">29 //<![CDATA[30 jQuery(document).ready(function($){31 $("input[name='date_format']").click(function(){32 if ( "date_format_custom_radio" != $(this).attr("id") )33 $("input[name='date_format_custom']").val( $(this).val() );34 });35 $("input[name='date_format_custom']").focus(function(){36 $("#date_format_custom_radio").attr("checked", "checked");37 });38 39 $("input[name='time_format']").click(function(){40 if ( "time_format_custom_radio" != $(this).attr("id") )41 $("input[name='time_format_custom']").val( $(this).val() );42 });43 $("input[name='time_format_custom']").focus(function(){44 $("#time_format_custom_radio").attr("checked", "checked");45 });46 });47 //]]>48 </script>49 <?php50 }51 add_filter('admin_head', 'add_js');52 53 15 include('./admin-header.php'); 54 16 ?> 55 17 … … 97 59 <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select> 98 60 </td> 99 61 </tr> 100 <tr>101 <?php102 if ( !wp_timezone_supported() ) : // no magic timezone support here103 ?>104 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>105 <td>106 <select name="gmt_offset" id="gmt_offset">107 <?php108 $current_offset = get_option('gmt_offset');109 $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,110 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);111 foreach ( $offset_range as $offset ) {112 if ( 0 < $offset )113 $offset_name = '+' . $offset;114 elseif ( 0 == $offset )115 $offset_name = '';116 else117 $offset_name = (string) $offset;118 119 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);120 121 $selected = '';122 if ( $current_offset == $offset ) {123 $selected = " selected='selected'";124 $current_offset_name = $offset_name;125 }126 echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';127 }128 ?>129 </select>130 <?php _e('hours'); ?>131 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n( $time_format, false, 'gmt')); ?></span>132 <?php if ($current_offset) : ?>133 <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>134 <?php endif; ?>135 <br />136 <span class="description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>137 </td>138 <?php139 else: // looks like we can do nice timezone selection!140 $current_offset = get_option('gmt_offset');141 $tzstring = get_option('timezone_string');142 if (empty($tzstring)) { // set the Etc zone if no timezone string exists143 if ($current_offset < 0) $offnum = - ceil($current_offset);144 else $offnum = - floor($current_offset);145 $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum;146 }147 ?>148 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>149 <td>150 151 <select id="timezone_string" name="timezone_string">152 <?php echo wp_timezone_choice($tzstring); ?>153 </select>154 155 <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>156 <?php if (get_option('timezone_string')) : ?>157 <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>158 <?php endif; ?>159 <br />160 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>161 <br />162 <span>163 <?php if ($tzstring) : ?>164 <?php165 $now = localtime(time(),true);166 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');167 else _e('This timezone is currently in standard time.');168 ?>169 <br />170 <?php171 if (function_exists('timezone_transitions_get')) {172 $dateTimeZoneSelected = new DateTimeZone($tzstring);173 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {174 if ($tr['ts'] > time()) {175 $found = true;176 break;177 }178 }179 180 if ( isset($found) && $found === true ) {181 echo ' ';182 $message = $tr['isdst'] ?183 __('Daylight savings time begins on: <code>%s</code>.') :184 __('Standard time begins on: <code>%s</code>.');185 printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );186 } else {187 _e('This timezone does not observe daylight savings time.');188 }189 }190 ?>191 </span>192 <?php endif; ?>193 </td>194 195 <?php endif; ?>196 </tr>197 <tr>198 <th scope="row"><?php _e('Date Format') ?></th>199 <td>200 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>201 <?php202 203 $date_formats = apply_filters( 'date_formats', array(204 __('F j, Y'),205 'Y/m/d',206 'm/d/Y',207 'd/m/Y',208 ) );209 210 $custom = TRUE;211 212 foreach ( $date_formats as $format ) {213 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";214 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="215 echo " checked='checked'";216 $custom = FALSE;217 }218 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";219 }220 221 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';222 checked( $custom );223 echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";224 225 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";226 ?>227 </fieldset>228 </td>229 </tr>230 <tr>231 <th scope="row"><?php _e('Time Format') ?></th>232 <td>233 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>234 <?php235 236 $time_formats = apply_filters( 'time_formats', array(237 __('g:i a'),238 'g:i A',239 'H:i',240 ) );241 242 $custom = TRUE;243 244 foreach ( $time_formats as $format ) {245 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";246 if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="247 echo " checked='checked'";248 $custom = FALSE;249 }250 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";251 }252 253 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';254 checked( $custom );255 echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";256 ?>257 </fieldset>258 </td>259 </tr>260 <tr>261 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>262 <td><select name="start_of_week" id="start_of_week">263 <?php264 for ($day_index = 0; $day_index <= 6; $day_index++) :265 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';266 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';267 endfor;268 ?>269 </select></td>270 </tr>271 62 <?php do_settings_fields('general', 'default'); ?> 272 63 </table> 273 64 -
menu.php
106 106 107 107 $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' ); 108 108 $submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php'); 109 $submenu['options-general.php'][12] = array(__('Date and Time'), 'manage_options', 'options-datetime.php'); 109 110 $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php'); 110 111 $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php'); 111 112 $submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php'); -
options.php
22 22 wp_reset_vars(array('action')); 23 23 24 24 $whitelist_options = array( 25 'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ), 25 'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'default_role' ), 26 'datetime' => array( 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ), 26 27 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 27 28 'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 28 29 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), … … 60 61 } 61 62 62 63 // Handle custom date/time formats 63 if ( ' general' == $option_page ) {64 if ( 'datetime' == $option_page ) { 64 65 if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) ) 65 66 $_POST['date_format'] = $_POST['date_format_custom']; 66 67 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) -
options-datetime.php
1 <?php 2 /** 3 * Date and time settings administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 require_once( './admin.php' ); 11 12 if ( !current_user_can( 'manage_options' ) ) { 13 wp_die( __( 'You do not have sufficient permissions to manage options for this blog.' ) ); 14 } 15 16 $title = __( 'Date and Time Settings' ); 17 $parent_file = 'options-general.php'; 18 /* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */ 19 $timezone_format = _x( 'Y-m-d G:i:s', 'timezone date format' ); 20 21 /** 22 * Display JavaScript on the page. 23 * 24 * @package WordPress 25 * @subpackage General_Settings_Panel 26 */ 27 function add_js() { 28 ?> 29 <script type="text/javascript"> 30 //<![CDATA[ 31 jQuery(document).ready(function($){ 32 $("input[name='date_format']").click(function(){ 33 if ( "date_format_custom_radio" != $(this).attr("id") ) 34 $("input[name='date_format_custom']").val( $(this).val() ); 35 }); 36 $("input[name='date_format_custom']").focus(function(){ 37 $("#date_format_custom_radio").attr("checked", "checked"); 38 }); 39 40 $("input[name='time_format']").click(function(){ 41 if ( "time_format_custom_radio" != $(this).attr("id") ) 42 $("input[name='time_format_custom']").val( $(this).val() ); 43 }); 44 $("input[name='time_format_custom']").focus(function(){ 45 $("#time_format_custom_radio").attr("checked", "checked"); 46 }); 47 $("#timezone_suggest").click(function(){ 48 $("#timezone_suggest_working").animate({opacity:'show'},500); 49 $.ajax({ 50 type: 'GET', 51 dataType: 'jsonp', 52 url: 'http://api.wordpress.org/core/ip-to-zoneinfo/1.0/', 53 success: function(data){ 54 if (data.errorcode) { 55 $("#timezone_suggest_result").text('<?php _e('Suggestion failed'); ?>'); 56 } else { 57 $("#timezone_string").val(data.timezoneId); 58 $("#timezone_suggest_result").text('<?php _e('Suggestion provided'); ?>'); 59 } 60 $("#timezone_suggest_working").animate( 61 {opacity:'hide'}, 62 500, 63 'linear', 64 function(){ 65 $("#timezone_suggest_result").animate({opacity:'show'},1000); 66 $("#timezone_suggest_result").animate({opacity:'hide'},3000); 67 } 68 ); 69 } 70 }); 71 }); 72 }); 73 //]]> 74 </script> 75 <?php 76 } 77 add_filter('admin_head', 'add_js'); 78 79 include('./admin-header.php'); 80 ?> 81 82 <div class="wrap"> 83 <?php screen_icon(); ?> 84 <h2><?php echo esc_html( $title ); ?></h2> 85 86 <form method="post" action="options.php"> 87 <?php settings_fields('datetime'); ?> 88 89 <table class="form-table"> 90 <?php 91 if ( !wp_timezone_supported() ) : 92 // no magic timezone support here 93 ?> 94 <tr> 95 <th scope="row"><label for="gmt_offset"><?php _e('Time zone') ?> </label></th> 96 <td> 97 <select name="gmt_offset" id="gmt_offset"> 98 <?php 99 $current_offset = get_option('gmt_offset'); 100 $offset_range = array ( 101 -12, -11.5, -11, -10.5, 102 -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, 103 -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 104 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 105 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 106 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14 107 ); 108 foreach ( $offset_range as $offset ) { 109 if ( 0 < $offset ) { 110 $offset_name = '+' . $offset; 111 } elseif ( 0 == $offset ) { 112 $offset_name = ''; 113 } else { 114 $offset_name = (string) $offset; 115 } 116 117 $offset_name = str_replace( 118 array( '.25','.5','.75' ), 119 array( ':15',':30',':45' ), 120 $offset_name 121 ); 122 123 $selected = ''; 124 if ( $current_offset == $offset ) { 125 $selected = " selected='selected'"; 126 $current_offset_name = $offset_name; 127 } 128 echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>' . "\n"; 129 } 130 ?> 131 </select> 132 <?php _e('hours'); ?><br /> 133 <span class="description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time.'); ?></span><br /> 134 <div id="time-info"> 135 <table> 136 <caption><?php _e('Current time'); ?></caption> 137 <tbody> 138 <tr> 139 <th><?php _e( '<abbr title="Coordinated Universal Time">UTC</abbr> time:' ); ?></th> 140 <td><?php echo date_i18n( $timezone_format, false, 'gmt' ); ?></td> 141 </tr> 142 <?php 143 if ( $current_offset ) : 144 ?> 145 <tr> 146 <th><?php _e( 'Local time:' ); ?></th> 147 <td><?php echo date_i18n( $timezone_format ); ?></td> 148 </tr> 149 <?php 150 endif; 151 ?> 152 </tbody> 153 </table> 154 </div> 155 </td> 156 </tr> 157 <?php 158 else: 159 // looks like we can do nice timezone selection! 160 $current_offset = get_option('gmt_offset'); 161 $tzstring = get_option('timezone_string'); 162 if ( empty( $tzstring ) ) { 163 // set the Etc zone if no timezone string exists 164 if ($current_offset < 0) { 165 $offnum = -ceil( $current_offset ); 166 } else { 167 $offnum = -floor( $current_offset ); 168 } 169 $tzstring = 'Etc/GMT' . ( ( $offnum >= 0 ) ? '+' : '' ) . $offnum; 170 } 171 ?> 172 <tr> 173 <th scope="row"><label for="timezone_string"><?php _e('Time Zone') ?></label></th> 174 <td> 175 <select id="timezone_string" name="timezone_string"> 176 <?php echo wp_timezone_choice( $tzstring ); ?> 177 </select> 178 <input id="timezone_suggest" type="button" class="button" value="<?php _e('Suggest a time zone'); ?>" /> 179 <img id="timezone_suggest_working" src="images/wpspin_light.gif" width="16" height="16" /> 180 <span id="timezone_suggest_result"></span><br /> 181 <span class="description"><?php _e('WordPress can suggest a time zone for you based on your computers IP address, or you may manually select a city in the same time zone as you.'); ?></span><br /> 182 <div id="time-info"> 183 <table> 184 <caption><?php _e('Current time zone'); ?></caption> 185 <tbody> 186 <tr> 187 <th><?php _e( '<abbr title="Coordinated Universal Time">UTC</abbr> time:' ); ?></th> 188 <td><?php echo date_i18n( $timezone_format, false, 'gmt' ); ?></td> 189 </tr> 190 <?php 191 if ( !empty( $tzstring ) ) : 192 ?> 193 <tr> 194 <th><?php _e( 'Local time:' ); ?></th> 195 <td><?php echo date_i18n( $timezone_format ); ?></td> 196 </tr> 197 <tr> 198 <th><?php _e( '"Zoneinfo" zone:' ); ?></th> 199 <td><?php echo $tzstring; ?></td> 200 </tr> 201 <tr> 202 <th><?php _e( 'Currently observing:' ) ?></th> 203 <td><?php 204 $now = localtime( time(),true ); 205 if ( $now['tm_isdst'] ) { 206 _e( 'daylight savings time' ); 207 } else { 208 _e( 'standard time' ); 209 } 210 ?></td> 211 </tr> 212 <?php 213 if ( function_exists( 'timezone_transitions_get' ) ) : 214 $dateTimeZoneSelected = new DateTimeZone($tzstring); 215 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) { 216 if ($tr['ts'] > time()) { 217 $found = true; 218 break; 219 } 220 } 221 if ( isset($found) && $found === true ) : 222 $term = $tr['isdst'] ? 223 __('Daylight savings begins:') : 224 __('Standard time resumes:'); 225 $definition = date_i18n( $timezone_format, $tr['ts'] ); 226 ?> 227 <tr> 228 <th><?php echo $term; ?></th> 229 <td><?php echo $definition; ?></td> 230 </tr> 231 <?php 232 endif; 233 endif; 234 endif; 235 ?> 236 </tbody> 237 </table> 238 </div> 239 </td> 240 </tr> 241 <?php 242 endif; 243 ?> 244 </table> 245 246 <table class="form-table"> 247 <tr> 248 <th scope="row"><?php _e('Date Format') ?></th> 249 <td> 250 <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> 251 <?php 252 253 $date_formats = apply_filters( 'date_formats', array( 254 __('F j, Y'), 255 'Y/m/d', 256 'm/d/Y', 257 'd/m/Y', 258 ) ); 259 260 $custom = TRUE; 261 262 foreach ( $date_formats as $format ) { 263 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'"; 264 if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" 265 echo " checked='checked'"; 266 $custom = FALSE; 267 } 268 echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; 269 } 270 271 echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; 272 checked( $custom ); 273 echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n"; 274 275 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"; 276 ?> 277 </fieldset> 278 </td> 279 </tr> 280 <tr> 281 <th scope="row"><?php _e('Time Format') ?></th> 282 <td> 283 <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> 284 <?php 285 286 $time_formats = apply_filters( 'time_formats', array( 287 __('g:i a'), 288 'g:i A', 289 'H:i', 290 ) ); 291 292 $custom = TRUE; 293 294 foreach ( $time_formats as $format ) { 295 echo "\t<label title='" . esc_attr( $format ) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'"; 296 if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===" 297 echo " checked='checked'"; 298 $custom = FALSE; 299 } 300 echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; 301 } 302 303 echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; 304 checked( $custom ); 305 echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" /> ' . date_i18n( get_option( 'time_format' ) ) . "\n"; 306 ?> 307 </fieldset> 308 </td> 309 </tr> 310 <tr> 311 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th> 312 <td> 313 <select name="start_of_week" id="start_of_week"> 314 <?php 315 for ($day_index = 0; $day_index <= 6; $day_index++) : 316 $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; 317 echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>'; 318 endfor; 319 ?> 320 </select> 321 </td> 322 </tr> 323 <?php do_settings_fields('datetime', 'default'); ?> 324 </table> 325 326 <?php do_settings_sections('datetime'); ?> 327 328 <p class="submit"> 329 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 330 </p> 331 </form> 332 333 </div> 334 335 <?php include( './admin-footer.php' ); ?> 336 No newline at end of file