Fix advisory GHSA-gw58-89f7-4xgjpull/5961/head
parent
241c569dde
commit
82cc07edd8
@ -0,0 +1,24 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Component\HTMLPurifier\Filter; |
||||
|
||||
use HTMLPurifier_Filter; |
||||
|
||||
class RemoveOnAttributes extends HTMLPurifier_Filter |
||||
{ |
||||
public $name = 'RemoveOnAttributes'; |
||||
|
||||
public function preFilter($html, $config, $context) |
||||
{ |
||||
return self::filter($html); |
||||
} |
||||
|
||||
public static function filter($html) |
||||
{ |
||||
$pattern = '/\s*on\w+=(?:"[^"]*"|\'[^\']*\'|[^\s>]+)/i'; |
||||
|
||||
return preg_replace($pattern, '', $html); |
||||
} |
||||
} |
Loading…
Reference in new issue