summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-04-26 18:19:11 +0000
committertailor <cygnus@janrain.com>2007-04-26 18:19:11 +0000
commitb8d3eff26808d1907020b2d70674906e4f7e1d0e (patch)
treefd789c1c3eedeec8cd6d6bc7efe25c3f0c50dd57 /Auth
parentd699e6340e49bb29f45748853d3a869476c07417 (diff)
downloadphp-openid-b8d3eff26808d1907020b2d70674906e4f7e1d0e.zip
php-openid-b8d3eff26808d1907020b2d70674906e4f7e1d0e.tar.gz
php-openid-b8d3eff26808d1907020b2d70674906e4f7e1d0e.tar.bz2
[project @ Make yadis META tag search ignore comments]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/Yadis/ParseHTML.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/Auth/Yadis/ParseHTML.php b/Auth/Yadis/ParseHTML.php
index dd001ab..1922917 100644
--- a/Auth/Yadis/ParseHTML.php
+++ b/Auth/Yadis/ParseHTML.php
@@ -30,6 +30,12 @@ class Auth_Yadis_ParseHTML {
/**
* @access private
*/
+ var $_removed_re =
+ "<!--.*?-->|<!\[CDATA\[.*?\]\]>|<script\b(?!:)[^>]*>.*?<\/script>";
+
+ /**
+ * @access private
+ */
var $_tag_expr = "<%s%s(?:\s.*?)?%s>";
/**
@@ -43,6 +49,10 @@ class Auth_Yadis_ParseHTML {
$this->_attr_find,
$this->_re_flags);
+ $this->_removed_re = sprintf("/%s/%s",
+ $this->_removed_re,
+ $this->_re_flags);
+
$this->_entity_replacements = array(
'amp' => '&',
'lt' => '<',
@@ -146,6 +156,10 @@ class Auth_Yadis_ParseHTML {
*/
function getMetaTags($html_string)
{
+ $html_string = preg_replace($this->_removed_re,
+ "",
+ $html_string);
+
$key_tags = array($this->tagPattern('html', false, false),
$this->tagPattern('head', false, false),
$this->tagPattern('head', true, false),