Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

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

Defines 1 class

HTMLPurifier_Strategy_MakeWellFormed:: (4 methods):
  execute()
  processToken()
  insertBefore()
  remove()


Class: HTMLPurifier_Strategy_MakeWellFormed  - X-Ref

Takes tokens makes them well-formed (balance end tags, etc.)

Specification of the armor attributes this strategy uses:

- MakeWellFormed_TagClosedError: This armor field is used to
suppress tag closed errors for certain tokens [TagClosedSuppress],
in particular, if a tag was generated automatically by HTML
Purifier, we may rely on our infrastructure to close it for us
and shouldn't report an error to the user [TagClosedAuto].
execute($tokens, $config, $context)   X-Ref

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

processToken($token, $injector = -1)   X-Ref
Processes arbitrary token values for complicated substitution patterns.
In general:

If $token is an array, it is a list of tokens to substitute for the
current token. These tokens then get individually processed. If there
is a leading integer in the list, that integer determines how many
tokens from the stream should be removed.

If $token is a regular token, it is swapped with the current token.

If $token is false, the current token is deleted.

If $token is an integer, that number of tokens (with the first token
being the current one) will be deleted.

param: HTMLPurifier_Token|array|int|bool $token Token substitution value
param: HTMLPurifier_Injector|int $injector Injector that performed the substitution; default is if

insertBefore($token)   X-Ref
Inserts a token before the current token. Cursor now points to
this token.  You must reprocess after this.

param: HTMLPurifier_Token $token

remove()   X-Ref
Removes current token. Cursor now points to new token occupying previously
occupied space.  You must reprocess after this.