ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMediaSvgSanitizer Class Reference

Small wrapper for svg sanitizer. More...

+ Collaboration diagram for ilMediaSvgSanitizer:

Static Public Member Functions

static sanitizeFile (string $a_file)
 Sanitize (temporary solution for sec issue 20339, ILIAS 5.0-5.2, not using composer autoloading yet) More...
 
static sanitizeDir (string $a_path)
 Sanitize directory recursively. More...
 

Detailed Description

Small wrapper for svg sanitizer.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilMediaSvgSanitizer.php.

Member Function Documentation

◆ sanitizeDir()

static ilMediaSvgSanitizer::sanitizeDir ( string  $a_path)
static

Sanitize directory recursively.

Definition at line 44 of file class.ilMediaSvgSanitizer.php.

References $name, and $path.

Referenced by ilObjMediaObject\_saveTempFileAsMediaObject(), ilMediaObjectDataSet\importRecord(), ilObjMediaObjectGUI\returnToContextObject(), ilObjMediaObjectGUI\savePropertiesObject(), ilObjMediaObjectGUI\setObjectPerCreationForm(), and ilObjMediaObject\uploadAdditionalFile().

46  : void {
47  $path = realpath($a_path);
48 
49  $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
50  foreach ($objects as $name => $object) {
51  if (strtolower(pathinfo($name, PATHINFO_EXTENSION)) == "svg") {
52  self::sanitizeFile($name);
53  }
54  }
55  }
$path
Definition: ltiservices.php:32
if($format !==null) $name
Definition: metadata.php:247
+ Here is the caller graph for this function:

◆ sanitizeFile()

static ilMediaSvgSanitizer::sanitizeFile ( string  $a_file)
static

Sanitize (temporary solution for sec issue 20339, ILIAS 5.0-5.2, not using composer autoloading yet)

Parameters
string$a_filefile to be sanitized

Definition at line 32 of file class.ilMediaSvgSanitizer.php.

34  : void {
35  $sanitizer = new Sanitizer();
36  $dirtySVG = file_get_contents($a_file);
37  $cleanSVG = $sanitizer->sanitize($dirtySVG);
38  file_put_contents($a_file, $cleanSVG);
39  }

The documentation for this class was generated from the following file: