Public Member Functions | Data Fields

Services_Yadis_ParseHTML Class Reference

Public Member Functions

 Services_Yadis_ParseHTML ()
 replaceEntities ($str)
 removeQuotes ($str)
 tagMatcher ($tag_name, $close_tags=null)
 htmlFind ($str)
 headFind ()
 getMetaTags ($html_string)
 getHTTPEquiv ($html_string)

Data Fields

 $_re_flags = "si"
 $_tag_expr = "<%s\b(?!:)([^>]*?)(?:\/>|>(.*?)(?:<\/?%s\s*>|\Z))"
 $_close_tag_expr = "<\/?%s\s*>"
 $_removed_re = "<!--.*?-->|<!\[CDATA\[.*?\]\]>|<script\b(?!:)[^>]*>.*?<\/script>"
 $_attr_find = '\b([-\w]+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)'

Detailed Description

Definition at line 23 of file ParseHTML.php.


Member Function Documentation

getHTTPEquiv ( html_string  ) 

Looks for a META tag with an "http-equiv" attribute whose value is one of ("x-xrds-location", "x-yadis-location"), ignoring case. If such a META tag is found, its "content" attribute value is returned.

Parameters:
string $html_string An HTML document in string format
Returns:
mixed $content The "content" attribute value of the META tag, if found, or null if no such tag was found.

Definition at line 251 of file ParseHTML.php.

getMetaTags ( html_string  ) 

Given an HTML document string, this finds all the META tags in the document, provided they are found in the <HTML><HEAD>...</HEAD> section of the document. The <HTML> tag may be missing.

private

Parameters:
string $html_string An HTMl document string
Returns:
array $tag_list Array of tags; each tag is an array of attribute -> value.

Definition at line 174 of file ParseHTML.php.

headFind (  ) 

private

Definition at line 158 of file ParseHTML.php.

htmlFind ( str  ) 

private

Definition at line 150 of file ParseHTML.php.

removeQuotes ( str  ) 

Strip single and double quotes off of a string, if they are present.

private

Parameters:
string $str The original string
Returns:
string $new_str The new string with leading and trailing quotes removed

Definition at line 108 of file ParseHTML.php.

replaceEntities ( str  ) 

Replace HTML entities (amp, lt, gt, and quot) as well as numeric entities (e.g. x9f;) with their actual values and return the new string.

private

Parameters:
string $str The string in which to look for entities
Returns:
string $new_str The new string entities decoded

Definition at line 85 of file ParseHTML.php.

Definition at line 51 of file ParseHTML.php.

tagMatcher ( tag_name,
close_tags = null 
)

Create a regular expression that will match an opening (and optional) closing tag of a given name.

private

Parameters:
string $tag_name The tag name to match
array $close_tags An array of tag names which also constitute closing of the original tag
Returns:
string $regex A regular expression string to be used in, say, preg_match.

Definition at line 134 of file ParseHTML.php.


Field Documentation

$_attr_find = '\b([-\w]+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)'

private

Definition at line 49 of file ParseHTML.php.

$_close_tag_expr = "<\/?%s\s*>"

private

Definition at line 38 of file ParseHTML.php.

$_re_flags = "si"

private

Definition at line 28 of file ParseHTML.php.

$_removed_re = "<!--.*?-->|<!\[CDATA\[.*?\]\]>|<script\b(?!:)[^>]*>.*?<\/script>"

private

Definition at line 43 of file ParseHTML.php.

$_tag_expr = "<%s\b(?!:)([^>]*?)(?:\/>|>(.*?)(?:<\/?%s\s*>|\Z))"

private

Definition at line 33 of file ParseHTML.php.


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