Skip to content

Commit 4681633

Browse files
author
Julien Tessier
committed
Update svg-sanitize closes #12, closes #6
1 parent d2a2a13 commit 4681633

19 files changed

+1661
-426
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "spip/logo_svg",
33
"require": {
44
"php": ">=5.3.3",
5-
"enshrined/svg-sanitize": "0.7.2"
5+
"enshrined/svg-sanitize": "0.10.0"
66
},
77
"minimum-stability": "stable"
88
}

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

paquet.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<paquet
22
prefix="logo_svg"
33
categorie="edition"
4-
version="1.3.0"
4+
version="1.4.0"
55
etat="stable"
6-
compatibilite="[3.1.1;3.2.*]"
6+
compatibilite="[3.1.0;3.2.*]"
77
logo="images/logo_logo_svg_32.png"
88
documentation="https://contrib.spip.net/4834"
99
>
1010

1111
<nom>Logo SVG</nom>
1212

1313
<auteur lien="http://www.spip.net">Collectif SPIP</auteur>
14-
<auteur lien="http://www.cahri.com">Julien Tessier, Agence Cahri</auteur>
14+
<auteur lien="https://www.cari.agency">Julien Tessier, Agence Cari</auteur>
1515

1616
<licence>GNU/GPL</licence>
1717

18-
<necessite nom="medias" compatibilite="[2.10.28;]" />
18+
<necessite nom="medias" compatibilite="[2.10.27;]" />
1919
<style source="css/logo_svg_prive.css" type="prive" />
2020

2121
</paquet>

vendor/composer/ClassLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ private function findFileWithExtension($class, $ext)
379379
$subPath = substr($subPath, 0, $lastPos);
380380
$search = $subPath.'\\';
381381
if (isset($this->prefixDirsPsr4[$search])) {
382+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
382383
foreach ($this->prefixDirsPsr4[$search] as $dir) {
383-
$length = $this->prefixLengthsPsr4[$first][$search];
384-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
384+
if (file_exists($file = $dir . $pathEnd)) {
385385
return $file;
386386
}
387387
}

vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[
22
{
33
"name": "enshrined/svg-sanitize",
4-
"version": "0.7.2",
5-
"version_normalized": "0.7.2.0",
4+
"version": "0.10.0",
5+
"version_normalized": "0.10.0.0",
66
"source": {
77
"type": "git",
88
"url": "https://github.com/darylldoyle/svg-sanitizer.git",
9-
"reference": "2768fb1c8868d97145e8f2a5457caf590c8d2062"
9+
"reference": "5344d8511e494adf160f71f4b34024d3a3c66c82"
1010
},
1111
"dist": {
1212
"type": "zip",
13-
"url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/2768fb1c8868d97145e8f2a5457caf590c8d2062",
14-
"reference": "2768fb1c8868d97145e8f2a5457caf590c8d2062",
13+
"url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/5344d8511e494adf160f71f4b34024d3a3c66c82",
14+
"reference": "5344d8511e494adf160f71f4b34024d3a3c66c82",
1515
"shasum": ""
1616
},
1717
"require-dev": {
1818
"codeclimate/php-test-reporter": "^0.1.2",
19-
"phpunit/phpunit": "^4.7"
19+
"phpunit/phpunit": "^6"
2020
},
21-
"time": "2017-08-31T00:10:18+00:00",
21+
"time": "2019-01-11T12:31:32+00:00",
2222
"type": "library",
2323
"installation-source": "dist",
2424
"autoload": {

vendor/enshrined/svg-sanitize/.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
language: php
22
php:
3-
- 5.3
4-
- 5.4
5-
- 5.5
6-
- 5.6
73
- 7.0
4+
- 7.1
5+
- 7.2
86

97
before_script:
108
- composer install --dev

vendor/enshrined/svg-sanitize/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ This defaults to false, set to true to remove references.
4848

4949
`$sanitizer->removeRemoteReferences(true);`
5050

51+
## Viewing Sanitisation Issues
52+
53+
You may use the `getXmlIssues()` method to return an array of issues that occurred during sanitisation.
54+
55+
This may be useful for logging or providing feedback to the user on why an SVG was refused.
56+
57+
`$issues = $sanitizer->getXmlIssues();`
58+
5159
## Minification
5260

5361
You can minify the XML output by calling `$sanitiser->minify(true);`.
@@ -67,6 +75,14 @@ I've just released a WordPress plugin containing this code so you can sanitize y
6775

6876
You can run these by running `phpunit`
6977

78+
## Standalone scanning of files via CLI
79+
80+
Thanks to the work by [gudmdharalds](https://github.com/gudmdharalds) there's now a standalone scanner that can be used via the CLI.
81+
82+
Any errors will be output in JSON format. See [the PR](https://github.com/darylldoyle/svg-sanitizer/pull/25) for an example.
83+
84+
Use it as follows: `php svg-scanner.php ~/svgs/myfile.svg`
85+
7086
## To-Do
7187

7288
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!

vendor/enshrined/svg-sanitize/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"minimum-stability": "stable",
1717
"require": {},
1818
"require-dev": {
19-
"phpunit/phpunit": "^4.7",
19+
"phpunit/phpunit": "^6",
2020
"codeclimate/php-test-reporter": "^0.1.2"
2121
}
2222
}

0 commit comments

Comments
 (0)