\n/', '/\n/', '/wmf2svg<\/desc>\n/' ); $replacement = array( 'xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"', '', '', '' ); /** * ================================================================= * MAIN * ================================================================= */ $processed = 1; $good = 0; $error = 0; $no_maches = 0; $files = glob($path . '*.svg'); print 'Processing ' . count($files) . ' files.'; print '
'; print ''; flush(); ob_flush(); foreach ( $files as $filename) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; flush(); ob_flush(); $processed++; } print '
' . $processed . '  ' . $filename . '  '; $fileContent = file_get_contents($filename); $count = null; $replacedContent = preg_replace($regexExpr, $replacement, $fileContent, -1, $count); if ($count) { if (FALSE !== file_put_contents($filename, $replacedContent)) { print 'Ok'; $good++; } else { print 'Error'; $error++; } } else { print 'No matches'; $no_maches++; } print '
'; print '
'; print 'Done.
'; $processed--; print 'Processed: ' . $processed . '
'; print 'Patched: ' . $good . '
'; print 'Failed: ' . $error . '
'; print 'No matches: ' . $no_maches . '
'; flush(); ob_flush(); ?>