Skip to content

Commit

Permalink
Update svg-sanitize closes #12, closes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Tessier committed Apr 1, 2019
1 parent d2a2a13 commit 4681633
Show file tree
Hide file tree
Showing 19 changed files with 1,661 additions and 426 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "spip/logo_svg",
"require": {
"php": ">=5.3.3",
"enshrined/svg-sanitize": "0.7.2"
"enshrined/svg-sanitize": "0.10.0"
},
"minimum-stability": "stable"
}
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions paquet.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<paquet
prefix="logo_svg"
categorie="edition"
version="1.3.0"
version="1.4.0"
etat="stable"
compatibilite="[3.1.1;3.2.*]"
compatibilite="[3.1.0;3.2.*]"
logo="images/logo_logo_svg_32.png"
documentation="https://contrib.spip.net/4834"
>

<nom>Logo SVG</nom>

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

<licence>GNU/GPL</licence>

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

</paquet>
4 changes: 2 additions & 2 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ private function findFileWithExtension($class, $ext)
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"name": "enshrined/svg-sanitize",
"version": "0.7.2",
"version_normalized": "0.7.2.0",
"version": "0.10.0",
"version_normalized": "0.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/darylldoyle/svg-sanitizer.git",
"reference": "2768fb1c8868d97145e8f2a5457caf590c8d2062"
"reference": "5344d8511e494adf160f71f4b34024d3a3c66c82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/2768fb1c8868d97145e8f2a5457caf590c8d2062",
"reference": "2768fb1c8868d97145e8f2a5457caf590c8d2062",
"url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/5344d8511e494adf160f71f4b34024d3a3c66c82",
"reference": "5344d8511e494adf160f71f4b34024d3a3c66c82",
"shasum": ""
},
"require-dev": {
"codeclimate/php-test-reporter": "^0.1.2",
"phpunit/phpunit": "^4.7"
"phpunit/phpunit": "^6"
},
"time": "2017-08-31T00:10:18+00:00",
"time": "2019-01-11T12:31:32+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down
6 changes: 2 additions & 4 deletions vendor/enshrined/svg-sanitize/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2

before_script:
- composer install --dev
Expand Down
16 changes: 16 additions & 0 deletions vendor/enshrined/svg-sanitize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ This defaults to false, set to true to remove references.

`$sanitizer->removeRemoteReferences(true);`

## Viewing Sanitisation Issues

You may use the `getXmlIssues()` method to return an array of issues that occurred during sanitisation.

This may be useful for logging or providing feedback to the user on why an SVG was refused.

`$issues = $sanitizer->getXmlIssues();`

## Minification

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

You can run these by running `phpunit`

## Standalone scanning of files via CLI

Thanks to the work by [gudmdharalds](https://github.com/gudmdharalds) there's now a standalone scanner that can be used via the CLI.

Any errors will be output in JSON format. See [the PR](https://github.com/darylldoyle/svg-sanitizer/pull/25) for an example.

Use it as follows: `php svg-scanner.php ~/svgs/myfile.svg`

## To-Do

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!
2 changes: 1 addition & 1 deletion vendor/enshrined/svg-sanitize/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"minimum-stability": "stable",
"require": {},
"require-dev": {
"phpunit/phpunit": "^4.7",
"phpunit/phpunit": "^6",
"codeclimate/php-test-reporter": "^0.1.2"
}
}
Loading

0 comments on commit 4681633

Please sign in to comment.