class tidy (View source)

An HTML node in an HTML file, as detected by tidy.

Properties

string|null $errorBuffer
string|null $value

Methods

string|int|bool
getOpt(string $option)

(PHP 5, PECL tidy >= 0.5.2)
Returns the value of the specified configuration option for the tidy document

bool
cleanRepair()

(PHP 5, PECL tidy >= 0.5.2)
Execute configured cleanup and repair operations on parsed markup

bool
parseFile(string $filename, mixed $config = null, string|null $encoding = null, bool $useIncludePath = false)

(PHP 5, PECL tidy >= 0.5.2)
Parse markup in file or URI

bool
parseString(string $string, mixed $config = null, string|null $encoding = null)

(PHP 5, PECL tidy >= 0.5.2)
Parse a document stored in a string

static string|false
repairString(string $string, array|string|null $config = null, string|null $encoding = null)

(PHP 5, PECL tidy >= 0.7.0)
Repair a string using an optionally provided configuration file

static string|false
repairFile(string $filename, array|string|null $config = null, string|null $encoding = null, bool $useIncludePath = false)

(PHP 5, PECL tidy >= 0.7.0)
Repair a file and return it as a string

bool
diagnose()

(PHP 5, PECL tidy >= 0.5.2)
Run configured diagnostics on parsed and repaired markup

string
getRelease()

(PHP 5, PECL tidy >= 0.5.2)
Get release date (version) for Tidy library

array
getConfig()

(PHP 5, PECL tidy >= 0.7.0)
Get current Tidy configuration

int
getStatus()

(PHP 5, PECL tidy >= 0.5.2)
Get status of specified document

int
getHtmlVer()

(PHP 5, PECL tidy >= 0.5.2)
Get the Detected HTML version for the specified document

string|false
getOptDoc(string $option)

Returns the documentation for the given option name

bool
isXhtml()

(PHP 5, PECL tidy >= 0.5.2)
Indicates if the document is a XHTML document

bool
isXml()

(PHP 5, PECL tidy >= 0.5.2)
Indicates if the document is a generic (non HTML/XHTML) XML document

tidyNode|null
root()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object representing the root of the tidy parse tree

tidyNode|null
head()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object starting from the <head> tag of the tidy parse tree

tidyNode|null
html()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object starting from the <html> tag of the tidy parse tree

tidyNode|null
body()

(PHP 5, PECL tidy 0.5.2-1.0)
Returns a tidyNode object starting from the <body> tag of the tidy parse tree

__construct(string $filename = null, mixed $config = null, string|null $encoding = null, bool $useIncludePath = null)

(PHP 5, PECL tidy >= 0.5.2)
Constructs a new tidy object

Details

string|int|bool getOpt(string $option)

(PHP 5, PECL tidy >= 0.5.2)
Returns the value of the specified configuration option for the tidy document

Parameters

string $option

You will find a list with each configuration option and their types at: http://tidy.sourceforge.net/docs/quickref.html.

Return Value

string|int|bool

the value of the specified option. The return type depends on the type of the specified one.

bool cleanRepair()

(PHP 5, PECL tidy >= 0.5.2)
Execute configured cleanup and repair operations on parsed markup

Return Value

bool

TRUE on success or FALSE on failure.

bool parseFile(string $filename, mixed $config = null, string|null $encoding = null, bool $useIncludePath = false)

(PHP 5, PECL tidy >= 0.5.2)
Parse markup in file or URI

Parameters

string $filename

If the filename parameter is given, this function will also read that file and initialize the object with the file, acting like tidy_parse_file.

mixed $config

[optional]

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

For an explanation about each option, see http://tidy.sourceforge.net/docs/quickref.html.

string|null $encoding

[optional]

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

bool $useIncludePath

[optional]

Search for the file in the include_path.

Return Value

bool

TRUE on success or FALSE on failure.

bool parseString(string $string, mixed $config = null, string|null $encoding = null)

(PHP 5, PECL tidy >= 0.5.2)
Parse a document stored in a string

Parameters

string $string

The data to be parsed.

mixed $config

[optional]

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html.

string|null $encoding

[optional]

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

Return Value

