Small Tidy-based HTML validator. More...
Public Member Functions | |
setContent ($content) | |
Sets content to validate. | |
getContent () | |
getMessages () | |
setConfig ($config) | |
Sets configuration array for tidy. | |
getConfig () | |
setHeader ($header) | |
Sets header for content. | |
getHeader () | |
setEncoding ($encoding) | |
Sets encoding for content. | |
getEncoding () | |
getErrorCount () | |
getWarningCount () | |
validateContent ($content=null) | |
Do the content validation and repair it. | |
Static Public Member Functions | |
static | create () |
Private Member Functions | |
countTags ($tag, $text) | |
Private Attributes | |
$content = null | |
$messages = null | |
$errorCount = null | |
$warningCount = null | |
$config | |
$header | |
$headerLines = 7 | |
$encoding = 'utf8' |
Small Tidy-based HTML validator.
Definition at line 17 of file TidyValidator.class.php.
TidyValidator::countTags | ( | $ | tag, | |
$ | text | |||
) | [private] |
Definition at line 279 of file TidyValidator.class.php.
Referenced by validateContent().
static TidyValidator::create | ( | ) | [static] |
Definition at line 47 of file TidyValidator.class.php.
TidyValidator::getConfig | ( | ) |
Definition at line 92 of file TidyValidator.class.php.
Referenced by validateContent().
TidyValidator::getContent | ( | ) |
Definition at line 67 of file TidyValidator.class.php.
Referenced by validateContent().
TidyValidator::getEncoding | ( | ) |
Definition at line 131 of file TidyValidator.class.php.
Referenced by validateContent().
TidyValidator::getErrorCount | ( | ) |
Definition at line 136 of file TidyValidator.class.php.
TidyValidator::getHeader | ( | ) |
Definition at line 111 of file TidyValidator.class.php.
Referenced by validateContent().
TidyValidator::getMessages | ( | ) |
Definition at line 72 of file TidyValidator.class.php.
TidyValidator::getWarningCount | ( | ) |
Definition at line 141 of file TidyValidator.class.php.
TidyValidator::setConfig | ( | $ | config | ) |
Sets configuration array for tidy.
There is default config (see code).
For example: TidyValidator::create()->setConfig('output-xhtml' => true);
$config | array with tidy's configuration |
Definition at line 85 of file TidyValidator.class.php.
References $config.
TidyValidator::setContent | ( | $ | content | ) |
Sets content to validate.
For example: TidyValidator::create()->setContent('blabla');
$content | content itself |
Definition at line 60 of file TidyValidator.class.php.
References $content.
Referenced by validateContent().
TidyValidator::setEncoding | ( | $ | encoding | ) |
Sets encoding for content.
There is default encoding 'utf8'.
For example: TidyValidator::create()->setEncoding('utf8');
$encoding | encoding name |
Definition at line 124 of file TidyValidator.class.php.
References $encoding.
TidyValidator::setHeader | ( | $ | header | ) |
Sets header for content.
There is default header (see code).
$header | header string |
Definition at line 103 of file TidyValidator.class.php.
References $header.
TidyValidator::validateContent | ( | $ | content = null |
) |
Do the content validation and repair it.
For example: $repairedContent = TidyValidator::create()-> setContent('blablabla')-> validateContent()-> getContent();
Or just: $repairedContent = TidyValidator::create()-> validateContent('blablabla')-> getContent();
$content | content to validate |
Definition at line 165 of file TidyValidator.class.php.
References $content, countTags(), getConfig(), getContent(), getEncoding(), getHeader(), Assert::isTrue(), and setContent().
TidyValidator::$config [private] |
array( 'output-xhtml' => true, 'doctype' => 'strict', 'wrap' => 0, 'quote-marks' => true, 'drop-empty-paras' => true )
Definition at line 24 of file TidyValidator.class.php.
Referenced by setConfig().
TidyValidator::$content = null [private] |
Definition at line 19 of file TidyValidator.class.php.
Referenced by setContent(), and validateContent().
TidyValidator::$encoding = 'utf8' [private] |
Definition at line 42 of file TidyValidator.class.php.
Referenced by setEncoding().
TidyValidator::$errorCount = null [private] |
Definition at line 21 of file TidyValidator.class.php.
TidyValidator::$header [private] |
' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body>'
Definition at line 32 of file TidyValidator.class.php.
Referenced by setHeader().
TidyValidator::$headerLines = 7 [private] |
Definition at line 40 of file TidyValidator.class.php.
TidyValidator::$messages = null [private] |
Definition at line 20 of file TidyValidator.class.php.
TidyValidator::$warningCount = null [private] |
Definition at line 22 of file TidyValidator.class.php.