mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
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
This commit is contained in:
parent
2bab4e2ec0
commit
7ec57f9dea
@ -119,9 +119,9 @@ foreach ( $offset_range as $offset ) {
|
||||
?>
|
||||
</select>
|
||||
<?php _e('hours') ?>
|
||||
<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), gmdate(__('Y-m-d G:i:s'))); ?></span>
|
||||
<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n(__('Y-m-d G:i:s'), false, 'gmt')); ?></span>
|
||||
<?php if ($current_offset) : ?>
|
||||
<span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, gmdate(__('Y-m-d G:i:s'), current_time('timestamp'))); ?></span>
|
||||
<span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n(__('Y-m-d G:i:s'))); ?></span>
|
||||
<?php endif; ?>
|
||||
<br/>
|
||||
<span class="setting-description"><?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?></span>
|
||||
@ -148,12 +148,12 @@ foreach ( $offset_range as $offset ) {
|
||||
echo " checked='checked'";
|
||||
$custom = FALSE;
|
||||
}
|
||||
echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "</label><br />\n";
|
||||
echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
|
||||
}
|
||||
|
||||
echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
|
||||
checked( $custom, TRUE );
|
||||
echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" class="small-text" /> ' . gmdate( get_option('date_format'), current_time('timestamp') ) . "\n";
|
||||
echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . attribute_escape( get_option('date_format') ) . '" class="small-text" /> ' . date_i18n( get_option('date_format') ) . "\n";
|
||||
|
||||
echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') . "</p>\n";
|
||||
?>
|
||||
@ -180,12 +180,12 @@ foreach ( $offset_range as $offset ) {
|
||||
echo " checked='checked'";
|
||||
$custom = FALSE;
|
||||
}
|
||||
echo ' /> ' . gmdate( $format, current_time('timestamp') ) . "</label><br />\n";
|
||||
echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
|
||||
}
|
||||
|
||||
echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
|
||||
checked( $custom, TRUE );
|
||||
echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" class="small-text" /> ' . gmdate( get_option('time_format'), current_time('timestamp') ) . "\n";
|
||||
echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . attribute_escape( get_option('time_format') ) . '" class="small-text" /> ' . date_i18n( get_option('time_format') ) . "\n";
|
||||
?>
|
||||
</fieldset>
|
||||
</td>
|
||||
|
@ -1313,7 +1313,7 @@ textarea.large-text {
|
||||
}
|
||||
|
||||
.form-table input.small-text {
|
||||
width: 40px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#profile-page .form-table textarea {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user