Switch to Symfony’s HTML Sanitizer package
This commit is contained in:
parent
e91f3e0d17
commit
e98a90fe1e
4 changed files with 212 additions and 88 deletions
|
@ -4,21 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Traits;
|
||||
|
||||
use HtmlSanitizer\Sanitizer;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Symfony\Component\HtmlSanitizer\HtmlSanitizer;
|
||||
|
||||
trait FilterHtml
|
||||
{
|
||||
public function filterHtml(string $html): string
|
||||
{
|
||||
return Sanitizer::create([
|
||||
'extensions' => [
|
||||
'basic',
|
||||
'code',
|
||||
'image',
|
||||
'list',
|
||||
'table',
|
||||
'extra',
|
||||
],
|
||||
])->sanitize($html);
|
||||
return App::make(HtmlSanitizer::class)->sanitize($html);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue