WordPress.org

Make WordPress Core

Changeset 11323


Ignore:
Timestamp:
05/14/09 02:00:32 (6 years ago)
Author:
ryan
Message:

Don't localize dates where not appropriate. Props Denis-de-Bernardy, hakre. fixes #9730

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-attachment-rows.php

    r11245 r11323  
    132132            $t_time = get_the_time(__('Y/m/d g:i:s A')); 
    133133            $m_time = $post->post_date; 
    134             $time = get_post_time( 'G', true, $post ); 
     134            $time = get_post_time( 'G', true, $post, false ); 
    135135            if ( ( abs($t_diff = time() - $time) ) < 86400 ) { 
    136136                if ( $t_diff < 0 ) 
  • trunk/wp-admin/edit-form-advanced.php

    r11312 r11323  
    4242 
    4343    // Detect if there exists an autosave newer than the post and if that autosave is different than the post 
    44     if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) { 
     44    if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { 
    4545        foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { 
    4646            if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { 
  • trunk/wp-admin/edit-page-form.php

    r11312 r11323  
    4242    $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 
    4343    $autosave = wp_get_post_autosave( $post_ID ); 
    44     if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) 
     44    if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) 
    4545        $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) ); 
    4646} 
  • trunk/wp-admin/includes/template.php

    r11322 r11323  
    12991299    <div class="ping_status">' . $post->ping_status . '</div> 
    13001300    <div class="_status">' . $post->post_status . '</div> 
    1301     <div class="jj">' . mysql2date( 'd', $post->post_date ) . '</div> 
    1302     <div class="mm">' . mysql2date( 'm', $post->post_date ) . '</div> 
    1303     <div class="aa">' . mysql2date( 'Y', $post->post_date ) . '</div> 
    1304     <div class="hh">' . mysql2date( 'H', $post->post_date ) . '</div> 
    1305     <div class="mn">' . mysql2date( 'i', $post->post_date ) . '</div> 
    1306     <div class="ss">' . mysql2date( 's', $post->post_date ) . '</div> 
     1301    <div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div> 
     1302    <div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div> 
     1303    <div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div> 
     1304    <div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div> 
     1305    <div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div> 
     1306    <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div> 
    13071307    <div class="post_password">' . wp_specialchars($post->post_password, 1) . '</div>'; 
    13081308 
     
    25332533    $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 ); 
    25342534    $post_date = ($for_post) ? $post->post_date : $comment->comment_date; 
    2535     $jj = ($edit) ? mysql2date( 'd', $post_date ) : gmdate( 'd', $time_adj ); 
    2536     $mm = ($edit) ? mysql2date( 'm', $post_date ) : gmdate( 'm', $time_adj ); 
    2537     $aa = ($edit) ? mysql2date( 'Y', $post_date ) : gmdate( 'Y', $time_adj ); 
    2538     $hh = ($edit) ? mysql2date( 'H', $post_date ) : gmdate( 'H', $time_adj ); 
    2539     $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj ); 
    2540     $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); 
     2535    $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); 
     2536    $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); 
     2537    $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); 
     2538    $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj ); 
     2539    $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj ); 
     2540    $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj ); 
    25412541 
    25422542    $cur_jj = gmdate( 'd', $time_adj ); 
  • trunk/wp-admin/includes/upgrade.php

    r11318 r11323  
    682682        if ( !empty($posts) ) 
    683683            foreach ( $posts as $post ) 
    684                 wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID)); 
     684                wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID)); 
    685685    } 
    686686} 
  • trunk/wp-admin/options-general.php

    r11312 r11323  
    9797<tr> 
    9898<?php 
    99 if (!wp_timezone_supported()) : // no magic timezone support here 
     99if ( !wp_timezone_supported() ) : // no magic timezone support here 
    100100?> 
    101101<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th> 
     
    125125?> 
    126126</select> 
    127 <?php _e('hours') ?> 
     127<?php _e('hours'); ?> 
    128128<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> 
    129129<?php if ($current_offset) : ?> 
  • trunk/wp-app.php

    r11318 r11323  
    11071107?><feed xmlns="<?php echo $this->ATOM_NS ?>" xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>"> 
    11081108<id><?php $this->the_entries_url() ?></id> 
    1109 <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> 
     1109<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated> 
    11101110<title type="text"><?php bloginfo_rss('name') ?></title> 
    11111111<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> 
  • trunk/wp-includes/comment-template.php

    r11316 r11323  
    354354    global $comment; 
    355355    if ( '' == $d ) 
    356         $date = mysql2date( get_option('date_format'), $comment->comment_date); 
     356        $date = mysql2date(get_option('date_format'), $comment->comment_date); 
    357357    else 
    358358        $date = mysql2date($d, $comment->comment_date); 
     
    592592 * @param string $d Optional. The format of the time (defaults to user's config) 
    593593 * @param bool $gmt Whether to use the GMT date 
     594 * @param bool $translate Whether to translate the time (for use in feeds) 
    594595 * @return string The formatted time 
    595596 */ 
    596 function get_comment_time( $d = '', $gmt = false ) { 
     597function get_comment_time( $d = '', $gmt = false, $translate = true ) { 
    597598    global $comment; 
    598599    $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date; 
    599600    if ( '' == $d ) 
    600         $date = mysql2date(get_option('time_format'), $comment_date); 
     601        $date = mysql2date(get_option('time_format'), $comment_date, $translate); 
    601602    else 
    602         $date = mysql2date($d, $comment_date); 
     603        $date = mysql2date($d, $comment_date, $translate); 
    603604    return apply_filters('get_comment_time', $date, $d, $gmt); 
    604605} 
  • trunk/wp-includes/comment.php

    r11204 r11323  
    465465        return; // don't throttle admins 
    466466    if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) { 
    467         $time_lastcomment = mysql2date('U', $lasttime); 
    468         $time_newcomment  = mysql2date('U', $date); 
     467        $time_lastcomment = mysql2date('U', $lasttime, false); 
     468        $time_newcomment  = mysql2date('U', $date, false); 
    469469        $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); 
    470470        if ( $flood_die ) { 
  • trunk/wp-includes/feed-atom-comments.php

    r11303 r11323  
    2525    <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle> 
    2626 
    27     <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT')); ?></updated> 
     27    <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated> 
    2828    <?php the_generator( 'atom' ); ?> 
    2929 
     
    6666 
    6767        <id><?php comment_guid(); ?></id> 
    68         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></updated> 
    69         <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></published> 
     68        <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></updated> 
     69        <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></published> 
    7070<?php if ( post_password_required($comment_post) ) : ?> 
    7171        <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content> 
  • trunk/wp-includes/feed-atom.php

    r10952 r11323  
    2020    <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> 
    2121 
    22     <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></updated> 
     22    <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated> 
    2323    <?php the_generator( 'atom' ); ?> 
    2424 
  • trunk/wp-includes/feed-rss2-comments.php

    r11303 r11323  
    5151        <link><?php comment_link() ?></link> 
    5252        <dc:creator><?php echo get_comment_author_rss() ?></dc:creator> 
    53         <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate> 
     53        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate> 
    5454        <guid isPermaLink="false"><?php comment_guid() ?></guid> 
    5555<?php if ( post_password_required($comment_post) ) : ?> 
  • trunk/wp-includes/functions.php

    r11315 r11323  
    123123    $j = @$datefunc( $dateformatstring, $i ); 
    124124    // allow plugins to redo this entirely for languages with untypical grammars 
    125     $j = apply_filters('date_i18n', $j, $req_format, $unixtimestamp, $gmt); 
     125    $j = apply_filters('date_i18n', $j, $req_format, $i, $gmt); 
    126126    return $j; 
    127127} 
  • trunk/wp-includes/general-template.php

    r11312 r11323  
    11781178function the_date_xml() { 
    11791179    global $post; 
    1180     echo mysql2date('Y-m-d', $post->post_date); 
     1180    echo mysql2date('Y-m-d', $post->post_date, false); 
    11811181} 
    11821182 
     
    12371237function get_the_modified_date($d = '') { 
    12381238    if ( '' == $d ) 
    1239         $the_time = get_post_modified_time(get_option('date_format')); 
     1239        $the_time = get_post_modified_time(get_option('date_format'), null, null, true); 
    12401240    else 
    1241         $the_time = get_post_modified_time($d); 
     1241        $the_time = get_post_modified_time($d, null, null, true); 
    12421242    return apply_filters('get_the_modified_date', $the_time, $d); 
    12431243} 
     
    12671267 
    12681268    if ( '' == $d ) 
    1269         $the_time = get_post_time(get_option('time_format'), false, $post); 
     1269        $the_time = get_post_time(get_option('time_format'), false, $post, true); 
    12701270    else 
    1271         $the_time = get_post_time($d, false, $post); 
     1271        $the_time = get_post_time($d, false, $post, true); 
    12721272    return apply_filters('get_the_time', $the_time, $d, $post); 
    12731273} 
     
    12811281 * @param bool $gmt Whether of not to return the gmt time. 
    12821282 * @param int|object $post Optional post ID or object. Default is global $post object. 
     1283 * @param bool $translate Whether to translate the time string or not 
    12831284 * @return string 
    12841285 */ 
    1285 function get_post_time( $d = 'U', $gmt = false, $post = null ) { // returns timestamp 
     1286function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { // returns timestamp 
    12861287    $post = get_post($post); 
    12871288 
     
    12911292        $time = $post->post_date; 
    12921293 
    1293     $time = mysql2date($d, $time); 
     1294    $time = mysql2date($d, $time, $translate); 
    12941295    return apply_filters('get_post_time', $time, $d, $gmt); 
    12951296} 
     
    13161317function get_the_modified_time($d = '') { 
    13171318    if ( '' == $d ) 
    1318         $the_time = get_post_modified_time(get_option('time_format')); 
     1319        $the_time = get_post_modified_time(get_option('time_format'), null, null, true); 
    13191320    else 
    1320         $the_time = get_post_modified_time($d); 
     1321        $the_time = get_post_modified_time($d, null, null, true); 
    13211322    return apply_filters('get_the_modified_time', $the_time, $d); 
    13221323} 
     
    13291330 * @param string $d Either 'G', 'U', or php date format. 
    13301331 * @param bool $gmt Whether of not to return the gmt time. 
     1332 * @param int|object $post A post_id or post object 
     1333 * @param bool translate Whether to translate the result or not 
    13311334 * @return string Returns timestamp 
    13321335 */ 
    1333 function get_post_modified_time( $d = 'U', $gmt = false ) { 
    1334     global $post; 
     1336function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { 
     1337    $post = get_post($post); 
    13351338 
    13361339    if ( $gmt ) 
     
    13381341    else 
    13391342        $time = $post->post_modified; 
    1340     $time = mysql2date($d, $time); 
     1343    $time = mysql2date($d, $time, $translate); 
    13411344 
    13421345    return apply_filters('get_the_modified_time', $time, $d, $gmt); 
     
    13521355function the_weekday() { 
    13531356    global $wp_locale, $post; 
    1354     $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date)); 
     1357    $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); 
    13551358    $the_weekday = apply_filters('the_weekday', $the_weekday); 
    13561359    echo $the_weekday; 
     
    13731376    if ( $day != $previousweekday ) { 
    13741377        $the_weekday_date .= $before; 
    1375         $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date)); 
     1378        $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false)); 
    13761379        $the_weekday_date .= $after; 
    13771380        $previousweekday = $day; 
  • trunk/wp-includes/post.php

    r11305 r11323  
    14681468    if ( 'publish' == $post_status ) { 
    14691469        $now = gmdate('Y-m-d H:i:59'); 
    1470         if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) ) 
     1470        if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) 
    14711471            $post_status = 'future'; 
    14721472    } 
  • trunk/wp-includes/query.php

    r11259 r11323  
    26612661    $authordata = get_userdata($post->post_author); 
    26622662 
    2663     $day = mysql2date('d.m.y', $post->post_date); 
    2664     $currentmonth = mysql2date('m', $post->post_date); 
     2663    $day = mysql2date('d.m.y', $post->post_date, false); 
     2664    $currentmonth = mysql2date('m', $post->post_date, false); 
    26652665    $numpages = 1; 
    26662666    $page = get_query_var('page'); 
  • trunk/xmlrpc.php

    r11190 r11323  
    524524 
    525525            // Format page date. 
    526             $page_date = mysql2date("Ymd\TH:i:s", $page->post_date); 
    527             $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt); 
     526            $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false); 
     527            $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false); 
    528528 
    529529            // Pull the categories info together. 
     
    800800        $num_pages = count($page_list); 
    801801        for($i = 0; $i < $num_pages; $i++) { 
    802             $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date); 
    803             $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt); 
     802            $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false); 
     803            $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false); 
    804804 
    805805            $page_list[$i]->dateCreated = new IXR_Date($post_date); 
     
    10481048 
    10491049        // Format page date. 
    1050         $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date); 
    1051         $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt); 
     1050        $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false); 
     1051        $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false); 
    10521052 
    10531053        if ( 0 == $comment->comment_approved ) 
     
    16801680        $struct = array( 
    16811681            'userid'    => $post_data['post_author'], 
    1682             'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])), 
     1682            'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)), 
    16831683            'content'     => $content, 
    16841684            'postid'  => $post_data['ID'] 
     
    17221722                continue; 
    17231723 
    1724             $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); 
     1724            $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); 
    17251725            $categories = implode(',', wp_get_post_categories($entry['ID'])); 
    17261726 
     
    25722572 
    25732573        if ($postdata['post_date'] != '') { 
    2574             $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date']); 
    2575             $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt']); 
     2574            $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false); 
     2575            $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false); 
    25762576 
    25772577            $categories = array(); 
     
    26882688                continue; 
    26892689 
    2690             $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); 
    2691             $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']); 
     2690            $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); 
     2691            $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); 
    26922692 
    26932693            $categories = array(); 
     
    29232923                continue; 
    29242924 
    2925             $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); 
    2926             $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt']); 
     2925            $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false); 
     2926            $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false); 
    29272927 
    29282928            $struct[] = array( 
Note: See TracChangeset for help on using the changeset viewer.