/**
  * Quick test to ensure HTMLPurifier 'works'
  */
 function testHTMLVR_construct_purifier()
 {
     $hvr = new HTMLValidationRule('HTMLValidator');
     $this->setExpectedException('ValidationException');
     $a = '<body><body><div>Hi!</div></body>';
     $hvr->getValid('testHTMLVR_construct_purifier', $a);
     // error=Unrecognized <body> tag removed
 }
 /**
  * Implements corresponding isValidXX logic.
  *
  * @param string $context   Please see corresponding isValidXX description.
  * @param string $input     Please see corresponding isValidXX description.
  * @param int    $maxLength Please see corresponding isValidXX description.
  * @param bool   $allowNull Please see corresponding isValidXX description.
  *
  * @return does not return a value.
  * @throws ValidationException thrown if input is invalid.
  * @throws IntrusionException thrown if intrusion is detected.
  */
 private function _assertValidHTML($context, $input, $maxLength, $allowNull)
 {
     $hvr = new HTMLValidationRule('HTML_Validator', $this->_encoder);
     $hvr->setMaximumLength($maxLength);
     $hvr->setAllowNull($allowNull);
     $hvr->assertValid($context, $input);
     return null;
 }
 /**
  * Returns valid, "safe" HTML.
  *
  * This implementation uses HTMLPurifier {@link http://htmlpurifier.org}.
  *
  * @param  $context A descriptive name of the parameter that you are
  *         validating (e.g. ProfilePage_Sig). This value is used by any
  *         logging or error handling that is done with respect to the value
  *         passed in.
  * @param  $input The actual user input data to validate.
  *
  * @return valid, "safe" HTML.
  */
 public function getSanitizedHTML($context, $input)
 {
     $hvr = new HTMLValidationRule('HTML_Validator', $this->encoder);
     return $hvr->sanitize($context, $input);
 }