Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

TidyValidator Class Reference
[Various accompanying utilities]

Small Tidy-based HTML validator. More...

List of all members.

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'

Detailed Description

Small Tidy-based HTML validator.

Definition at line 17 of file TidyValidator.class.php.


Member Function Documentation

TidyValidator::countTags ( tag,
text 
) [private]

Definition at line 279 of file TidyValidator.class.php.

Referenced by validateContent().

static TidyValidator::create (  )  [static]
Returns:
TidyValidator

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);

Parameters:
$config array with tidy's configuration
Returns:
TidyValidator

Definition at line 85 of file TidyValidator.class.php.

References $config.

TidyValidator::setContent ( content  ) 

Sets content to validate.

For example: TidyValidator::create()->setContent('blabla');

Parameters:
$content content itself
Returns:
TidyValidator

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');

Parameters:
$encoding encoding name
Returns:
TidyValidator

Definition at line 124 of file TidyValidator.class.php.

References $encoding.

TidyValidator::setHeader ( header  ) 

Sets header for content.

There is default header (see code).

Parameters:
$header header string
Returns:
TidyValidator

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();

Parameters:
$content content to validate
Returns:
TidyValidator

Definition at line 165 of file TidyValidator.class.php.

References $content, countTags(), getConfig(), getContent(), getEncoding(), getHeader(), Assert::isTrue(), and setContent().

Here is the call graph for this function:


Member Data Documentation

TidyValidator::$config [private]
Initial value:
 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]
Initial value:
 '
            <!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.


The documentation for this class was generated from the following file: