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 ()
 
Returns:
TidyValidator


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 18 of file TidyValidator.class.php.


Member Function Documentation

static TidyValidator::create (  )  [static]

Returns:
TidyValidator

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

TidyValidator::setContent ( content  ) 

Sets content to validate.

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

Parameters:
$content content itself
Returns:
TidyValidator

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

References $content.

Referenced by validateContent().

TidyValidator::getContent (  ) 

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

Referenced by validateContent().

TidyValidator::getMessages (  ) 

Definition at line 73 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 86 of file TidyValidator.class.php.

References $config.

TidyValidator::getConfig (  ) 

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

Referenced by validateContent().

TidyValidator::setHeader ( header  ) 

Sets header for content.

There is default header (see code).

Parameters:
$header header string
Returns:
TidyValidator

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

References $header.

TidyValidator::getHeader (  ) 

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

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 125 of file TidyValidator.class.php.

References $encoding.

TidyValidator::getEncoding (  ) 

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

Referenced by validateContent().

TidyValidator::getErrorCount (  ) 

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

TidyValidator::getWarningCount (  ) 

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

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 166 of file TidyValidator.class.php.

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

Here is the call graph for this function:

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

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

Referenced by validateContent().


Member Data Documentation

TidyValidator::$content = null [private]

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

Referenced by setContent(), and validateContent().

TidyValidator::$messages = null [private]

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

TidyValidator::$errorCount = null [private]

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

TidyValidator::$warningCount = null [private]

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

TidyValidator::$config [private]

Initial value:

 array(
            'output-xhtml'      => true,
            'doctype'           => 'strict',
            'wrap'              => 0,
            'quote-marks'       => true,
            'drop-empty-paras'  => true
        )

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

Referenced by setConfig().

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 33 of file TidyValidator.class.php.

Referenced by setHeader().

TidyValidator::$headerLines = 7 [private]

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

TidyValidator::$encoding = 'utf8' [private]

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

Referenced by setEncoding().


The documentation for this class was generated from the following file:
Generated on Sun Dec 9 21:58:36 2007 for onPHP by  doxygen 1.5.4