PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 3.1.2
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v3.1.2
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / includes / svg.class.php
folders / includes Last commit date
class-affiliate.php 1 year ago class-email-signup.php 1 year ago class-help.php 1 year ago class-polylang.php 1 year ago class-review-box.php 1 year ago class-upgrade-box.php 1 year ago class-wpml.php 1 year ago folders.class.php 1 year ago form.class.php 1 year ago form.fields.php 1 year ago import.export.class.php 1 year ago media.replace.php 1 year ago notifications.class.php 1 year ago plugins.class.php 1 year ago svg.class.php 1 year ago tree.class.php 1 year ago
svg.class.php
69 lines
1 <?php
2 if(!class_exists('enshrined\svgSanitize\Sanitizer') ) {
3 $svgFiles = array(
4 'libraries/svg-sanitizer/src/data/AttributeInterface.php',
5 'libraries/svg-sanitizer/src/data/TagInterface.php',
6 'libraries/svg-sanitizer/src/data/AllowedAttributes.php',
7 'libraries/svg-sanitizer/src/data/AllowedTags.php',
8 'libraries/svg-sanitizer/src/data/XPath.php',
9 'libraries/svg-sanitizer/src/ElementReference/Resolver.php',
10 'libraries/svg-sanitizer/src/ElementReference/Subject.php',
11 'libraries/svg-sanitizer/src/ElementReference/Usage.php',
12 'libraries/svg-sanitizer/src/Exceptions/NestingException.php',
13 'libraries/svg-sanitizer/src/Helper.php',
14 'libraries/svg-sanitizer/src/Sanitizer.php'
15 );
16
17 foreach( $svgFiles as $svgFile ) {
18 $real_path = WCP_FOLDERS_PLUGIN_PATH . $svgFile;
19 if(file_exists( $real_path ) ) {
20 require_once( $real_path );
21 }
22 }
23 }
24
25 if(!function_exists('isGzipped') ) {
26 function isGzipped( $data ){
27 if( function_exists('mb_strpos') ){
28 return 0 === mb_strpos( $data, "\x1f" . "\x8b" . "\x08" );
29 }else{
30 return 0 === strpos( $data, "\x1f" . "\x8b" . "\x08" );
31 }
32 }
33 }
34
35 if(!function_exists('sanitizeSvgFileContent')) {
36 function sanitizeSvgFileContent($filePath)
37 {
38 $data = file_get_contents( $filePath );
39
40 $is_zipped = isGzipped( $data );
41 if( $is_zipped ){
42 $data = gzdecode( $data );
43 if( $data === false ){
44 return false;
45 }
46 }
47
48 // load sanitizer
49 $sanitizer = new \enshrined\svgSanitize\Sanitizer();
50 $sanitizer->removeXMLTag( true );
51 $sanitizer->minify( true );
52
53 $clean = $sanitizer->sanitize( $data );
54
55 if( $clean === false ){
56
57 return false;
58 }
59
60 if( $is_zipped ){
61 $clean = gzencode( $clean );
62 }
63
64 // Save cleaned file
65 file_put_contents( $filePath, $clean );
66
67 return true;
68 }
69 }