/** * Constructor sets-up the validation rule with a descriptive name for this * validator, an optional Encoder instance (for canonicalization) and an * optional whitelist regex pattern to validate the input against prior to * HTML purification. * An instance of the HTMLPurifier class is created and stored too. * * @param string $typeName descriptive name for this validator. * @param object $encoder providing canonicalize method. * @param string $whitelistPattern Whitelist regex. * * @return does not return a value. */ public function __construct($typeName, $encoder = null, $whitelistPattern = null) { parent::__construct($typeName, $encoder); $this->_auditor = ESAPI::getAuditor('HTMLValidationRule'); try { $this->_purifier = new HTMLPurifier($this->_basicConfig()); } catch (Exception $e) { throw new ValidationException('Could not initialize HTMLPurifier.', 'Caught ' . gettype($e) . ' attempting to instantiate HTMLPurifier: ' . $e->getMessage, 'HTMLValidationRule->construct'); } }
/** * Constructor sets-up the validation rule with a descriptive name for this * validator, an optional Encoder instance (for canonicalization) and an * optional whitelist regex pattern to validate the input against prior to * email address purification. * An instance of the HTMLPurifier class is created and stored too. * * @param string $typeName descriptive name for this validator. * @param object $encoder object providing canonicalize method. * @param string $whitelistPattern whitelist regex. * * @return does not return a value. */ public function __construct($typeName, $encoder = null, $whitelistPattern = null) { global $ESAPI; parent::__construct($typeName, $encoder); $this->_auditor = $ESAPI->getAuditor("EmailAddressValidationRule"); }
/** * Constructor sets-up the validation rule with a descriptive name for this * validator, an optional Encoder instance (for canonicalization) and an * optional whitelist regex pattern to validate the input against prior to * email address purification. * An instance of the HTMLPurifier class is created and stored too. * * @param string $typeName descriptive name for this validator. * @param object $encoder providing canonicalize method. * @param string $whitelistPattern Whitelist regex. * * @return does not return a value. */ public function __construct($typeName, $encoder = null, $whitelistPattern = null) { parent::__construct($typeName, $encoder); $this->_auditor = ESAPI::getAuditor("URLValidationRule"); }