Dom

HTML input cleanup and DOM array construction.

Namespace: Com\Tecnick\Pdf\HTML

trait Dom

Source: src/HTML/Dom.php:45

HTML input cleanup and DOM array construction.

Methods

strTrim()

Trim the input string.

public strTrim(string $str, string $replace = ''): string

Parameters:

  • $str (string): string to trim.
  • $replace (string): string that replace spaces.

Returns: string: trimmed string.

Source: src/HTML/Dom.php:140

strTrimLeft()

Left trim the input string.

public strTrimLeft(string $str, string $replace = ''): string

Parameters:

  • $str (string): string to trim.
  • $replace (string): string that replace spaces.

Returns: string: left trimmed string.

Source: src/HTML/Dom.php:114

strTrimRight()

Right trim the input string.

public strTrimRight(string $str, string $replace = ''): string

Parameters:

  • $str (string): string to trim.
  • $replace (string): string that replace spaces.

Returns: string: right trimmed string.

Source: src/HTML/Dom.php:127

tidyHTML()

Cleanup HTML code (requires HTML Tidy library).

public tidyHTML(string $html, string $defcss): string

Parameters:

  • $html (string): htmlcode to fix.
  • $defcss (string): CSS to add.

Returns: string: XHTML code cleaned up.

Throws:

  • Exception: If Tidy cannot parse the input HTML.

Source: src/HTML/Dom.php:57