Dynamische Daten in Seitentemplates eingefügt
This commit is contained in:
18
webseite/classes/Util.php
Normal file
18
webseite/classes/Util.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class Util
|
||||
{
|
||||
static function removeIllegalCharacters($string): string
|
||||
{
|
||||
return preg_replace("/[^a-zA-Z0-9_-]/", "", $string);
|
||||
}
|
||||
|
||||
static function parseJsonFromFile($filename): mixed
|
||||
{
|
||||
$file = fopen($filename, "r") or die("Unable to open file!");
|
||||
$fileContent = fread($file, filesize($filename));
|
||||
fclose($file);
|
||||
|
||||
return json_decode($fileContent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user