Make WordPress Core

Ticket #4994: 4994.r6668.diff

File 4994.r6668.diff, 1.4 KB (added by darkdragon, 17 years ago)

Sets the default timezone based off of the settings in gmt_offset for the blog. Does this, even if it is already set. Based off of r6668

  • wp-includes/functions.php

     
    16761676                        trigger_error( printf( __("%s is <strong>deprecated</strong> since version %s with no alternative available."), $file, $version ) );
    16771677        }
    16781678}
    1679 ?>
     1679
     1680/**
     1681 * wp_set_default_timezone() - Sets the default timezone based off of the gmt_offset setting.
     1682 *
     1683 * @since 2.5
     1684 *
     1685 * @return void Returns nothing
     1686 */
     1687function wp_set_default_timezone() {
     1688        if( function_exists('date_default_timezone_set') ) {
     1689
     1690                $timezone = get_option('gmt_offset');
     1691                if( false === $timezone )
     1692                        $timezone = "+0";
     1693                else
     1694                        $timezone = ( $timezone >= 0 ) ? '+'.$timezone : $timezone;
     1695
     1696                date_default_timezone_set('Etc/GMT'.$timezone);
     1697
     1698        }
     1699}
     1700
     1701?>
     1702 No newline at end of file
  • wp-settings.php

     
    204204if ( is_wp_error($prefix) )
    205205        wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.');
    206206
     207wp_set_default_timezone();
     208
    207209if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )
    208210        require_once (ABSPATH . 'wp-content/object-cache.php');
    209211else