platform/api/symfony/Component/HtmlSanitizer/Visitor/DomVisitor.yaml

114 lines
4.8 KiB
YAML
Raw Normal View History

2024-09-02 17:44:11 +00:00
name: DomVisitor
class_comment: null
dependencies:
- name: HtmlSanitizerAction
type: class
source: Symfony\Component\HtmlSanitizer\HtmlSanitizerAction
- name: HtmlSanitizerConfig
type: class
source: Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig
- name: StringSanitizer
type: class
source: Symfony\Component\HtmlSanitizer\TextSanitizer\StringSanitizer
- name: AttributeSanitizerInterface
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\AttributeSanitizer\AttributeSanitizerInterface
- name: Cursor
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Model\Cursor
- name: BlockedNode
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Node\BlockedNode
- name: DocumentNode
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Node\DocumentNode
- name: Node
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Node\Node
- name: NodeInterface
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Node\NodeInterface
- name: TextNode
type: class
source: Symfony\Component\HtmlSanitizer\Visitor\Node\TextNode
properties: []
methods:
- name: __construct
visibility: public
parameters:
- name: config
- name: elementsConfig
comment: "# * Iterates over the parsed DOM tree to build the sanitized tree.\n#\
\ *\n# * The DomVisitor iterates over the parsed DOM tree, visits its nodes and\
\ build\n# * a sanitized tree with their attributes and content.\n# *\n# * @author\
\ Titouan Galopin <galopintitouan@gmail.com>\n# *\n# * @internal\n# */\n# final\
\ class DomVisitor\n# {\n# private HtmlSanitizerAction $defaultAction = HtmlSanitizerAction::Drop;\n\
# \n# /**\n# * Registry of attributes to forcefully set on nodes, index by element\
\ and attribute.\n# *\n# * @var array<string, array<string, string>>\n# */\n#\
\ private array $forcedAttributes;\n# \n# /**\n# * Registry of attributes sanitizers\
\ indexed by element name and attribute name for\n# * faster sanitization.\n#\
\ *\n# * @var array<string, array<string, list<AttributeSanitizerInterface>>>\n\
# */\n# private array $attributeSanitizers = [];\n# \n# /**\n# * @param array<string,\
\ HtmlSanitizerAction|array<string, bool>> $elementsConfig Registry of allowed/blocked\
\ elements:\n# * \
\ * If an element is present as a key and contains an array,\
\ the element should be allowed\n# * \
\ and the array is the list of allowed attributes.\n\
# * \
\ * If an element is present as a key and contains an HtmlSanitizerAction,\
\ that action applies.\n# * \
\ * If an element is not present as a key, the default\
\ action applies."
- name: visit
visibility: public
parameters:
- name: domNode
comment: null
- name: visitNode
visibility: private
parameters:
- name: domNode
- name: cursor
comment: null
- name: enterNode
visibility: private
parameters:
- name: domNodeName
- name: domNode
- name: cursor
comment: null
- name: visitChildren
visibility: private
parameters:
- name: domNode
- name: cursor
comment: null
- name: setAttributes
visibility: private
parameters:
- name: domNodeName
- name: domNode
- name: node
- name: allowedAttributes
default: '[]'
comment: "# @var \\DOMNode $child */\n# foreach ($domNode->childNodes ?? [] as $child)\
\ {\n# if ('#text' === $child->nodeName) {\n# // Add text directly for performance\n\
# $cursor->node->addChild(new TextNode($cursor->node, $child->nodeValue));\n#\
\ } elseif (!$child instanceof \\DOMText && !$child instanceof \\DOMProcessingInstruction)\
\ {\n# // Otherwise continue the visit recursively\n# // Ignore comments for security\
\ reasons (interpreted differently by browsers)\n# // Ignore processing instructions\
\ (treated as comments)\n# $this->visitNode($child, $cursor);\n# }\n# }\n# }\n\
# \n# /**\n# * Set attributes from a DOM node to a sanitized node."
traits:
- Symfony\Component\HtmlSanitizer\HtmlSanitizerAction
- Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig
- Symfony\Component\HtmlSanitizer\TextSanitizer\StringSanitizer
- Symfony\Component\HtmlSanitizer\Visitor\AttributeSanitizer\AttributeSanitizerInterface
- Symfony\Component\HtmlSanitizer\Visitor\Model\Cursor
- Symfony\Component\HtmlSanitizer\Visitor\Node\BlockedNode
- Symfony\Component\HtmlSanitizer\Visitor\Node\DocumentNode
- Symfony\Component\HtmlSanitizer\Visitor\Node\Node
- Symfony\Component\HtmlSanitizer\Visitor\Node\NodeInterface
- Symfony\Component\HtmlSanitizer\Visitor\Node\TextNode
interfaces: []