Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

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

Defines 1 class

HTMLPurifier_Strategy_FixNesting:: (1 method):
  execute()


Class: HTMLPurifier_Strategy_FixNesting  - X-Ref

Takes a well formed list of tokens and fixes their nesting.

HTML elements dictate which elements are allowed to be their children,
for example, you can't have a p tag in a span tag.  Other elements have
much more rigorous definitions: tables, for instance, require a specific
order for their elements.  There are also constraints not expressible by
document type definitions, such as the chameleon nature of ins/del
tags and global child exclusions.

The first major objective of this strategy is to iterate through all
the nodes and determine whether or not their children conform to the
element's definition.  If they do not, the child definition may
optionally supply an amended list of elements that is valid or
require that the entire node be deleted (and the previous node
rescanned).

The second objective is to ensure that explicitly excluded elements of
an element do not appear in its children.  Code that accomplishes this
task is pervasive through the strategy, though the two are distinct tasks
and could, theoretically, be seperated (although it's not recommended).

execute($tokens, $config, $context)   X-Ref

param: HTMLPurifier_Token[] $tokens
param: HTMLPurifier_Config $config
param: HTMLPurifier_Context $context
return: array|HTMLPurifier_Token[]