Safe SVG - Version 1.0.0

Version Description

  • Initial Release
Download this release

Release Info

Developer enshrined
Plugin Icon 128x128 Safe SVG
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

Files changed (36) hide show
  1. lib/composer.json +5 -0
  2. lib/composer.lock +55 -0
  3. lib/vendor/autoload.php +7 -0
  4. lib/vendor/composer/ClassLoader.php +413 -0
  5. lib/vendor/composer/autoload_classmap.php +9 -0
  6. lib/vendor/composer/autoload_namespaces.php +9 -0
  7. lib/vendor/composer/autoload_psr4.php +10 -0
  8. lib/vendor/composer/autoload_real.php +50 -0
  9. lib/vendor/composer/installed.json +41 -0
  10. lib/vendor/enshrined/svg-sanitize/.gitignore +1 -0
  11. lib/vendor/enshrined/svg-sanitize/.travis.yml +17 -0
  12. lib/vendor/enshrined/svg-sanitize/LICENSE +340 -0
  13. lib/vendor/enshrined/svg-sanitize/README.md +52 -0
  14. lib/vendor/enshrined/svg-sanitize/composer.json +22 -0
  15. lib/vendor/enshrined/svg-sanitize/composer.lock +1492 -0
  16. lib/vendor/enshrined/svg-sanitize/phpunit.xml.dist +17 -0
  17. lib/vendor/enshrined/svg-sanitize/src/Sanitizer.php +255 -0
  18. lib/vendor/enshrined/svg-sanitize/src/data/AllowedAttributes.php +70 -0
  19. lib/vendor/enshrined/svg-sanitize/src/data/AllowedTags.php +56 -0
  20. lib/vendor/enshrined/svg-sanitize/src/data/AttributeInterface.php +21 -0
  21. lib/vendor/enshrined/svg-sanitize/src/data/TagInterface.php +22 -0
  22. lib/vendor/enshrined/svg-sanitize/tests/AllowedAttributesTest.php +41 -0
  23. lib/vendor/enshrined/svg-sanitize/tests/AllowedTagsTest.php +41 -0
  24. lib/vendor/enshrined/svg-sanitize/tests/SanitizerTest.php +121 -0
  25. lib/vendor/enshrined/svg-sanitize/tests/data/TestAllowedAttributes.php +18 -0
  26. lib/vendor/enshrined/svg-sanitize/tests/data/TestAllowedTags.php +18 -0
  27. lib/vendor/enshrined/svg-sanitize/tests/data/badXmlTestOne.svg +15 -0
  28. lib/vendor/enshrined/svg-sanitize/tests/data/hrefCleanOne.svg +9 -0
  29. lib/vendor/enshrined/svg-sanitize/tests/data/hrefTestOne.svg +9 -0
  30. lib/vendor/enshrined/svg-sanitize/tests/data/svgCleanOne.svg +11 -0
  31. lib/vendor/enshrined/svg-sanitize/tests/data/svgTestOne.svg +15 -0
  32. lib/vendor/enshrined/svg-sanitize/tests/data/xmlCleanOne.xml +11 -0
  33. lib/vendor/enshrined/svg-sanitize/tests/data/xmlTestOne.xml +12 -0
  34. licence.txt +371 -0
  35. readme.txt +30 -0
  36. safe-svg.php +94 -0
