diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 0f1f0f4e04..1056997831 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -1476,7 +1476,7 @@ function wp_ajax_add_meta() { $post_data['post_status'] = 'draft'; $now = time(); /* translators: 1: Post creation date, 2: Post creation time */ - $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), date( __( 'F j, Y' ), $now ), date( __( 'g:i a' ), $now ) ); + $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) ); $pid = edit_post( $post_data ); if ( $pid ) { diff --git a/src/wp-admin/includes/class-ftp.php b/src/wp-admin/includes/class-ftp.php index f1d40a4ffd..60fb2a19f6 100644 --- a/src/wp-admin/includes/class-ftp.php +++ b/src/wp-admin/includes/class-ftp.php @@ -207,7 +207,7 @@ class ftp_base { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) { - $b['year'] = date("Y"); + $b['year'] = gmdate("Y"); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { diff --git a/src/wp-admin/includes/class-wp-filesystem-direct.php b/src/wp-admin/includes/class-wp-filesystem-direct.php index 41839097f0..9b1757cc65 100644 --- a/src/wp-admin/includes/class-wp-filesystem-direct.php +++ b/src/wp-admin/includes/class-wp-filesystem-direct.php @@ -598,8 +598,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); - $struc['lastmod'] = date( 'M j', $struc['lastmodunix'] ); - $struc['time'] = date( 'h:i:s', $struc['lastmodunix'] ); + $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); + $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' == $struc['type'] ) { diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php index 1db0a57917..26d1454c9a 100644 --- a/src/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/src/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -621,7 +621,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { $b['month'] = $lucifer[5]; $b['day'] = $lucifer[6]; if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) { - $b['year'] = date( 'Y' ); + $b['year'] = gmdate( 'Y' ); $b['hour'] = $l2[1]; $b['minute'] = $l2[2]; } else { diff --git a/src/wp-admin/includes/class-wp-filesystem-ssh2.php b/src/wp-admin/includes/class-wp-filesystem-ssh2.php index b87a195724..47eb8e7ae9 100644 --- a/src/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/src/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -744,8 +744,8 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { $struc['group'] = $this->group( $path . '/' . $entry ); $struc['size'] = $this->size( $path . '/' . $entry ); $struc['lastmodunix'] = $this->mtime( $path . '/' . $entry ); - $struc['lastmod'] = date( 'M j', $struc['lastmodunix'] ); - $struc['time'] = date( 'h:i:s', $struc['lastmodunix'] ); + $struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] ); + $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; if ( 'd' == $struc['type'] ) { diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index ad02909c74..9563fe37ab 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -863,11 +863,11 @@ function wp_dashboard_recent_posts( $args ) { $posts->the_post(); $time = get_the_time( 'U' ); - if ( date( 'Y-m-d', $time ) == $today ) { + if ( gmdate( 'Y-m-d', $time ) == $today ) { $relative = __( 'Today' ); - } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { + } elseif ( gmdate( 'Y-m-d', $time ) == $tomorrow ) { $relative = __( 'Tomorrow' ); - } elseif ( date( 'Y', $time ) !== $year ) { + } elseif ( gmdate( 'Y', $time ) !== $year ) { /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ $relative = date_i18n( __( 'M jS Y' ), $time ); } else { diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index 5600371455..bdf9fad69c 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -79,7 +79,7 @@ function export_wp( $args = array() ) { if ( ! empty( $sitename ) ) { $sitename .= '.'; } - $date = date( 'Y-m-d' ); + $date = gmdate( 'Y-m-d' ); $wp_filename = $sitename . 'WordPress.' . $date . '.xml'; /** * Filters the export filename. @@ -129,11 +129,11 @@ function export_wp( $args = array() ) { } if ( $args['start_date'] ) { - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime( $args['start_date'] ) ) ); + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) ); } if ( $args['end_date'] ) { - $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) ); + $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) ); } } @@ -458,7 +458,7 @@ function export_wp( $args = array() ) { <?php bloginfo_rss( 'name' ); ?> - + diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index dc341bf9f3..8e31335944 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -170,10 +170,10 @@ function _wp_translate_postdata( $update = false, $post_data = null ) { $hh = $post_data['hh']; $mn = $post_data['mn']; $ss = $post_data['ss']; - $aa = ( $aa <= 0 ) ? date( 'Y' ) : $aa; - $mm = ( $mm <= 0 ) ? date( 'n' ) : $mm; + $aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa; + $mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm; $jj = ( $jj > 31 ) ? 31 : $jj; - $jj = ( $jj <= 0 ) ? date( 'j' ) : $jj; + $jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj; $hh = ( $hh > 23 ) ? $hh - 24 : $hh; $mn = ( $mn > 59 ) ? $mn - 60 : $mn; $ss = ( $ss > 59 ) ? $ss - 60 : $ss; diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 4de9b109f4..38fdb9b25c 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -941,7 +941,7 @@ function upgrade_110() { $time_difference = $all_options->time_difference; - $server_time = time() + date( 'Z' ); + $server_time = time() + gmdate( 'Z' ); $weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS; $gmt_time = time(); diff --git a/src/wp-admin/options-permalink.php b/src/wp-admin/options-permalink.php index 8e064faebe..a7cb9c5d84 100644 --- a/src/wp-admin/options-permalink.php +++ b/src/wp-admin/options-permalink.php @@ -202,11 +202,11 @@ $structures = array( - + - + diff --git a/src/wp-includes/IXR/class-IXR-date.php b/src/wp-includes/IXR/class-IXR-date.php index 7304f603b5..fc80cda4a1 100644 --- a/src/wp-includes/IXR/class-IXR-date.php +++ b/src/wp-includes/IXR/class-IXR-date.php @@ -37,12 +37,12 @@ class IXR_Date { function parseTimestamp($timestamp) { - $this->year = date('Y', $timestamp); - $this->month = date('m', $timestamp); - $this->day = date('d', $timestamp); - $this->hour = date('H', $timestamp); - $this->minute = date('i', $timestamp); - $this->second = date('s', $timestamp); + $this->year = gmdate('Y', $timestamp); + $this->month = gmdate('m', $timestamp); + $this->day = gmdate('d', $timestamp); + $this->hour = gmdate('H', $timestamp); + $this->minute = gmdate('i', $timestamp); + $this->second = gmdate('s', $timestamp); $this->timezone = ''; } diff --git a/src/wp-includes/IXR/class-IXR-server.php b/src/wp-includes/IXR/class-IXR-server.php index 095e44557b..9702ba28b7 100644 --- a/src/wp-includes/IXR/class-IXR-server.php +++ b/src/wp-includes/IXR/class-IXR-server.php @@ -151,7 +151,7 @@ EOD; header('Content-Type: text/xml; charset='.$charset); else header('Content-Type: text/xml'); - header('Date: '.date('r')); + header('Date: '.gmdate('r')); echo $xml; exit; } diff --git a/src/wp-includes/bookmark-template.php b/src/wp-includes/bookmark-template.php index 78025b4550..85804125fb 100644 --- a/src/wp-includes/bookmark-template.php +++ b/src/wp-includes/bookmark-template.php @@ -87,7 +87,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) { $title .= ' ('; $title .= sprintf( __( 'Last updated: %s' ), - date( + gmdate( get_option( 'links_updated_date_format' ), $bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php index b3bc907f9a..f939e33ac0 100644 --- a/src/wp-includes/class-wp.php +++ b/src/wp-includes/class-wp.php @@ -443,7 +443,7 @@ class WP { } if ( ! $wp_last_modified ) { - $wp_last_modified = date( 'D, d M Y H:i:s' ); + $wp_last_modified = gmdate( 'D, d M Y H:i:s' ); } $wp_last_modified .= ' GMT'; diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index 5e89ef7695..6c2f332893 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -337,7 +337,7 @@ function get_lastcommentmodified( $timezone = 'server' ) { $comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" ); break; case 'server': - $add_seconds_server = date( 'Z' ); + $add_seconds_server = gmdate( 'Z' ); $comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) ); break; diff --git a/src/wp-includes/date.php b/src/wp-includes/date.php index 8d82db784e..fa464c6dac 100644 --- a/src/wp-includes/date.php +++ b/src/wp-includes/date.php @@ -317,7 +317,7 @@ class WP_Date_Query { $_year = $date_query['year']; } - $max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1; + $max_days_of_year = gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1; } else { // otherwise we use the max of 366 (leap-year) $max_days_of_year = 366; @@ -352,7 +352,7 @@ class WP_Date_Query { * If we have a specific year, use it to calculate number of weeks. * Note: the number of weeks in a year is the date in which Dec 28 appears. */ - $week_count = date( 'W', mktime( 0, 0, 0, 12, 28, $_year ) ); + $week_count = gmdate( 'W', mktime( 0, 0, 0, 12, 28, $_year ) ); } else { // Otherwise set the week-count to a maximum of 53. @@ -923,7 +923,7 @@ class WP_Date_Query { } if ( ! isset( $datetime['day'] ) ) { - $datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1; + $datetime['day'] = ( $default_to_max ) ? (int) gmdate( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1; } if ( ! isset( $datetime['hour'] ) ) { diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index d928a2891f..dc6134eea6 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -960,7 +960,7 @@ function get_links($category = -1, $before = '', $after = '
', $between = ' if ( $show_updated ) if (substr($row->link_updated_f, 0, 2) != '00') - $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; + $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; if ( '' != $title ) $title = ' title="' . $title . '"'; diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 3d51852798..bd879e4835 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -3432,13 +3432,13 @@ function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) { if ( $tz ) { $datetime = date_create( $string, new DateTimeZone( 'UTC' ) ); if ( ! $datetime ) { - return date( $format, 0 ); + return gmdate( $format, 0 ); } $datetime->setTimezone( new DateTimeZone( $tz ) ); $string_localtime = $datetime->format( $format ); } else { if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) { - return date( $format, 0 ); + return gmdate( $format, 0 ); } $string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] ); $string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ce45499d0c..c9f817011a 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -41,7 +41,7 @@ function mysql2date( $format, $date, $translate = true ) { if ( $translate ) { return date_i18n( $format, $i ); } else { - return date( $format, $i ); + return gmdate( $format, $i ); } } @@ -111,12 +111,12 @@ function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = fa $dateformatstring = preg_replace( '/(?month ) ) && ( ! empty( $wp_locale->weekday ) ) ) { - $datemonth = $wp_locale->get_month( date( 'm', $i ) ); + $datemonth = $wp_locale->get_month( gmdate( 'm', $i ) ); $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); - $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) ); + $dateweekday = $wp_locale->get_weekday( gmdate( 'w', $i ) ); $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); - $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) ); - $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) ); + $datemeridiem = $wp_locale->get_meridiem( gmdate( 'a', $i ) ); + $datemeridiem_capital = $wp_locale->get_meridiem( gmdate( 'A', $i ) ); $dateformatstring = ' ' . $dateformatstring; $dateformatstring = preg_replace( '/([^\\\])D/', "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); $dateformatstring = preg_replace( '/([^\\\])F/', "\\1" . backslashit( $datemonth ), $dateformatstring ); @@ -177,7 +177,7 @@ function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = fa } } } - $j = @date( $dateformatstring, $i ); + $j = @gmdate( $dateformatstring, $i ); /** * Filters the date formatted based on the locale. @@ -415,7 +415,7 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) { $day = mktime( 0, 0, 0, $md, $mm, $my ); // The day of the week from the timestamp. - $weekday = date( 'w', $day ); + $weekday = gmdate( 'w', $day ); if ( ! is_numeric( $start_of_week ) ) { $start_of_week = get_option( 'start_of_week' ); diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 633619cf4d..50323da6b9 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -2107,7 +2107,7 @@ function get_calendar( $initial = true, $echo = true ) { } $unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear ); - $last_day = date( 't', $unixmonth ); + $last_day = gmdate( 't', $unixmonth ); // Get the next and previous month and year with at least one post $previous = $wpdb->get_row( @@ -2133,7 +2133,7 @@ function get_calendar( $initial = true, $echo = true ) { ' . sprintf( $calendar_caption, $wp_locale->get_month( $thismonth ), - date( 'Y', $unixmonth ) + gmdate( 'Y', $unixmonth ) ) . ' '; @@ -2199,13 +2199,13 @@ function get_calendar( $initial = true, $echo = true ) { } // See how much we should pad in the beginning - $pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins ); + $pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins ); if ( 0 != $pad ) { $calendar_output .= "\n\t\t" . ' '; } $newrow = false; - $daysinmonth = (int) date( 't', $unixmonth ); + $daysinmonth = (int) gmdate( 't', $unixmonth ); for ( $day = 1; $day <= $daysinmonth; ++$day ) { if ( isset( $newrow ) && $newrow ) { @@ -2223,7 +2223,7 @@ function get_calendar( $initial = true, $echo = true ) { if ( in_array( $day, $daywithpost ) ) { // any posts today? - $date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); + $date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) ); /* translators: Post calendar label. %s: Date */ $label = sprintf( __( 'Posts published on %s' ), $date_format ); $calendar_output .= sprintf( @@ -2237,12 +2237,12 @@ function get_calendar( $initial = true, $echo = true ) { } $calendar_output .= ''; - if ( 6 == calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { + if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { $newrow = true; } } - $pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); + $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); if ( $pad != 0 && $pad != 7 ) { $calendar_output .= "\n\t\t" . ' '; } @@ -4452,7 +4452,7 @@ function get_the_generator( $type = '' ) { $gen = ''; break; case 'export': - $gen = ''; + $gen = ''; break; } diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 3526239d3f..77b18c6fca 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -212,7 +212,7 @@ function get_permalink( $post = 0, $leavename = false ) { $author = $authordata->user_nicename; } - $date = explode( ' ', date( 'Y m d H i s', $unixtime ) ); + $date = explode( ' ', gmdate( 'Y m d H i s', $unixtime ) ); $rewritereplace = array( $date[0], diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 54e6c14f3b..5856af56ca 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -6031,8 +6031,8 @@ function wp_check_for_changed_slugs( $post_id, $post, $post_before ) { * @param WP_Post $post_before The Previous Post Object */ function wp_check_for_changed_dates( $post_id, $post, $post_before ) { - $previous_date = date( 'Y-m-d', strtotime( $post_before->post_date ) ); - $new_date = date( 'Y-m-d', strtotime( $post->post_date ) ); + $previous_date = gmdate( 'Y-m-d', strtotime( $post_before->post_date ) ); + $new_date = gmdate( 'Y-m-d', strtotime( $post->post_date ) ); // Don't bother if it hasn't changed. if ( $new_date == $previous_date ) { return; @@ -6286,7 +6286,7 @@ function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { $date = $wpdb->get_var( "SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; case 'server': - $add_seconds_server = date( 'Z' ); + $add_seconds_server = gmdate( 'Z' ); $date = $wpdb->get_var( "SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" ); break; } diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index 1c73b97824..adcca17d3b 100644 --- a/src/wp-includes/rest-api.php +++ b/src/wp-includes/rest-api.php @@ -924,10 +924,10 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) { // Timezone conversion needs to be handled differently between these two // cases. if ( ! $is_utc && ! $has_timezone ) { - $local = date( 'Y-m-d H:i:s', $date ); + $local = gmdate( 'Y-m-d H:i:s', $date ); $utc = get_gmt_from_date( $local ); } else { - $utc = date( 'Y-m-d H:i:s', $date ); + $utc = gmdate( 'Y-m-d H:i:s', $date ); $local = get_date_from_gmt( $utc ); } diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index f24bc068c8..ee8af5b3ad 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1478,7 +1478,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { // based on the `post_modified` field with the site's timezone // offset applied. if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) { - $post_modified_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) ); + $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) ); } else { $post_modified_gmt = $post->post_modified_gmt; } diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index 8aab4ca5ad..19c3019881 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -925,7 +925,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller { } if ( in_array( 'registered_date', $fields, true ) ) { - $data['registered_date'] = date( 'c', strtotime( $user->user_registered ) ); + $data['registered_date'] = gmdate( 'c', strtotime( $user->user_registered ) ); } if ( in_array( 'capabilities', $fields, true ) ) { diff --git a/tests/phpunit/includes/testcase-rest-post-type-controller.php b/tests/phpunit/includes/testcase-rest-post-type-controller.php index 832650855f..b25aed0fd2 100644 --- a/tests/phpunit/includes/testcase-rest-post-type-controller.php +++ b/tests/phpunit/includes/testcase-rest-post-type-controller.php @@ -10,7 +10,7 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C $this->assertEquals( $post->post_name, $data['slug'] ); $this->assertEquals( get_permalink( $post->ID ), $data['link'] ); if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { - $post_date_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_date ) - ( get_option( 'gmt_offset' ) * 3600 ) ); + $post_date_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_date ) - ( get_option( 'gmt_offset' ) * 3600 ) ); $this->assertEquals( mysql_to_rfc3339( $post_date_gmt ), $data['date_gmt'] ); } else { $this->assertEquals( mysql_to_rfc3339( $post->post_date_gmt ), $data['date_gmt'] ); @@ -18,7 +18,7 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C $this->assertEquals( mysql_to_rfc3339( $post->post_date ), $data['date'] ); if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) { - $post_modified_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) ); + $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) ); $this->assertEquals( mysql_to_rfc3339( $post_modified_gmt ), $data['modified_gmt'] ); } else { $this->assertEquals( mysql_to_rfc3339( $post->post_modified_gmt ), $data['modified_gmt'] ); diff --git a/tests/phpunit/tests/admin/includesCommunityEvents.php b/tests/phpunit/tests/admin/includesCommunityEvents.php index 911d052f3c..995c5a1288 100644 --- a/tests/phpunit/tests/admin/includesCommunityEvents.php +++ b/tests/phpunit/tests/admin/includesCommunityEvents.php @@ -164,7 +164,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { $this->assertNotWPError( $response ); $this->assertEqualSetsWithIndex( $this->get_user_location(), $response['location'] ); - $this->assertEquals( date( 'l, M j, Y', strtotime( 'next Sunday 1pm' ) ), $response['events'][0]['formatted_date'] ); + $this->assertEquals( gmdate( 'l, M j, Y', strtotime( 'next Sunday 1pm' ) ), $response['events'][0]['formatted_date'] ); $this->assertEquals( '1:00 pm', $response['events'][0]['formatted_time'] ); remove_filter( 'pre_http_request', array( $this, '_http_request_valid_response' ) ); @@ -185,7 +185,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { $this->assertNotWPError( $cached_events ); $this->assertEqualSetsWithIndex( $this->get_user_location(), $cached_events['location'] ); - $this->assertEquals( date( 'l, M j, Y', strtotime( 'next Sunday 1pm' ) ), $cached_events['events'][0]['formatted_date'] ); + $this->assertEquals( gmdate( 'l, M j, Y', strtotime( 'next Sunday 1pm' ) ), $cached_events['events'][0]['formatted_date'] ); $this->assertEquals( '1:00 pm', $cached_events['events'][0]['formatted_time'] ); remove_filter( 'pre_http_request', array( $this, '_http_request_valid_response' ) ); @@ -211,7 +211,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/events/236031233/', 'meetup' => 'The East Bay WordPress Meetup Group', 'meetup_url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Sunday 1pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Sunday 1pm' ) ), 'location' => array( 'location' => 'Oakland, CA, USA', 'country' => 'us', @@ -225,7 +225,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/events/237706839/', 'meetup' => 'WordPress Bay Area Foothills Group', 'meetup_url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Wednesday 1:30pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Wednesday 1:30pm' ) ), 'location' => array( 'location' => 'Milpitas, CA, USA', 'country' => 'us', @@ -239,7 +239,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://2017.kansascity.wordcamp.org', 'meetup' => null, 'meetup_url' => null, - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Saturday' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Saturday' ) ), 'location' => array( 'location' => 'Kansas City, MO', 'country' => 'US', @@ -303,7 +303,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/events/236031233/', 'meetup' => 'The East Bay WordPress Meetup Group', 'meetup_url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Monday 1pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Monday 1pm' ) ), 'location' => array( 'location' => 'Oakland, CA, USA', 'country' => 'us', @@ -317,7 +317,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/events/237706839/', 'meetup' => 'WordPress Bay Area Foothills Group', 'meetup_url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Tuesday 1:30pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Tuesday 1:30pm' ) ), 'location' => array( 'location' => 'Milpitas, CA, USA', 'country' => 'us', @@ -331,7 +331,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/sanjosewp/events/245419844/', 'meetup' => 'The San Jose WordPress Meetup', 'meetup_url' => 'https://www.meetup.com/sanjosewp/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Wednesday 5:30pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Wednesday 5:30pm' ) ), 'location' => array( 'location' => 'Milpitas, CA, USA', 'country' => 'us', @@ -345,7 +345,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://2018.sandiego.wordcamp.org', 'meetup' => null, 'meetup_url' => null, - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Thursday 9am' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Thursday 9am' ) ), 'location' => array( 'location' => 'San Diego, CA', 'country' => 'US', @@ -406,7 +406,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/events/236031233/', 'meetup' => 'The East Bay WordPress Meetup Group', 'meetup_url' => 'https://www.meetup.com/Eastbay-WordPress-Meetup/', - 'date' => date( 'Y-m-d H:i:s', strtotime( '2 days ago' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( '2 days ago' ) ), 'location' => array( 'location' => 'Oakland, CA, USA', 'country' => 'us', @@ -420,7 +420,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://2018.sandiego.wordcamp.org', 'meetup' => null, 'meetup_url' => null, - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Tuesday 9am' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Tuesday 9am' ) ), 'location' => array( 'location' => 'San Diego, CA', 'country' => 'US', @@ -434,7 +434,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/events/237706839/', 'meetup' => 'WordPress Bay Area Foothills Group', 'meetup_url' => 'https://www.meetup.com/Wordpress-Bay-Area-CA-Foothills/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Wednesday 1:30pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Wednesday 1:30pm' ) ), 'location' => array( 'location' => 'Milpitas, CA, USA', 'country' => 'us', @@ -448,7 +448,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://www.meetup.com/sanjosewp/events/245419844/', 'meetup' => 'The San Jose WordPress Meetup', 'meetup_url' => 'https://www.meetup.com/sanjosewp/', - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Thursday 5:30pm' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Thursday 5:30pm' ) ), 'location' => array( 'location' => 'Milpitas, CA, USA', 'country' => 'us', @@ -462,7 +462,7 @@ class Test_WP_Community_Events extends WP_UnitTestCase { 'url' => 'https://2018.la.wordcamp.org', 'meetup' => null, 'meetup_url' => null, - 'date' => date( 'Y-m-d H:i:s', strtotime( 'next Friday 9am' ) ), + 'date' => gmdate( 'Y-m-d H:i:s', strtotime( 'next Friday 9am' ) ), 'location' => array( 'location' => 'Los Angeles, CA', 'country' => 'US', diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index 5f5857629f..06c5ac467c 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -355,7 +355,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { $permalink_structure = '%postname%'; $this->set_permalink_structure( "/$permalink_structure/" ); - $future_date = date( 'Y-m-d H:i:s', time() + 100 ); + $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'future', @@ -377,7 +377,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_link_when_pretty_permalinks_are_disabled() { wp_set_current_user( self::$admin_id ); - $future_date = date( 'Y-m-d H:i:s', time() + 100 ); + $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'future', @@ -400,7 +400,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { wp_set_current_user( self::$admin_id ); - $future_date = date( 'Y-m-d H:i:s', time() + 100 ); + $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'future', @@ -464,7 +464,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { $this->assertContains( '>new_slug-صورة<', $found, $message ); // Scheduled posts should use published permalink - $future_date = date( 'Y-m-d H:i:s', time() + 100 ); + $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'future', @@ -507,7 +507,7 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase { wp_set_current_user( self::$admin_id ); - $future_date = date( 'Y-m-d H:i:s', time() + 100 ); + $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 ); $p = self::factory()->post->create( array( 'post_status' => 'pending', diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index e86a0aa71b..50dda1ec3f 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -13,7 +13,7 @@ class Tests_Basic extends WP_UnitTestCase { $license = file_get_contents( ABSPATH . 'license.txt' ); preg_match( '#Copyright 2011-(\d+) by the contributors#', $license, $matches ); - $this_year = date( 'Y' ); + $this_year = gmdate( 'Y' ); $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." ); } diff --git a/tests/phpunit/tests/comment-submission.php b/tests/phpunit/tests/comment-submission.php index 0760b44dc2..2ad7f49bf5 100644 --- a/tests/phpunit/tests/comment-submission.php +++ b/tests/phpunit/tests/comment-submission.php @@ -133,7 +133,7 @@ class Tests_Comment_Submission extends WP_UnitTestCase { $post = self::factory()->post->create_and_get( array( - 'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ), + 'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '+1 day' ) ), ) ); diff --git a/tests/phpunit/tests/comment/commentsTemplate.php b/tests/phpunit/tests/comment/commentsTemplate.php index b5cc7ef3e3..d5bf72d2f8 100644 --- a/tests/phpunit/tests/comment/commentsTemplate.php +++ b/tests/phpunit/tests/comment/commentsTemplate.php @@ -17,14 +17,14 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); @@ -51,14 +51,14 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); @@ -85,14 +85,14 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); @@ -119,14 +119,14 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); @@ -153,42 +153,42 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); $comment_5 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 500 ), ) ); $comment_6 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 600 ), ) ); @@ -224,42 +224,42 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); $comment_5 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 500 ), ) ); $comment_6 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 600 ), ) ); @@ -295,28 +295,28 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); @@ -352,28 +352,28 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); @@ -411,21 +411,21 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); @@ -463,21 +463,21 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); @@ -513,28 +513,28 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); @@ -592,42 +592,42 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); $comment_5 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 500 ), ) ); $comment_6 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 600 ), ) ); @@ -706,7 +706,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '1', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( @@ -714,7 +714,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '2', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( @@ -722,7 +722,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '3', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_4 = self::factory()->comment->create( @@ -730,7 +730,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '4', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); @@ -762,7 +762,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '1', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( @@ -770,7 +770,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '2', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( @@ -778,7 +778,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '3', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), 'comment_author_email' => $comment_author_email, ) ); @@ -787,7 +787,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '4', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), 'comment_author_email' => $comment_author_email, ) ); @@ -796,7 +796,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '5', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), 'comment_author_email' => $comment_author_email, ) ); @@ -805,7 +805,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '6', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); @@ -842,7 +842,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '1', 'comment_approved' => '0', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), 'comment_author_email' => 'foo@bar.mail', ) ); @@ -878,7 +878,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '1', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); $comment_2 = self::factory()->comment->create( @@ -886,7 +886,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '2', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_3 = self::factory()->comment->create( @@ -895,7 +895,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_content' => '3', 'comment_approved' => '1', 'comment_parent' => $comment_1, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); @@ -923,7 +923,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '1', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); $comment_2 = self::factory()->comment->create( @@ -931,7 +931,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_post_ID' => $p, 'comment_content' => '2', 'comment_approved' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); $comment_3 = self::factory()->comment->create( @@ -940,7 +940,7 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 'comment_content' => '3', 'comment_approved' => '1', 'comment_parent' => $comment_1, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); diff --git a/tests/phpunit/tests/comment/getCommentLink.php b/tests/phpunit/tests/comment/getCommentLink.php index ca75da1532..03ccf923ab 100644 --- a/tests/phpunit/tests/comment/getCommentLink.php +++ b/tests/phpunit/tests/comment/getCommentLink.php @@ -15,42 +15,42 @@ class Tests_Comment_GetCommentLink extends WP_UnitTestCase { array( 'comment_post_ID' => self::$p, 'comment_content' => '1', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 100 ), ) ); self::$comments[] = self::factory()->comment->create( array( 'comment_post_ID' => self::$p, 'comment_content' => '2', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 200 ), ) ); self::$comments[] = self::factory()->comment->create( array( 'comment_post_ID' => self::$p, 'comment_content' => '3', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 300 ), ) ); self::$comments[] = self::factory()->comment->create( array( 'comment_post_ID' => self::$p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 400 ), ) ); self::$comments[] = self::factory()->comment->create( array( 'comment_post_ID' => self::$p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 500 ), ) ); self::$comments[] = self::factory()->comment->create( array( 'comment_post_ID' => self::$p, 'comment_content' => '4', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 600 ), ) ); diff --git a/tests/phpunit/tests/comment/getPageOfComment.php b/tests/phpunit/tests/comment/getPageOfComment.php index 509ecffad6..e492e0e8d4 100644 --- a/tests/phpunit/tests/comment/getPageOfComment.php +++ b/tests/phpunit/tests/comment/getPageOfComment.php @@ -45,7 +45,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $now -= 10 * $i; @@ -57,7 +57,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_type' => 'pingback', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $now -= 10 * $i; @@ -135,7 +135,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 10 * $i ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( 10 * $i ) ), ) ); } @@ -226,20 +226,20 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); @@ -262,13 +262,13 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $comments_0[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[0], - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), ) ); $comments_1[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[1], - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), ) ); } @@ -292,7 +292,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $parent = self::factory()->comment->create( array( 'comment_post_ID' => $post, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( $i * 60 ) ), ) ); $comment_parents[ $i ] = $parent; @@ -300,7 +300,7 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $child = self::factory()->comment->create( array( 'comment_post_ID' => $post, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), 'comment_parent' => $parent, ) ); @@ -336,19 +336,19 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); @@ -369,25 +369,25 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ), ) ); @@ -409,25 +409,25 @@ class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ), ) ); diff --git a/tests/phpunit/tests/comment/metaCache.php b/tests/phpunit/tests/comment/metaCache.php index 834097a76c..a455654e11 100644 --- a/tests/phpunit/tests/comment/metaCache.php +++ b/tests/phpunit/tests/comment/metaCache.php @@ -142,7 +142,7 @@ class Tests_Comment_Meta_Cache extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[0], - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), ) ); } @@ -190,7 +190,7 @@ class Tests_Comment_Meta_Cache extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[0], - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), ) ); } diff --git a/tests/phpunit/tests/comment/query.php b/tests/phpunit/tests/comment/query.php index 211415214b..9966f2d1bd 100644 --- a/tests/phpunit/tests/comment/query.php +++ b/tests/phpunit/tests/comment/query.php @@ -2949,25 +2949,25 @@ class Tests_Comment_Query extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 50 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 50 ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); @@ -2995,25 +2995,25 @@ class Tests_Comment_Query extends WP_UnitTestCase { $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 50 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 50 ), ) ); $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ), ) ); $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ), ) ); $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ), ) ); diff --git a/tests/phpunit/tests/comment/wpAllowComment.php b/tests/phpunit/tests/comment/wpAllowComment.php index 6d3e3ef6d8..a1404b624c 100644 --- a/tests/phpunit/tests/comment/wpAllowComment.php +++ b/tests/phpunit/tests/comment/wpAllowComment.php @@ -42,7 +42,7 @@ class Tests_Comment_WpAllowComment extends WP_UnitTestCase { 'comment_content' => 'Yes, we can!', 'comment_author_IP' => '192.168.0.1', 'comment_parent' => 0, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), 'comment_agent' => 'Bobbot/2.1', 'comment_type' => '', ); @@ -65,7 +65,7 @@ class Tests_Comment_WpAllowComment extends WP_UnitTestCase { 'comment_content' => 'Yes, we can!', 'comment_author_IP' => '192.168.0.1', 'comment_parent' => 0, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now ), 'comment_agent' => 'Bobbot/2.1', 'comment_type' => '', ); diff --git a/tests/phpunit/tests/comment/wpListComments.php b/tests/phpunit/tests/comment/wpListComments.php index da330c7924..9fb94467d0 100644 --- a/tests/phpunit/tests/comment/wpListComments.php +++ b/tests/phpunit/tests/comment/wpListComments.php @@ -16,7 +16,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, ) ); @@ -54,7 +54,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, ) ); @@ -92,7 +92,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, ) ); @@ -138,7 +138,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, ) ); @@ -178,7 +178,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, ) ); @@ -223,7 +223,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase { $comments[] = self::factory()->comment->create( array( 'comment_post_ID' => $p, - 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), + 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ), 'comment_author' => 'Commenter ' . $i, 'user_id' => $u, ) diff --git a/tests/phpunit/tests/date/dateI18n.php b/tests/phpunit/tests/date/dateI18n.php index 408a4ce447..3305856913 100644 --- a/tests/phpunit/tests/date/dateI18n.php +++ b/tests/phpunit/tests/date/dateI18n.php @@ -6,7 +6,7 @@ */ class Tests_Date_I18n extends WP_UnitTestCase { public function test_should_format_date() { - $this->assertEquals( strtotime( date( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); + $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); } public function test_should_use_custom_timestamp() { @@ -14,7 +14,7 @@ class Tests_Date_I18n extends WP_UnitTestCase { } public function test_date_should_be_in_gmt() { - $this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); + $this->assertEquals( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); } public function test_custom_timestamp_ignores_gmt_setting() { @@ -24,13 +24,13 @@ class Tests_Date_I18n extends WP_UnitTestCase { public function test_custom_timezone_setting() { update_option( 'timezone_string', 'America/Regina' ); - $this->assertEquals( strtotime( date( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); + $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s', time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); } public function test_date_should_be_in_gmt_with_custom_timezone_setting() { update_option( 'timezone_string', 'America/Regina' ); - $this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); + $this->assertEquals( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); } public function test_date_should_be_in_gmt_with_custom_timezone_setting_and_timestamp() { diff --git a/tests/phpunit/tests/functions/getArchives.php b/tests/phpunit/tests/functions/getArchives.php index bd7b617250..f3cc4536df 100644 --- a/tests/phpunit/tests/functions/getArchives.php +++ b/tests/phpunit/tests/functions/getArchives.php @@ -15,8 +15,8 @@ class Tests_Get_Archives extends WP_UnitTestCase { function setUp() { parent::setUp(); - $this->month_url = get_month_link( date( 'Y' ), date( 'm' ) ); - $this->year_url = get_year_link( date( 'Y' ) ); + $this->month_url = get_month_link( gmdate( 'Y' ), gmdate( 'm' ) ); + $this->year_url = get_year_link( gmdate( 'Y' ) ); } public static function wpSetUpBeforeClass( $factory ) { @@ -30,12 +30,12 @@ class Tests_Get_Archives extends WP_UnitTestCase { } function test_wp_get_archives_default() { - $expected['default'] = "
  • " . date( 'F Y' ) . '
  • '; + $expected['default'] = "
  • " . gmdate( 'F Y' ) . '
  • '; $this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) ); } function test_wp_get_archives_type() { - $expected['type'] = "
  • " . date( 'Y' ) . '
  • '; + $expected['type'] = "
  • " . gmdate( 'Y' ) . '
  • '; $this->assertEquals( $expected['type'], trim( @@ -86,7 +86,7 @@ EOF; } function test_wp_get_archives_format() { - $expected['format'] = "'; + $expected['format'] = "'; $this->assertEquals( $expected['format'], trim( @@ -101,7 +101,7 @@ EOF; } function test_wp_get_archives_before_and_after() { - $expected['before_and_after'] = "
    " . date( 'F Y' ) . '
    '; + $expected['before_and_after'] = "
    " . gmdate( 'F Y' ) . '
    '; $this->assertEquals( $expected['before_and_after'], trim( @@ -118,7 +118,7 @@ EOF; } function test_wp_get_archives_show_post_count() { - $expected['show_post_count'] = "
  • " . date( 'F Y' ) . ' (8)
  • '; + $expected['show_post_count'] = "
  • " . gmdate( 'F Y' ) . ' (8)
  • '; $this->assertEquals( $expected['show_post_count'], trim( @@ -133,7 +133,7 @@ EOF; } function test_wp_get_archives_echo() { - $expected['echo'] = "\t
  • " . date( 'F Y' ) . '
  • ' . "\n"; + $expected['echo'] = "\t
  • " . gmdate( 'F Y' ) . '
  • ' . "\n"; $this->expectOutputString( $expected['echo'] ); wp_get_archives( array( 'echo' => true ) ); } @@ -147,7 +147,7 @@ EOF; ) ); - $date_full = date( 'F Y' ); + $date_full = gmdate( 'F Y' ); $oct_url = get_month_link( 2012, 10 ); $expected['order_asc'] = <<October 2012 diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 857de42386..112382462a 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -1428,7 +1428,7 @@ EOF; function test_wp_calculate_image_srcset() { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); - $year_month = date( 'Y/m' ); + $year_month = gmdate( 'Y/m' ); $image_meta = wp_get_attachment_metadata( self::$large_id ); $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; @@ -1550,7 +1550,7 @@ EOF; function test_wp_calculate_image_srcset_with_absolute_path_in_meta() { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); - $year_month = date( 'Y/m' ); + $year_month = gmdate( 'Y/m' ); $image_meta = wp_get_attachment_metadata( self::$large_id ); $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; @@ -1831,7 +1831,7 @@ EOF; $srcset = wp_get_attachment_image_srcset( self::$large_id, $size_array, $image_meta ); - $year_month = date( 'Y/m' ); + $year_month = gmdate( 'Y/m' ); $uploads_dir = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; // Set up test cases for all expected size names. @@ -2228,8 +2228,8 @@ EOF; remove_all_filters( 'wp_calculate_image_sizes' ); $actual = wp_get_attachment_image( self::$large_id, 'testsize' ); - $year = date( 'Y' ); - $month = date( 'm' ); + $year = gmdate( 'Y' ); + $month = gmdate( 'm' ); $expected = 'update( $wpdb->signups, array( 'registered' => $date ), array( 'user_login' => 'foo123' ) ); $v = wpmu_validate_user_signup( 'foo123', 'foo2@example.com' ); @@ -123,7 +123,7 @@ if ( is_multisite() ) : remove_filter( 'wpmu_signup_user_notification', '__return_true' ); global $wpdb; - $date = date( 'Y-m-d H:i:s', time() - ( 2 * DAY_IN_SECONDS ) - 60 ); + $date = gmdate( 'Y-m-d H:i:s', time() - ( 2 * DAY_IN_SECONDS ) - 60 ); $wpdb->update( $wpdb->signups, array( 'registered' => $date ), array( 'user_login' => 'foo123' ) ); $v = wpmu_validate_user_signup( 'foo2', 'foo2@example.com' ); diff --git a/tests/phpunit/tests/post/listPages.php b/tests/phpunit/tests/post/listPages.php index 2c5a9a26c2..8d8b85bd52 100644 --- a/tests/phpunit/tests/post/listPages.php +++ b/tests/phpunit/tests/post/listPages.php @@ -49,7 +49,7 @@ class Tests_List_Pages extends WP_UnitTestCase { public static function wpSetupBeforeClass() { self::$time = time(); - $post_date = date( 'Y-m-d H:i:s', self::$time ); + $post_date = gmdate( 'Y-m-d H:i:s', self::$time ); self::$parent_1 = self::factory()->post->create( array( @@ -157,7 +157,7 @@ class Tests_List_Pages extends WP_UnitTestCase { 'depth' => 1, 'show_date' => true, ); - $date = date( get_option( 'date_format' ), self::$time ); + $date = gmdate( get_option( 'date_format' ), self::$time ); $expected = '