diff options
author | tailor <cygnus@janrain.com> | 2006-01-12 19:03:09 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2006-01-12 19:03:09 +0000 |
commit | de2024e48e2bfd665823459aad4407fa507e6691 (patch) | |
tree | cb9a9eac6d5c746fb6d16aa973a3e00fd76af988 /Net/OpenID/Consumer/Parse.php | |
parent | 33b9f915920fd196beb8f7c337de39fe25f99ab5 (diff) | |
download | php-openid-de2024e48e2bfd665823459aad4407fa507e6691.zip php-openid-de2024e48e2bfd665823459aad4407fa507e6691.tar.gz php-openid-de2024e48e2bfd665823459aad4407fa507e6691.tar.bz2 |
[project @ Fixed bugs in parser and added parser tests]
Diffstat (limited to 'Net/OpenID/Consumer/Parse.php')
-rw-r--r-- | Net/OpenID/Consumer/Parse.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Net/OpenID/Consumer/Parse.php b/Net/OpenID/Consumer/Parse.php index b49d462..dbb05eb 100644 --- a/Net/OpenID/Consumer/Parse.php +++ b/Net/OpenID/Consumer/Parse.php @@ -61,13 +61,13 @@ function Net_OpenID_html_find() function Net_OpenID_head_find() { - return Net_OpenID_tagMatcher('head'); + return Net_OpenID_tagMatcher('head', array('body')); } -$_Net_OpenID_link_find = sprintf("/<link\b(?!:)[^\>]*>/%s", - $_Net_OpenID_re_flags); +$_Net_OpenID_attr_find = '\b(\w+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)'; -$_Net_OpenID_attr_find = '(\w+)=("[^"]*"|\'[^\']*\'|[^\s>]*)'; +$_Net_OpenID_link_find = sprintf("/<link\b(?!:)([^>]*)(?!<)>/%s", + $_Net_OpenID_re_flags); $_Net_OpenID_entity_replacements = array( 'amp' => '&', @@ -150,10 +150,12 @@ function Net_OpenID_parseLinkAttrs($html) preg_match_all($_Net_OpenID_attr_find, $link, $attr_matches); $link_attrs = array(); foreach ($attr_matches[0] as $index => $full_match) { - $link_attrs[$attr_matches[1][$index]] = - Net_OpenID_replace_entities( - Net_OpenID_remove_quotes( - $attr_matches[2][$index])); + $name = $attr_matches[1][$index]; + $value = Net_OpenID_replace_entities( + Net_OpenID_remove_quotes( + $attr_matches[2][$index])); + + $link_attrs[$name] = $value; } $link_data[] = $link_attrs; } |