HTMLPurifier::__construct PHP Method

__construct() public method

Initializes the purifier.
public __construct ( HTMLPurifier_Config | mixed $config = null )
$config HTMLPurifier_Config | mixed Optional HTMLPurifier_Config object for all instances of the purifier, if omitted, a default configuration is supplied (which can be overridden on a per-use basis). The parameter can also be any type that HTMLPurifier_Config::create() supports.
    public function __construct($config = null)
    {
        $this->config = HTMLPurifier_Config::create($config);
        $this->strategy = new HTMLPurifier_Strategy_Core();
    }

Usage Example

Example #1
0
 function __construct($opt)
 {
     // prepare config
     $config = HTMLPurifier_Config::createDefault();
     // set cache directory
     $config->set('Cache.SerializerPath', $opt['html_purifier']['cache_path']);
     // create parent object with config
     parent::__construct($config);
 }
All Usage Examples Of HTMLPurifier::__construct