| version 1.24, 2005/01/31 20:30:29 |
version 1.25, 2010/07/17 19:33:54 |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: $ */ |
/* $Platon: phpPlatonLib/HTML_Content/Content.php,v 1.24 2005/01/31 20:30:29 nepto Exp $ */ |
| |
|
| /* Notes: |
/* Notes: |
| |
|
| Line 414 class HTML_Content |
|
| Line 414 class HTML_Content |
|
| return $ret; |
return $ret; |
| } /* }}} */ |
} /* }}} */ |
| |
|
| # |
|
| # D E P R E C A T E D |
|
| # |
|
| |
|
| function getMeta($attr, $value) /* {{{ */ |
|
| { |
|
| $this->_data['meta'] == null && $this->_parseMeta(); |
|
| $attr = strtolower($attr); |
|
| for ($i = 0; $i < count($this->_data['meta']); $i++) { |
|
| if (isset($this->_data['meta'][$i][$attr]) |
|
| && stristr($this->_data['meta'][$i][$attr], $value)) { |
|
| return $this->_data['meta'][$i]; |
|
| } |
|
| } |
|
| } /* }}} */ |
|
| |
|
| function _parseTitle() /* {{{ */ |
|
| { |
|
| if (preg_match('|<title>(.*)</title>|si', $this->_data['head'], $matches)) { |
|
| $this->_data['title'] = trim($matches[1]); |
|
| return; |
|
| } |
|
| $this->_data['title'] = ''; |
|
| } /* }}} */ |
|
| |
|
| function _parseMeta() /* {{{ */ |
|
| { |
|
| $this->_data['meta'] = array(); |
|
| if (preg_match_all('|<meta ([^>]*)>|si', $this->_data['head'], $matches) > 0) { |
|
| $meta_idx = 0; |
|
| foreach ($matches[1] as $val) { |
|
| $ar = preg_split('{([\w-]+)=(\'[^\']*\'|"[^"]*"|[^ ]*)}si', |
|
| $val, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
| for ($i = 1; $i < count($ar); $i++) { |
|
| $attr = $ar[$i++]; |
|
| $value = $ar[$i++]; |
|
| $l_val = strlen($value); |
|
| if ($l_val > 1 && (($value[0] == "'" && $value[$l_val - 1] == "'") |
|
| || ($value[0] == '"' && $value[$l_val - 1] == '"'))) { |
|
| $value = substr($value, 1, $l_val - 2); |
|
| } |
|
| |
|
| $this->_data['meta'][$meta_idx][strtolower($attr)] = trim($value); |
|
| } |
|
| $meta_idx++; |
|
| } |
|
| } |
|
| } /* }}} */ |
|
| |
|
| } |
} |
| |
|
| /* Modeline for ViM {{{ |
/* Modeline for ViM {{{ |