mirror of
https://github.com/moodle/moodle.git
synced 2025-07-10 08:56:39 +02:00
MDL-14898 upgraded html purifier to 3.1.0 in HEAD
This commit is contained in:
@ -7,19 +7,6 @@ INSIDE HTML PURIFIER DOCUMENTS. USE ONLY WITH TRUSTED USER INPUT!!!
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements required attribute stipulation for <script>
|
||||
*/
|
||||
class HTMLPurifier_AttrTransform_ScriptRequired extends HTMLPurifier_AttrTransform
|
||||
{
|
||||
function transform($attr, $config, &$context) {
|
||||
if (!isset($attr['type'])) {
|
||||
$attr['type'] = 'text/javascript';
|
||||
}
|
||||
return $attr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* XHTML 1.1 Scripting module, defines elements that are used to contain
|
||||
* information pertaining to executable scripts or the lack of support
|
||||
@ -28,11 +15,12 @@ class HTMLPurifier_AttrTransform_ScriptRequired extends HTMLPurifier_AttrTransfo
|
||||
*/
|
||||
class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
var $name = 'Scripting';
|
||||
var $elements = array('script', 'noscript');
|
||||
var $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
|
||||
public $name = 'Scripting';
|
||||
public $elements = array('script', 'noscript');
|
||||
public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
|
||||
public $safe = false;
|
||||
|
||||
function HTMLPurifier_HTMLModule_Scripting() {
|
||||
public function __construct() {
|
||||
// TODO: create custom child-definition for noscript that
|
||||
// auto-wraps stray #PCDATA in a similar manner to
|
||||
// blockquote's custom definition (we would use it but
|
||||
@ -41,13 +29,15 @@ class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
|
||||
|
||||
// TODO: convert this to new syntax, main problem is getting
|
||||
// both content sets working
|
||||
foreach ($this->elements as $element) {
|
||||
$this->info[$element] = new HTMLPurifier_ElementDef();
|
||||
$this->info[$element]->safe = false;
|
||||
}
|
||||
|
||||
// In theory, this could be safe, but I don't see any reason to
|
||||
// allow it.
|
||||
$this->info['noscript'] = new HTMLPurifier_ElementDef();
|
||||
$this->info['noscript']->attr = array( 0 => array('Common') );
|
||||
$this->info['noscript']->content_model = 'Heading | List | Block';
|
||||
$this->info['noscript']->content_model_type = 'required';
|
||||
|
||||
$this->info['script'] = new HTMLPurifier_ElementDef();
|
||||
$this->info['script']->attr = array(
|
||||
'defer' => new HTMLPurifier_AttrDef_Enum(array('defer')),
|
||||
'src' => new HTMLPurifier_AttrDef_URI(true),
|
||||
|
Reference in New Issue
Block a user