diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/class-giglogadmin-icalexport.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/includes/class-giglogadmin-icalexport.php b/includes/class-giglogadmin-icalexport.php index ba1d7f0..d12db13 100644 --- a/includes/class-giglogadmin-icalexport.php +++ b/includes/class-giglogadmin-icalexport.php @@ -18,12 +18,6 @@ if ( ! class_exists( 'GiglogAdmin_IcalExport' ) ) { */ class Giglogadmin_IcalExport { - static function textclean( string $txt ) : string { - $cleantext = preg_replace( '/[^A-Za-z0-9 ]/', '', $txt ); - $cleantext = str_replace( ' ', '_', $cleantext ); - return( $cleantext ); - } - public static function export_ical() { $evid = $_GET['evid']; @@ -32,8 +26,12 @@ if ( ! class_exists( 'GiglogAdmin_IcalExport' ) ) { $cshortname = substr( $cfullname, 0, 20 ); $fdate = strtotime( $concert->cdate() ); $newformat = date( 'Ymd', $fdate ); - $filename = 'Concert ' . $concert->venue()->name() . ' ' . $newformat . ' ' . substr( $concert->cname(), 0, 30 ); - $filename = self::textclean( $filename ); + + $filename = sanitize_file_name( + "Concert-{$concert->venue()->name()}-{$newformat}-" + . substr( $concert->cname(), 0, 30 ) + ); + // create a new calendar $vcalendar = Vcalendar::factory( array( Vcalendar::UNIQUE_ID => 'kigkonsult.se' ) ) // with calendaring info |