lib/composer.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "require": {
3
+ "enshrined/svg-sanitize": "^0.2.0"
4
+ }
5
+ }
lib/composer.lock ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "hash": "7fb36cc4052a3a5b3592765592f98aab",
8
+ "packages": [
9
+ {
10
+ "name": "enshrined/svg-sanitize",
11
+ "version": "0.2.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/darylldoyle/svg-sanitizer.git",
15
+ "reference": "d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa",
20
+ "reference": "d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa",
21
+ "shasum": ""
22
+ },
23
+ "require-dev": {
24
+ "codeclimate/php-test-reporter": "^0.1.2",
25
+ "phpunit/phpunit": "^4.7"
26
+ },
27
+ "type": "library",
28
+ "autoload": {
29
+ "psr-4": {
30
+ "enshrined\\svgSanitize\\": "src"
31
+ }
32
+ },
33
+ "notification-url": "https://packagist.org/downloads/",
34
+ "license": [
35
+ "GPL-2.0+"
36
+ ],
37
+ "authors": [
38
+ {
39
+ "name": "Daryll Doyle",
40
+ "email": "daryll@enshrined.co.uk"
41
+ }
42
+ ],
43
+ "description": "An SVG sanitizer for PHP",
44
+ "time": "2015-06-25 22:19:47"
45
+ }
46
+ ],
47
+ "packages-dev": [],
48
+ "aliases": [],
49
+ "minimum-stability": "stable",
50
+ "stability-flags": [],
51
+ "prefer-stable": false,
52
+ "prefer-lowest": false,
53
+ "platform": [],
54
+ "platform-dev": []
55
+ }
lib/vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit0917edb609b9527c9322825d39f92c1b::getLoader();
lib/vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0 class loader
17
+ *
18
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
19
+ *
20
+ * $loader = new \Composer\Autoload\ClassLoader();
21
+ *
22
+ * // register classes with namespaces
23
+ * $loader->add('Symfony\Component', __DIR__.'/component');
24
+ * $loader->add('Symfony', __DIR__.'/framework');
25
+ *
26
+ * // activate the autoloader
27
+ * $loader->register();
28
+ *
29
+ * // to enable searching the include path (eg. for PEAR packages)
30
+ * $loader->setUseIncludePath(true);
31
+ *
32
+ * In this example, if you try to use a class in the Symfony\Component
33
+ * namespace or one of its children (Symfony\Component\Console for instance),
34
+ * the autoloader will first look for the class under the component/
35
+ * directory, and it will then fallback to the framework/ directory if not
36
+ * found before giving up.
37
+ *
38
+ * This class is loosely based on the Symfony UniversalClassLoader.
39
+ *
40
+ * @author Fabien Potencier <fabien@symfony.com>
41
+ * @author Jordi Boggiano <j.boggiano@seld.be>
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+
57
+ private $classMapAuthoritative = false;
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-0 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if ($file === null) {
337
+ // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Scope isolated include.
407
+ *
408
+ * Prevents access to $this/self from included files.
409
+ */
410
+ function includeFile($file)
411
+ {
412
+ include $file;
413
+ }
lib/vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
lib/vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
lib/vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'enshrined\\svgSanitize\\' => array($vendorDir . '/enshrined/svg-sanitize/src'),
10
+ );
lib/vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit0917edb609b9527c9322825d39f92c1b
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit0917edb609b9527c9322825d39f92c1b', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0917edb609b9527c9322825d39f92c1b', 'loadClassLoader'));
25
+
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
39
+ }
40
+
41
+ $loader->register(true);
42
+
43
+ return $loader;
44
+ }
45
+ }
46
+
47
+ function composerRequire0917edb609b9527c9322825d39f92c1b($file)
48
+ {
49
+ require $file;
50
+ }
lib/vendor/composer/installed.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "enshrined/svg-sanitize",
4
+ "version": "0.2.0",
5
+ "version_normalized": "0.2.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/darylldoyle/svg-sanitizer.git",
9
+ "reference": "d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa",
14
+ "reference": "d290fff5b5a8ebbbe7684d4097cd82a214cdb1fa",
15
+ "shasum": ""
16
+ },
17
+ "require-dev": {
18
+ "codeclimate/php-test-reporter": "^0.1.2",
19
+ "phpunit/phpunit": "^4.7"
20
+ },
21
+ "time": "2015-06-25 22:19:47",
22
+ "type": "library",
23
+ "installation-source": "dist",
24
+ "autoload": {
25
+ "psr-4": {
26
+ "enshrined\\svgSanitize\\": "src"
27
+ }
28
+ },
29
+ "notification-url": "https://packagist.org/downloads/",
30
+ "license": [
31
+ "GPL-2.0+"
32
+ ],
33
+ "authors": [
34
+ {
35
+ "name": "Daryll Doyle",
36
+ "email": "daryll@enshrined.co.uk"
37
+ }
38
+ ],
39
+ "description": "An SVG sanitizer for PHP"
40
+ }
41
+ ]
lib/vendor/enshrined/svg-sanitize/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /vendor
lib/vendor/enshrined/svg-sanitize/.travis.yml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ language: php
2
+ php:
3
+ - 5.4
4
+ - 5.5
5
+ - 5.6
6
+ - hhvm
7
+
8
+ before_script:
9
+ - composer install --dev
10
+
11
+ addons:
12
+ code_climate:
13
+ repo_token: c051f6d29cce2d4ab0d6dfa460798b050cced025311f94ab3ba1ed50c7ceb31e
14
+
15
+ after_script:
16
+ - CODECLIMATE_REPO_TOKEN="c051f6d29cce2d4ab0d6dfa460798b050cced025311f94ab3ba1ed50c7ceb31e" vendor/bin/test-reporter --stdout > build/logs/codeclimate.json
17
+ - "curl --verbose -X POST -d @build/logs/codeclimate.json -H 'Content-Type: application/json' -H 'User-Agent: Code Climate (PHP Test Reporter v0.1.1)' https://codeclimate.com/test_reports"
lib/vendor/enshrined/svg-sanitize/LICENSE ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
340
+
lib/vendor/enshrined/svg-sanitize/README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # svg-sanitizer
2
+
3
+ [![Build Status](https://travis-ci.org/darylldoyle/svg-sanitizer.svg?branch=master)](https://travis-ci.org/darylldoyle/svg-sanitizer) [![Test Coverage](https://codeclimate.com/github/darylldoyle/svg-sanitizer/badges/coverage.svg)](https://codeclimate.com/github/darylldoyle/svg-sanitizer/coverage)
4
+
5
+ This is my attempt at building a decent SVG sanitizer in PHP. The work is laregely borrowed from [DOMPurify](https://github.com/cure53/DOMPurify).
6
+
7
+ ## Installation
8
+
9
+ Either require `enshrined/svg-sanitize` through composer or download the repo and include the old way!
10
+
11
+ ## Usage
12
+
13
+ Using this is fairly easy. Create a new instance of `enshrined\svgSanitize\Sanitizer` and then call the `sanitize` whilst passing in your dirty SVG/XML
14
+
15
+ **Basic Example**
16
+
17
+ ```php
18
+ use enshrined\svgSanitize\Sanitizer;
19
+
20
+ // Create a new sanitizer instance
21
+ $sanitizer = new Sanitizer();
22
+
23
+ // Load the dirty svg
24
+ $dirtySVG = file_get_contents('filthy.svg');
25
+
26
+ // Pass it to the sanitizer and get it back clean
27
+ $cleanSVG = $sanitizer->sanitize($dirtySVG);
28
+
29
+ // Now do what you want with your clean SVG/XML data
30
+
31
+ ```
32
+
33
+ ## Output
34
+
35
+ This will either return a sanitized SVG/XML string or boolean `false` if XML parsing failed (usually due to a badly formatted file).
36
+
37
+ ## Options
38
+
39
+ You may pass your own whitelist of tags and attributes by using the `Sanitizer::setAllowedTags` and `Sanitizer::setAllowedAttrs` methods respectively.
40
+
41
+ These methods require that you implement the `enshrined\svgSanitize\data\TagInterface` or `enshrined\svgSanitize\data\AttributeInterface`.
42
+
43
+ ## Demo
44
+ There is a demo available at: [http://svg.enshrined.co.uk/](http://svg.enshrined.co.uk/)
45
+
46
+ ## Tests
47
+
48
+ You can run these by running `phpunit`
49
+
50
+ ## To-Do
51
+
52
+ More extensive testing for the SVGs/XML would be lovely, I'll try and add these soon. If you feel like doing it for me, please do and make a PR!
lib/vendor/enshrined/svg-sanitize/composer.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "enshrined/svg-sanitize",
3
+ "description": "An SVG sanitizer for PHP",
4
+ "license": "GPL-2.0+",
5
+ "authors": [
6
+ {
7
+ "name": "Daryll Doyle",
8
+ "email": "daryll@enshrined.co.uk"
9
+ }
10
+ ],
11
+ "autoload": {
12
+ "psr-4": {
13
+ "enshrined\\svgSanitize\\": "src"
14
+ }
15
+ },
16
+ "minimum-stability": "stable",
17
+ "require": {},
18
+ "require-dev": {
19
+ "phpunit/phpunit": "^4.7",
20
+ "codeclimate/php-test-reporter": "^0.1.2"
21
+ }
22
+ }
lib/vendor/enshrined/svg-sanitize/composer.lock ADDED
@@ -0,0 +1,1492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "hash": "5de16e26bfc22a583a99a771e94688b8",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "codeclimate/php-test-reporter",
12
+ "version": "v0.1.2",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/codeclimate/php-test-reporter.git",
16
+ "reference": "8ed24ff30f3663ecf40f1c12d6c97eb56c69e646"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/codeclimate/php-test-reporter/zipball/8ed24ff30f3663ecf40f1c12d6c97eb56c69e646",
21
+ "reference": "8ed24ff30f3663ecf40f1c12d6c97eb56c69e646",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "ext-curl": "*",
26
+ "php": ">=5.3",
27
+ "satooshi/php-coveralls": "0.6.*",
28
+ "symfony/console": ">=2.0"
29
+ },
30
+ "require-dev": {
31
+ "phpunit/phpunit": "3.7.*@stable"
32
+ },
33
+ "bin": [
34
+ "composer/bin/test-reporter"
35
+ ],
36
+ "type": "library",
37
+ "extra": {
38
+ "branch-alias": {
39
+ "dev-master": "0.1.x-dev"
40
+ }
41
+ },
42
+ "autoload": {
43
+ "psr-0": {
44
+ "CodeClimate\\Component": "src/",
45
+ "CodeClimate\\Bundle": "src/"
46
+ }
47
+ },
48
+ "notification-url": "https://packagist.org/downloads/",
49
+ "license": [
50
+ "MIT"
51
+ ],
52
+ "authors": [
53
+ {
54
+ "name": "Code Climate",
55
+ "email": "hello@codeclimate.com",
56
+ "homepage": "https://codeclimate.com"
57
+ }
58
+ ],
59
+ "description": "PHP client for reporting test coverage to Code Climate",
60
+ "homepage": "https://github.com/codeclimate/php-test-reporter",
61
+ "keywords": [
62
+ "codeclimate",
63
+ "coverage"
64
+ ],
65
+ "time": "2014-07-23 13:42:41"
66
+ },
67
+ {
68
+ "name": "doctrine/instantiator",
69
+ "version": "1.0.5",
70
+ "source": {
71
+ "type": "git",
72
+ "url": "https://github.com/doctrine/instantiator.git",
73
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
74
+ },
75
+ "dist": {
76
+ "type": "zip",
77
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
78
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
79
+ "shasum": ""
80
+ },
81
+ "require": {
82
+ "php": ">=5.3,<8.0-DEV"
83
+ },
84
+ "require-dev": {
85
+ "athletic/athletic": "~0.1.8",
86
+ "ext-pdo": "*",
87
+ "ext-phar": "*",
88
+ "phpunit/phpunit": "~4.0",
89
+ "squizlabs/php_codesniffer": "~2.0"
90
+ },
91
+ "type": "library",
92
+ "extra": {
93
+ "branch-alias": {
94
+ "dev-master": "1.0.x-dev"
95
+ }
96
+ },
97
+ "autoload": {
98
+ "psr-4": {
99
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
100
+ }
101
+ },
102
+ "notification-url": "https://packagist.org/downloads/",
103
+ "license": [
104
+ "MIT"
105
+ ],
106
+ "authors": [
107
+ {
108
+ "name": "Marco Pivetta",
109
+ "email": "ocramius@gmail.com",
110
+ "homepage": "http://ocramius.github.com/"
111
+ }
112
+ ],
113
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
114
+ "homepage": "https://github.com/doctrine/instantiator",
115
+ "keywords": [
116
+ "constructor",
117
+ "instantiate"
118
+ ],
119
+ "time": "2015-06-14 21:17:01"
120
+ },
121
+ {
122
+ "name": "guzzle/guzzle",
123
+ "version": "v3.9.3",
124
+ "source": {
125
+ "type": "git",
126
+ "url": "https://github.com/guzzle/guzzle3.git",
127
+ "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9"
128
+ },
129
+ "dist": {
130
+ "type": "zip",
131
+ "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9",
132
+ "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9",
133
+ "shasum": ""
134
+ },
135
+ "require": {
136
+ "ext-curl": "*",
137
+ "php": ">=5.3.3",
138
+ "symfony/event-dispatcher": "~2.1"
139
+ },
140
+ "replace": {
141
+ "guzzle/batch": "self.version",
142
+ "guzzle/cache": "self.version",
143
+ "guzzle/common": "self.version",
144
+ "guzzle/http": "self.version",
145
+ "guzzle/inflection": "self.version",
146
+ "guzzle/iterator": "self.version",
147
+ "guzzle/log": "self.version",
148
+ "guzzle/parser": "self.version",
149
+ "guzzle/plugin": "self.version",
150
+ "guzzle/plugin-async": "self.version",
151
+ "guzzle/plugin-backoff": "self.version",
152
+ "guzzle/plugin-cache": "self.version",
153
+ "guzzle/plugin-cookie": "self.version",
154
+ "guzzle/plugin-curlauth": "self.version",
155
+ "guzzle/plugin-error-response": "self.version",
156
+ "guzzle/plugin-history": "self.version",
157
+ "guzzle/plugin-log": "self.version",
158
+ "guzzle/plugin-md5": "self.version",
159
+ "guzzle/plugin-mock": "self.version",
160
+ "guzzle/plugin-oauth": "self.version",
161
+ "guzzle/service": "self.version",
162
+ "guzzle/stream": "self.version"
163
+ },
164
+ "require-dev": {
165
+ "doctrine/cache": "~1.3",
166
+ "monolog/monolog": "~1.0",
167
+ "phpunit/phpunit": "3.7.*",
168
+ "psr/log": "~1.0",
169
+ "symfony/class-loader": "~2.1",
170
+ "zendframework/zend-cache": "2.*,<2.3",
171
+ "zendframework/zend-log": "2.*,<2.3"
172
+ },
173
+ "suggest": {
174
+ "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated."
175
+ },
176
+ "type": "library",
177
+ "extra": {
178
+ "branch-alias": {
179
+ "dev-master": "3.9-dev"
180
+ }
181
+ },
182
+ "autoload": {
183
+ "psr-0": {
184
+ "Guzzle": "src/",
185
+ "Guzzle\\Tests": "tests/"
186
+ }
187
+ },
188
+ "notification-url": "https://packagist.org/downloads/",
189
+ "license": [
190
+ "MIT"
191
+ ],
192
+ "authors": [
193
+ {
194
+ "name": "Michael Dowling",
195
+ "email": "mtdowling@gmail.com",
196
+ "homepage": "https://github.com/mtdowling"
197
+ },
198
+ {
199
+ "name": "Guzzle Community",
200
+ "homepage": "https://github.com/guzzle/guzzle/contributors"
201
+ }
202
+ ],
203
+ "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle",
204
+ "homepage": "http://guzzlephp.org/",
205
+ "keywords": [
206
+ "client",
207
+ "curl",
208
+ "framework",
209
+ "http",
210
+ "http client",
211
+ "rest",
212
+ "web service"
213
+ ],
214
+ "time": "2015-03-18 18:23:50"
215
+ },
216
+ {
217
+ "name": "phpdocumentor/reflection-docblock",
218
+ "version": "2.0.4",
219
+ "source": {
220
+ "type": "git",
221
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
222
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
223
+ },
224
+ "dist": {
225
+ "type": "zip",
226
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
227
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
228
+ "shasum": ""
229
+ },
230
+ "require": {
231
+ "php": ">=5.3.3"
232
+ },
233
+ "require-dev": {
234
+ "phpunit/phpunit": "~4.0"
235
+ },
236
+ "suggest": {
237
+ "dflydev/markdown": "~1.0",
238
+ "erusev/parsedown": "~1.0"
239
+ },
240
+ "type": "library",
241
+ "extra": {
242
+ "branch-alias": {
243
+ "dev-master": "2.0.x-dev"
244
+ }
245
+ },
246
+ "autoload": {
247
+ "psr-0": {
248
+ "phpDocumentor": [
249
+ "src/"
250
+ ]
251
+ }
252
+ },
253
+ "notification-url": "https://packagist.org/downloads/",
254
+ "license": [
255
+ "MIT"
256
+ ],
257
+ "authors": [
258
+ {
259
+ "name": "Mike van Riel",
260
+ "email": "mike.vanriel@naenius.com"
261
+ }
262
+ ],
263
+ "time": "2015-02-03 12:10:50"
264
+ },
265
+ {
266
+ "name": "phpspec/prophecy",
267
+ "version": "v1.4.1",
268
+ "source": {
269
+ "type": "git",
270
+ "url": "https://github.com/phpspec/prophecy.git",
271
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373"
272
+ },
273
+ "dist": {
274
+ "type": "zip",
275
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
276
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
277
+ "shasum": ""
278
+ },
279
+ "require": {
280
+ "doctrine/instantiator": "^1.0.2",
281
+ "phpdocumentor/reflection-docblock": "~2.0",
282
+ "sebastian/comparator": "~1.1"
283
+ },
284
+ "require-dev": {
285
+ "phpspec/phpspec": "~2.0"
286
+ },
287
+ "type": "library",
288
+ "extra": {
289
+ "branch-alias": {
290
+ "dev-master": "1.4.x-dev"
291
+ }
292
+ },
293
+ "autoload": {
294
+ "psr-0": {
295
+ "Prophecy\\": "src/"
296
+ }
297
+ },
298
+ "notification-url": "https://packagist.org/downloads/",
299
+ "license": [
300
+ "MIT"
301
+ ],
302
+ "authors": [
303
+ {
304
+ "name": "Konstantin Kudryashov",
305
+ "email": "ever.zet@gmail.com",
306
+ "homepage": "http://everzet.com"
307
+ },
308
+ {
309
+ "name": "Marcello Duarte",
310
+ "email": "marcello.duarte@gmail.com"
311
+ }
312
+ ],
313
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
314
+ "homepage": "https://github.com/phpspec/prophecy",
315
+ "keywords": [
316
+ "Double",
317
+ "Dummy",
318
+ "fake",
319
+ "mock",
320
+ "spy",
321
+ "stub"
322
+ ],
323
+ "time": "2015-04-27 22:15:08"
324
+ },
325
+ {
326
+ "name": "phpunit/php-code-coverage",
327
+ "version": "2.1.5",
328
+ "source": {
329
+ "type": "git",
330
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
331
+ "reference": "be2286cb8c7e1773eded49d9719219e6f74f9e3e"
332
+ },
333
+ "dist": {
334
+ "type": "zip",
335
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be2286cb8c7e1773eded49d9719219e6f74f9e3e",
336
+ "reference": "be2286cb8c7e1773eded49d9719219e6f74f9e3e",
337
+ "shasum": ""
338
+ },
339
+ "require": {
340
+ "php": ">=5.3.3",
341
+ "phpunit/php-file-iterator": "~1.3",
342
+ "phpunit/php-text-template": "~1.2",
343
+ "phpunit/php-token-stream": "~1.3",
344
+ "sebastian/environment": "~1.0",
345
+ "sebastian/version": "~1.0"
346
+ },
347
+ "require-dev": {
348
+ "ext-xdebug": ">=2.1.4",
349
+ "phpunit/phpunit": "~4"
350
+ },
351
+ "suggest": {
352
+ "ext-dom": "*",
353
+ "ext-xdebug": ">=2.2.1",
354
+ "ext-xmlwriter": "*"
355
+ },
356
+ "type": "library",
357
+ "extra": {
358
+ "branch-alias": {
359
+ "dev-master": "2.1.x-dev"
360
+ }
361
+ },
362
+ "autoload": {
363
+ "classmap": [
364
+ "src/"
365
+ ]
366
+ },
367
+ "notification-url": "https://packagist.org/downloads/",
368
+ "license": [
369
+ "BSD-3-Clause"
370
+ ],
371
+ "authors": [
372
+ {
373
+ "name": "Sebastian Bergmann",
374
+ "email": "sb@sebastian-bergmann.de",
375
+ "role": "lead"
376
+ }
377
+ ],
378
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
379
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
380
+ "keywords": [
381
+ "coverage",
382
+ "testing",
383
+ "xunit"
384
+ ],
385
+ "time": "2015-06-09 13:05:42"
386
+ },
387
+ {
388
+ "name": "phpunit/php-file-iterator",
389
+ "version": "1.4.0",
390
+ "source": {
391
+ "type": "git",
392
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
393
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
394
+ },
395
+ "dist": {
396
+ "type": "zip",
397
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
398
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
399
+ "shasum": ""
400
+ },
401
+ "require": {
402
+ "php": ">=5.3.3"
403
+ },
404
+ "type": "library",
405
+ "extra": {
406
+ "branch-alias": {
407
+ "dev-master": "1.4.x-dev"
408
+ }
409
+ },
410
+ "autoload": {
411
+ "classmap": [
412
+ "src/"
413
+ ]
414
+ },
415
+ "notification-url": "https://packagist.org/downloads/",
416
+ "license": [
417
+ "BSD-3-Clause"
418
+ ],
419
+ "authors": [
420
+ {
421
+ "name": "Sebastian Bergmann",
422
+ "email": "sb@sebastian-bergmann.de",
423
+ "role": "lead"
424
+ }
425
+ ],
426
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
427
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
428
+ "keywords": [
429
+ "filesystem",
430
+ "iterator"
431
+ ],
432
+ "time": "2015-04-02 05:19:05"
433
+ },
434
+ {
435
+ "name": "phpunit/php-text-template",
436
+ "version": "1.2.0",
437
+ "source": {
438
+ "type": "git",
439
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
440
+ "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
441
+ },
442
+ "dist": {
443
+ "type": "zip",
444
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
445
+ "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
446
+ "shasum": ""
447
+ },
448
+ "require": {
449
+ "php": ">=5.3.3"
450
+ },
451
+ "type": "library",
452
+ "autoload": {
453
+ "classmap": [
454
+ "Text/"
455
+ ]
456
+ },
457
+ "notification-url": "https://packagist.org/downloads/",
458
+ "include-path": [
459
+ ""
460
+ ],
461
+ "license": [
462
+ "BSD-3-Clause"
463
+ ],
464
+ "authors": [
465
+ {
466
+ "name": "Sebastian Bergmann",
467
+ "email": "sb@sebastian-bergmann.de",
468
+ "role": "lead"
469
+ }
470
+ ],
471
+ "description": "Simple template engine.",
472
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
473
+ "keywords": [
474
+ "template"
475
+ ],
476
+ "time": "2014-01-30 17:20:04"
477
+ },
478
+ {
479
+ "name": "phpunit/php-timer",
480
+ "version": "1.0.6",
481
+ "source": {
482
+ "type": "git",
483
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
484
+ "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d"
485
+ },
486
+ "dist": {
487
+ "type": "zip",
488
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d",
489
+ "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d",
490
+ "shasum": ""
491
+ },
492
+ "require": {
493
+ "php": ">=5.3.3"
494
+ },
495
+ "type": "library",
496
+ "autoload": {
497
+ "classmap": [
498
+ "src/"
499
+ ]
500
+ },
501
+ "notification-url": "https://packagist.org/downloads/",
502
+ "license": [
503
+ "BSD-3-Clause"
504
+ ],
505
+ "authors": [
506
+ {
507
+ "name": "Sebastian Bergmann",
508
+ "email": "sb@sebastian-bergmann.de",
509
+ "role": "lead"
510
+ }
511
+ ],
512
+ "description": "Utility class for timing",
513
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
514
+ "keywords": [
515
+ "timer"
516
+ ],
517
+ "time": "2015-06-13 07:35:30"
518
+ },
519
+ {
520
+ "name": "phpunit/php-token-stream",
521
+ "version": "1.4.2",
522
+ "source": {
523
+ "type": "git",
524
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
525
+ "reference": "db63be1159c81df649cd0260e30249a586d4129e"
526
+ },
527
+ "dist": {
528
+ "type": "zip",
529
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db63be1159c81df649cd0260e30249a586d4129e",
530
+ "reference": "db63be1159c81df649cd0260e30249a586d4129e",
531
+ "shasum": ""
532
+ },
533
+ "require": {
534
+ "ext-tokenizer": "*",
535
+ "php": ">=5.3.3"
536
+ },
537
+ "require-dev": {
538
+ "phpunit/phpunit": "~4.2"
539
+ },
540
+ "type": "library",
541
+ "extra": {
542
+ "branch-alias": {
543
+ "dev-master": "1.4-dev"
544
+ }
545
+ },
546
+ "autoload": {
547
+ "classmap": [
548
+ "src/"
549
+ ]
550
+ },
551
+ "notification-url": "https://packagist.org/downloads/",
552
+ "license": [
553
+ "BSD-3-Clause"
554
+ ],
555
+ "authors": [
556
+ {
557
+ "name": "Sebastian Bergmann",
558
+ "email": "sebastian@phpunit.de"
559
+ }
560
+ ],
561
+ "description": "Wrapper around PHP's tokenizer extension.",
562
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
563
+ "keywords": [
564
+ "tokenizer"
565
+ ],
566
+ "time": "2015-06-12 07:34:24"
567
+ },
568
+ {
569
+ "name": "phpunit/phpunit",
570
+ "version": "4.7.4",
571
+ "source": {
572
+ "type": "git",
573
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
574
+ "reference": "e5f851f324f7add846316f39e668e9deac97a103"
575
+ },
576
+ "dist": {
577
+ "type": "zip",
578
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e5f851f324f7add846316f39e668e9deac97a103",
579
+ "reference": "e5f851f324f7add846316f39e668e9deac97a103",
580
+ "shasum": ""
581
+ },
582
+ "require": {
583
+ "ext-dom": "*",
584
+ "ext-json": "*",
585
+ "ext-pcre": "*",
586
+ "ext-reflection": "*",
587
+ "ext-spl": "*",
588
+ "php": ">=5.3.3",
589
+ "phpspec/prophecy": "~1.3,>=1.3.1",
590
+ "phpunit/php-code-coverage": "~2.1",
591
+ "phpunit/php-file-iterator": "~1.4",
592
+ "phpunit/php-text-template": "~1.2",
593
+ "phpunit/php-timer": ">=1.0.6",
594
+ "phpunit/phpunit-mock-objects": "~2.3",
595
+ "sebastian/comparator": "~1.1",
596
+ "sebastian/diff": "~1.2",
597
+ "sebastian/environment": "~1.2",
598
+ "sebastian/exporter": "~1.2",
599
+ "sebastian/global-state": "~1.0",
600
+ "sebastian/version": "~1.0",
601
+ "symfony/yaml": "~2.1|~3.0"
602
+ },
603
+ "suggest": {
604
+ "phpunit/php-invoker": "~1.1"
605
+ },
606
+ "bin": [
607
+ "phpunit"
608
+ ],
609
+ "type": "library",
610
+ "extra": {
611
+ "branch-alias": {
612
+ "dev-master": "4.7.x-dev"
613
+ }
614
+ },
615
+ "autoload": {
616
+ "classmap": [
617
+ "src/"
618
+ ]
619
+ },
620
+ "notification-url": "https://packagist.org/downloads/",
621
+ "license": [
622
+ "BSD-3-Clause"
623
+ ],
624
+ "authors": [
625
+ {
626
+ "name": "Sebastian Bergmann",
627
+ "email": "sebastian@phpunit.de",
628
+ "role": "lead"
629
+ }
630
+ ],
631
+ "description": "The PHP Unit Testing framework.",
632
+ "homepage": "https://phpunit.de/",
633
+ "keywords": [
634
+ "phpunit",
635
+ "testing",
636
+ "xunit"
637
+ ],
638
+ "time": "2015-06-18 13:33:26"
639
+ },
640
+ {
641
+ "name": "phpunit/phpunit-mock-objects",
642
+ "version": "2.3.4",
643
+ "source": {
644
+ "type": "git",
645
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
646
+ "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35"
647
+ },
648
+ "dist": {
649
+ "type": "zip",
650
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/92408bb1968a81b3217a6fdf6c1a198da83caa35",
651
+ "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35",
652
+ "shasum": ""
653
+ },
654
+ "require": {
655
+ "doctrine/instantiator": "~1.0,>=1.0.2",
656
+ "php": ">=5.3.3",
657
+ "phpunit/php-text-template": "~1.2"
658
+ },
659
+ "require-dev": {
660
+ "phpunit/phpunit": "~4.4"
661
+ },
662
+ "suggest": {
663
+ "ext-soap": "*"
664
+ },
665
+ "type": "library",
666
+ "extra": {
667
+ "branch-alias": {
668
+ "dev-master": "2.3.x-dev"
669
+ }
670
+ },
671
+ "autoload": {
672
+ "classmap": [
673
+ "src/"
674
+ ]
675
+ },
676
+ "notification-url": "https://packagist.org/downloads/",
677
+ "license": [
678
+ "BSD-3-Clause"
679
+ ],
680
+ "authors": [
681
+ {
682
+ "name": "Sebastian Bergmann",
683
+ "email": "sb@sebastian-bergmann.de",
684
+ "role": "lead"
685
+ }
686
+ ],
687
+ "description": "Mock Object library for PHPUnit",
688
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
689
+ "keywords": [
690
+ "mock",
691
+ "xunit"
692
+ ],
693
+ "time": "2015-06-11 15:55:48"
694
+ },
695
+ {
696
+ "name": "psr/log",
697
+ "version": "1.0.0",
698
+ "source": {
699
+ "type": "git",
700
+ "url": "https://github.com/php-fig/log.git",
701
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
702
+ },
703
+ "dist": {
704
+ "type": "zip",
705
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
706
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
707
+ "shasum": ""
708
+ },
709
+ "type": "library",
710
+ "autoload": {
711
+ "psr-0": {
712
+ "Psr\\Log\\": ""
713
+ }
714
+ },
715
+ "notification-url": "https://packagist.org/downloads/",
716
+ "license": [
717
+ "MIT"
718
+ ],
719
+ "authors": [
720
+ {
721
+ "name": "PHP-FIG",
722
+ "homepage": "http://www.php-fig.org/"
723
+ }
724
+ ],
725
+ "description": "Common interface for logging libraries",
726
+ "keywords": [
727
+ "log",
728
+ "psr",
729
+ "psr-3"
730
+ ],
731
+ "time": "2012-12-21 11:40:51"
732
+ },
733
+ {
734
+ "name": "satooshi/php-coveralls",
735
+ "version": "v0.6.1",
736
+ "source": {
737
+ "type": "git",
738
+ "url": "https://github.com/satooshi/php-coveralls.git",
739
+ "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760"
740
+ },
741
+ "dist": {
742
+ "type": "zip",
743
+ "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
744
+ "reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
745
+ "shasum": ""
746
+ },
747
+ "require": {
748
+ "ext-curl": "*",
749
+ "ext-json": "*",
750
+ "ext-simplexml": "*",
751
+ "guzzle/guzzle": ">=3.0",
752
+ "php": ">=5.3",
753
+ "psr/log": "1.0.0",
754
+ "symfony/config": ">=2.0",
755
+ "symfony/console": ">=2.0",
756
+ "symfony/stopwatch": ">=2.2",
757
+ "symfony/yaml": ">=2.0"
758
+ },
759
+ "require-dev": {
760
+ "apigen/apigen": "2.8.*@stable",
761
+ "pdepend/pdepend": "dev-master",
762
+ "phpmd/phpmd": "dev-master",
763
+ "phpunit/php-invoker": ">=1.1.0,<1.2.0",
764
+ "phpunit/phpunit": "3.7.*@stable",
765
+ "sebastian/finder-facade": "dev-master",
766
+ "sebastian/phpcpd": "1.4.*@stable",
767
+ "squizlabs/php_codesniffer": "1.4.*@stable",
768
+ "theseer/fdomdocument": "dev-master"
769
+ },
770
+ "bin": [
771
+ "composer/bin/coveralls"
772
+ ],
773
+ "type": "library",
774
+ "autoload": {
775
+ "psr-0": {
776
+ "Contrib\\Component": "src/",
777
+ "Contrib\\Bundle": "src/"
778
+ }
779
+ },
780
+ "notification-url": "https://packagist.org/downloads/",
781
+ "license": [
782
+ "MIT"
783
+ ],
784
+ "authors": [
785
+ {
786
+ "name": "Kitamura Satoshi",
787
+ "email": "with.no.parachute@gmail.com",
788
+ "homepage": "https://www.facebook.com/satooshi.jp"
789
+ }
790
+ ],
791
+ "description": "PHP client library for Coveralls API",
792
+ "homepage": "https://github.com/satooshi/php-coveralls",
793
+ "keywords": [
794
+ "ci",
795
+ "coverage",
796
+ "github",
797
+ "test"
798
+ ],
799
+ "time": "2013-05-04 08:07:33"
800
+ },
801
+ {
802
+ "name": "sebastian/comparator",
803
+ "version": "1.1.1",
804
+ "source": {
805
+ "type": "git",
806
+ "url": "https://github.com/sebastianbergmann/comparator.git",
807
+ "reference": "1dd8869519a225f7f2b9eb663e225298fade819e"
808
+ },
809
+ "dist": {
810
+ "type": "zip",
811
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e",
812
+ "reference": "1dd8869519a225f7f2b9eb663e225298fade819e",
813
+ "shasum": ""
814
+ },
815
+ "require": {
816
+ "php": ">=5.3.3",
817
+ "sebastian/diff": "~1.2",
818
+ "sebastian/exporter": "~1.2"
819
+ },
820
+ "require-dev": {
821
+ "phpunit/phpunit": "~4.4"
822
+ },
823
+ "type": "library",
824
+ "extra": {
825
+ "branch-alias": {
826
+ "dev-master": "1.1.x-dev"
827
+ }
828
+ },
829
+ "autoload": {
830
+ "classmap": [
831
+ "src/"
832
+ ]
833
+ },
834
+ "notification-url": "https://packagist.org/downloads/",
835
+ "license": [
836
+ "BSD-3-Clause"
837
+ ],
838
+ "authors": [
839
+ {
840
+ "name": "Jeff Welch",
841
+ "email": "whatthejeff@gmail.com"
842
+ },
843
+ {
844
+ "name": "Volker Dusch",
845
+ "email": "github@wallbash.com"
846
+ },
847
+ {
848
+ "name": "Bernhard Schussek",
849
+ "email": "bschussek@2bepublished.at"
850
+ },
851
+ {
852
+ "name": "Sebastian Bergmann",
853
+ "email": "sebastian@phpunit.de"
854
+ }
855
+ ],
856
+ "description": "Provides the functionality to compare PHP values for equality",
857
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
858
+ "keywords": [
859
+ "comparator",
860
+ "compare",
861
+ "equality"
862
+ ],
863
+ "time": "2015-01-29 16:28:08"
864
+ },
865
+ {
866
+ "name": "sebastian/diff",
867
+ "version": "1.3.0",
868
+ "source": {
869
+ "type": "git",
870
+ "url": "https://github.com/sebastianbergmann/diff.git",
871
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
872
+ },
873
+ "dist": {
874
+ "type": "zip",
875
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
876
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
877
+ "shasum": ""
878
+ },
879
+ "require": {
880
+ "php": ">=5.3.3"
881
+ },
882
+ "require-dev": {
883
+ "phpunit/phpunit": "~4.2"
884
+ },
885
+ "type": "library",
886
+ "extra": {
887
+ "branch-alias": {
888
+ "dev-master": "1.3-dev"
889
+ }
890
+ },
891
+ "autoload": {
892
+ "classmap": [
893
+ "src/"
894
+ ]
895
+ },
896
+ "notification-url": "https://packagist.org/downloads/",
897
+ "license": [
898
+ "BSD-3-Clause"
899
+ ],
900
+ "authors": [
901
+ {
902
+ "name": "Kore Nordmann",
903
+ "email": "mail@kore-nordmann.de"
904
+ },
905
+ {
906
+ "name": "Sebastian Bergmann",
907
+ "email": "sebastian@phpunit.de"
908
+ }
909
+ ],
910
+ "description": "Diff implementation",
911
+ "homepage": "http://www.github.com/sebastianbergmann/diff",
912
+ "keywords": [
913
+ "diff"
914
+ ],
915
+ "time": "2015-02-22 15:13:53"
916
+ },
917
+ {
918
+ "name": "sebastian/environment",
919
+ "version": "1.2.2",
920
+ "source": {
921
+ "type": "git",
922
+ "url": "https://github.com/sebastianbergmann/environment.git",
923
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
924
+ },
925
+ "dist": {
926
+ "type": "zip",
927
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
928
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
929
+ "shasum": ""
930
+ },
931
+ "require": {
932
+ "php": ">=5.3.3"
933
+ },
934
+ "require-dev": {
935
+ "phpunit/phpunit": "~4.4"
936
+ },
937
+ "type": "library",
938
+ "extra": {
939
+ "branch-alias": {
940
+ "dev-master": "1.3.x-dev"
941
+ }
942
+ },
943
+ "autoload": {
944
+ "classmap": [
945
+ "src/"
946
+ ]
947
+ },
948
+ "notification-url": "https://packagist.org/downloads/",
949
+ "license": [
950
+ "BSD-3-Clause"
951
+ ],
952
+ "authors": [
953
+ {
954
+ "name": "Sebastian Bergmann",
955
+ "email": "sebastian@phpunit.de"
956
+ }
957
+ ],
958
+ "description": "Provides functionality to handle HHVM/PHP environments",
959
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
960
+ "keywords": [
961
+ "Xdebug",
962
+ "environment",
963
+ "hhvm"
964
+ ],
965
+ "time": "2015-01-01 10:01:08"
966
+ },
967
+ {
968
+ "name": "sebastian/exporter",
969
+ "version": "1.2.0",
970
+ "source": {
971
+ "type": "git",
972
+ "url": "https://github.com/sebastianbergmann/exporter.git",
973
+ "reference": "84839970d05254c73cde183a721c7af13aede943"
974
+ },
975
+ "dist": {
976
+ "type": "zip",
977
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
978
+ "reference": "84839970d05254c73cde183a721c7af13aede943",
979
+ "shasum": ""
980
+ },
981
+ "require": {
982
+ "php": ">=5.3.3",
983
+ "sebastian/recursion-context": "~1.0"
984
+ },
985
+ "require-dev": {
986
+ "phpunit/phpunit": "~4.4"
987
+ },
988
+ "type": "library",
989
+ "extra": {
990
+ "branch-alias": {
991
+ "dev-master": "1.2.x-dev"
992
+ }
993
+ },
994
+ "autoload": {
995
+ "classmap": [
996
+ "src/"
997
+ ]
998
+ },
999
+ "notification-url": "https://packagist.org/downloads/",
1000
+ "license": [
1001
+ "BSD-3-Clause"
1002
+ ],
1003
+ "authors": [
1004
+ {
1005
+ "name": "Jeff Welch",
1006
+ "email": "whatthejeff@gmail.com"
1007
+ },
1008
+ {
1009
+ "name": "Volker Dusch",
1010
+ "email": "github@wallbash.com"
1011
+ },
1012
+ {
1013
+ "name": "Bernhard Schussek",
1014
+ "email": "bschussek@2bepublished.at"
1015
+ },
1016
+ {
1017
+ "name": "Sebastian Bergmann",
1018
+ "email": "sebastian@phpunit.de"
1019
+ },
1020
+ {
1021
+ "name": "Adam Harvey",
1022
+ "email": "aharvey@php.net"
1023
+ }
1024
+ ],
1025
+ "description": "Provides the functionality to export PHP variables for visualization",
1026
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
1027
+ "keywords": [
1028
+ "export",
1029
+ "exporter"
1030
+ ],
1031
+ "time": "2015-01-27 07:23:06"
1032
+ },
1033
+ {
1034
+ "name": "sebastian/global-state",
1035
+ "version": "1.0.0",
1036
+ "source": {
1037
+ "type": "git",
1038
+ "url": "https://github.com/sebastianbergmann/global-state.git",
1039
+ "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
1040
+ },
1041
+ "dist": {
1042
+ "type": "zip",
1043
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
1044
+ "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
1045
+ "shasum": ""
1046
+ },
1047
+ "require": {
1048
+ "php": ">=5.3.3"
1049
+ },
1050
+ "require-dev": {
1051
+ "phpunit/phpunit": "~4.2"
1052
+ },
1053
+ "suggest": {
1054
+ "ext-uopz": "*"
1055
+ },
1056
+ "type": "library",
1057
+ "extra": {
1058
+ "branch-alias": {
1059
+ "dev-master": "1.0-dev"
1060
+ }
1061
+ },
1062
+ "autoload": {
1063
+ "classmap": [
1064
+ "src/"
1065
+ ]
1066
+ },
1067
+ "notification-url": "https://packagist.org/downloads/",
1068
+ "license": [
1069
+ "BSD-3-Clause"
1070
+ ],
1071
+ "authors": [
1072
+ {
1073
+ "name": "Sebastian Bergmann",
1074
+ "email": "sebastian@phpunit.de"
1075
+ }
1076
+ ],
1077
+ "description": "Snapshotting of global state",
1078
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
1079
+ "keywords": [
1080
+ "global state"
1081
+ ],
1082
+ "time": "2014-10-06 09:23:50"
1083
+ },
1084
+ {
1085
+ "name": "sebastian/recursion-context",
1086
+ "version": "1.0.0",
1087
+ "source": {
1088
+ "type": "git",
1089
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
1090
+ "reference": "3989662bbb30a29d20d9faa04a846af79b276252"
1091
+ },
1092
+ "dist": {
1093
+ "type": "zip",
1094
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
1095
+ "reference": "3989662bbb30a29d20d9faa04a846af79b276252",
1096
+ "shasum": ""
1097
+ },
1098
+ "require": {
1099
+ "php": ">=5.3.3"
1100
+ },
1101
+ "require-dev": {
1102
+ "phpunit/phpunit": "~4.4"
1103
+ },
1104
+ "type": "library",
1105
+ "extra": {
1106
+ "branch-alias": {
1107
+ "dev-master": "1.0.x-dev"
1108
+ }
1109
+ },
1110
+ "autoload": {
1111
+ "classmap": [
1112
+ "src/"
1113
+ ]
1114
+ },
1115
+ "notification-url": "https://packagist.org/downloads/",
1116
+ "license": [
1117
+ "BSD-3-Clause"
1118
+ ],
1119
+ "authors": [
1120
+ {
1121
+ "name": "Jeff Welch",
1122
+ "email": "whatthejeff@gmail.com"
1123
+ },
1124
+ {
1125
+ "name": "Sebastian Bergmann",
1126
+ "email": "sebastian@phpunit.de"
1127
+ },
1128
+ {
1129
+ "name": "Adam Harvey",
1130
+ "email": "aharvey@php.net"
1131
+ }
1132
+ ],
1133
+ "description": "Provides functionality to recursively process PHP variables",
1134
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
1135
+ "time": "2015-01-24 09:48:32"
1136
+ },
1137
+ {
1138
+ "name": "sebastian/version",
1139
+ "version": "1.0.5",
1140
+ "source": {
1141
+ "type": "git",
1142
+ "url": "https://github.com/sebastianbergmann/version.git",
1143
+ "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
1144
+ },
1145
+ "dist": {
1146
+ "type": "zip",
1147
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
1148
+ "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
1149
+ "shasum": ""
1150
+ },
1151
+ "type": "library",
1152
+ "autoload": {
1153
+ "classmap": [
1154
+ "src/"
1155
+ ]
1156
+ },
1157
+ "notification-url": "https://packagist.org/downloads/",
1158
+ "license": [
1159
+ "BSD-3-Clause"
1160
+ ],
1161
+ "authors": [
1162
+ {
1163
+ "name": "Sebastian Bergmann",
1164
+ "email": "sebastian@phpunit.de",
1165
+ "role": "lead"
1166
+ }
1167
+ ],
1168
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
1169
+ "homepage": "https://github.com/sebastianbergmann/version",
1170
+ "time": "2015-02-24 06:35:25"
1171
+ },
1172
+ {
1173
+ "name": "symfony/config",
1174
+ "version": "v2.7.1",
1175
+ "source": {
1176
+ "type": "git",
1177
+ "url": "https://github.com/symfony/Config.git",
1178
+ "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374"
1179
+ },
1180
+ "dist": {
1181
+ "type": "zip",
1182
+ "url": "https://api.github.com/repos/symfony/Config/zipball/58ded81f1f582a87c528ef3dae9a859f78b5f374",
1183
+ "reference": "58ded81f1f582a87c528ef3dae9a859f78b5f374",
1184
+ "shasum": ""
1185
+ },
1186
+ "require": {
1187
+ "php": ">=5.3.9",
1188
+ "symfony/filesystem": "~2.3"
1189
+ },
1190
+ "require-dev": {
1191
+ "symfony/phpunit-bridge": "~2.7"
1192
+ },
1193
+ "type": "library",
1194
+ "extra": {
1195
+ "branch-alias": {
1196
+ "dev-master": "2.7-dev"
1197
+ }
1198
+ },
1199
+ "autoload": {
1200
+ "psr-4": {
1201
+ "Symfony\\Component\\Config\\": ""
1202
+ }
1203
+ },
1204
+ "notification-url": "https://packagist.org/downloads/",
1205
+ "license": [
1206
+ "MIT"
1207
+ ],
1208
+ "authors": [
1209
+ {
1210
+ "name": "Fabien Potencier",
1211
+ "email": "fabien@symfony.com"
1212
+ },
1213
+ {
1214
+ "name": "Symfony Community",
1215
+ "homepage": "https://symfony.com/contributors"
1216
+ }
1217
+ ],
1218
+ "description": "Symfony Config Component",
1219
+ "homepage": "https://symfony.com",
1220
+ "time": "2015-06-11 14:06:56"
1221
+ },
1222
+ {
1223
+ "name": "symfony/console",
1224
+ "version": "v2.7.1",
1225
+ "source": {
1226
+ "type": "git",
1227
+ "url": "https://github.com/symfony/Console.git",
1228
+ "reference": "564398bc1f33faf92fc2ec86859983d30eb81806"
1229
+ },
1230
+ "dist": {
1231
+ "type": "zip",
1232
+ "url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806",
1233
+ "reference": "564398bc1f33faf92fc2ec86859983d30eb81806",
1234
+ "shasum": ""
1235
+ },
1236
+ "require": {
1237
+ "php": ">=5.3.9"
1238
+ },
1239
+ "require-dev": {
1240
+ "psr/log": "~1.0",
1241
+ "symfony/event-dispatcher": "~2.1",
1242
+ "symfony/phpunit-bridge": "~2.7",
1243
+ "symfony/process": "~2.1"
1244
+ },
1245
+ "suggest": {
1246
+ "psr/log": "For using the console logger",
1247
+ "symfony/event-dispatcher": "",
1248
+ "symfony/process": ""
1249
+ },
1250
+ "type": "library",
1251
+ "extra": {
1252
+ "branch-alias": {
1253
+ "dev-master": "2.7-dev"
1254
+ }
1255
+ },
1256
+ "autoload": {
1257
+ "psr-4": {
1258
+ "Symfony\\Component\\Console\\": ""
1259
+ }
1260
+ },
1261
+ "notification-url": "https://packagist.org/downloads/",
1262
+ "license": [
1263
+ "MIT"
1264
+ ],
1265
+ "authors": [
1266
+ {
1267
+ "name": "Fabien Potencier",
1268
+ "email": "fabien@symfony.com"
1269
+ },
1270
+ {
1271
+ "name": "Symfony Community",
1272
+ "homepage": "https://symfony.com/contributors"
1273
+ }
1274
+ ],
1275
+ "description": "Symfony Console Component",
1276
+ "homepage": "https://symfony.com",
1277
+ "time": "2015-06-10 15:30:22"
1278
+ },
1279
+ {
1280
+ "name": "symfony/event-dispatcher",
1281
+ "version": "v2.7.1",
1282
+ "source": {
1283
+ "type": "git",
1284
+ "url": "https://github.com/symfony/EventDispatcher.git",
1285
+ "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9"
1286
+ },
1287
+ "dist": {
1288
+ "type": "zip",
1289
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9",
1290
+ "reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9",
1291
+ "shasum": ""
1292
+ },
1293
+ "require": {
1294
+ "php": ">=5.3.9"
1295
+ },
1296
+ "require-dev": {
1297
+ "psr/log": "~1.0",
1298
+ "symfony/config": "~2.0,>=2.0.5",
1299
+ "symfony/dependency-injection": "~2.6",
1300
+ "symfony/expression-language": "~2.6",
1301
+ "symfony/phpunit-bridge": "~2.7",
1302
+ "symfony/stopwatch": "~2.3"
1303
+ },
1304
+ "suggest": {
1305
+ "symfony/dependency-injection": "",
1306
+ "symfony/http-kernel": ""
1307
+ },
1308
+ "type": "library",
1309
+ "extra": {
1310
+ "branch-alias": {
1311
+ "dev-master": "2.7-dev"
1312
+ }
1313
+ },
1314
+ "autoload": {
1315
+ "psr-4": {
1316
+ "Symfony\\Component\\EventDispatcher\\": ""
1317
+ }
1318
+ },
1319
+ "notification-url": "https://packagist.org/downloads/",
1320
+ "license": [
1321
+ "MIT"
1322
+ ],
1323
+ "authors": [
1324
+ {
1325
+ "name": "Fabien Potencier",
1326
+ "email": "fabien@symfony.com"
1327
+ },
1328
+ {
1329
+ "name": "Symfony Community",
1330
+ "homepage": "https://symfony.com/contributors"
1331
+ }
1332
+ ],
1333
+ "description": "Symfony EventDispatcher Component",
1334
+ "homepage": "https://symfony.com",
1335
+ "time": "2015-06-08 09:37:21"
1336
+ },
1337
+ {
1338
+ "name": "symfony/filesystem",
1339
+ "version": "v2.7.1",
1340
+ "source": {
1341
+ "type": "git",
1342
+ "url": "https://github.com/symfony/Filesystem.git",
1343
+ "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3"
1344
+ },
1345
+ "dist": {
1346
+ "type": "zip",
1347
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a0d43eb3e17d4f4c6990289805a488a0482a07f3",
1348
+ "reference": "a0d43eb3e17d4f4c6990289805a488a0482a07f3",
1349
+ "shasum": ""
1350
+ },
1351
+ "require": {
1352
+ "php": ">=5.3.9"
1353
+ },
1354
+ "require-dev": {
1355
+ "symfony/phpunit-bridge": "~2.7"
1356
+ },
1357
+ "type": "library",
1358
+ "extra": {
1359
+ "branch-alias": {
1360
+ "dev-master": "2.7-dev"
1361
+ }
1362
+ },
1363
+ "autoload": {
1364
+ "psr-4": {
1365
+ "Symfony\\Component\\Filesystem\\": ""
1366
+ }
1367
+ },
1368
+ "notification-url": "https://packagist.org/downloads/",
1369
+ "license": [
1370
+ "MIT"
1371
+ ],
1372
+ "authors": [
1373
+ {
1374
+ "name": "Fabien Potencier",
1375
+ "email": "fabien@symfony.com"
1376
+ },
1377
+ {
1378
+ "name": "Symfony Community",
1379
+ "homepage": "https://symfony.com/contributors"
1380
+ }
1381
+ ],
1382
+ "description": "Symfony Filesystem Component",
1383
+ "homepage": "https://symfony.com",
1384
+ "time": "2015-06-08 09:37:21"
1385
+ },
1386
+ {
1387
+ "name": "symfony/stopwatch",
1388
+ "version": "v2.7.1",
1389
+ "source": {
1390
+ "type": "git",
1391
+ "url": "https://github.com/symfony/Stopwatch.git",
1392
+ "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b"
1393
+ },
1394
+ "dist": {
1395
+ "type": "zip",
1396
+ "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/c653f1985f6c2b7dbffd04d48b9c0a96aaef814b",
1397
+ "reference": "c653f1985f6c2b7dbffd04d48b9c0a96aaef814b",
1398
+ "shasum": ""
1399
+ },
1400
+ "require": {
1401
+ "php": ">=5.3.9"
1402
+ },
1403
+ "require-dev": {
1404
+ "symfony/phpunit-bridge": "~2.7"
1405
+ },
1406
+ "type": "library",
1407
+ "extra": {
1408
+ "branch-alias": {
1409
+ "dev-master": "2.7-dev"
1410
+ }
1411
+ },
1412
+ "autoload": {
1413
+ "psr-4": {
1414
+ "Symfony\\Component\\Stopwatch\\": ""
1415
+ }
1416
+ },
1417
+ "notification-url": "https://packagist.org/downloads/",
1418
+ "license": [
1419
+ "MIT"
1420
+ ],
1421
+ "authors": [
1422
+ {
1423
+ "name": "Fabien Potencier",
1424
+ "email": "fabien@symfony.com"
1425
+ },
1426
+ {
1427
+ "name": "Symfony Community",
1428
+ "homepage": "https://symfony.com/contributors"
1429
+ }
1430
+ ],
1431
+ "description": "Symfony Stopwatch Component",
1432
+ "homepage": "https://symfony.com",
1433
+ "time": "2015-06-04 20:11:48"
1434
+ },
1435
+ {
1436
+ "name": "symfony/yaml",
1437
+ "version": "v2.7.1",
1438
+ "source": {
1439
+ "type": "git",
1440
+ "url": "https://github.com/symfony/Yaml.git",
1441
+ "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160"
1442
+ },
1443
+ "dist": {
1444
+ "type": "zip",
1445
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160",
1446
+ "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160",
1447
+ "shasum": ""
1448
+ },
1449
+ "require": {
1450
+ "php": ">=5.3.9"
1451
+ },
1452
+ "require-dev": {
1453
+ "symfony/phpunit-bridge": "~2.7"
1454
+ },
1455
+ "type": "library",
1456
+ "extra": {
1457
+ "branch-alias": {
1458
+ "dev-master": "2.7-dev"
1459
+ }
1460
+ },
1461
+ "autoload": {
1462
+ "psr-4": {
1463
+ "Symfony\\Component\\Yaml\\": ""
1464
+ }
1465
+ },
1466
+ "notification-url": "https://packagist.org/downloads/",
1467
+ "license": [
1468
+ "MIT"
1469
+ ],
1470
+ "authors": [
1471
+ {
1472
+ "name": "Fabien Potencier",
1473
+ "email": "fabien@symfony.com"
1474
+ },
1475
+ {
1476
+ "name": "Symfony Community",
1477
+ "homepage": "https://symfony.com/contributors"
1478
+ }
1479
+ ],
1480
+ "description": "Symfony Yaml Component",
1481
+ "homepage": "https://symfony.com",
1482
+ "time": "2015-06-10 15:30:22"
1483
+ }
1484
+ ],
1485
+ "aliases": [],
1486
+ "minimum-stability": "stable",
1487
+ "stability-flags": [],
1488
+ "prefer-stable": false,
1489
+ "prefer-lowest": false,
1490
+ "platform": [],
1491
+ "platform-dev": []
1492
+ }
lib/vendor/enshrined/svg-sanitize/phpunit.xml.dist ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit bootstrap="vendor/autoload.php"
3
+ colors="true"
4
+ stopOnFailure="false"
5
+ syntaxCheck="false">
6
+
7
+ <testsuites>
8
+ <testsuite name="The project's test suite">
9
+ <directory>./tests</directory>
10
+ </testsuite>
11
+ </testsuites>
12
+
13
+ <logging>
14
+ <log type="coverage-clover" target="./build/logs/clover.xml"/>
15
+ </logging>
16
+
17
+ </phpunit>
lib/vendor/enshrined/svg-sanitize/src/Sanitizer.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace enshrined\svgSanitize;
5
+
6
+
7
+ use DOMDocument;
8
+ use enshrined\svgSanitize\data\AllowedAttributes;
9
+ use enshrined\svgSanitize\data\AllowedTags;
10
+ use enshrined\svgSanitize\data\AttributeInterface;
11
+ use enshrined\svgSanitize\data\TagInterface;
12
+
13
+ /**
14
+ * Class Sanitizer
15
+ *
16
+ * @package enshrined\svgSanitize
17
+ */
18
+ class Sanitizer
19
+ {
20
+
21
+ /**
22
+ * Regex to catch script and data values in attributes
23
+ */
24
+ const SCRIPT_REGEX = '/(?:\w+script|data):/xi';
25
+
26
+ /**
27
+ * @var DOMDocument
28
+ */
29
+ protected $xmlDocument;
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ protected $allowedTags;
35
+
36
+ /**
37
+ * @var array
38
+ */
39
+ protected $allowedAttrs;
40
+
41
+ /**
42
+ * @var
43
+ */
44
+ protected $xmlLoaderValue;
45
+
46
+ /**
47
+ *
48
+ */
49
+ function __construct()
50
+ {
51
+ $this->resetInternal();
52
+
53
+ // Load default tags/attributes
54
+ $this->allowedAttrs = AllowedAttributes::getAttributes();
55
+ $this->allowedTags = AllowedTags::getTags();
56
+ }
57
+
58
+ /**
59
+ * Set up the DOMDocument
60
+ */
61
+ protected function resetInternal()
62
+ {
63
+ $this->xmlDocument = new DOMDocument();
64
+ $this->xmlDocument->preserveWhiteSpace = false;
65
+ $this->xmlDocument->strictErrorChecking = false;
66
+ $this->xmlDocument->formatOutput = true;
67
+ }
68
+
69
+ /**
70
+ * Get the array of allowed tags
71
+ *
72
+ * @return array
73
+ */
74
+ public function getAllowedTags()
75
+ {
76
+ return $this->allowedTags;
77
+ }
78
+
79
+ /**
80
+ * Set custom allowed tags
81
+ *
82
+ * @param TagInterface $allowedTags
83
+ */
84
+ public function setAllowedTags(TagInterface $allowedTags)
85
+ {
86
+ $this->allowedTags = $allowedTags::getTags();
87
+ }
88
+
89
+ /**
90
+ * Get the array of allowed attributes
91
+ *
92
+ * @return array
93
+ */
94
+ public function getAllowedAttrs()
95
+ {
96
+ return $this->allowedAttrs;
97
+ }
98
+
99
+ /**
100
+ * Set custom allowed attributes
101
+ *
102
+ * @param AttributeInterface $allowedAttrs
103
+ */
104
+ public function setAllowedAttrs(AttributeInterface $allowedAttrs)
105
+ {
106
+ $this->allowedAttrs = $allowedAttrs::getAttributes();
107
+ }
108
+
109
+ /**
110
+ * Sanitize the passed string
111
+ *
112
+ * @param string $dirty
113
+ * @return string
114
+ */
115
+ public function sanitize($dirty)
116
+ {
117
+ // Don't run on an empty string
118
+ if (empty($dirty)) {
119
+ return '';
120
+ }
121
+
122
+ $this->setUpBefore();
123
+
124
+ $loaded = $this->xmlDocument->loadXML($dirty);
125
+
126
+ // If we couldn't parse the XML then we go no further. Reset and return false
127
+ if (!$loaded) {
128
+ $this->resetAfter();
129
+ return false;
130
+ }
131
+
132
+ $this->removeDoctype();
133
+
134
+ // Grab all the elements
135
+ $allElements = $this->xmlDocument->getElementsByTagName("*");
136
+
137
+ // Start the cleaning proccess
138
+ $this->startClean($allElements);
139
+
140
+ // Save cleaned XML to a variable
141
+ $clean = $this->xmlDocument->saveXML($this->xmlDocument->documentElement);
142
+
143
+ $this->resetAfter();
144
+ // Return result
145
+ return $clean;
146
+ }
147
+
148
+ /**
149
+ * Set up libXML before we start
150
+ */
151
+ protected function setUpBefore()
152
+ {
153
+ // Turn off the entity loader
154
+ $this->xmlLoaderValue = libxml_disable_entity_loader(true);
155
+
156
+ // Suppress the errors because we don't really have to worry about formation before cleansing
157
+ libxml_use_internal_errors(true);
158
+ }
159
+
160
+ /**
161
+ * Reset the class after use
162
+ */
163
+ protected function resetAfter()
164
+ {
165
+ // Reset DOMDocument to a clean state in case we use it again
166
+ $this->resetInternal();
167
+
168
+ // Reset the entity loader3
169
+ libxml_disable_entity_loader($this->xmlLoaderValue);
170
+ }
171
+
172
+ /**
173
+ * Remove the XML Doctype
174
+ * It may be caught later on output but that seems to be buggy, so we need to make sure it's gone
175
+ */
176
+ protected function removeDoctype()
177
+ {
178
+ foreach ($this->xmlDocument->childNodes as $child) {
179
+ if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
180
+ $child->parentNode->removeChild($child);
181
+ }
182
+ }
183
+ }
184
+
185
+ /**
186
+ * Start the cleaning with tags, then we move onto attributes and hrefs later
187
+ *
188
+ * @param \DOMNodeList $elements
189
+ */
190
+ protected function startClean(\DOMNodeList $elements)
191
+ {
192
+ // loop through all elements
193
+ // we do this backwards so we don't skip anything if we delete a node
194
+ // see comments at: http://php.net/manual/en/class.domnamednodemap.php
195
+ for ($i = $elements->length - 1; $i >= 0; $i--) {
196
+ $currentElement = $elements->item($i);
197
+
198
+ // If the tag isn't in the whitelist, remove it and continue with next iteration
199
+ if (!in_array($currentElement->tagName, $this->allowedTags)) {
200
+ $currentElement->parentNode->removeChild($currentElement);
201
+ continue;
202
+ }
203
+
204
+ $this->cleanAttributesOnWhitelist($currentElement);
205
+
206
+ $this->cleanXlinkHrefs($currentElement);
207
+
208
+ $this->cleanHrefs($currentElement);
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Only allow attributes that are on the whitelist
214
+ *
215
+ * @param \DOMElement $element
216
+ */
217
+ protected function cleanAttributesOnWhitelist(\DOMElement $element)
218
+ {
219
+ for ($x = $element->attributes->length - 1; $x >= 0; $x--) {
220
+ // get attribute name
221
+ $attrName = $element->attributes->item($x)->name;
222
+
223
+ // Remove attribute if not in whitelist
224
+ if (!in_array($attrName, $this->allowedAttrs)) {
225
+ $element->removeAttribute($attrName);
226
+ }
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Clean the xlink:hrefs of script and data embeds
232
+ *
233
+ * @param \DOMElement $element
234
+ */
235
+ protected function cleanXlinkHrefs(\DOMElement &$element)
236
+ {
237
+ $xlinks = $element->getAttributeNS('http://www.w3.org/1999/xlink', 'href');
238
+ if (preg_match(self::SCRIPT_REGEX, $xlinks) === 1) {
239
+ $element->removeAttributeNS('http://www.w3.org/1999/xlink', 'href');
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Clean the hrefs of script and data embeds
245
+ *
246
+ * @param \DOMElement $element
247
+ */
248
+ protected function cleanHrefs(\DOMElement &$element)
249
+ {
250
+ $href = $element->getAttribute('href');
251
+ if (preg_match(self::SCRIPT_REGEX, $href) === 1) {
252
+ $element->removeAttribute('href');
253
+ }
254
+ }
255
+ }
lib/vendor/enshrined/svg-sanitize/src/data/AllowedAttributes.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace enshrined\svgSanitize\data;
5
+
6
+
7
+ /**
8
+ * Class AllowedAttributes
9
+ *
10
+ * @package enshrined\svgSanitize\data
11
+ */
12
+ class AllowedAttributes implements AttributeInterface
13
+ {
14
+
15
+ /**
16
+ * Returns an array of attributes
17
+ *
18
+ * @return array
19
+ */
20
+ public static function getAttributes()
21
+ {
22
+ return array(
23
+ // HTML
24
+ 'accept','action','align','alt','autocomplete','background','bgcolor',
25
+ 'border','cellpadding','cellspacing','checked','cite','class','clear','color',
26
+ 'cols','colspan','coords','datetime','default','dir','disabled',
27
+ 'download','enctype','face','for','headers','height','hidden','high','href',
28
+ 'hreflang','id','ismap','label','lang','list','loop', 'low','max',
29
+ 'maxlength','media','method','min','multiple','name','noshade','novalidate',
30
+ 'nowrap','open','optimum','pattern','placeholder','poster','preload','pubdate',
31
+ 'radiogroup','readonly','rel','required','rev','reversed','rows',
32
+ 'rowspan','spellcheck','scope','selected','shape','size','span',
33
+ 'srclang','start','src','step','style','summary','tabindex','title',
34
+ 'type','usemap','valign','value','width','xmlns',
35
+
36
+ // SVG
37
+ 'accent-height','accumulate','additivive','alignment-baseline',
38
+ 'ascent','azimuth','baseline-shift','bias','clip','clip-path',
39
+ 'clip-rule','color','color-interpolation','color-interpolation-filters',
40
+ 'color-profile','color-rendering','cx','cy','d','dy','dy','direction',
41
+ 'display','divisor','dur','elevation','end','fill','fill-opacity',
42
+ 'fill-rule','filter','flood-color','flood-opacity','font-family',
43
+ 'font-size','font-size-adjust','font-stretch','font-style','font-variant',
44
+ 'font-weight','image-rendering','in','in2','k1','k2','k3','k4','kerning',
45
+ 'letter-spacing','lighting-color','local','marker-end','marker-mid',
46
+ 'marker-start','max','mask','mode','min','offset','operator','opacity',
47
+ 'order','overflow','paint-order','path','points','r','rx','ry','radius',
48
+ 'restart','scale','seed','shape-rendering','stop-color','stop-opacity',
49
+ 'stroke-dasharray','stroke-dashoffset','stroke-linecap','stroke-linejoin',
50
+ 'stroke-miterlimit','stroke-opacity','stroke','stroke-width','transform',
51
+ 'text-anchor','text-decoration','text-rendering','u1','u2','viewbox',
52
+ 'visibility','word-spacing','wrap','writing-mode','x','x1','x2','y',
53
+ 'y1','y2','z',
54
+
55
+ // MathML
56
+ 'accent','accentunder','bevelled','close','columnsalign','columnlines',
57
+ 'columnspan','denomalign','depth','display','displaystyle','fence',
58
+ 'frame','largeop','length','linethickness','lspace','lquote',
59
+ 'mathbackground','mathcolor','mathsize','mathvariant','maxsize',
60
+ 'minsize','movablelimits','notation','numalign','open','rowalign',
61
+ 'rowlines','rowspacing','rowspan','rspace','rquote','scriptlevel',
62
+ 'scriptminsize','scriptsizemultiplier','selection','separator',
63
+ 'separators','stretchy','subscriptshift','supscriptshift','symmetric',
64
+ 'voffset',
65
+
66
+ // XML
67
+ 'xlink:href','xml:id','xlink:title','xml:space'
68
+ );
69
+ }
70
+ }
lib/vendor/enshrined/svg-sanitize/src/data/AllowedTags.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace enshrined\svgSanitize\data;
5
+
6
+
7
+ /**
8
+ * Class AllowedTags
9
+ *
10
+ * @package enshrined\svgSanitize\data
11
+ */
12
+ class AllowedTags implements TagInterface
13
+ {
14
+
15
+ /**
16
+ * Returns an array of tags
17
+ *
18
+ * @return array
19
+ */
20
+ public static function getTags()
21
+ {
22
+ return array (
23
+ // HTML
24
+ 'a','abbr','acronym','address','area','article','aside','audio','b',
25
+ 'bdi','bdo','big','blink','blockquote','body','br','button','canvas',
26
+ 'caption','center','cite','code','col','colgroup','content','data',
27
+ 'datalist','dd','decorator','del','details','dfn','dir','div','dl','dt',
28
+ 'element','em','fieldset','figcaption','figure','font','footer','form',
29
+ 'h1','h2','h3','h4','h5','h6','head','header','hgroup','hr','html','i',
30
+ 'img','input','ins','kbd','label','legend','li','main','map','mark',
31
+ 'marquee','menu','menuitem','meter','nav','nobr','ol','optgroup',
32
+ 'option','output','p','pre','progress','q','rp','rt','ruby','s','samp',
33
+ 'section','select','shadow','small','source','spacer','span','strike',
34
+ 'strong','style','sub','summary','sup','table','tbody','td','template',
35
+ 'textarea','tfoot','th','thead','time','tr','track','tt','u','ul','var',
36
+ 'video','wbr',
37
+
38
+ // SVG
39
+ 'svg','altglyph','altglyphdef','altglyphitem','animatecolor',
40
+ 'animatemotion','animatetransform','circle','clippath','defs','desc',
41
+ 'ellipse','font','g','glyph','glyphref','hkern','image','line',
42
+ 'lineargradient','marker','mask','metadata','mpath','path','pattern',
43
+ 'polygon','polyline','radialgradient','rect','stop','switch','symbol',
44
+ 'text','textpath','title','tref','tspan','view','vkern',
45
+
46
+ //MathML
47
+ 'math','menclose','merror','mfenced','mfrac','mglyph','mi','mlabeledtr',
48
+ 'mmuliscripts','mn','mo','mover','mpadded','mphantom','mroot','mrow',
49
+ 'ms','mpspace','msqrt','mystyle','msub','msup','msubsup','mtable','mtd',
50
+ 'mtext','mtr','munder','munderover',
51
+
52
+ //Text
53
+ '#text'
54
+ );
55
+ }
56
+ }
lib/vendor/enshrined/svg-sanitize/src/data/AttributeInterface.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace enshrined\svgSanitize\data;
5
+
6
+
7
+ /**
8
+ * Class AttributeInterface
9
+ *
10
+ * @package enshrined\svgSanitize\data
11
+ */
12
+ interface AttributeInterface
13
+ {
14
+
15
+ /**
16
+ * Returns an array of attributes
17
+ *
18
+ * @return array
19
+ */
20
+ public static function getAttributes();
21
+ }
lib/vendor/enshrined/svg-sanitize/src/data/TagInterface.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace enshrined\svgSanitize\data;
5
+
6
+
7
+ /**
8
+ * Interface TagInterface
9
+ *
10
+ * @package enshrined\svgSanitize\tags
11
+ */
12
+ interface TagInterface
13
+ {
14
+
15
+ /**
16
+ * Returns an array of tags
17
+ *
18
+ * @return array
19
+ */
20
+ public static function getTags();
21
+
22
+ }
lib/vendor/enshrined/svg-sanitize/tests/AllowedAttributesTest.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use \enshrined\svgSanitize\data\AllowedAttributes;
4
+
5
+ /**
6
+ * Class AllowedAttributesTest
7
+ */
8
+ class AllowedAttributesTest extends PHPUnit_Framework_TestCase
9
+ {
10
+
11
+ /**
12
+ * @var AllowedAttributes
13
+ */
14
+ protected $class;
15
+
16
+ /**
17
+ * Set up the test class
18
+ */
19
+ public function setUp()
20
+ {
21
+ $this->class = new AllowedAttributes();
22
+ }
23
+
24
+ /**
25
+ * Test that the class implements the interface
26
+ */
27
+ public function testItImplementsTheInterface()
28
+ {
29
+ $this->assertInstanceOf('enshrined\svgSanitize\data\AttributeInterface', $this->class);
30
+ }
31
+
32
+ /**
33
+ * Test that an array is returned
34
+ */
35
+ public function testThatItReturnsAnArray()
36
+ {
37
+ $result = AllowedAttributes::getAttributes();
38
+
39
+ $this->assertInternalType('array', $result);
40
+ }
41
+ }
lib/vendor/enshrined/svg-sanitize/tests/AllowedTagsTest.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use \enshrined\svgSanitize\data\AllowedTags;
4
+
5
+ /**
6
+ * Class AllowedTagsTest
7
+ */
8
+ class AllowedTagsTest extends PHPUnit_Framework_TestCase
9
+ {
10
+
11
+ /**
12
+ * @var AllowedTags
13
+ */
14
+ protected $class;
15
+
16
+ /**
17
+ * Set up the test class
18
+ */
19
+ public function setUp()
20
+ {
21
+ $this->class = new AllowedTags();
22
+ }
23
+
24
+ /**
25
+ * Test that the class implements the interface
26
+ */
27
+ public function testItImplementsTheInterface()
28
+ {
29
+ $this->assertInstanceOf('enshrined\svgSanitize\data\TagInterface', $this->class);
30
+ }
31
+
32
+ /**
33
+ * Test that an array is returned
34
+ */
35
+ public function testThatItReturnsAnArray()
36
+ {
37
+ $result = AllowedTags::getTags();
38
+
39
+ $this->assertInternalType('array', $result);
40
+ }
41
+ }
lib/vendor/enshrined/svg-sanitize/tests/SanitizerTest.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require 'data/TestAllowedTags.php';
3
+ require 'data/TestAllowedAttributes.php';
4
+
5
+ use \enshrined\svgSanitize\Sanitizer;
6
+
7
+ /**
8
+ * Class SanitizerTest
9
+ */
10
+ class SanitizerTest extends PHPUnit_Framework_TestCase
11
+ {
12
+ /**
13
+ * @var Sanitizer
14
+ */
15
+ protected $class;
16
+
17
+ /**
18
+ * Set up the test class
19
+ */
20
+ public function setUp()
21
+ {
22
+ $this->class = new Sanitizer();
23
+ }
24
+
25
+ /**
26
+ * Make sure the initial tags are loaded
27
+ */
28
+ public function testLoadDefaultTags()
29
+ {
30
+ $tags = $this->class->getAllowedTags();
31
+
32
+ $this->assertInternalType('array', $tags);
33
+ }
34
+
35
+ /**
36
+ * Make sure the initial attributes are loaded
37
+ */
38
+ public function testLoadDefaultAttributes()
39
+ {
40
+ $attributes = $this->class->getAllowedAttrs();
41
+
42
+ $this->assertInternalType('array', $attributes);
43
+ }
44
+
45
+ /**
46
+ * Test the custom tag setters and getters
47
+ */
48
+ public function testSetCustomTags()
49
+ {
50
+ $this->class->setAllowedTags(new TestAllowedTags());
51
+
52
+ $tags = $this->class->getAllowedTags();
53
+
54
+ $this->assertInternalType('array', $tags);
55
+ $this->assertEquals(TestAllowedTags::getTags(), $tags);
56
+ }
57
+
58
+ /**
59
+ * Test the custom attribute setters and getters
60
+ */
61
+ public function testSetCustomAttributes()
62
+ {
63
+ $this->class->setAllowedAttrs(new TestAllowedAttributes());
64
+
65
+ $attributes = $this->class->getAllowedAttrs();
66
+
67
+ $this->assertInternalType('array', $attributes);
68
+ $this->assertEquals(TestAllowedAttributes::getAttributes(), $attributes);
69
+ }
70
+
71
+ /**
72
+ * Test that malicious elements and attributes are removed from standard XML
73
+ */
74
+ public function testSanitizeXMLDoc()
75
+ {
76
+ $initialData = file_get_contents('tests/data/xmlTestOne.xml');
77
+ $expected = file_get_contents('tests/data/xmlCleanOne.xml');
78
+
79
+ $cleanData = $this->class->sanitize($initialData);
80
+
81
+ $this->assertXmlStringEqualsXmlString($expected, $cleanData);
82
+ }
83
+
84
+ /**
85
+ * Test that malicious elements and attributes are removed from an SVG
86
+ */
87
+ public function testSanitizeSVGDoc()
88
+ {
89
+ $initialData = file_get_contents('tests/data/svgTestOne.svg');
90
+ $expected = file_get_contents('tests/data/svgCleanOne.svg');
91
+
92
+ $cleanData = $this->class->sanitize($initialData);
93
+
94
+ $this->assertXmlStringEqualsXmlString($expected, $cleanData);
95
+ }
96
+
97
+ /**
98
+ * Test that a badly formatted XML document returns false
99
+ */
100
+ public function testBadXMLReturnsFalse()
101
+ {
102
+ $initialData = file_get_contents('tests/data/badXmlTestOne.svg');
103
+
104
+ $cleanData = $this->class->sanitize($initialData);
105
+
106
+ $this->assertEquals(false, $cleanData);
107
+ }
108
+
109
+ /**
110
+ * Make sure that hrefs get sanitized correctly
111
+ */
112
+ public function testSanitizeHrefs()
113
+ {
114
+ $initialData = file_get_contents('tests/data/hrefTestOne.svg');
115
+ $expected = file_get_contents('tests/data/hrefCleanOne.svg');
116
+
117
+ $cleanData = $this->class->sanitize($initialData);
118
+
119
+ $this->assertXmlStringEqualsXmlString($expected, $cleanData);
120
+ }
121
+ }
lib/vendor/enshrined/svg-sanitize/tests/data/TestAllowedAttributes.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class TestAllowedAttributes implements \enshrined\svgSanitize\data\AttributeInterface
5
+ {
6
+
7
+ /**
8
+ * Returns an array of attributes
9
+ *
10
+ * @return array
11
+ */
12
+ public static function getAttributes()
13
+ {
14
+ return array(
15
+ 'testAttribute',
16
+ );
17
+ }
18
+ }
lib/vendor/enshrined/svg-sanitize/tests/data/TestAllowedTags.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class TestAllowedTags implements enshrined\svgSanitize\data\TagInterface
5
+ {
6
+
7
+ /**
8
+ * Returns an array of tags
9
+ *
10
+ * @return array
11
+ */
12
+ public static function getTags()
13
+ {
14
+ return array(
15
+ 'testTag',
16
+ );
17
+ }
18
+ }
lib/vendor/enshrined/svg-sanitize/tests/data/badXmlTestOne.svg ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="600px" height="600px" viewBox="0 0 600 600" enable-background="new 0 0 600 600" xml:space="preserve">
6
+ <line onload="alert(2)" fill="none" stroke="#000000" stroke-miterlimit="10" x1="119" y1="84.5" x2="454" y2="84.5"/>
7
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="111.212" y1="102.852" x2="112.032" y2="476.623"/>
8
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="198.917" y1="510.229" x2="486.622" y2="501.213">
9
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="484.163" y1="442.196" x2="89.901" y2="60.229"/>
10
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="101.376" y1="478.262" x2="443.18" y2="75.803"/>
11
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="457.114" y1="126.623" x2="458.753" y2="363.508"/>
12
+ <this>shouldn't be here</this>
13
+ <script>alert(1);</script>
14
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="541.54" y1="299.573" x2="543.179" y2="536.458"/>
15
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/hrefCleanOne.svg ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="600px" id="Layer_1" width="600px" x="0px" y="0px" xml:space="preserve">
2
+ <a>test 1</a>
3
+ <a>test 2</a>
4
+ <a href="#test3">test 3</a>
5
+ <a xlink:href="#test">test 4</a>
6
+
7
+ <a>test 5</a>
8
+ <a>test 6</a>
9
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/hrefTestOne.svg ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="600px" id="Layer_1" width="600px" x="0px" y="0px" xml:space="preserve">
2
+ <a href="javascript:alert(2)">test 1</a>
3
+ <a xlink:href="javascript:alert(2)">test 2</a>
4
+ <a href="#test3">test 3</a>
5
+ <a xlink:href="#test">test 4</a>
6
+
7
+ <a href="data:data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' onload='alert(88)'%3E%3C/svg%3E">test 5</a>
8
+ <a xlink:href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' onload='alert(88)'%3E%3C/svg%3E">test 6</a>
9
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/svgCleanOne.svg ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" x="0px" y="0px" width="600px" height="600px" xml:space="preserve">
2
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="119" y1="84.5" x2="454" y2="84.5"/>
3
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="111.212" y1="102.852" x2="112.032" y2="476.623"/>
4
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="198.917" y1="510.229" x2="486.622" y2="501.213"/>
5
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="484.163" y1="442.196" x2="89.901" y2="60.229"/>
6
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="101.376" y1="478.262" x2="443.18" y2="75.803"/>
7
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="457.114" y1="126.623" x2="458.753" y2="363.508"/>
8
+
9
+
10
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="541.54" y1="299.573" x2="543.179" y2="536.458"/>
11
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/svgTestOne.svg ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="600px" height="600px" viewBox="0 0 600 600" enable-background="new 0 0 600 600" xml:space="preserve">
6
+ <line onload="alert(2)" fill="none" stroke="#000000" stroke-miterlimit="10" x1="119" y1="84.5" x2="454" y2="84.5"/>
7
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="111.212" y1="102.852" x2="112.032" y2="476.623"/>
8
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="198.917" y1="510.229" x2="486.622" y2="501.213"/>
9
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="484.163" y1="442.196" x2="89.901" y2="60.229"/>
10
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="101.376" y1="478.262" x2="443.18" y2="75.803"/>
11
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="457.114" y1="126.623" x2="458.753" y2="363.508"/>
12
+ <this>shouldn't be here</this>
13
+ <script>alert(1);</script>
14
+ <line fill="none" stroke="#000000" stroke-miterlimit="10" x1="541.54" y1="299.573" x2="543.179" y2="536.458"/>
15
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/xmlCleanOne.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <image/>
3
+ <svg/>
4
+
5
+ <defs/>
6
+ <g>
7
+ <circle/>
8
+ <text/>
9
+ </g>
10
+
11
+ </svg>
lib/vendor/enshrined/svg-sanitize/tests/data/xmlTestOne.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <test></test>
3
+ <image onload="alert(1)"></image>
4
+ <svg onload="alert(2)"></svg>
5
+ <script>alert(3)</script>
6
+ <defs onload="alert(4)"></defs>
7
+ <g onload="alert(5)">
8
+ <circle onload="alert(6)" />
9
+ <text onload="alert(7)"></text>
10
+ </g>
11
+ <ø:script src="//0x.lv/" />
12
+ </svg>
licence.txt ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Safe SVG - Upload and sanitize SVGs within Wordpress
2
+
3
+ Copyright 2015 Daryll Doyle
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ This program incorporates work covered by the following copyright and
20
+ permission notices:
21
+
22
+ svg-sanitize is (c) 2015 Daryll Doyle - daryll@enshrined.co.uk -
23
+ http://enshrined.co.uk
24
+
25
+ Wherever third party code has been used, credit has been given in the code's
26
+ comments.
27
+
28
+ svg-sanitize is released under the GPL
29
+
30
+
31
+ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
32
+
33
+ GNU GENERAL PUBLIC LICENSE
34
+ Version 2, June 1991
35
+
36
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
37
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38
+ Everyone is permitted to copy and distribute verbatim copies
39
+ of this license document, but changing it is not allowed.
40
+
41
+ Preamble
42
+
43
+ The licenses for most software are designed to take away your
44
+ freedom to share and change it. By contrast, the GNU General Public
45
+ License is intended to guarantee your freedom to share and change free
46
+ software--to make sure the software is free for all its users. This
47
+ General Public License applies to most of the Free Software
48
+ Foundation's software and to any other program whose authors commit to
49
+ using it. (Some other Free Software Foundation software is covered by
50
+ the GNU Lesser General Public License instead.) You can apply it to
51
+ your programs, too.
52
+
53
+ When we speak of free software, we are referring to freedom, not
54
+ price. Our General Public Licenses are designed to make sure that you
55
+ have the freedom to distribute copies of free software (and charge for
56
+ this service if you wish), that you receive source code or can get it
57
+ if you want it, that you can change the software or use pieces of it
58
+ in new free programs; and that you know you can do these things.
59
+
60
+ To protect your rights, we need to make restrictions that forbid
61
+ anyone to deny you these rights or to ask you to surrender the rights.
62
+ These restrictions translate to certain responsibilities for you if you
63
+ distribute copies of the software, or if you modify it.
64
+
65
+ For example, if you distribute copies of such a program, whether
66
+ gratis or for a fee, you must give the recipients all the rights that
67
+ you have. You must make sure that they, too, receive or can get the
68
+ source code. And you must show them these terms so they know their
69
+ rights.
70
+
71
+ We protect your rights with two steps: (1) copyright the software, and
72
+ (2) offer you this license which gives you legal permission to copy,
73
+ distribute and/or modify the software.
74
+
75
+ Also, for each author's protection and ours, we want to make certain
76
+ that everyone understands that there is no warranty for this free
77
+ software. If the software is modified by someone else and passed on, we
78
+ want its recipients to know that what they have is not the original, so
79
+ that any problems introduced by others will not reflect on the original
80
+ authors' reputations.
81
+
82
+ Finally, any free program is threatened constantly by software
83
+ patents. We wish to avoid the danger that redistributors of a free
84
+ program will individually obtain patent licenses, in effect making the
85
+ program proprietary. To prevent this, we have made it clear that any
86
+ patent must be licensed for everyone's free use or not licensed at all.
87
+
88
+ The precise terms and conditions for copying, distribution and
89
+ modification follow.
90
+
91
+ GNU GENERAL PUBLIC LICENSE
92
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
93
+
94
+ 0. This License applies to any program or other work which contains
95
+ a notice placed by the copyright holder saying it may be distributed
96
+ under the terms of this General Public License. The "Program", below,
97
+ refers to any such program or work, and a "work based on the Program"
98
+ means either the Program or any derivative work under copyright law:
99
+ that is to say, a work containing the Program or a portion of it,
100
+ either verbatim or with modifications and/or translated into another
101
+ language. (Hereinafter, translation is included without limitation in
102
+ the term "modification".) Each licensee is addressed as "you".
103
+
104
+ Activities other than copying, distribution and modification are not
105
+ covered by this License; they are outside its scope. The act of
106
+ running the Program is not restricted, and the output from the Program
107
+ is covered only if its contents constitute a work based on the
108
+ Program (independent of having been made by running the Program).
109
+ Whether that is true depends on what the Program does.
110
+
111
+ 1. You may copy and distribute verbatim copies of the Program's
112
+ source code as you receive it, in any medium, provided that you
113
+ conspicuously and appropriately publish on each copy an appropriate
114
+ copyright notice and disclaimer of warranty; keep intact all the
115
+ notices that refer to this License and to the absence of any warranty;
116
+ and give any other recipients of the Program a copy of this License
117
+ along with the Program.
118
+
119
+ You may charge a fee for the physical act of transferring a copy, and
120
+ you may at your option offer warranty protection in exchange for a fee.
121
+
122
+ 2. You may modify your copy or copies of the Program or any portion
123
+ of it, thus forming a work based on the Program, and copy and
124
+ distribute such modifications or work under the terms of Section 1
125
+ above, provided that you also meet all of these conditions:
126
+
127
+ a) You must cause the modified files to carry prominent notices
128
+ stating that you changed the files and the date of any change.
129
+
130
+ b) You must cause any work that you distribute or publish, that in
131
+ whole or in part contains or is derived from the Program or any
132
+ part thereof, to be licensed as a whole at no charge to all third
133
+ parties under the terms of this License.
134
+
135
+ c) If the modified program normally reads commands interactively
136
+ when run, you must cause it, when started running for such
137
+ interactive use in the most ordinary way, to print or display an
138
+ announcement including an appropriate copyright notice and a
139
+ notice that there is no warranty (or else, saying that you provide
140
+ a warranty) and that users may redistribute the program under
141
+ these conditions, and telling the user how to view a copy of this
142
+ License. (Exception: if the Program itself is interactive but
143
+ does not normally print such an announcement, your work based on
144
+ the Program is not required to print an announcement.)
145
+
146
+ These requirements apply to the modified work as a whole. If
147
+ identifiable sections of that work are not derived from the Program,
148
+ and can be reasonably considered independent and separate works in
149
+ themselves, then this License, and its terms, do not apply to those
150
+ sections when you distribute them as separate works. But when you
151
+ distribute the same sections as part of a whole which is a work based
152
+ on the Program, the distribution of the whole must be on the terms of
153
+ this License, whose permissions for other licensees extend to the
154
+ entire whole, and thus to each and every part regardless of who wrote it.
155
+
156
+ Thus, it is not the intent of this section to claim rights or contest
157
+ your rights to work written entirely by you; rather, the intent is to
158
+ exercise the right to control the distribution of derivative or
159
+ collective works based on the Program.
160
+
161
+ In addition, mere aggregation of another work not based on the Program
162
+ with the Program (or with a work based on the Program) on a volume of
163
+ a storage or distribution medium does not bring the other work under
164
+ the scope of this License.
165
+
166
+ 3. You may copy and distribute the Program (or a work based on it,
167
+ under Section 2) in object code or executable form under the terms of
168
+ Sections 1 and 2 above provided that you also do one of the following:
169
+
170
+ a) Accompany it with the complete corresponding machine-readable
171
+ source code, which must be distributed under the terms of Sections
172
+ 1 and 2 above on a medium customarily used for software interchange; or,
173
+
174
+ b) Accompany it with a written offer, valid for at least three
175
+ years, to give any third party, for a charge no more than your
176
+ cost of physically performing source distribution, a complete
177
+ machine-readable copy of the corresponding source code, to be
178
+ distributed under the terms of Sections 1 and 2 above on a medium
179
+ customarily used for software interchange; or,
180
+
181
+ c) Accompany it with the information you received as to the offer
182
+ to distribute corresponding source code. (This alternative is
183
+ allowed only for noncommercial distribution and only if you
184
+ received the program in object code or executable form with such
185
+ an offer, in accord with Subsection b above.)
186
+
187
+ The source code for a work means the preferred form of the work for
188
+ making modifications to it. For an executable work, complete source
189
+ code means all the source code for all modules it contains, plus any
190
+ associated interface definition files, plus the scripts used to
191
+ control compilation and installation of the executable. However, as a
192
+ special exception, the source code distributed need not include
193
+ anything that is normally distributed (in either source or binary
194
+ form) with the major components (compiler, kernel, and so on) of the
195
+ operating system on which the executable runs, unless that component
196
+ itself accompanies the executable.
197
+
198
+ If distribution of executable or object code is made by offering
199
+ access to copy from a designated place, then offering equivalent
200
+ access to copy the source code from the same place counts as
201
+ distribution of the source code, even though third parties are not
202
+ compelled to copy the source along with the object code.
203
+
204
+ 4. You may not copy, modify, sublicense, or distribute the Program
205
+ except as expressly provided under this License. Any attempt
206
+ otherwise to copy, modify, sublicense or distribute the Program is
207
+ void, and will automatically terminate your rights under this License.
208
+ However, parties who have received copies, or rights, from you under
209
+ this License will not have their licenses terminated so long as such
210
+ parties remain in full compliance.
211
+
212
+ 5. You are not required to accept this License, since you have not
213
+ signed it. However, nothing else grants you permission to modify or
214
+ distribute the Program or its derivative works. These actions are
215
+ prohibited by law if you do not accept this License. Therefore, by
216
+ modifying or distributing the Program (or any work based on the
217
+ Program), you indicate your acceptance of this License to do so, and
218
+ all its terms and conditions for copying, distributing or modifying
219
+ the Program or works based on it.
220
+
221
+ 6. Each time you redistribute the Program (or any work based on the
222
+ Program), the recipient automatically receives a license from the
223
+ original licensor to copy, distribute or modify the Program subject to
224
+ these terms and conditions. You may not impose any further
225
+ restrictions on the recipients' exercise of the rights granted herein.
226
+ You are not responsible for enforcing compliance by third parties to
227
+ this License.
228
+
229
+ 7. If, as a consequence of a court judgment or allegation of patent
230
+ infringement or for any other reason (not limited to patent issues),
231
+ conditions are imposed on you (whether by court order, agreement or
232
+ otherwise) that contradict the conditions of this License, they do not
233
+ excuse you from the conditions of this License. If you cannot
234
+ distribute so as to satisfy simultaneously your obligations under this
235
+ License and any other pertinent obligations, then as a consequence you
236
+ may not distribute the Program at all. For example, if a patent
237
+ license would not permit royalty-free redistribution of the Program by
238
+ all those who receive copies directly or indirectly through you, then
239
+ the only way you could satisfy both it and this License would be to
240
+ refrain entirely from distribution of the Program.
241
+
242
+ If any portion of this section is held invalid or unenforceable under
243
+ any particular circumstance, the balance of the section is intended to
244
+ apply and the section as a whole is intended to apply in other
245
+ circumstances.
246
+
247
+ It is not the purpose of this section to induce you to infringe any
248
+ patents or other property right claims or to contest validity of any
249
+ such claims; this section has the sole purpose of protecting the
250
+ integrity of the free software distribution system, which is
251
+ implemented by public license practices. Many people have made
252
+ generous contributions to the wide range of software distributed
253
+ through that system in reliance on consistent application of that
254
+ system; it is up to the author/donor to decide if he or she is willing
255
+ to distribute software through any other system and a licensee cannot
256
+ impose that choice.
257
+
258
+ This section is intended to make thoroughly clear what is believed to
259
+ be a consequence of the rest of this License.
260
+
261
+ 8. If the distribution and/or use of the Program is restricted in
262
+ certain countries either by patents or by copyrighted interfaces, the
263
+ original copyright holder who places the Program under this License
264
+ may add an explicit geographical distribution limitation excluding
265
+ those countries, so that distribution is permitted only in or among
266
+ countries not thus excluded. In such case, this License incorporates
267
+ the limitation as if written in the body of this License.
268
+
269
+ 9. The Free Software Foundation may publish revised and/or new versions
270
+ of the General Public License from time to time. Such new versions will
271
+ be similar in spirit to the present version, but may differ in detail to
272
+ address new problems or concerns.
273
+
274
+ Each version is given a distinguishing version number. If the Program
275
+ specifies a version number of this License which applies to it and "any
276
+ later version", you have the option of following the terms and conditions
277
+ either of that version or of any later version published by the Free
278
+ Software Foundation. If the Program does not specify a version number of
279
+ this License, you may choose any version ever published by the Free Software
280
+ Foundation.
281
+
282
+ 10. If you wish to incorporate parts of the Program into other free
283
+ programs whose distribution conditions are different, write to the author
284
+ to ask for permission. For software which is copyrighted by the Free
285
+ Software Foundation, write to the Free Software Foundation; we sometimes
286
+ make exceptions for this. Our decision will be guided by the two goals
287
+ of preserving the free status of all derivatives of our free software and
288
+ of promoting the sharing and reuse of software generally.
289
+
290
+ NO WARRANTY
291
+
292
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
293
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
294
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
295
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
296
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
297
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
298
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
299
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
300
+ REPAIR OR CORRECTION.
301
+
302
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
303
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
304
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
305
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
306
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
307
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
308
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
309
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
310
+ POSSIBILITY OF SUCH DAMAGES.
311
+
312
+ END OF TERMS AND CONDITIONS
313
+
314
+ How to Apply These Terms to Your New Programs
315
+
316
+ If you develop a new program, and you want it to be of the greatest
317
+ possible use to the public, the best way to achieve this is to make it
318
+ free software which everyone can redistribute and change under these terms.
319
+
320
+ To do so, attach the following notices to the program. It is safest
321
+ to attach them to the start of each source file to most effectively
322
+ convey the exclusion of warranty; and each file should have at least
323
+ the "copyright" line and a pointer to where the full notice is found.
324
+
325
+ {description}
326
+ Copyright (C) {year} {fullname}
327
+
328
+ This program is free software; you can redistribute it and/or modify
329
+ it under the terms of the GNU General Public License as published by
330
+ the Free Software Foundation; either version 2 of the License, or
331
+ (at your option) any later version.
332
+
333
+ This program is distributed in the hope that it will be useful,
334
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
335
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
336
+ GNU General Public License for more details.
337
+
338
+ You should have received a copy of the GNU General Public License along
339
+ with this program; if not, write to the Free Software Foundation, Inc.,
340
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
341
+
342
+ Also add information on how to contact you by electronic and paper mail.
343
+
344
+ If the program is interactive, make it output a short notice like this
345
+ when it starts in an interactive mode:
346
+
347
+ Gnomovision version 69, Copyright (C) year name of author
348
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
349
+ This is free software, and you are welcome to redistribute it
350
+ under certain conditions; type `show c' for details.
351
+
352
+ The hypothetical commands `show w' and `show c' should show the appropriate
353
+ parts of the General Public License. Of course, the commands you use may
354
+ be called something other than `show w' and `show c'; they could even be
355
+ mouse-clicks or menu items--whatever suits your program.
356
+
357
+ You should also get your employer (if you work as a programmer) or your
358
+ school, if any, to sign a "copyright disclaimer" for the program, if
359
+ necessary. Here is a sample; alter the names:
360
+
361
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
362
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
363
+
364
+ {signature of Ty Coon}, 1 April 1989
365
+ Ty Coon, President of Vice
366
+
367
+ This General Public License does not permit incorporating your program into
368
+ proprietary programs. If your program is a subroutine library, you may
369
+ consider it more useful to permit linking proprietary applications with the
370
+ library. If this is what you want to do, use the GNU Lesser General
371
+ Public License instead of this License.
readme.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Safe SVG ===
2
+ Contributors: enshrined
3
+ Donate link: http://enshrined.co.uk
4
+ Tags: svg, sanitize, uploads, sanitise
5
+ Requires at least: 4.0
6
+ Tested up to: 4.2.2
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Allow SVG uploads and sanitize them to stop XML/SVG vulnerabilities
12
+
13
+ == Description ==
14
+
15
+ Safe SVG gives you the ability to allow SVG uploads in WordPress and make sure that they're sanitized to stop SVG/XML vulnerabilities affecting your site.
16
+
17
+ This is more of a proof of concept for [#24251](https://core.trac.wordpress.org/ticket/24251) than anything but feel free to use it!
18
+
19
+ SVG Sanitization is done through the following library: [https://github.com/darylldoyle/svg-sanitizer](https://github.com/darylldoyle/svg-sanitizer)
20
+
21
+ == Installation ==
22
+
23
+ Install through the WordPress directory or download, unzip and upload the files to your `/wp-content/plugins/` directory
24
+
25
+ == Changelog ==
26
+
27
+ = 1.0.0 =
28
+ * Initial Release
29
+
30
+
safe-svg.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Safe SVG
4
+ Plugin URI: http://wordpress.org/extend/plugins/health-check/
5
+ Description: Allows SVG uploads into Wordpress and sanitizes the SVG before saving it
6
+ Version: 1.0.0
7
+ Author: Daryll Doyle
8
+ Author URI: http://enshrined.co.uk
9
+ */
10
+
11
+ defined( 'ABSPATH' ) or die( 'Really?' );
12
+
13
+ require 'lib/vendor/autoload.php';
14
+
15
+ if ( ! class_exists( 'safe_svg' ) ) {
16
+
17
+ /**
18
+ * Class safe_svg
19
+ */
20
+ Class safe_svg {
21
+
22
+ /**
23
+ * The sanitizer
24
+ *
25
+ * @var \enshrined\svgSanitize\Sanitizer
26
+ */
27
+ protected $sanitizer;
28
+
29
+ /**
30
+ * Set up the class
31
+ */
32
+ function __construct() {
33
+ $this->sanitizer = new enshrined\svgSanitize\Sanitizer();
34
+
35
+ add_filter( 'upload_mimes', array( $this, 'allow_svg' ) );
36
+ add_filter( 'wp_handle_upload_prefilter', array( $this, 'check_for_svg' ) );
37
+ }
38
+
39
+ /**
40
+ * Allow SVG Uploads
41
+ *
42
+ * @param $mimes
43
+ *
44
+ * @return mixed
45
+ */
46
+ public function allow_svg( $mimes ) {
47
+ $mimes['svg'] = 'image/svg+xml';
48
+
49
+ return $mimes;
50
+ }
51
+
52
+ /**
53
+ * Check if the file is an SVG, if so handle appropriately
54
+ *
55
+ * @param $file
56
+ *
57
+ * @return mixed
58
+ */
59
+ public function check_for_svg( $file ) {
60
+
61
+ if ( $file['type'] === 'image/svg+xml' ) {
62
+ if ( ! $this->sanitize( $file['tmp_name'] ) ) {
63
+ return array( 'error' => 'Sorry, this file couldn\'t be sanitized so for security reasons wasn\'t uploaded' );
64
+ }
65
+ }
66
+
67
+ return $file;
68
+ }
69
+
70
+ /**
71
+ * Sanitize the SVG
72
+ *
73
+ * @param $file
74
+ *
75
+ * @return bool|int
76
+ */
77
+ protected function sanitize( $file ) {
78
+ $dirty = file_get_contents( $file );
79
+
80
+ $clean = $this->sanitizer->sanitize( $dirty );
81
+
82
+ if ( $clean === false ) {
83
+ return false;
84
+ }
85
+
86
+ file_put_contents( $file, $clean );
87
+
88
+ return true;
89
+ }
90
+
91
+ }
92
+ }
93
+
94
+ $safe_svg = new safe_svg();