Changeset 2967898
- Timestamp:
- 09/17/2023 04:49:36 AM (2 years ago)
- Location:
- cits-support-svg-webp-media-upload/trunk
- Files:
-
- 2 edited
-
init.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cits-support-svg-webp-media-upload/trunk/init.php
r2953455 r2967898 5 5 Author: Ashik 6 6 Author URI: https://ashik.me 7 Description: WordPress doesn't allow the .svg,.webp format for media upload and .ttf,.otf fonts files upload gives an error. Active the Plugin and Enjoy. uploads your Svg, Webp Images, TTF, OTF fonts file Safely without Erros.8 Tags: Support svg, Support webp, cits support svg, cits support webp,CITS Support svg, webp Media Upload, fonts file upload support, ttf upload, otf upload, eot upload, woff upload.9 Version: 2.1.07 Description: Enhance your WordPress media capabilities with "Active the Plugin and Enjoy." This plugin extends your media library to support not only SVG and WebP images but also TTF, OTF, EOT, and WOFF font files. Safety is our top priority; that's why we've included an SVG sanitization feature to keep your site secure while you enjoy broader media upload options. Take control of your media and start uploading without errors today! 8 Tags: svg support, safe svg, webp support, support webp, cits support svg, cits support webp, CITS Support svg, webp media upload, font file upload support, ttf upload, otf upload, eot upload, woff upload. 9 Version: 3.0 10 10 Requires at least:5.0 11 Tested up to: 6.3 11 Tested up to: 6.3.1 12 12 Requires PHP version: 7.0 13 13 License: GPL2 … … 21 21 add_filter( 'wp_check_filetype_and_ext', array($this,'cits_check_types'), 10, 4 ); 22 22 add_filter( 'wp_check_filetype_and_ext', array($this,'cits_allow_svg_upload'), 10, 4 ); 23 add_filter( 'wp_handle_upload_prefilter', array($this,'cits_sanitize_svg')); 23 24 } 25 24 26 function cits_upload_media_mimes($cits_mimes) { 25 27 $cits_mimes['webp'] = 'image/webp'; … … 108 110 return (object) array( 'width' => $width, 'height' => $height ); 109 111 } 110 112 function cits_sanitize_svg($file) { 113 // Check if file is SVG 114 if($file['type'] === 'image/svg+xml') { 115 $file_content = file_get_contents($file['tmp_name']); 116 $dom = new DOMDocument(); 117 $dom->loadXML($file_content, LIBXML_NONET); 118 119 // Remove script elements 120 $scripts = $dom->getElementsByTagName('script'); 121 $length = $scripts->length; 122 for ($i = 0; $i < $length; $i++) { 123 $scripts->item($i)->parentNode->removeChild($scripts->item($i)); 124 } 125 126 // Save the cleaned-up SVG content back to the temporary file 127 file_put_contents($file['tmp_name'], $dom->saveXML()); 128 } 129 return $file; 130 } 111 131 112 132 } -
cits-support-svg-webp-media-upload/trunk/readme.txt
r2953455 r2967898 1 1 === CITS Support svg, webp Media and TTF,OTF File Upload === 2 2 Contributors: ashikcse 3 Tags: Support svg, Support webp, cits support svg, cits support webp,CITS Support svg, webp Media Upload, fonts file upload support, ttf upload, otf upload, eot upload, woff upload.3 Tags: svg support, safe svg, webp support, support webp, cits support svg, cits support webp, CITS Support svg, webp media upload, font file upload support, ttf upload, otf upload, eot upload, woff upload. 4 4 Requires at least: 5.0 5 5 Stable tag: 1.0.0 6 Tested up to: 6.3 6 Tested up to: 6.3.1 7 7 Requires PHP: 7.0 8 Version: 2.1.08 Version: 3.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 14 14 == Description == 15 15 16 WordPress doesn't allow the .svg,.webp format for media upload and .ttf,.otf fonts files upload gives an error. Active the Plugin and Enjoy. uploads your Svg, Webp Images, TTF, OTF fonts file Safely without Erros. Speed up website you need to add svg, webp images on your Website. upload and use your custom fonts files. 16 Enhance your WordPress media capabilities with "Active the Plugin and Enjoy." This plugin extends your media library to support not only SVG and WebP images but also TTF, OTF, EOT, and WOFF font files. Safety is our top priority; that's why we've included an SVG sanitization feature to keep your site secure while you enjoy broader media upload options. Take control of your media and start uploading without errors today! 17 17 18 18 * New Update 2.0 19 19 * Supports TTF, OTF, WOFF fonts file upload. 20 * New Update 3.0 21 * SVG Sanitize - keep secure your website 20 22 21 23 == Installation ==
Note: See TracChangeset
for help on using the changeset viewer.