ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMediaSvgSanitizer Class Reference

Small wrapper for svg sanitizer. More...

+ Collaboration diagram for ilMediaSvgSanitizer:

Static Public Member Functions

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

Detailed Description

Small wrapper for svg sanitizer.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ sanitizeDir()

static ilMediaSvgSanitizer::sanitizeDir (   $a_path)
static

Sanitize directory recursively.

Parameters
$a_path

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

42 {
43 $path = realpath($a_path);
44
45 $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
46 foreach ($objects as $name => $object) {
47 if (strtolower(pathinfo($name, PATHINFO_EXTENSION)) == "svg") {
49 }
50 }
51 }
static sanitizeFile($a_file)
Sanitize (temporary solution for sec issue 20339, ILIAS 5.0-5.2, not using composer autoloading yet)
if($format !==null) $name
Definition: metadata.php:146

References $name, $path, and sanitizeFile().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sanitizeFile()

static ilMediaSvgSanitizer::sanitizeFile (   $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 22 of file class.ilMediaSvgSanitizer.php.

23 {
24 /*include_once("./Services/MediaObjects/lib/svg-sanitizer-master/src/data/AttributeInterface.php");
25 include_once("./Services/MediaObjects/lib/svg-sanitizer-master/src/data/TagInterface.php");
26 include_once("./Services/MediaObjects/lib/svg-sanitizer-master/src/data/AllowedTags.php");
27 include_once("./Services/MediaObjects/lib/svg-sanitizer-master/src/data/AllowedAttributes.php");
28 include_once("./Services/MediaObjects/lib/svg-sanitizer-master/src/Sanitizer.php");*/
29
30 $sanitizer = new Sanitizer();
31 $dirtySVG = file_get_contents($a_file);
32 $cleanSVG = $sanitizer->sanitize($dirtySVG);
33 file_put_contents($a_file, $cleanSVG);
34 }
if(empty( $files_to_scan)) $sanitizer
Definition: svg-scanner.php:90

References $sanitizer.

Referenced by sanitizeDir().

+ Here is the caller graph for this function:

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