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.

(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.

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

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

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

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