ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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 }
static sanitizeFile(string $a_file)
Sanitize (temporary solution for sec issue 20339, ILIAS 5.0-5.2, not using composer autoloading yet)
$path
Definition: ltiservices.php:30

◆ 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: