summaryrefslogtreecommitdiffstats
path: root/includes/giglogadmin-export-ical-handler.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-01-28 16:59:44 +0100
committerHarald Eilertsen <haraldei@anduin.net>2023-01-28 16:59:44 +0100
commit9355261bfe664f181bd8b6c4fe23a2949e06769e (patch)
treecb9aebc241a9608b255f79e3666d6082752f27dc /includes/giglogadmin-export-ical-handler.php
parente50647ecda43e7708e92175afd1507991f1bd855 (diff)
downloadgigologadmin-9355261bfe664f181bd8b6c4fe23a2949e06769e.tar.gz
gigologadmin-9355261bfe664f181bd8b6c4fe23a2949e06769e.tar.bz2
gigologadmin-9355261bfe664f181bd8b6c4fe23a2949e06769e.zip
Clean up phpcs warnings in ical handler code.
One warning remains, for using the locale dependent `date` function. Leaving this as I'm looking to redo the date formatting stuff anyways.
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();
}