summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2022-03-28 20:49:35 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2022-03-28 20:49:35 +0200
commit3c714dc6d5b2d3e6036130dd870c9b661adadbad (patch)
tree9735eeff2c8959ddb62382943bebcc8be5d2346a /includes
parente2f170c6aee1465228b3cafe74681b68116e602b (diff)
downloadgigologadmin-3c714dc6d5b2d3e6036130dd870c9b661adadbad.tar.gz
gigologadmin-3c714dc6d5b2d3e6036130dd870c9b661adadbad.tar.bz2
gigologadmin-3c714dc6d5b2d3e6036130dd870c9b661adadbad.zip
added function to clean file name before ical export
Diffstat (limited to 'includes')
-rw-r--r--includes/ical_export.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/ical_export.php b/includes/ical_export.php
index 637bb58..ec45b13 100644
--- a/includes/ical_export.php
+++ b/includes/ical_export.php
@@ -11,6 +11,12 @@ 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'];
@@ -20,6 +26,8 @@ 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=Giglogadmin_IcalExport::textclean($filename);
// create a new calendar
$vcalendar = Vcalendar::factory( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] )
// with calendaring info