Example #1
0
    } elseif ($current_offset < 0) {
        $tzstring = 'UTC' . $current_offset;
    } else {
        $tzstring = 'UTC+' . $current_offset;
    }
}
?>
<th scope="row"><label for="timezone_string"><?php 
_e('Timezone');
?>
</label></th>
<td>

<select id="timezone_string" name="timezone_string">
<?php 
echo nxt_timezone_choice($tzstring);
?>
</select>

	<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>
<?php 
if (get_option('timezone_string') || !empty($current_offset)) {
    ?>
	<span id="local-time"><?php 
    printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format));
    ?>
</span>
<?php 
 if (!($timezone_string = bb_get_option('timezone_string'))) {
     // set the Etc zone if no timezone string exists
     $_gmt_offset = (int) round($gmt_offset);
     if ($_gmt_offset === 0) {
         $timezone_string = 'Etc/UTC';
     } elseif ($_gmt_offset > 0) {
         // Zoneinfo has these signed backwards to common convention
         $timezone_string = 'Etc/GMT-' . abs($_gmt_offset);
     } else {
         // Zoneinfo has these signed backwards to common convention
         $timezone_string = 'Etc/GMT+' . abs($_gmt_offset);
     }
     unset($_gmt_offset);
 }
 // Build the new selector
 $_time_options = array('timezone_string' => array('title' => __('Time zone'), 'type' => 'select', 'options' => nxt_timezone_choice($timezone_string), 'note' => array(__('Choose a city in the same time zone as you.'), sprintf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), bb_gmdate_i18n(bb_get_datetime_formatstring_i18n(), bb_current_time())), sprintf(__('Local time is <code>%s</code>'), bb_datetime_format_i18n(bb_current_time())))));
 $_now = localtime(bb_current_time(), true);
 if ($now['tm_isdst']) {
     $_time_options['timezone_string']['note'][] = __('This time zone is currently in daylight savings time.');
 } else {
     $_time_options['timezone_string']['note'][] = __('This time zone is currently in standard time.');
 }
 if (function_exists('timezone_transitions_get')) {
     $timezone_object = new DateTimeZone($timezone_string);
     $found_transition = false;
     foreach (timezone_transitions_get($timezone_object) as $timezone_transition) {
         if ($timezone_transition['ts'] > time()) {
             $note = $timezone_transition['isdst'] ? __('Daylight savings time begins on <code>%s</code>') : __('Standard time begins on <code>%s</code>');
             $_time_options['timezone_string']['note'][] = sprintf($note, bb_gmdate_i18n(bb_get_datetime_formatstring_i18n(), $timezone_transition['ts'], false));
             break;
         }