11 require_once( __DIR__ .
'/data/AttributeInterface.php' );
12 require_once( __DIR__ .
'/data/TagInterface.php' );
13 require_once( __DIR__ .
'/data/AllowedAttributes.php' );
14 require_once( __DIR__ .
'/data/AllowedTags.php' );
15 require_once( __DIR__ .
'/Sanitizer.php' );
75 array(
'No files to scan specified' ),
102 $svg_file = @file_get_contents( $file_name );
107 if (
false === $svg_file ) {
110 $results[
'files'][ $file_name ][] = array(
114 'message' =>
'File specified could not be read (' . $file_name .
')',
126 $sanitize_status =
$sanitizer->sanitize( $svg_file );
133 if ( empty( $xml_issues ) && (
false !== $sanitize_status ) ) {
134 $results[
'files'][ $file_name ] = array(
136 'messages' => array()
144 (
'' === $sanitize_status ) ||
145 (
false === $sanitize_status )
149 $results[
'files'][ $file_name ] = array(
153 'message' =>
'Unable to sanitize file \'' . $file_name .
'\'' ,
165 $results[
'totals'][
'errors'] += count( $xml_issues );
167 $results[
'files'][ $file_name ] = array(
168 'errors' => count( $xml_issues ),
169 'messages' => $xml_issues,
174 unset( $xml_issues );
175 unset( $sanitize_status );
186 (
$results[
'totals'][
'errors'] === 0 ? 0 : 1 )
if(empty( $files_to_scan)) $sanitizer
sysexit( $results, $status)