Make WordPress Core

Changeset 19785


Ignore:
Timestamp:
01/29/2012 08:04:11 PM (15 years ago)
Author:
nacin
Message:

Allow translators to specify a default timezone string OR GMT offset. Stop doing date('Z')/3600 math for default gmt_offset, as since WP 2.9, we set server time to UTC. Server time is unreliable, so no workarounds for now. fixes #19601.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r19784 r19785  
    352352                }
    353353        }
     354
     355        $timezone_string = '';
     356        $gmt_offset = 0;
     357        /* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
     358           or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php
     359           for all timezone strings supported by PHP.
     360        */
     361        $offset_or_tz = __( '0', 'default GMT offset or timezone string' );
     362        if ( is_numeric( $offset_or_tz ) )
     363                $gmt_offset = $offset_or_tz;
     364        elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) )
     365                        $timezone_string = $offset_or_tz;
    354366
    355367        $options = array(
     
    400412        'advanced_edit' => 0,
    401413        'comment_max_links' => 2,
    402         'gmt_offset' => date('Z') / 3600,
     414        'gmt_offset' => $gmt_offset,
    403415
    404416        // 1.5
     
    466478
    467479        // 2.8
    468         'timezone_string' => '',
     480        'timezone_string' => $timezone_string,
    469481
    470482        // 2.9
Note: See TracChangeset for help on using the changeset viewer.