From 7ec57f9dead6606442c05d43e7c3f93db539166a Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 11 Nov 2008 19:56:35 +0000 Subject: [PATCH] Use localized dates on General Options page. Props nbachiyski. fixes #8153 git-svn-id: http://svn.automattic.com/wordpress/trunk@9616 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-general.php | 12 ++++++------ wp-admin/wp-admin.css | 2 +- wp-includes/functions.php | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 0b1a514919..12b6d1909b 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -119,9 +119,9 @@ foreach ( $offset_range as $offset ) { ?> -UTC time is %s'), gmdate(__('Y-m-d G:i:s'))); ?> +UTC time is %s'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?> - %2$s'), $current_offset_name, gmdate(__('Y-m-d G:i:s'), current_time('timestamp'))); ?> + %2$s'), $current_offset_name, date_i18n(__('Y-m-d G:i:s'))); ?>
@@ -148,12 +148,12 @@ foreach ( $offset_range as $offset ) { echo " checked='checked'"; $custom = FALSE; } - echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "
\n"; + echo ' /> ' . date_i18n( $format ) . "
\n"; } echo ' ' . gmdate( get_option('date_format'), current_time('timestamp') ) . "\n"; + echo '/> ' . __('Custom:') . ' ' . date_i18n( get_option('date_format') ) . "\n"; echo "\t

" . __('Documentation on date formatting. Click "Save Changes" to update sample output.') . "

\n"; ?> @@ -180,12 +180,12 @@ foreach ( $offset_range as $offset ) { echo " checked='checked'"; $custom = FALSE; } - echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "
\n"; + echo ' /> ' . date_i18n( $format ) . "
\n"; } echo ' ' . gmdate( get_option('time_format'), current_time('timestamp') ) . "\n"; + echo '/> ' . __('Custom:') . ' ' . date_i18n( get_option('time_format') ) . "\n"; ?> diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 17a6f94cc3..224bbae3d0 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1313,7 +1313,7 @@ textarea.large-text { } .form-table input.small-text { - width: 40px; + width: 50px; } #profile-page .form-table textarea { diff --git a/wp-includes/functions.php b/wp-includes/functions.php index cad7692682..d410641969 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -112,12 +112,12 @@ function current_time( $type, $gmt = 0 ) { * @param int $unixtimestamp Unix timestamp * @return string The date, translated if locale specifies it. */ -function date_i18n( $dateformatstring, $unixtimestamp ) { +function date_i18n( $dateformatstring, $unixtimestamp, $gmt = false ) { global $wp_locale; $i = $unixtimestamp; // Sanity check for PHP 5.1.0- - if ( -1 == $i ) - $i = false; + if ( intval($i) < 1 ) + $i = time(); if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { $datemonth = $wp_locale->get_month( date( 'm', $i ) ); @@ -136,7 +136,7 @@ function date_i18n( $dateformatstring, $unixtimestamp ) { $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); } - $j = @date( $dateformatstring, $i ); + $j = $gmt? @gmdate( $dateformatstring, $i ) : @date( $dateformatstring, $i ); return $j; }