Copied!
  • property-read string $outerText
  • property-read string $outerHtml
  • property-read string $innerText
  • property-read string $innerHtml
  • property-read string $plaintext
CloneableInstantiable
Methods
public __call( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • return bool|mixed
public static __callStatic( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • throws \BadMethodCallException
  • throws \RuntimeException
  • return static
public voku\helper\AbstractDomParser::__clone()
public __construct( $element = NULL)
 
  • param \DOMNode|\SimpleHtmlDomInterface|string $element HTML code or SimpleHtmlDomInterface, \DOMNode
public __get( $name)
 
  • param string $name
  • return string|null
public __invoke( $selector, $idx = NULL)
 
  • param string $selector
  • param int $idx
  • return \SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public __toString() : string
 
  • return string
public clear() : bool
 

does nothing (only for api-compatibility-reasons)

  • return bool
  • deprecated
public find(string $selector, $idx = NULL)
 

Find list of nodes with a CSS selector.

  • param string $selector
  • param int|null $idx
  • return \SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public findMulti(string $selector) : voku\helper\SimpleHtmlDomNodeInterface
 

Find nodes with a CSS selector.

  • param string $selector
  • return \SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public findMultiOrFalse(string $selector)
 

Find nodes with a CSS selector or false, if no element is found.

  • param string $selector
  • return false|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public findOne(string $selector) : voku\helper\SimpleHtmlDomInterface
 

Find one node with a CSS selector.

  • param string $selector
  • return \SimpleHtmlDomInterface
public findOneOrFalse(string $selector)
 

Find one node with a CSS selector or false, if no element is found.

  • param string $selector
  • return false|\SimpleHtmlDomInterface
public fixHtmlOutput(string $content, bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 
  • param string $content
  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::getDocument() : DOMDocument
 
  • return \DOMDocument
public getElementByClass(string $class) : voku\helper\SimpleHtmlDomNodeInterface
 

Return elements by ".class".

  • param string $class
  • return \SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public getElementById(string $id) : voku\helper\SimpleHtmlDomInterface
 

Return element by #id.

  • param string $id
  • return \SimpleHtmlDomInterface
public getElementByTagName(string $name) : voku\helper\SimpleHtmlDomInterface
 

Return element by tag name.

  • param string $name
  • return \SimpleHtmlDomInterface
public getElementsById(string $id, $idx = NULL)
 

Returns elements by "#id".

  • param string $id
  • param int|null $idx
  • return \SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public getElementsByTagName(string $name, $idx = NULL)
 

Returns elements by tag name.

  • param string $name
  • param int|null $idx
  • return \SimpleHtmlDomInterface|\SimpleHtmlDomInterface[]|\SimpleHtmlDomNodeInterface<\SimpleHtmlDomInterface>
public getIsDOMDocumentCreatedWithFakeEndScript() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithMultiRoot() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutBodyWrapper() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutHeadWrapper() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutHtml() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutHtmlWrapper() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutPTagWrapper() : bool
 
  • return bool
public getIsDOMDocumentCreatedWithoutWrapper() : bool
 
  • return bool
public html(bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 

Get dom node's outer html.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::innerHtml(bool $multiDecodeNewHtmlEntity = false, bool $putBrokenReplacedBack = true) : string
 

Get dom node's inner html.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
public voku\helper\AbstractDomParser::innerXml(bool $multiDecodeNewHtmlEntity = false) : string
 

Get dom node's inner html.

  • param bool $multiDecodeNewHtmlEntity
  • return string
public loadHtml(string $html, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : voku\helper\DomParserInterface
 

Load HTML from string.

  • param string $html
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • return $this
public loadHtmlFile(string $filePath, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : voku\helper\DomParserInterface
 

Load HTML from file.

  • param string $filePath
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • throws \RuntimeException
  • return $this
public overwriteSpecialScriptTags(array $specialScriptTags) : voku\helper\DomParserInterface
 
  • param string[] $specialScriptTags
  • return $this
public overwriteTemplateLogicSyntaxInSpecialScriptTags(array $templateLogicSyntaxInSpecialScriptTags) : voku\helper\DomParserInterface
 
  • param string[] $templateLogicSyntaxInSpecialScriptTags
  • return $this
public static voku\helper\AbstractDomParser::putReplacedBackToPreserveHtmlEntities(string $html, bool $putBrokenReplacedBack = true) : string
 
  • param string $html
  • return string
public static voku\helper\AbstractDomParser::replaceToPreserveHtmlEntities(string $html) : string
 
  • param string $html
  • return string
public voku\helper\AbstractDomParser::save(string $filepath = '') : string
 

Save the html-dom as string.

  • param string $filepath
  • return string
public voku\helper\AbstractDomParser::set_callback( $functionName)
 
  • param callable $functionName
  • phpstan-param callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void $functionName
  • return void
public setCallbackBeforeCreateDom(callable $callbackBeforeCreateDom) : self
 
  • param callable $callbackBeforeCreateDom
  • phpstan-param callable(string $htmlString, \voku\helper\HtmlDomParser): string $callbackBeforeCreateDom
  • return $this
public setCallbackXPathBeforeQuery(callable $callbackXPathBeforeQuery) : self
 
  • param callable $callbackXPathBeforeQuery
  • phpstan-param callable(string $cssSelectorString, string $xPathString,\DOMXPath,\voku\helper\HtmlDomParser): string $callbackXPathBeforeQuery
  • return $this
public voku\helper\AbstractDomParser::text(bool $multiDecodeNewHtmlEntity = false) : string
 

Get dom node's plain text.

  • param bool $multiDecodeNewHtmlEntity
  • return string
public useKeepBrokenHtml(bool $keepBrokenHtml) : voku\helper\DomParserInterface
 
  • param bool $keepBrokenHtml
  • return $this
public xml(bool $multiDecodeNewHtmlEntity = false, bool $htmlToXml = true, bool $removeXmlHeader = true, int $options = 4LIBXML_NOEMPTYTAG) : string
 

Get the HTML as XML or plain XML if needed.

  • param bool $multiDecodeNewHtmlEntity
  • param bool $htmlToXml
  • param bool $removeXmlHeader
  • param int $options
  • return string
Properties
protected static voku\helper\AbstractDomParser::$callback = NULL
 
  • var callable|null
  • phpstan-var null|callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void
protected voku\helper\AbstractDomParser::$document = NULL
 
  • var \DOMDocument
protected static voku\helper\AbstractDomParser::$domBrokenReplaceHelper = []
 
  • var array
protected static voku\helper\AbstractDomParser::$domHtmlBrokenHtmlHelper = '____simple_html_dom__voku__broken_html____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlSpecialScriptHelper = '____simple_html_dom__voku__html_special_script____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlWrapperHelper = '____simple_html_dom__voku__html_wrapper____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domLinkReplaceHelper = ['orig' => ['[', ']', '{', '}'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_RIGHT____']]
 
  • var string[][]
protected static voku\helper\AbstractDomParser::$domReplaceHelper = ['orig' => ['&', '|', '+', '%', '@', '<html âš¡'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__AMP____', '____SIMPLE_HTML_DOM__VOKU__PIPE____', '____SIMPLE_HTML_DOM__VOKU__PLUS____', '____SIMPLE_HTML_DOM__VOKU__PERCENT____', '____SIMPLE_HTML_DOM__VOKU__AT____', '<html ____SIMPLE_HTML_DOM__VOKU__GOOGLE_AMP____="true"']]
 
  • var string[][]
protected voku\helper\AbstractDomParser::$encoding = 'UTF-8'
 
  • var string
protected static $functionAliases = ['outertext' => 'html', 'outerhtml' => 'html', 'innertext' => 'innerHtml', 'innerhtml' => 'innerHtml', 'load' => 'loadHtml', 'load_file' => 'loadHtmlFile']
 
  • var string[]
protected $isDOMDocumentCreatedWithCommentWrapper = false
 
  • var bool
protected $isDOMDocumentCreatedWithFakeEndScript = false
 
  • var bool
protected $isDOMDocumentCreatedWithMultiRoot = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutBodyWrapper = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutHeadWrapper = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutHtml = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutHtmlWrapper = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutPTagWrapper = false
 
  • var bool
protected $isDOMDocumentCreatedWithoutWrapper = false
 
  • var bool
protected $keepBrokenHtml = false
 
  • var bool
protected $selfClosingTags = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']
 
  • var string[]
protected $specialScriptTags = ['text/html', 'text/template', 'text/x-custom-template', 'text/x-handlebars-template']
 

The properties specified for each special script tag is an array.

protected $specialScriptTags = [
    'text/html',
    'text/template',
    'text/x-custom-template',
    'text/x-handlebars-template'
]
  • var string[]
protected $templateLogicSyntaxInSpecialScriptTags = ['+', '<%', '{%', '{{']
 
  • var string[]
Methods
protected createDOMDocument(string $html, $libXMLExtraOptions = NULL, $useDefaultLibXMLOptions = true) : DOMDocument
 

Create DOMDocument from HTML.

  • param string $html
  • param int|null $libXMLExtraOptions
  • param bool $useDefaultLibXMLOptions
  • return \DOMDocument
protected voku\helper\AbstractDomParser::decodeHtmlEntity(string $content, bool $multiDecodeNewHtmlEntity) : string
 
  • param string $content
  • param bool $multiDecodeNewHtmlEntity
  • return string
protected voku\helper\AbstractDomParser::getEncoding() : string
 

Get the encoding to use.

  • return string
protected voku\helper\AbstractDomParser::html5FallbackForScriptTags(string $html)
 
  • param string $html
  • return void
protected keepBrokenHtml(string $html) : string
 
  • param string $html
  • return string
protected keepSpecialScriptTags(string $html)
 
  • param string $html
  • return void
protected keepSpecialSvgTags(string $html)
 
  • param string $html
  • return void
Properties
private $callbackBeforeCreateDom = NULL
 
  • var callable|null
  • phpstan-var null|callable(string $htmlString, \voku\helper\HtmlDomParser): string
private $callbackXPathBeforeQuery = NULL
 
  • var callable|null
  • phpstan-var null|callable(string $cssSelectorString, string $xPathString, \DOMXPath, \voku\helper\HtmlDomParser): string
Properties
protected static voku\helper\AbstractDomParser::$callback = NULL
 
  • var callable|null
  • phpstan-var null|callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void
protected static voku\helper\AbstractDomParser::$domBrokenReplaceHelper = []
 
  • var array
protected static voku\helper\AbstractDomParser::$domHtmlBrokenHtmlHelper = '____simple_html_dom__voku__broken_html____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlSpecialScriptHelper = '____simple_html_dom__voku__html_special_script____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domHtmlWrapperHelper = '____simple_html_dom__voku__html_wrapper____'
 
  • var string
protected static voku\helper\AbstractDomParser::$domLinkReplaceHelper = ['orig' => ['[', ']', '{', '}'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__SQUARE_BRACKET_RIGHT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_LEFT____', '____SIMPLE_HTML_DOM__VOKU__BRACKET_RIGHT____']]
 
  • var string[][]
protected static voku\helper\AbstractDomParser::$domReplaceHelper = ['orig' => ['&', '|', '+', '%', '@', '<html âš¡'], 'tmp' => ['____SIMPLE_HTML_DOM__VOKU__AMP____', '____SIMPLE_HTML_DOM__VOKU__PIPE____', '____SIMPLE_HTML_DOM__VOKU__PLUS____', '____SIMPLE_HTML_DOM__VOKU__PERCENT____', '____SIMPLE_HTML_DOM__VOKU__AT____', '<html ____SIMPLE_HTML_DOM__VOKU__GOOGLE_AMP____="true"']]
 
  • var string[][]
protected static $functionAliases = ['outertext' => 'html', 'outerhtml' => 'html', 'innertext' => 'innerHtml', 'innerhtml' => 'innerHtml', 'load' => 'loadHtml', 'load_file' => 'loadHtmlFile']
 
  • var string[]
Methods
public static __callStatic( $name, $arguments)
 
  • param string $name
  • param array $arguments
  • throws \BadMethodCallException
  • throws \RuntimeException
  • return static
public static voku\helper\AbstractDomParser::putReplacedBackToPreserveHtmlEntities(string $html, bool $putBrokenReplacedBack = true) : string
 
  • param string $html
  • return string
public static voku\helper\AbstractDomParser::replaceToPreserveHtmlEntities(string $html) : string
 
  • param string $html
  • return string
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration