Changeset 10251 for sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php
- Timestamp:
- 09/11/2020 06:08:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php
r10244 r10251 328 328 'title' => $wordcamp->title->rendered, 329 329 'description' => $wordcamp->content->rendered, 330 'utc_offset' => self::get_wordcamp_offset( $wordcamp ), 330 331 ); 331 332 … … 396 397 } 397 398 398 if ( $wordcamp->{'Event Timezone'} && $event['start_timestamp'] ) {399 $wordcamp_timezone = new DateTimeZone( $wordcamp->{'Event Timezone'} );400 401 $wordcamp_datetime = new DateTime(402 '@' . $event['start_timestamp'],403 $wordcamp_timezone404 );405 406 $event['utc_offset'] = $wordcamp_timezone->getOffset( $wordcamp_datetime );407 }408 409 399 $events[] = new Official_WordPress_Event( $event ); 410 400 } … … 412 402 413 403 return $events; 404 } 405 406 /** 407 * Get a WordCamp's UTC offset in seconds. 408 * 409 * @param object $wordcamp 410 * 411 * @return int 412 * @throws Exception 413 */ 414 static function get_wordcamp_offset( $wordcamp ) { 415 if ( ! $wordcamp->{'Event Timezone'} || ! $wordcamp->{'Start Date (YYYY-mm-dd)'} ) { 416 return 0; 417 } 418 419 $wordcamp_timezone = new DateTimeZone( $wordcamp->{'Event Timezone'} ); 420 421 $wordcamp_datetime = new DateTime( 422 '@' . $wordcamp->{'Start Date (YYYY-mm-dd)'}, 423 $wordcamp_timezone 424 ); 425 426 return $wordcamp_timezone->getOffset( $wordcamp_datetime ); 414 427 } 415 428
Note: See TracChangeset
for help on using the changeset viewer.