Make WordPress Core

Ticket #9730: 9730.3.diff

File 9730.3.diff, 20.9 KB (added by Denis-de-Bernardy, 16 years ago)

refreshed against 11256

  • wp-app.php

     
    11061106                $self_page = $page > 1 ? $page : NULL;
    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>
    11121112<link rel="first" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url() ?>" />
  • wp-includes/feed-atom.php

     
    1919        <title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
    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
    2525        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
  • wp-includes/post.php

     
    14651465
    14661466        if ( 'publish' == $post_status ) {
    14671467                $now = gmdate('Y-m-d H:i:59');
    1468                 if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
     1468                if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) )
    14691469                        $post_status = 'future';
    14701470        }
    14711471
  • wp-includes/comment.php

     
    464464        if ( current_user_can( 'manage_options' ) )
    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 ) {
    471471                        do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
  • wp-includes/functions.php

     
    122122        }
    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}
    128128
  • wp-includes/comment-template.php

     
    353353function get_comment_date( $d = '' ) {
    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);
    359359        return apply_filters('get_comment_date', $date, $d);
     
    591591 *
    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}
    605606
  • wp-includes/feed-atom-comments.php

     
    2424        ?></title>
    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
    3030<?php if ( is_singular() ) { ?>
     
    6565                </author>
    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>
    7272<?php else : // post pass ?>
  • wp-includes/query.php

     
    26602660
    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');
    26672667        if ( !$page )
  • wp-includes/feed-rss2-comments.php

     
    4949                ?></title>
    5050                <link><?php comment_link() ?></link>
    5151                <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
    52                 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
     52                <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>
    5353                <guid isPermaLink="false"><?php comment_guid() ?></guid>
    5454<?php if ( post_password_required($comment_post) ) : ?>
    5555                <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
  • wp-includes/general-template.php

     
    11771177 */
    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
    11831183/**
     
    12361236 */
    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}
    12441244
     
    12661266        $post = get_post($post);
    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}
    12741274
     
    12801280 * @param string $d Either 'G', 'U', or php date format.
    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
    12881289        if ( $gmt )
     
    12901291        else
    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}
    12961297
     
    13151316 */
    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}
    13231324
     
    13281329 *
    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 )
    13371340                $time = $post->post_modified_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);
    13431346}
     
    13511354 */
    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;
    13571360}
     
    13721375        $the_weekday_date = '';
    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;
    13781381        }
  • xmlrpc.php

     
    523523                        $allow_pings = pings_open($page->ID) ? 1 : 0;
    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.
    530530                        $categories = array();
     
    799799                // The date needs to be formated properly.
    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);
    806806                        $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
     
    10471047                        return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
    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 )
    10541054                        $comment_status = 'hold';
     
    16791679
    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']
    16851685                );
     
    17211721                        if( !current_user_can( 'edit_post', $entry['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
    17271727                        $content  = '<title>'.stripslashes($entry['post_title']).'</title>';
     
    25712571                $postdata = wp_get_single_post($post_ID, ARRAY_A);
    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();
    25782578                        $catids = wp_get_post_categories($post_ID);
     
    26872687                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
    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();
    26942694                        $catids = wp_get_post_categories($entry['ID']);
     
    29222922                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
    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(
    29292929                                'dateCreated' => new IXR_Date($post_date),
  • wp-admin/includes/upgrade.php

     
    685685                $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
    686686                if ( !empty($posts) )
    687687                        foreach ( $posts as $post )
    688                                 wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', array($post->ID));
     688                                wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID));
    689689        }
    690690}
    691691
  • wp-admin/includes/template.php

     
    12981298        <div class="comment_status">' . $post->comment_status . '</div>
    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
    13091309        if( $post->post_type == 'page' )
     
    25322532
    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 );
    25432543        $cur_mm = gmdate( 'm', $time_adj );
  • wp-admin/edit-page-form.php

     
    4141        $nonce_action = 'update-page_' . $post_ID;
    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}
    4747
  • wp-admin/edit-attachment-rows.php

     
    131131                } else {
    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 )
    137137                                        $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
  • wp-admin/options-general.php

     
    9696</tr>
    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>
    102102<td>
     
    124124}
    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) : ?>
    130130        <span id="local-time"><?php printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, date_i18n($time_format)); ?></span>
  • wp-admin/edit-form-advanced.php

     
    4141        $autosave = wp_get_post_autosave( $post_ID );
    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 ) ) {
    4747                                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );