[ Index ]

PHP Cross Reference of phpBB-3.3.5-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/Helpers/ -> TemplateInspector.php (summary)

(no description)

Copyright: Copyright (c) 2010-2021 The s9e authors
License: http://www.opensource.org/licenses/mit-license.php The MIT License
File Size: 713 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TemplateInspector:: (31 methods):
  __construct()
  allowsChild()
  allowsDescendant()
  allowsChildElements()
  allowsText()
  closesParent()
  evaluate()
  isBlock()
  isFormattingElement()
  isEmpty()
  isPassthrough()
  isTransparent()
  isVoid()
  preservesNewLines()
  analyseContent()
  analyseRootNodes()
  analyseBranches()
  anyBranchHasProperty()
  computeBitfields()
  computeAllowsChildElements()
  computeAllowsText()
  computeFormattingElement()
  computeIsEmpty()
  computeIsTransparent()
  computeIsVoid()
  computePreservesNewLines()
  elementIsBlock()
  getStyle()
  isFormattingSpan()
  storeLeafNodes()
  match()


Class: TemplateInspector  - X-Ref

This class helps the RulesGenerator by analyzing a given template in order to answer questions
such as "can this tag be a child/descendant of that other tag?" and others related to the HTML5
content model.

We use the HTML5 specs to determine which children or descendants should be allowed or denied
based on HTML5 content models. While it does not exactly match HTML5 content models, it gets
pretty close. We also use HTML5 "optional end tag" rules to create closeParent rules.

Currently, this method does not evaluate elements created with <xsl:element> correctly, or
attributes created with <xsl:attribute> and may never will due to the increased complexity it
would entail. Additionally, it does not evaluate the scope of <xsl:apply-templates/>. For
instance, it will treat <xsl:apply-templates select="LI"/> as if it was <xsl:apply-templates/>

__construct($template)   X-Ref
Constructor

param: string $template Template content

allowsChild(TemplateInspector $child)   X-Ref
Return whether this template allows a given child

param: TemplateInspector $child
return: bool

allowsDescendant(TemplateInspector $descendant)   X-Ref
Return whether this template allows a given descendant

param: TemplateInspector $descendant
return: bool

allowsChildElements()   X-Ref
Return whether this template allows elements as children

return: bool

allowsText()   X-Ref
Return whether this template allows text nodes as children

return: bool

closesParent(TemplateInspector $parent)   X-Ref
Return whether this template automatically closes given parent template

param: TemplateInspector $parent
return: bool

evaluate($expr, DOMElement $node = null)   X-Ref
Evaluate an XPath expression

param: string     $expr XPath expression
param: DOMElement $node Context node
return: mixed

isBlock()   X-Ref
Return whether this template should be considered a block-level element

return: bool

isFormattingElement()   X-Ref
Return whether this template adds to the list of active formatting elements

return: bool

isEmpty()   X-Ref
Return whether this template uses the "empty" content model

return: bool

isPassthrough()   X-Ref
Return whether this template lets content through via an xsl:apply-templates element

return: bool

isTransparent()   X-Ref
Return whether this template uses the "transparent" content model

return: bool

isVoid()   X-Ref
Return whether all branches have an ancestor that is a void element

return: bool

preservesNewLines()   X-Ref
Return whether this template preserves the whitespace in its descendants

return: bool

analyseContent()   X-Ref
Analyses the content of the whole template and set $this->contentBitfield accordingly


analyseRootNodes()   X-Ref
Records the HTML elements (and their bitfield) rendered at the root of the template


analyseBranches()   X-Ref
Analyses each branch that leads to an <xsl:apply-templates/> tag


anyBranchHasProperty($methodName)   X-Ref
Test whether any branch of this template has an element that has given property

param: string $methodName
return: bool

computeBitfields()   X-Ref
Compute the allowChildBitfields and denyDescendantBitfield properties

return: void

computeAllowsChildElements()   X-Ref
Compute the allowsChildElements property

A template allows child Elements if it has at least one xsl:apply-templates and none of its
ancestors have the text-only ("to") property

return: void

computeAllowsText()   X-Ref
Compute the allowsText property

A template is said to allow text if none of the leaf elements disallow text

return: void

computeFormattingElement()   X-Ref
Compute the isFormattingElement property

A template is said to be a formatting element if all (non-zero) of its branches are entirely
composed of formatting elements

return: void

computeIsEmpty()   X-Ref
Compute the isEmpty property

A template is said to be empty if it has no xsl:apply-templates elements or any there is a empty
element ancestor to an xsl:apply-templates element

return: void

computeIsTransparent()   X-Ref
Compute the isTransparent property

A template is said to be transparent if it has at least one branch and no non-transparent
elements in its path

return: void

computeIsVoid()   X-Ref
Compute the isVoid property

A template is said to be void if it has no xsl:apply-templates elements or any there is a void
element ancestor to an xsl:apply-templates element

return: void

computePreservesNewLines()   X-Ref
Compute the preservesNewLines property

return: void

elementIsBlock(DOMElement $element)   X-Ref
Test whether given element is a block-level element

param: DOMElement $element
return: bool

getStyle(DOMElement $node, $deep = false)   X-Ref
Retrieve and return the inline style assigned to given element

param: DOMElement $node Context node
param: bool       $deep Whether to retrieve the content of all xsl:attribute descendants
return: string

isFormattingSpan(DOMElement $node)   X-Ref
Test whether given node is a span element used for formatting

Will return TRUE if the node is a span element with a class attribute and/or a style attribute
and no other attributes

param: DOMElement $node
return: boolean

storeLeafNodes()   X-Ref
Store the names of every leaf node

A leaf node is defined as the closest non-XSL ancestor to an xsl:apply-templates element

return: void

match($bitfield1, $bitfield2)   X-Ref
Test whether two bitfields have any bits in common

param: string $bitfield1
param: string $bitfield2
return: bool



Generated: Mon Oct 4 17:42:11 2021 Cross-referenced by PHPXref 0.7.1