Copied!
  • property-read string $outerText

    Get dom node's outer html (alias for "outerHtml").

  • property-read string $outerHtml

    Get dom node's outer html.

  • property-read string $innerText

    Get dom node's inner html (alias for "innerHtml").

  • property-read string $innerHtml

    Get dom node's inner html.

  • property-read string $plaintext

    Get dom node's plain text.

Cloneable Instantiable
Methods
public __call ( $name , $arguments )
 
  • param string $name
  • param array $arguments
  • return bool | mixed
  • param array $arguments
  • return bool | mixed
public static __callStatic ( $name , $arguments )
 
  • param string $name
  • param array $arguments
  • throws BadMethodCallException
  • throws RuntimeException
  • return static
  • param array $arguments
  • throws BadMethodCallException
  • throws RuntimeException
  • return static
public voku\helper\AbstractDomParser :: __clone ()
public __construct ( $element = NULL )
 
public __get ( $name )
 
  • param string $name
  • return string | null
  • return string | null
public __invoke ( $selector , $idx = NULL )
 
public __toString () : string
 
  • return string
public clear () : bool
 

does nothing (only for api-compatibility-reasons)

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

Find list of nodes with a CSS selector.

public findMulti ( string $selector ) : voku\helper\SimpleHtmlDomNodeInterface
 

Find nodes with a CSS selector.

public findMultiOrFalse ( string $selector )
 

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

public findOne ( string $selector ) : voku\helper\SimpleHtmlDomInterface
 

Find one node with a CSS selector.

public findOneOrFalse ( string $selector )
 

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

public fixHtmlOutput ( string $content , bool $multiDecodeNewHtmlEntity = false , bool $putBrokenReplacedBack = true ) : string
 
  • param string $content
  • param bool $multiDecodeNewHtmlEntity
  • param bool $putBrokenReplacedBack
  • return string
  • 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".

public getElementById ( string $id ) : voku\helper\SimpleHtmlDomInterface
 

Return element by #id.

public getElementByTagName ( string $name ) : voku\helper\SimpleHtmlDomInterface
 

Return element by tag name.

public getElementsById ( string $id , $idx = NULL )
 

Returns elements by "#id".

public getElementsByTagName ( string $name , $idx = NULL )
 

Returns elements by tag name.

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
  • 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 ) : voku\helper\DomParserInterface
 

Load HTML from string.

public loadHtmlFile ( string $filePath , $libXMLExtraOptions = NULL ) : voku\helper\DomParserInterface
 

Load HTML from file.

  • param string $filePath
  • param int | null $libXMLExtraOptions
  • throws RuntimeException
  • return voku\helper\DomParserInterface
  • param int | null $libXMLExtraOptions
  • 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 = 4 LIBXML_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
  • param bool $htmlToXml
  • param bool $removeXmlHeader
  • param int $options
  • return string
Properties
protected static voku\helper\AbstractDomParser :: $callback
 
  • var callable | null
  • phpstan-var null|callable(\voku\helper\XmlDomParser|\voku\helper\HtmlDomParser): void
protected voku\helper\AbstractDomParser :: $document
 
  • 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
 
  • var string
protected static $functionAliases = [ 'outertext' => 'html' , 'outerhtml' => 'html' , 'innertext' => 'innerHtml' , 'innerhtml' => 'innerHtml' , 'load' => 'loadHtml' , 'load_file' => 'loadHtmlFile' ]
 
  • var string []
protected $isDOMDocumentCreatedWithCommentWrapper
 
  • var bool
protected $isDOMDocumentCreatedWithFakeEndScript
 
  • var bool
protected $isDOMDocumentCreatedWithMultiRoot
 
  • var bool
protected $isDOMDocumentCreatedWithoutBodyWrapper
 
  • var bool
protected $isDOMDocumentCreatedWithoutHeadWrapper
 
  • var bool
protected $isDOMDocumentCreatedWithoutHtml
 
  • var bool
protected $isDOMDocumentCreatedWithoutHtmlWrapper
 
  • var bool
protected $isDOMDocumentCreatedWithoutPTagWrapper
 
  • var bool
protected $isDOMDocumentCreatedWithoutWrapper
 
  • var bool
protected $keepBrokenHtml
 
  • var bool
protected $selfClosingTags
 
  • var string []
protected $specialScriptTags
 

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

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

Create DOMDocument from HTML.

  • param string $html
  • param int | null $libXMLExtraOptions
  • return DOMDocument
  • param int | null $libXMLExtraOptions
  • 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
 
  • var callable | null
  • phpstan-var null|callable(string $htmlString, \voku\helper\HtmlDomParser): string
private $callbackXPathBeforeQuery
 
  • var callable | null
  • phpstan-var null|callable(string $cssSelectorString, string $xPathString, \DOMXPath, \voku\helper\HtmlDomParser): string
Properties
protected static voku\helper\AbstractDomParser :: $callback
 
  • 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
  • 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
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration