WordPress.org

Make WordPress Core

Ticket #3962: timezone-etc.diff

File timezone-etc.diff, 2.2 KB (added by Otto42, 6 years ago)
  • wp-admin/options-general.php

     
    133133<?php  
    134134else: // looks like we can do nice timezone selection! 
    135135$current_offset = get_option('gmt_offset'); 
     136$tzstring = get_option('timezone_string'); 
     137if (empty($tzstring)) { // set the Etc zone if no timezone string exists 
     138        if ($current_offset < 0) $offnum = ceil($current_offset); 
     139        else $offnum = floor($current_offset); 
     140        $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum; 
     141} 
    136142?> 
    137143<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th> 
    138144<td> 
    139145 
    140146<select id="timezone_string" name="timezone_string"> 
    141 <?php echo wp_timezone_choice(get_option('timezone_string')); ?> 
     147<?php echo wp_timezone_choice($tzstring); ?> 
    142148</select> 
    143149 
    144150<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?></span> 
  • wp-includes/functions.php

     
    31043104                $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : ''; 
    31053105                $i++; 
    31063106        } 
    3107  
     3107         
    31083108        asort($zonen); 
    31093109        $structure = ''; 
    31103110        $pad = '&nbsp;&nbsp;&nbsp;'; 
     
    31333133                        if ( !empty($subcity) ) { 
    31343134                                $city = $city . '/'. $subcity; 
    31353135                        } 
    3136                         $structure .= "\t<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected "':'')." value=\"".($continent.'/'.$city)."\">$pad".str_replace('_',' ',$city)."</option>\n"; //Timezone 
     3136                        $structure .= "\t<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected"':'')." value=\"".($continent.'/'.$city)."\">$pad".str_replace('_',' ',$city)."</option>\n"; //Timezone 
    31373137                } else { 
    3138                         $structure .= "<option ".(($continent==$selectedzone)?'selected="selected "':'')." value=\"".$continent."\">".$continent."</option>\n"; //Timezone 
     3138                        $structure .= "<option ".(($continent==$selectedzone)?'selected="selected"':'')." value=\"".$continent."\">".$continent."</option>\n"; //Timezone 
    31393139                } 
    31403140        } 
    31413141