Make WordPress Core

Changeset 17637


Ignore:
Timestamp:
04/13/2011 05:30:02 PM (13 years ago)
Author:
ryan
Message:

Remove PHP4 timezone support. Props hakre. fixes #16970

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-general.php

    r16736 r17637  
    136136<tr>
    137137<?php
    138 if ( !wp_timezone_supported() ) : // no magic timezone support here
    139 ?>
    140 <th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
    141 <td>
    142 <select name="gmt_offset" id="gmt_offset">
    143 <?php
    144 $current_offset = get_option('gmt_offset');
    145 $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,
    146     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);
    147 foreach ( $offset_range as $offset ) {
    148     if ( 0 < $offset )
    149         $offset_name = '+' . $offset;
    150     elseif ( 0 == $offset )
    151         $offset_name = '';
    152     else
    153         $offset_name = (string) $offset;
    154 
    155     $offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
    156 
    157     $selected = '';
    158     if ( $current_offset == $offset ) {
    159         $selected = " selected='selected'";
    160         $current_offset_name = $offset_name;
    161     }
    162     echo "<option value=\"" . esc_attr($offset) . "\"$selected>" . sprintf(__('UTC %s'), $offset_name) . '</option>';
    163 }
    164 ?>
    165 </select>
    166 <?php _e('hours'); ?>
    167 <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>
    168 <?php if ($current_offset) : ?>
    169     <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
    170 <?php endif; ?>
    171 <br />
    172 <span class="description"><?php _e('Unfortunately, you have to manually update this for daylight saving time. The PHP Date/Time library is not supported by your web host.'); ?></span>
    173 </td>
    174 <?php
    175 else: // looks like we can do nice timezone selection!
    176138$current_offset = get_option('gmt_offset');
    177139$tzstring = get_option('timezone_string');
     
    251213</td>
    252214
    253 <?php endif; ?>
    254215</tr>
    255216<tr>
  • trunk/wp-includes/deprecated.php

    r17613 r17637  
    26202620    return clone $object;
    26212621}
     2622
     2623/**
     2624 * Check for PHP timezone support
     2625 *
     2626 * @since 2.9.0
     2627 * @deprecated 3.2
     2628 *
     2629 * @return bool
     2630 */
     2631function wp_timezone_supported() {
     2632    _deprecated_function( __FUNCTION__, '3.2' );
     2633 
     2634    return true;
     2635}
  • trunk/wp-includes/functions.php

    r17613 r17637  
    121121    $timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
    122122    $timezone_formats_re = implode( '|', $timezone_formats );
    123     if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) && wp_timezone_supported() ) {
     123    if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
    124124        $timezone_string = get_option( 'timezone_string' );
    125125        if ( $timezone_string ) {
     
    40634063 */
    40644064function wp_timezone_override_offset() {
    4065     if ( !wp_timezone_supported() ) {
    4066         return false;
    4067     }
    40684065    if ( !$timezone_string = get_option( 'timezone_string' ) ) {
    40694066        return false;
     
    40764073    }
    40774074    return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 );
    4078 }
    4079 
    4080 /**
    4081  * Check for PHP timezone support
    4082  *
    4083  * @since 2.9.0
    4084  *
    4085  * @return bool
    4086  */
    4087 function wp_timezone_supported() {
    4088     $support = false;
    4089     if (
    4090         function_exists( 'date_create' ) &&
    4091         function_exists( 'date_default_timezone_set' ) &&
    4092         function_exists( 'timezone_identifiers_list' ) &&
    4093         function_exists( 'timezone_open' ) &&
    4094         function_exists( 'timezone_offset_get' )
    4095     ) {
    4096         $support = true;
    4097     }
    4098     return apply_filters( 'timezone_support', $support );
    40994075}
    41004076
Note: See TracChangeset for help on using the changeset viewer.