Ticket #40657: trac-40657-reduce-timestamp.diff
File trac-40657-reduce-timestamp.diff, 9.2 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 04c31e51d3..9b523f6945 100644
a b function wp_ajax_add_meta() { 1388 1388 $post_data['post_ID'] = $pid; 1389 1389 $post_data['post_type'] = $post->post_type; 1390 1390 $post_data['post_status'] = 'draft'; 1391 $now = current_time( 'timestamp', 1);1391 $now = time(); 1392 1392 /* translators: 1: Post creation date, 2: Post creation time */ 1393 1393 $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), date( __( 'F j, Y' ), $now ), date( __( 'g:i a' ), $now ) ); 1394 1394 -
src/wp-admin/includes/dashboard.php
diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 0c5bb5f5b1..1d3dfb0ea5 100644
a b function wp_dashboard_recent_posts( $args ) { 858 858 859 859 echo '<ul>'; 860 860 861 $today = date( 'Y-m-d', current_time( 'timestamp' ) ); 862 $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); 861 $today = current_time( 'Y-m-d' ); 862 $tomorrow = gmdate( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); 863 $year = current_time( 'Y' ); 863 864 864 865 while ( $posts->have_posts() ) { 865 866 $posts->the_post(); … … function wp_dashboard_recent_posts( $args ) { 869 870 $relative = __( 'Today' ); 870 871 } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { 871 872 $relative = __( 'Tomorrow' ); 872 } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) )) {873 } elseif ( date( 'Y', $time ) !== $year ) { 873 874 /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ 874 875 $relative = date_i18n( __( 'M jS Y' ), $time ); 875 876 } else { -
src/wp-admin/includes/template.php
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 57dd7c2fcd..01af44bd8d 100644
a b function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { 762 762 // todo: Remove this? 763 763 // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />'; 764 764 765 $time_adj = current_time( 'timestamp' );766 765 $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date; 767 $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj);768 $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj);769 $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj);770 $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj);771 $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj);772 $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj);773 774 $cur_jj = gmdate( 'd', $time_adj);775 $cur_mm = gmdate( 'm', $time_adj);776 $cur_aa = gmdate( 'Y', $time_adj);777 $cur_hh = gmdate( 'H', $time_adj);778 $cur_mn = gmdate( 'i', $time_adj);766 $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' ); 767 $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' ); 768 $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : current_time( 'Y' ); 769 $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : current_time( 'H' ); 770 $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : current_time( 'i' ); 771 $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : current_time( 's' ); 772 773 $cur_jj = current_time( 'd' ); 774 $cur_mm = current_time( 'm' ); 775 $cur_aa = current_time( 'Y' ); 776 $cur_hh = current_time( 'H' ); 777 $cur_mn = current_time( 'i' ); 779 778 780 779 $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n"; 781 780 for ( $i = 1; $i < 13; $i = $i + 1 ) { -
src/wp-admin/includes/user.php
diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php index fa868d913d..969c2c3f7d 100644
a b protected function get_timestamp_as_date( $timestamp ) { 1315 1315 return ''; 1316 1316 } 1317 1317 1318 $time_diff = current_time( 'timestamp', true) - $timestamp;1318 $time_diff = time() - $timestamp; 1319 1319 1320 1320 if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { 1321 1321 /* translators: human readable timestamp */ -
src/wp-includes/general-template.php
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index d521a64eab..330c60e67c 100644
a b function get_calendar( $initial = true, $echo = true ) { 1999 1999 } 2000 2000 // week_begins = 0 stands for Sunday 2001 2001 $week_begins = (int) get_option( 'start_of_week' ); 2002 $ts = current_time( 'timestamp' );2003 2002 2004 2003 // Let's figure out when we are 2005 2004 if ( ! empty( $monthnum ) && ! empty( $year ) ) { … … function get_calendar( $initial = true, $echo = true ) { 2019 2018 $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 ); 2020 2019 } 2021 2020 } else { 2022 $thisyear = gmdate( 'Y', $ts);2023 $thismonth = gmdate( 'm', $ts);2021 $thisyear = current_time( 'Y' ); 2022 $thismonth = current_time( 'm' ); 2024 2023 } 2025 2024 2026 2025 $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); … … function get_calendar( $initial = true, $echo = true ) { 2129 2128 } 2130 2129 $newrow = false; 2131 2130 2132 if ( $day == gmdate( 'j', $ts) &&2133 $thismonth == gmdate( 'm', $ts) &&2134 $thisyear == gmdate( 'Y', $ts) ) {2131 if ( $day == current_time( 'j' ) && 2132 $thismonth == current_time( 'm' ) && 2133 $thisyear == current_time( 'Y' ) ) { 2135 2134 $calendar_output .= '<td id="today">'; 2136 2135 } else { 2137 2136 $calendar_output .= '<td>'; -
src/wp-includes/link-template.php
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 815c539a4a..5a888b39e8 100644
a b function get_attachment_link( $post = null, $leavename = false ) { 468 468 function get_year_link( $year ) { 469 469 global $wp_rewrite; 470 470 if ( ! $year ) { 471 $year = gmdate( 'Y', current_time( 'timestamp' ));471 $year = current_time( 'Y' ); 472 472 } 473 473 $yearlink = $wp_rewrite->get_year_permastruct(); 474 474 if ( ! empty( $yearlink ) ) { … … function get_year_link( $year ) { 503 503 function get_month_link( $year, $month ) { 504 504 global $wp_rewrite; 505 505 if ( ! $year ) { 506 $year = gmdate( 'Y', current_time( 'timestamp' ));506 $year = current_time( 'Y' ); 507 507 } 508 508 if ( ! $month ) { 509 $month = gmdate( 'm', current_time( 'timestamp' ));509 $month = current_time( 'm' ); 510 510 } 511 511 $monthlink = $wp_rewrite->get_month_permastruct(); 512 512 if ( ! empty( $monthlink ) ) { … … function get_month_link( $year, $month ) { 544 544 function get_day_link( $year, $month, $day ) { 545 545 global $wp_rewrite; 546 546 if ( ! $year ) { 547 $year = gmdate( 'Y', current_time( 'timestamp' ));547 $year = current_time( 'Y' ); 548 548 } 549 549 if ( ! $month ) { 550 $month = gmdate( 'm', current_time( 'timestamp' ));550 $month = current_time( 'm' ); 551 551 } 552 552 if ( ! $day ) { 553 $day = gmdate( 'j', current_time( 'timestamp' ));553 $day = current_time( 'j' ); 554 554 } 555 555 556 556 $daylink = $wp_rewrite->get_day_permastruct(); -
src/wp-includes/ms-functions.php
diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index f2dbbc750f..e205bf28ff 100644
a b function wpmu_validate_user_signup( $user_name, $user_email ) { 518 518 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name ) ); 519 519 if ( $signup != null ) { 520 520 $registered_at = mysql2date( 'U', $signup->registered ); 521 $now = current_time( 'timestamp', true);521 $now = time(); 522 522 $diff = $now - $registered_at; 523 523 // If registered more than two days ago, cancel registration and let this signup go through. 524 524 if ( $diff > 2 * DAY_IN_SECONDS ) { … … function wpmu_validate_user_signup( $user_name, $user_email ) { 530 530 531 531 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email ) ); 532 532 if ( $signup != null ) { 533 $diff = current_time( 'timestamp', true) - mysql2date( 'U', $signup->registered );533 $diff = time() - mysql2date( 'U', $signup->registered ); 534 534 // If registered more than two days ago, cancel registration and let this signup go through. 535 535 if ( $diff > 2 * DAY_IN_SECONDS ) { 536 536 $wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) ); … … function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) { 688 688 // Has someone already signed up for this domain? 689 689 $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) ); // TODO: Check email too? 690 690 if ( ! empty( $signup ) ) { 691 $diff = current_time( 'timestamp', true) - mysql2date( 'U', $signup->registered );691 $diff = time() - mysql2date( 'U', $signup->registered ); 692 692 // If registered more than two days ago, cancel registration and let this signup go through. 693 693 if ( $diff > 2 * DAY_IN_SECONDS ) { 694 694 $wpdb->delete(