JanRain OpenID Library

Auth_Yadis_ParseHTML
in package

This class is responsible for scanning an HTML string to find META tags and their attributes. This is used by the Yadis discovery process. This class must be instantiated to be used.

Table of Contents

$_attr_find  : mixed
$_re_flags  : mixed
$_removed_re  : mixed
$_tag_expr  : mixed
__construct()  : mixed
getHTTPEquiv()  : mixed
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.
getMetaTags()  : array<string|int, mixed>
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.
removeQuotes()  : string
Strip single and double quotes off of a string, if they are present.
tagPattern()  : string
Create a regular expression that will match an opening or closing tag from a set of names.

Properties

$_attr_find

public mixed $_attr_find = '\\b([-\\w]+)=(".*?"|\'.*?\'|.+?)[\\/\\s>]'
Tags
access

private

$_re_flags

public mixed $_re_flags = "si"
Tags
access

private

$_removed_re

public mixed $_removed_re = '<!--.*?-->|<!\\[CDATA\\[.*?\\]\\]>|<script\\b(?!:)[^>]*>.*?<\\/script>'
Tags
access

private

$_tag_expr

public mixed $_tag_expr = '<%s%s(?:\\s.*?)?%s>'
Tags
access

private

Methods

__construct()

public __construct() : mixed
Return values
mixed

getHTTPEquiv()

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.

public getHTTPEquiv(string $html_string) : mixed
Parameters
$html_string : string

An HTML document in string format

Return values
mixed

$content The "content" attribute value of the META tag, if found, or null if no such tag was found.

getMetaTags()

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.

public getMetaTags(string $html_string) : array<string|int, mixed>
Parameters
$html_string : string

An HTMl document string

Tags
access

private

Return values
array<string|int, mixed>

$tag_list Array of tags; each tag is an array of attribute -> value.

removeQuotes()

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

public removeQuotes(string $str) : string
Parameters
$str : string

The original string

Tags
access

private

Return values
string

$new_str The new string with leading and trailing quotes removed

tagPattern()

Create a regular expression that will match an opening or closing tag from a set of names.

public tagPattern(mixed $tag_names, mixed $close, mixed $self_close) : string
Parameters
$tag_names : mixed

Tag names to match

$close : mixed

false/0 = no, true/1 = yes, other = maybe

$self_close : mixed

false/0 = no, true/1 = yes, other = maybe

Tags
access

private

Return values
string

$regex A regular expression string to be used in, say, preg_match.

Search results