summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/_inc/lib/icalendar-reader.php')
-rw-r--r--plugins/jetpack/_inc/lib/icalendar-reader.php19
1 files changed, 2 insertions, 17 deletions
diff --git a/plugins/jetpack/_inc/lib/icalendar-reader.php b/plugins/jetpack/_inc/lib/icalendar-reader.php
index f7e047f9..998f4c13 100644
--- a/plugins/jetpack/_inc/lib/icalendar-reader.php
+++ b/plugins/jetpack/_inc/lib/icalendar-reader.php
@@ -90,17 +90,7 @@ class iCalendarReader {
}
// get timezone offset from the timezone name.
- $timezone_name = get_option( 'timezone_string' );
- if ( $timezone_name ) {
- $timezone = new DateTimeZone( $timezone_name );
- $timezone_offset_interval = false;
- } else {
- // If the timezone isn't set then the GMT offset must be set.
- // generate a DateInterval object from the timezone offset
- $gmt_offset = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
- $timezone_offset_interval = date_interval_create_from_date_string( "{$gmt_offset} seconds" );
- $timezone = new DateTimeZone( 'UTC' );
- }
+ $timezone = wp_timezone();
$offsetted_events = array();
@@ -115,11 +105,6 @@ class iCalendarReader {
$end_time = new DateTime( $end_time, $this->timezone );
$end_time->setTimeZone( $timezone );
- if ( $timezone_offset_interval ) {
- $start_time->add( $timezone_offset_interval );
- $end_time->add( $timezone_offset_interval );
- }
-
$event['DTSTART'] = $start_time->format( 'YmdHis\Z' );
$event['DTEND'] = $end_time->format( 'YmdHis\Z' );
}
@@ -895,7 +880,7 @@ class iCalendarReader {
* @return array
*/
function icalendar_get_events( $url = '', $count = 5 ) {
- // Find your calendar's address http://support.google.com/calendar/bin/answer.py?hl=en&answer=37103
+ // Find your calendar's address https://support.google.com/calendar/bin/answer.py?hl=en&answer=37103
$ical = new iCalendarReader();
return $ical->get_events( $url, $count );
}