diff --git a/library/HTMLPurifier/AttrDef/HTML5/Datetime.php b/library/HTMLPurifier/AttrDef/HTML5/Datetime.php index 4224162..c7ceccb 100644 --- a/library/HTMLPurifier/AttrDef/HTML5/Datetime.php +++ b/library/HTMLPurifier/AttrDef/HTML5/Datetime.php @@ -67,8 +67,8 @@ class HTMLPurifier_AttrDef_HTML5_Datetime extends HTMLPurifier_AttrDef protected $allowedFormats = array(); /** - * @noinspection PhpDocMissingThrowsInspection * @param array $allowedFormats OPTIONAL + * @throws HTMLPurifier_Exception If an invalid format is provided */ public function __construct(array $allowedFormats = array()) { @@ -76,7 +76,7 @@ public function __construct(array $allowedFormats = array()) $allowedFormatsLookup = array(); foreach ($allowedFormats as $format) { if (!isset(self::$formats[$format])) { - throw new InvalidArgumentException("'$format' is not a valid format"); + throw new HTMLPurifier_Exception("'$format' is not a valid format"); } $allowedFormatsLookup[$format] = true; } @@ -352,9 +352,9 @@ protected function formatTimezoneOffset(array $data) } /** - * @noinspection PhpDocMissingThrowsInspection * @param string $formats * @return HTMLPurifier_AttrDef_HTML5_Datetime + * @throws HTMLPurifier_Exception If an invalid format is provided */ public function make($formats) { diff --git a/library/HTMLPurifier/ChildDef/HTML5/Time.php b/library/HTMLPurifier/ChildDef/HTML5/Time.php index 1fce5f4..bc7012b 100644 --- a/library/HTMLPurifier/ChildDef/HTML5/Time.php +++ b/library/HTMLPurifier/ChildDef/HTML5/Time.php @@ -10,6 +10,8 @@ */ class HTMLPurifier_ChildDef_HTML5_Time extends HTMLPurifier_ChildDef_HTML5 { + public $type = 'time'; + public $excludes = array( 'time' => true, ); diff --git a/library/HTMLPurifier/HTMLModule/HTML5/Text.php b/library/HTMLPurifier/HTMLModule/HTML5/Text.php index 1c1a584..0204e97 100644 --- a/library/HTMLPurifier/HTMLModule/HTML5/Text.php +++ b/library/HTMLPurifier/HTMLModule/HTML5/Text.php @@ -13,6 +13,7 @@ class HTMLPurifier_HTMLModule_HTML5_Text extends HTMLPurifier_HTMLModule_Text /** * @param HTMLPurifier_Config $config + * @throws HTMLPurifier_Exception */ public function setup($config) { diff --git a/tests/HTMLPurifier/AttrDef/HTML5/DatetimeTest.php b/tests/HTMLPurifier/AttrDef/HTML5/DatetimeTest.php index 2701c2f..d4cd661 100644 --- a/tests/HTMLPurifier/AttrDef/HTML5/DatetimeTest.php +++ b/tests/HTMLPurifier/AttrDef/HTML5/DatetimeTest.php @@ -1,5 +1,8 @@ Foo'), array(''), + // time with inline elements + array(''), + // invalid datetime - use UNIX epoch instead of removing