Services_W3C_HTMLValidator
[ class tree: Services_W3C_HTMLValidator ] [ index: Services_W3C_HTMLValidator ] [ all elements ]

Class: Services_W3C_HTMLValidator

Source Location: /Services_W3C_HTMLValidator-1.0.0/Services/W3C/HTMLValidator.php

Class Overview


A simple class for utilizing the W3C HTML Validator service.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 40]
A simple class for utilizing the W3C HTML Validator service.


[ Top ]


Class Variables

$charset =

[line 90]

Character encoding

Character encoding override: Specify the character encoding to use when parsing the document. When used with the auxiliary parameter fbc set to 1, the given encoding will only be used as a fallback value, in case the charset is absent or unrecognized. Note that this parameter is ignored if validating a fragment with the direct input interface.

  • Access: public

Type:   string


[ Top ]

$doctype =

[line 111]

Document type

Document Type override: Specify the Document Type (DOCTYPE) to use when parsing the document. When used with the auxiliary parameter fbd set to 1, the given document type will only be used as a fallback value, in case the document's DOCTYPE declaration is missing or unrecognized.

  • Access: public

Type:   string


[ Top ]

$fbc =

[line 100]

Fall Back Character Set

When no character encoding is detected in the document, use the value in $charset as the fallback character set.

  • Access: public

Type:   bool


[ Top ]

$fbd =

[line 121]

Fall back doctype

When set to 1, use the value stored in $doctype when the document type cannot be automatically determined.

  • Access: public

Type:   bool


[ Top ]

$fragment =

[line 69]

HTML fragment to validate.

Full documents only. At the moment, will only work if data is sent with the UTF-8 encoding.

  • Access: public

Type:   string


[ Top ]

$outline =  false

[line 150]

outline

In the web interface, when set to 1, triggers the display of the document outline after the validation results. In SOAP output, does not have any impact.

  • Access: public

Type:   bool


[ Top ]

$output =  'soap12'

[line 78]

Output format

Triggers the various outputs formats of the validator. If unset, the usual Web format will be sent. If set to soap12, the SOAP1.2 interface will be triggered. See below for the SOAP 1.2 response format description.

  • Access: public

Type:   mixed


[ Top ]

$request =

[line 156]

HTTP_Request2 object.
  • Access: protected

Type:   object


[ Top ]

$ss =  false

[line 140]

Show source

In the web interface, triggers the display of the source after the validation results. In SOAP output, does not have any impact.

  • Access: public

Type:   bool


[ Top ]

$uploaded_file =

[line 60]

Internally used filename of a file to upload to the validator

POSTed as multipart/form-data

  • Access: public

Type:   string


[ Top ]

$uri =

[line 53]

The URL of the document to validate
  • Access: public

Type:   string


[ Top ]

$validator_uri =  'http://validator.w3.org/check'

[line 47]

URI to the w3 validator.
  • Access: public

Type:   string


[ Top ]

$verbose =  false

[line 131]

Verbose output

In the web interface, when set to 1, will make error messages, explanations and other diagnostics more verbose. In SOAP output, does not have any impact.

  • Access: public

Type:   bool


[ Top ]



Method Detail

__construct (Constructor)   [line 163]

Services_W3C_HTMLValidator __construct( [array $options = array()])

Constructor for the class.

Parameters:

array   $options   —  An array of options

[ Top ]

addPostParameter   [line 337]

void addPostParameter( string $name, [mixed $value = ''])

Add post data to the request
  • Access: protected

Parameters:

string   $name   —  Name of the post field
mixed   $value   —  Value of the field

[ Top ]

buildRequest   [line 271]

void buildRequest( [string $type = 'uri'])

Prepares a request object to send to the validator.
  • Access: protected

Parameters:

string   $type   —  uri, file, or fragment

[ Top ]

parseSOAP12Response   [line 372]

mixed parseSOAP12Response( string $xml)

Parse an XML response from the validator

This function parses a SOAP 1.2 response xml string from the validator.

  • Return: object Services_W3C_HTMLValidator_Response | bool false

Parameters:

string   $xml   —  The raw soap12 XML response from the validator.

[ Top ]

sendRequest   [line 349]

bool sendRequest( )

Actually sends the request to the HTML Validator service
  • Return: true | false
  • Throws: Services_W3C_HTMLValidator_Exception
  • Access: protected

[ Top ]

setOptions   [line 178]

void setOptions( array $options)

Sets options for the class.

Pass an associative array of options for the class.


Parameters:

array   $options   —  array of options

[ Top ]

setQueryVariable   [line 322]

void setQueryVariable( string $name, [mixed $value = ''])

Set a querystring variable for the request
  • Access: protected

Parameters:

string   $name   —  Name of the querystring parameter
mixed   $value   —  Value of the parameter

[ Top ]

setRequest   [line 192]

Services_W3C_HTMLValidator setRequest( HTTP_Request2 $request)

Sets the HTTP request object to use.

Parameters:

HTTP_Request2   $request   —  The request object.

[ Top ]

validate   [line 209]

mixed validate( string $uri)

Validates a given URI

Executes the validator using the current parameters and returns a Response object on success.

  • Return: object Services_W3C_HTMLValidator | bool false

Parameters:

string   $uri   —  The address to the page to validate ex: http://example.com/

[ Top ]

validateFile   [line 230]

mixed validateFile( string $file)

Validates the local file

Requests validation on the local file, from an instance of the W3C validator. The file is posted to the W3 validator using multipart/form-data.

  • Return: object Services_W3C_HTMLValidator | bool fals

Parameters:

string   $file   —  file to be validated.

[ Top ]

validateFragment   [line 253]

mixed validateFragment( string $html)

Validate an html string
  • Return: object Services_W3C_HTMLValidator | bool fals

Parameters:

string   $html   —  full html document fragment

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:37:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.