1. Go to this page and download the library: Download ipedis/file-sanitizer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ipedis / file-sanitizer example snippets
use Ipedis\FileSanitizer\Sanitizer\Sanitize;
$sanitizer = new Sanitize(type: 'html');
$result = $sanitizer->process('<div onclick="alert(1)"><script>evil()</script>Hello</div>');
echo $result->getContent(); // <div>Hello</div>
$sanitizer = new Sanitize(type: 'xml');
$result = $sanitizer->process($xmlContent);
use Ipedis\FileSanitizer\Configuration\Configuration;
use Ipedis\FileSanitizer\Pipeline\Steps\PhpTagCleanupStep;
// Skip specific steps
$config = new Configuration(
ignoredSteps: [PhpTagCleanupStep::class],
);
$sanitizer = new Sanitize(type: 'html', configuration: $config);
use Ipedis\FileSanitizer\Pipeline\Steps\CleanupStepAbstract;
use Ipedis\FileSanitizer\Pipeline\Payload;
class MyCustomStep extends CleanupStepAbstract
{
protected function process(Payload $payload): Payload
{
$content = preg_replace('/pattern/', '', $payload->getContent());
return $payload->setContent($content);
}
}
$config = new Configuration(customSteps: [MyCustomStep::class]);
$sanitizer = new Sanitize(type: 'html', configuration: $config);
`, `<?`, `
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.