diff --git a/includes/class-solrpower-sync.php b/includes/class-solrpower-sync.php index 7e61a31e..e98055b3 100644 --- a/includes/class-solrpower-sync.php +++ b/includes/class-solrpower-sync.php @@ -288,26 +288,26 @@ function build_document( $doc->setField( 'displaymodified', $post_info->post_modified ); $post_time = strtotime( $post_info->post_date ); - $doc->setField( 'year_i', date( 'Y', $post_time ) ); - $doc->setField( 'month_i', date( 'm', $post_time ) ); - $doc->setField( 'day_i', date( 'd', $post_time ) ); - $doc->setField( 'week_i', date( 'W', $post_time ) ); - $doc->setField( 'dayofweek_i', ( date( 'w', $post_time ) + 1 ) ); - $doc->setField( 'dayofweek_iso_i', date( 'w', $post_time ) ); - $doc->setField( 'hour_i', date( 'H', $post_time ) ); - $doc->setField( 'minute_i', date( 'i', $post_time ) ); - $doc->setField( 'second_i', date( 's', $post_time ) ); + $doc->setField( 'year_i', gmdate( 'Y', $post_time ) ); + $doc->setField( 'month_i', gmdate( 'm', $post_time ) ); + $doc->setField( 'day_i', gmdate( 'd', $post_time ) ); + $doc->setField( 'week_i', gmdate( 'W', $post_time ) ); + $doc->setField( 'dayofweek_i', ( gmdate( 'w', $post_time ) + 1 ) ); + $doc->setField( 'dayofweek_iso_i', gmdate( 'w', $post_time ) ); + $doc->setField( 'hour_i', gmdate( 'H', $post_time ) ); + $doc->setField( 'minute_i', gmdate( 'i', $post_time ) ); + $doc->setField( 'second_i', gmdate( 's', $post_time ) ); $post_time = strtotime( $post_info->post_modified ); - $doc->setField( 'post_modified_year_i', date( 'Y', $post_time ) ); - $doc->setField( 'post_modified_month_i', date( 'm', $post_time ) ); - $doc->setField( 'post_modified_day_i', date( 'd', $post_time ) ); - $doc->setField( 'post_modified_week_i', date( 'W', $post_time ) ); - $doc->setField( 'post_modified_dayofweek_i', ( date( 'w', $post_time ) + 1 ) ); - $doc->setField( 'post_modified_dayofweek_iso_i', date( 'w', $post_time ) ); - $doc->setField( 'post_modified_hour_i', date( 'H', $post_time ) ); - $doc->setField( 'post_modified_minute_i', date( 'i', $post_time ) ); - $doc->setField( 'post_modified_second_i', date( 's', $post_time ) ); + $doc->setField( 'post_modified_year_i', gmdate( 'Y', $post_time ) ); + $doc->setField( 'post_modified_month_i', gmdate( 'm', $post_time ) ); + $doc->setField( 'post_modified_day_i', gmdate( 'd', $post_time ) ); + $doc->setField( 'post_modified_week_i', gmdate( 'W', $post_time ) ); + $doc->setField( 'post_modified_dayofweek_i', ( gmdate( 'w', $post_time ) + 1 ) ); + $doc->setField( 'post_modified_dayofweek_iso_i', gmdate( 'w', $post_time ) ); + $doc->setField( 'post_modified_hour_i', gmdate( 'H', $post_time ) ); + $doc->setField( 'post_modified_minute_i', gmdate( 'i', $post_time ) ); + $doc->setField( 'post_modified_second_i', gmdate( 's', $post_time ) ); $doc->setField( 'post_status', $post_info->post_status ); $doc->setField( 'post_parent', $post_info->post_parent ); diff --git a/includes/class-solrpower-wp-query.php b/includes/class-solrpower-wp-query.php index bfad4522..0b2983ff 100644 --- a/includes/class-solrpower-wp-query.php +++ b/includes/class-solrpower-wp-query.php @@ -968,7 +968,7 @@ function parse_date_query( $date_query ) { } else { $the_date = strtotime( $the_date ); $the_date = ( ( isset( $dq['inclusive'] ) && $dq['inclusive'] ) || $inclusive ) ? $the_date : strtotime( '-1 second', $the_date ); - $the_date = date( 'Y-m-d H:i:s', $the_date ); + $the_date = gmdate( 'Y-m-d H:i:s', $the_date ); $the_date = SolrPower_Sync::get_instance()->format_date( $the_date ); $column = ( isset( $dq['column'] ) ) ? $dq['column'] : 'post_date'; @@ -990,7 +990,7 @@ function parse_date_query( $date_query ) { $the_date = strtotime( $the_date ); $the_date = ( ( isset( $dq['inclusive'] ) && $dq['inclusive'] ) || $inclusive ) ? $the_date : strtotime( '+1 second', $the_date ); - $the_date = date( 'Y-m-d H:i:s', $the_date ); + $the_date = gmdate( 'Y-m-d H:i:s', $the_date ); $the_date = SolrPower_Sync::get_instance()->format_date( $the_date ); $column = ( isset( $dq['column'] ) ) ? $dq['column'] : 'post_date'; @@ -1026,7 +1026,7 @@ function date_query( $dq, $inclusive = false, $type = false ) { && array_key_exists( 'day', $dq ) ) ) { - $the_date = date( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-' . $dq['day'] ) ); + $the_date = gmdate( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-' . $dq['day'] ) ); switch ( $type ) { case 'before': @@ -1052,11 +1052,11 @@ function date_query( $dq, $inclusive = false, $type = false ) { return '(year_i:[* TO ' . $year . '])'; } if ( ! isset( $dq['day'] ) ) { - $the_date = date( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); + $the_date = gmdate( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); if ( ( isset( $dq['inclusive'] ) && true === $dq['inclusive'] ) || true === $inclusive ) { - $the_date = date( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); + $the_date = gmdate( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); } return '(' . $column . ':' . '[* TO ' . $the_date . 'T00:00:00Z])'; @@ -1071,19 +1071,19 @@ function date_query( $dq, $inclusive = false, $type = false ) { return '(year_i:[' . $year . ' TO *])'; } if ( ! isset( $dq['day'] ) ) { - $the_date = date( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); + $the_date = gmdate( 'Y-m-d', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); if ( ( isset( $dq['inclusive'] ) && false === $dq['inclusive'] ) || false === $inclusive ) { - $the_date = date( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); - $the_date = date( 'Y-m-d', strtotime( '+1 Day', strtotime( $the_date ) ) ); + $the_date = gmdate( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-01' ) ); + $the_date = gmdate( 'Y-m-d', strtotime( '+1 Day', strtotime( $the_date ) ) ); } return '(' . $column . ':' . '[' . $the_date . 'T00:00:00Z TO *])'; } else { - $the_date = date( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-' . $dq['day'] ) ); + $the_date = gmdate( 'Y-m-t', strtotime( $dq['year'] . '-' . $dq['month'] . '-' . $dq['day'] ) ); if ( ( isset( $dq['inclusive'] ) && $dq['inclusive'] ) || $inclusive ) { - $the_date = date( 'Y-m-d', strtotime( '+1 Day', strtotime( $the_date ) ) ); + $the_date = gmdate( 'Y-m-d', strtotime( '+1 Day', strtotime( $the_date ) ) ); } return '(' . $column . ':' . '[' . $the_date . 'T00:00:00Z TO *])'; diff --git a/template/s4w_search.php b/template/s4w_search.php index fad3c698..11238568 100644 --- a/template/s4w_search.php +++ b/template/s4w_search.php @@ -107,7 +107,7 @@ $result['authorlink'], $result['author'], get_the_category_list( ', ', '', $result['id'] ), - date( 'm/d/Y', strtotime( $result['date'] ) ), + gmdate( 'm/d/Y', strtotime( $result['date'] ) ), $result['comment_link'], $result['numcomments'] ); diff --git a/template/s4wp_search.php b/template/s4wp_search.php index fad3c698..11238568 100644 --- a/template/s4wp_search.php +++ b/template/s4wp_search.php @@ -107,7 +107,7 @@ $result['authorlink'], $result['author'], get_the_category_list( ', ', '', $result['id'] ), - date( 'm/d/Y', strtotime( $result['date'] ) ), + gmdate( 'm/d/Y', strtotime( $result['date'] ) ), $result['comment_link'], $result['numcomments'] );