Sanitizer
MMO\editor\cms · 1 symbol · generated 27 Oct 2026
Sanitizer
Sanitizer.php:20Clean html on the server so that it only holds what <mmo-editor> produces: the same rules as MMO.editor.sanitize() (src/js/editor.js), which the browser applies first. What a client sends is never trusted for that -- a request can be written by hand -- so every "format": "html" field goes through here before it is saved (Pages::saveDraft).
- Namespace
MMO\editor\cms
Index
| ALLOWED_TAGS | ||
| BLOCK_TAGS | the tags of a block of text: inside an inline field, one becomes a space | |
| DROPPED_TAGS | the tags removed with everything they hold (MMO.editor.DROPPED_TAGS) | |
| EMPTY_DROPPED_TAGS | the tags removed when they hold nothing at all | |
| INLINE_TAGS | what an inline field (a title, a caption: "editor": "inline") keeps: text formatting only | |
| RENAMED_TAGS | the tags a word processor gives under another name: kept as the editor's own | |
| TOKEN_COLOR | a colour kept: a design token only, which follows the theme and its dark mode | |
| cleanAttributes($element) | Keep the attributes ALLOWED_TAGS lists for $element, with safe values only | |
| cleanChildren($node, $inline) | ||
| cleanStyle($style) | ||
| isAllowedStyle($property, $value) | ||
| IsSafeUrl($url, $image) static | ||
| rename($element, $tag) | ||
| sanitize($html, $inline) | ||
| unwrap($element) | Replace $element by its children |
Constants7
ALLOWED_TAGS
BLOCK_TAGS
the tags of a block of text: inside an inline field, one becomes a space
DROPPED_TAGS
the tags removed with everything they hold (MMO.editor.DROPPED_TAGS)
EMPTY_DROPPED_TAGS
the tags removed when they hold nothing at all
INLINE_TAGS
what an inline field (a title, a caption: "editor": "inline") keeps: text formatting only
RENAMED_TAGS
the tags a word processor gives under another name: kept as the editor's own
TOKEN_COLOR
a colour kept: a design token only, which follows the theme and its dark mode
Methods8
cleanAttributes($element)
Sanitizer.php:125Keep the attributes ALLOWED_TAGS lists for $element, with safe values only
| $element | DOMElement | |
| returns | void |
cleanChildren($node, $inline)
Sanitizer.php:87cleanStyle($style)
Sanitizer.php:166isAllowedStyle($property, $value)
Sanitizer.php:178- See
MMO.editor.ALLOWED_STYLES
IsSafeUrl($url, $image)
staticSanitizer.php:79rename($element, $tag)
Sanitizer.php:196| $element | DOMElement | |
| $tag | string | |
| returns | DOMElement | $element, as a $tag holding its attributes and children |
sanitize($html, $inline)
Sanitizer.php:55| $html | string | |
| $inline = false | bool | true to keep text formatting only (INLINE_TAGS) |
| returns | string | the clean html |
unwrap($element)
Sanitizer.php:188Replace $element by its children
| $element | DOMElement | |
| returns | void |