Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

(no description)

File Size: 297 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

HTMLPurifier:: (6 methods):
  __construct()
  addFilter()
  purify()
  purifyArray()
  instance()
  getInstance()


Class: HTMLPurifier  - X-Ref

Facade that coordinates HTML Purifier's subsystems in order to purify HTML.

__construct($config = null)   X-Ref
Initializes the purifier.

param: HTMLPurifier_Config|mixed $config Optional HTMLPurifier_Config object

addFilter($filter)   X-Ref
Adds a filter to process the output. First come first serve

param: HTMLPurifier_Filter $filter HTMLPurifier_Filter object

purify($html, $config = null)   X-Ref
Filters an HTML snippet/document to be XSS-free and standards-compliant.

param: string $html String of HTML to purify
param: HTMLPurifier_Config $config Config object for this operation,
return: string Purified HTML

purifyArray($array_of_html, $config = null)   X-Ref
Filters an array of HTML snippets

param: string[] $array_of_html Array of html snippets
param: HTMLPurifier_Config $config Optional config object for this operation.
return: string[] Array of purified HTML

instance($prototype = null)   X-Ref
Singleton for enforcing just one HTML Purifier in your system

param: HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
return: HTMLPurifier

getInstance($prototype = null)   X-Ref
Singleton for enforcing just one HTML Purifier in your system

param: HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
return: HTMLPurifier