Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
xemlock committed Jan 2, 2021
1 parent 7552710 commit 2db0d8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions library/HTMLPurifier/AttrDef/HTML5/InputType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class HTMLPurifier_AttrDef_HTML5_InputType extends HTMLPurifier_AttrDef
* Lookup table for valid values
* @var array
* @see https://html.spec.whatwg.org/dev/input.html#attr-input-type
* @note Generated by maintenance/generate-input-allowed.php script
* @note Generated by maintenance/generate-input-lookups.php script
*/
protected static $values = array(
'button' => true,
Expand Down Expand Up @@ -49,13 +49,7 @@ public static function values()
return self::$values;
}

/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
protected function init(HTMLPurifier_Config $config)
{
if ($this->allowed === null) {
$allowedInputTypes = isset($config->def->info['Attr.AllowedInputTypes'])
Expand All @@ -69,9 +63,19 @@ public function validate($string, $config, $context)
}
$this->allowed = $allowed;
}
}

$type = strtolower($this->parseCDATA($string));
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
$this->init($config);

$type = strtolower($this->parseCDATA($string));
if ($type === '') {
$type = 'text';
}
Expand Down
2 changes: 1 addition & 1 deletion library/HTMLPurifier/AttrTransform/HTML5/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HTMLPurifier_AttrTransform_HTML5_Input extends HTMLPurifier_AttrTransform
* Allowed attributes vs input type lookup
* @var array
* @see https://html.spec.whatwg.org/dev/input.html#input-type-attr-summary
* @note Generated by maintenance/generate-input-allowed.php script
* @note Generated by maintenance/generate-input-lookups.php script
*/
protected static $allowed = array(
'accept' => array(
Expand Down

0 comments on commit 2db0d8f

Please sign in to comment.