Ticket #11558: 11558.diff
File 11558.diff, 5.6 KB (added by , 15 years ago) |
---|
-
wp-includes/functions.php
3393 3393 function wp_timezone_choice( $selected_zone ) { 3394 3394 static $mo_loaded = false; 3395 3395 3396 $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' , 'Etc');3396 $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific'); 3397 3397 3398 3398 // Load translations for continents and cities 3399 3399 if ( !$mo_loaded ) { … … 3409 3409 if ( !in_array( $zone[0], $continents ) ) { 3410 3410 continue; 3411 3411 } 3412 if ( 'Etc' === $zone[0] && in_array( $zone[1], array( 'UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu' ) ) ) {3413 continue;3414 }3415 3412 3416 3413 // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later 3417 3414 $exists = array( … … 3452 3449 3453 3450 // Continent optgroup 3454 3451 if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) { 3455 $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) :$zone['t_continent'];3452 $label = $zone['t_continent']; 3456 3453 $structure[] = '<optgroup label="'. esc_attr( $label ) .'">'; 3457 3454 } 3458 3455 3459 3456 // Add the city to the value 3460 3457 $value[] = $zone['city']; 3461 if ( 'Etc' === $zone['continent'] ) { 3462 if ( 'UTC' === $zone['city'] ) { 3463 $display = ''; 3464 } else { 3465 $display = str_replace( 'GMT', '', $zone['city'] ); 3466 $display = strtr( $display, '+-', '-+' ) . ':00'; 3467 } 3468 $display = sprintf( __( 'UTC %s' ), $display ); 3469 } else { 3470 $display = $zone['t_city']; 3471 if ( !empty( $zone['subcity'] ) ) { 3472 // Add the subcity to the value 3473 $value[] = $zone['subcity']; 3474 $display .= ' - ' . $zone['t_subcity']; 3475 } 3458 3459 $display = $zone['t_city']; 3460 if ( !empty( $zone['subcity'] ) ) { 3461 // Add the subcity to the value 3462 $value[] = $zone['subcity']; 3463 $display .= ' - ' . $zone['t_subcity']; 3476 3464 } 3477 3465 } 3478 3466 … … 3490 3478 } 3491 3479 } 3492 3480 3481 // Do UTC 3482 $structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">'; 3483 $selected = ''; 3484 if ( 'UTC' === $selected_zone ) 3485 $selected = 'selected="selected" '; 3486 $structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>'; 3487 $structure[] = '</optgroup>'; 3488 3489 // Do manual UTC offsets 3490 $structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">'; 3491 $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, 3492 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); 3493 foreach ( $offset_range as $offset ) { 3494 if ( 0 <= $offset ) 3495 $offset_name = '+' . $offset; 3496 else 3497 $offset_name = (string) $offset; 3498 3499 $offset_value = $offset_name; 3500 $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name); 3501 $offset_name = 'UTC' . $offset_name; 3502 $offset_value = 'UTC' . $offset_value; 3503 $selected = ''; 3504 if ( $offset_value === $selected_zone ) 3505 $selected = 'selected="selected" '; 3506 $structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>"; 3507 3508 } 3509 $structure[] = '</optgroup>'; 3510 3493 3511 return join( "\n", $structure ); 3494 3512 } 3495 3513 -
wp-admin/options-general.php
139 139 else: // looks like we can do nice timezone selection! 140 140 $current_offset = get_option('gmt_offset'); 141 141 $tzstring = get_option('timezone_string'); 142 143 $check_zone_info = true; 144 145 // Remove old Etc mappings. Fallback to gmt_offset. 146 if ( false !== strpos($tzstring,'Etc/GMT') ) 147 $tzstring = ''; 148 142 149 if (empty($tzstring)) { // set the Etc zone if no timezone string exists 143 if ($current_offset < 0) $offnum = - ceil($current_offset); 144 else $offnum = - floor($current_offset); 145 $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum; 150 $check_zone_info = false; 151 if ( 0 == $current_offset ) 152 $tzstring = 'UTC+0'; 153 elseif ($current_offset < 0) 154 $tzstring = 'UTC-' . $current_offset; 155 else 156 $tzstring = 'UTC+' . $current_offset; 146 157 } 158 147 159 ?> 148 160 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th> 149 161 <td> … … 160 172 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span> 161 173 <br /> 162 174 <span> 163 <?php if ($ tzstring) : ?>175 <?php if ($check_zone_info && $tzstring) : ?> 164 176 <?php 165 177 $now = localtime(time(),true); 166 178 if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.'); -
wp-admin/options.php
65 65 $_POST['date_format'] = $_POST['date_format_custom']; 66 66 if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) ) 67 67 $_POST['time_format'] = $_POST['time_format_custom']; 68 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. 69 if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { 70 $_POST['gmt_offset'] = $_POST['timezone_string']; 71 $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); 72 $_POST['timezone_string'] = ''; 73 } 68 74 } 69 75 70 76 if ( $options ) {