A simple patient process
Don’t see the form below that you need? Give us a call to help at 844-442-9482 .
//************* TESTING *******************************************// // Display errors // error_reporting(E_ERROR | E_PARSE | E_COMPILE_ERROR); // ini_set('display_errors',1); // ini_set('display_startup_errors',1); // ini_set('log_errors',1); // ini_set('error_log',get_stylesheet_directory().'/debug.txt'); //************* BASIC WP ADDITIONS ********************************// // Allow SVG upload with extra security since an SVG is technically code // Allow SVG upload safely function allow_svg_upload($mimes){ $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter('upload_mimes','allow_svg_upload'); // Fix WP filetype check for SVGs function fix_svg_filetype_check($data,$file,$filename,$mimes){ $ext = strtolower(pathinfo($filename,PATHINFO_EXTENSION)); if($ext === 'svg'): $data['ext'] = 'svg'; $data['type'] = 'image/svg+xml'; endif; return $data; } add_filter('wp_check_filetype_and_ext','fix_svg_filetype_check',10,4); // Sanitize SVGs safely before saving function sanitize_svg($file){ $ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION)); if($ext !== 'svg') return $file; if(!file_exists($file['tmp_name'])) return $file; libxml_use_internal_errors(true); $svg_content = file_get_contents($file['tmp_name']); if(!$svg_content) return $file; $dom = new DOMDocument(); try{ $dom->loadXML($svg_content, LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING); // Remove
A simple patient process
Don’t see the form below that you need? Give us a call to help at 844-442-9482 .