bool

a new tidy instance.

static string|false repairString(string $string, array|string|null $config = null, string|null $encoding = null)

(PHP 5, PECL tidy >= 0.7.0)
Repair a string using an optionally provided configuration file

Parameters

string $string

The data to be repaired.

array|string|null $config

[optional]

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

Check http://tidy.sourceforge.net/docs/quickref.html for an explanation about each option.

string|null $encoding

[optional]

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

Return Value

string|false

the repaired string.

static string|false repairFile(string $filename, array|string|null $config = null, string|null $encoding = null, bool $useIncludePath = false)

(PHP 5, PECL tidy >= 0.7.0)
Repair a file and return it as a string

Parameters

string $filename

The file to be repaired.

array|string|null $config

[optional]

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

Check http://tidy.sourceforge.net/docs/quickref.html for an explanation about each option.

string|null $encoding

[optional]

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

bool $useIncludePath

[optional]

Search for the file in the include_path.

Return Value

string|false

the repaired contents as a string.

bool diagnose()

(PHP 5, PECL tidy >= 0.5.2)
Run configured diagnostics on parsed and repaired markup

Return Value

bool

TRUE on success or FALSE on failure.

string getRelease()

(PHP 5, PECL tidy >= 0.5.2)
Get release date (version) for Tidy library

Return Value

string

a string with the release date of the Tidy library.

array getConfig()

(PHP 5, PECL tidy >= 0.7.0)
Get current Tidy configuration

Return Value

array

an array of configuration options.

For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html.

int getStatus()

(PHP 5, PECL tidy >= 0.5.2)
Get status of specified document

Return Value

int

0 if no error/warning was raised, 1 for warnings or accessibility errors, or 2 for errors.

int getHtmlVer()

(PHP 5, PECL tidy >= 0.5.2)
Get the Detected HTML version for the specified document

Return Value

int

the detected HTML version.

This function is not yet implemented in the Tidylib itself, so it always return 0.

string|false getOptDoc(string $option)

Returns the documentation for the given option name

Parameters

string $option

The option name

Return Value

string|false

a string if the option exists and has documentation available, or FALSE otherwise.

bool isXhtml()

(PHP 5, PECL tidy >= 0.5.2)
Indicates if the document is a XHTML document

Return Value

bool

This function returns TRUE if the specified tidy object is a XHTML document, or FALSE otherwise.

This function is not yet implemented in the Tidylib itself, so it always return FALSE.

bool isXml()

(PHP 5, PECL tidy >= 0.5.2)
Indicates if the document is a generic (non HTML/XHTML) XML document

Return Value

bool

This function returns TRUE if the specified tidy object is a generic XML document (non HTML/XHTML), or FALSE otherwise.

This function is not yet implemented in the Tidylib itself, so it always return FALSE.

tidyNode|null root()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object representing the root of the tidy parse tree

Return Value

tidyNode|null

the tidyNode object.

tidyNode|null head()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object starting from the <head> tag of the tidy parse tree

Return Value

tidyNode|null

the tidyNode object.

tidyNode|null html()

(PHP 5, PECL tidy 0.5.2-1.0.0)
Returns a tidyNode object starting from the <html> tag of the tidy parse tree

Return Value

tidyNode|null

the tidyNode object.

tidyNode|null body()

(PHP 5, PECL tidy 0.5.2-1.0)
Returns a tidyNode object starting from the <body> tag of the tidy parse tree

Return Value

tidyNode|null

a tidyNode object starting from the <body> tag of the tidy parse tree.

__construct(string $filename = null, mixed $config = null, string|null $encoding = null, bool $useIncludePath = null)

(PHP 5, PECL tidy >= 0.5.2)
Constructs a new tidy object

Parameters

string $filename

[optional]

If the filename parameter is given, this function will also read that file and initialize the object with the file, acting like tidy_parse_file.

mixed $config

[optional]

The config config can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.

For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html.

string|null $encoding

[optional]

The encoding parameter sets the encoding for input/output documents. The possible values for encoding are: ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16, utf16le, utf16be, big5, and shiftjis.

bool $useIncludePath

[optional]

Search for the file in the include_path.