| version 1.7, 2002/12/02 23:09:49 |
version 1.8, 2002/12/15 09:05:26 |
| Line 168 class HTML_Content |
|
| Line 168 class HTML_Content |
|
| if (preg_match('|^\s*<!DOCTYPE ([^>]*)>|', $all_data, $matches)) { |
if (preg_match('|^\s*<!DOCTYPE ([^>]*)>|', $all_data, $matches)) { |
| $this->_data['doctype'] = trim($matches[1]); |
$this->_data['doctype'] = trim($matches[1]); |
| } |
} |
| if (preg_match('|<head([^>]*)>(.*)</head>|si', $all_data, $matches)) { |
if (preg_match('|<head([^>]*)>(.*)</head[^>]*>|si', $all_data, $matches)) { |
| $this->_data['head_attr'] = trim($matches[1]); |
$this->_data['head_attr'] = trim($matches[1]); |
| $this->_data['head'] = trim($matches[2]); |
$this->_data['head'] = trim($matches[2]); |
| } |
} |
| if (preg_match('{<body([^>]*)>(.*)$}si', $all_data, $matches)) { |
if (preg_match('{<body([^>]*)>(.*)$}si', $all_data, $matches)) { |
| /* This will try to find closing BODY or HTML tag and if not found, |
/* This will try to find closing BODY or HTML tag and if not found, |
| content will remain till end of file although document is not |
content will remain till end of file although document is not |
| valid without these ending tags */ |
valid without these ending tags. */ |
| if (($pos = strpos($matches[2], '</body>')) !== false) { |
$matches[2] = preg_replace('|^(.*)</body.*$|si','\\1',$matches[2]); |
| $matches[2] = substr($matches[2], 0, $pos - 1); |
$matches[2] = preg_replace('|^(.*)</html.*$|si','\\1',$matches[2]); |
| } elseif (($pos = strpos($matches[2], '</html>')) !== false) { |
|
| $matches[2] = substr($matches[2], 0, $pos - 1); |
|
| } |
|
| $this->_data['body'] = trim($matches[2]); |
$this->_data['body'] = trim($matches[2]); |
| $this->_data['body_attr'] = trim($matches[1]); |
$this->_data['body_attr'] = trim($matches[1]); |
| } |
} |