summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/class-giglogadmin-plugin.php2
-rw-r--r--includes/giglogadmin-export-ical-handler.php72
2 files changed, 31 insertions, 43 deletions
diff --git a/includes/class-giglogadmin-plugin.php b/includes/class-giglogadmin-plugin.php
index 96f3c5f..968d4c4 100644
--- a/includes/class-giglogadmin-plugin.php
+++ b/includes/class-giglogadmin-plugin.php
@@ -32,7 +32,7 @@ if ( ! class_exists( 'GiglogAdmin_Plugin' ) ) {
require_once __DIR__ . '/class-giglogadmin-venue.php';
require_once __DIR__ . '/class-giglogadmin-concert.php';
- require_once __DIR__ . '/class-giglogadmin-icalexport.php';
+ require_once __DIR__ . '/giglogadmin-export-ical-handler.php';
require_once __DIR__ . '/view-helpers/select-field-helper.php';
if ( is_admin() ) {
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();
}