Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

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

Defines 1 class

HTMLPurifier_AttrDef:: (4 methods):
  parseCDATA()
  make()
  mungeRgb()
  expandCSSEscape()


Class: HTMLPurifier_AttrDef  - X-Ref

Base class for all validating attribute definitions.

This family of classes forms the core for not only HTML attribute validation,
but also any sort of string that needs to be validated or cleaned (which
means CSS properties and composite definitions are defined here too).
Besides defining (through code) what precisely makes the string valid,
subclasses are also responsible for cleaning the code if possible.
parseCDATA($string)   X-Ref
Convenience method that parses a string as if it were CDATA.

This method process a string in the manner specified at
<http://www.w3.org/TR/html4/types.html#h-6.2> by removing
leading and trailing whitespace, ignoring line feeds, and replacing
carriage returns and tabs with spaces.  While most useful for HTML
attributes specified as CDATA, it can also be applied to most CSS
values.


make($string)   X-Ref
Factory method for creating this class from a string.

return: HTMLPurifier_AttrDef Created AttrDef object corresponding to $string
param: string $string String construction info

mungeRgb($string)   X-Ref
Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
properly. THIS IS A HACK!

return: string
param: string $string a CSS colour definition

expandCSSEscape($string)   X-Ref
Parses a possibly escaped CSS string and returns the "pure"
version of it.