summaryrefslogtreecommitdiffstats
path: root/includes/giglogadmin-export-ical-handler.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/giglogadmin-export-ical-handler.php')
-rw-r--r--includes/giglogadmin-export-ical-handler.php72
1 files changed, 30 insertions, 42 deletions
diff --git a/includes/giglogadmin-export-ical-handler.php b/includes/giglogadmin-export-ical-handler.php
index 94309fc..44afbea 100644
--- a/includes/giglogadmin-export-ical-handler.php
+++ b/includes/giglogadmin-export-ical-handler.php
@@ -39,54 +39,42 @@ if ( ! function_exists( 'giglogadmin_export_ical_handler' ) ) {
);
// create a new calendar
- $vcalendar = Vcalendar::factory( array( Vcalendar::UNIQUE_ID => 'kigkonsult.se' ) )
- // with calendaring info
+ $vcalendar = Vcalendar::factory( array( Vcalendar::UNIQUE_ID => 'eternal-terror.com' ) )
->setMethod( Vcalendar::PUBLISH )
- ->setXprop(
- Vcalendar::X_WR_CALNAME,
- 'Calendar Sample'
- )
- ->setXprop(
- Vcalendar::X_WR_CALDESC,
- 'Concert ' . $cfullname . ''
- )
- ->setXprop(
- Vcalendar::X_WR_RELCALID,
- '3E26604A-50F4-4449-8B3E-E4F4932D05B5'
- )
- ->setXprop(
- Vcalendar::X_WR_TIMEZONE,
- 'Europe/Oslo'
- );
+ ->setXprop( Vcalendar::X_WR_CALNAME, 'Eternal Terror Giglog' )
+ ->setXprop( Vcalendar::X_WR_CALDESC, "Concert {$cfullname}" )
+ ->setXprop( Vcalendar::X_WR_TIMEZONE, 'Europe/Oslo' );
// create a new event
- $event1 = $vcalendar->newVevent()
- ->setTransp( Vcalendar::OPAQUE )
- ->setClass( Vcalendar::P_BLIC )
- ->setSequence( 1 )
- // describe the event
- ->setSummary( '' . $cfullname . '' )
- ->setDescription( '' . $cfullname . '' )
- ->setComment( '' . $cfullname . '' )
- // place the event
- ->setLocation( '' . $concert->venue()->name() . ', ' . $concert->venue()->city() . '' )
- // set the time
- ->setDtstart(
- new DateTime(
- $newformat . 'T190000',
- new DateTimezone( 'Europe/Oslo' )
- )
- )
- ->setDuration( 'PT4H' );
- $output =
- // apply appropriate Vtimezone with Standard/DayLight components
- $vcalendar->vtimezonePopulate()
- // and create the (string) calendar
- ->createCalendar();
+ $vcalendar
+ ->newVevent()
+ ->setTransp( Vcalendar::OPAQUE )
+ ->setClass( Vcalendar::P_BLIC )
+ ->setSequence( 1 )
+ // describe the event
+ ->setSummary( $cfullname )
+ ->setDescription( $cfullname )
+ ->setComment( $cfullname )
+ // place the event
+ ->setLocation( "{$concert->venue()->name()}, {$concert->venue()->city()}" )
+ // set the time
+ ->setDtstart(
+ new DateTime(
+ $newformat . 'T190000',
+ new DateTimezone( 'Europe/Oslo' )
+ )
+ )
+ ->setDuration( 'PT4H' );
header( 'Content-Type: text/calendar' );
header( 'content-disposition: attachment;filename=' . $filename . '.ics' );
- echo $output;
+
+ // This output is generated by the ics class, and should be
+ // correctly escaped for output as ICS data.
+ //
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
+ echo $vcalendar->vtimezonePopulate()->createCalendar();
+
die();
}