53 define(
'SIMPLEPIE_NAME',
'SimplePie');
58 define(
'SIMPLEPIE_VERSION',
'1.2');
63 define(
'SIMPLEPIE_BUILD',
'20090627192103');
68 define(
'SIMPLEPIE_URL',
'http://simplepie.org');
85 define(
'SIMPLEPIE_LOCATOR_NONE', 0);
91 define(
'SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
97 define(
'SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
103 define(
'SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
109 define(
'SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
115 define(
'SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
121 define(
'SIMPLEPIE_LOCATOR_ALL', 31);
126 define(
'SIMPLEPIE_TYPE_NONE', 0);
131 define(
'SIMPLEPIE_TYPE_RSS_090', 1);
136 define(
'SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
141 define(
'SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
146 define(
'SIMPLEPIE_TYPE_RSS_091', 6);
151 define(
'SIMPLEPIE_TYPE_RSS_092', 8);
156 define(
'SIMPLEPIE_TYPE_RSS_093', 16);
161 define(
'SIMPLEPIE_TYPE_RSS_094', 32);
166 define(
'SIMPLEPIE_TYPE_RSS_10', 64);
171 define(
'SIMPLEPIE_TYPE_RSS_20', 128);
176 define(
'SIMPLEPIE_TYPE_RSS_RDF', 65);
181 define(
'SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
186 define(
'SIMPLEPIE_TYPE_RSS_ALL', 255);
191 define(
'SIMPLEPIE_TYPE_ATOM_03', 256);
196 define(
'SIMPLEPIE_TYPE_ATOM_10', 512);
201 define(
'SIMPLEPIE_TYPE_ATOM_ALL', 768);
206 define(
'SIMPLEPIE_TYPE_ALL', 1023);
211 define(
'SIMPLEPIE_CONSTRUCT_NONE', 0);
216 define(
'SIMPLEPIE_CONSTRUCT_TEXT', 1);
221 define(
'SIMPLEPIE_CONSTRUCT_HTML', 2);
226 define(
'SIMPLEPIE_CONSTRUCT_XHTML', 4);
231 define(
'SIMPLEPIE_CONSTRUCT_BASE64', 8);
236 define(
'SIMPLEPIE_CONSTRUCT_IRI', 16);
241 define(
'SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
246 define(
'SIMPLEPIE_CONSTRUCT_ALL', 63);
251 define(
'SIMPLEPIE_SAME_CASE', 1);
256 define(
'SIMPLEPIE_LOWERCASE', 2);
261 define(
'SIMPLEPIE_UPPERCASE', 4);
266 define(
'SIMPLEPIE_PCRE_HTML_ATTRIBUTE',
'((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*');
271 define(
'SIMPLEPIE_PCRE_XML_ATTRIBUTE',
'((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
276 define(
'SIMPLEPIE_NAMESPACE_XML',
'http://www.w3.org/XML/1998/namespace');
281 define(
'SIMPLEPIE_NAMESPACE_ATOM_10',
'http://www.w3.org/2005/Atom');
286 define(
'SIMPLEPIE_NAMESPACE_ATOM_03',
'http://purl.org/atom/ns#');
291 define(
'SIMPLEPIE_NAMESPACE_RDF',
'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
296 define(
'SIMPLEPIE_NAMESPACE_RSS_090',
'http://my.netscape.com/rdf/simple/0.9/');
301 define(
'SIMPLEPIE_NAMESPACE_RSS_10',
'http://purl.org/rss/1.0/');
306 define(
'SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT',
'http://purl.org/rss/1.0/modules/content/');
312 define(
'SIMPLEPIE_NAMESPACE_RSS_20',
'');
317 define(
'SIMPLEPIE_NAMESPACE_DC_10',
'http://purl.org/dc/elements/1.0/');
322 define(
'SIMPLEPIE_NAMESPACE_DC_11',
'http://purl.org/dc/elements/1.1/');
327 define(
'SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO',
'http://www.w3.org/2003/01/geo/wgs84_pos#');
332 define(
'SIMPLEPIE_NAMESPACE_GEORSS',
'http://www.georss.org/georss');
337 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS',
'http://search.yahoo.com/mrss/');
342 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG',
'http://search.yahoo.com/mrss');
347 define(
'SIMPLEPIE_NAMESPACE_ITUNES',
'http://www.itunes.com/dtds/podcast-1.0.dtd');
352 define(
'SIMPLEPIE_NAMESPACE_XHTML',
'http://www.w3.org/1999/xhtml');
357 define(
'SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY',
'http://www.iana.org/assignments/relation/');
362 define(
'SIMPLEPIE_PHP5', version_compare(PHP_VERSION,
'5.0.0',
'>='));
367 define(
'SIMPLEPIE_FILE_SOURCE_NONE', 0);
372 define(
'SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
377 define(
'SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
382 define(
'SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
387 define(
'SIMPLEPIE_FILE_SOURCE_CURL', 8);
392 define(
'SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
708 var
$strip_attributes = array(
'bgsound',
'class',
'expr',
'id',
'style',
'onclick',
'onerror',
'onfinish',
'onmouseover',
'onmouseout',
'onfocus',
'onblur',
'lowsrc',
'dynsrc');
715 var
$strip_htmltags = array(
'base',
'blink',
'body',
'doctype',
'embed',
'font',
'form',
'frame',
'frameset',
'html',
'iframe',
'input',
'marquee',
'meta',
'noscript',
'object',
'param',
'script',
'style');
767 return md5(serialize($this->data));
775 if ((version_compare(PHP_VERSION,
'5.3',
'<') || !gc_enabled()) && !ini_get(
'zend.ze1_compatibility_mode'))
777 if (!empty($this->data[
'items']))
779 foreach ($this->data[
'items'] as $item)
783 unset($item, $this->data[
'items']);
785 if (!empty($this->data[
'ordered_items']))
787 foreach ($this->data[
'ordered_items'] as $item)
791 unset($item, $this->data[
'ordered_items']);
829 $this->multifeed_url = array();
830 foreach ($url as $value)
850 if (is_a(
$file,
'SimplePie_File'))
852 $this->feed_url =
$file->url;
853 $this->file =&
$file;
873 $this->raw_data =
$data;
921 $this->xml_dump = (bool) $enable;
936 $this->cache = (bool) $enable;
948 $this->cache_duration = (int) $seconds;
960 $this->autodiscovery_cache_duration = (int) $seconds;
971 $this->cache_location = (string) $location;
982 $this->order_by_date = (bool) $enable;
995 $this->input_encoding = (string) $encoding;
999 $this->input_encoding =
false;
1019 $this->autodiscovery = (int) $level;
1035 $this->cache_class = $class;
1054 $this->locator_class = $class;
1073 $this->parser_class = $class;
1092 $this->file_class = $class;
1130 $this->item_class = $class;
1149 $this->author_class = $class;
1168 $this->category_class = $class;
1187 $this->enclosure_class = $class;
1206 $this->caption_class = $class;
1225 $this->copyright_class = $class;
1244 $this->credit_class = $class;
1263 $this->rating_class = $class;
1282 $this->restriction_class = $class;
1301 $this->content_type_sniffer_class = $class;
1320 $this->source_class = $class;
1334 $this->useragent = (string) $ua;
1345 if (is_callable($function))
1347 $this->cache_name_function = $function;
1361 $this->javascript = (string) $get;
1365 $this->javascript =
false;
1397 $this->max_checked_feeds = (int) $max;
1402 $this->
sanitize->remove_div($enable);
1411 $this->
sanitize->strip_htmltags($tags);
1412 if ($encode !== null)
1414 $this->
sanitize->encode_instead_of_strip($tags);
1420 $this->
sanitize->encode_instead_of_strip($enable);
1425 if ($attribs ===
'')
1429 $this->
sanitize->strip_attributes($attribs);
1434 $this->
sanitize->set_output_encoding($encoding);
1439 $this->
sanitize->strip_comments($strip);
1450 function set_url_replacements($element_attribute = array(
'a' =>
'href',
'area' =>
'href',
'blockquote' =>
'cite',
'del' =>
'cite',
'form' =>
'action',
'img' => array(
'longdesc',
'src'),
'input' =>
'src',
'ins' =>
'cite',
'q' =>
'cite'))
1452 $this->
sanitize->set_url_replacements($element_attribute);
1464 if ($page !==
false)
1466 $this->favicon_handler = $page .
'?' . $qs .
'=';
1470 $this->favicon_handler =
'';
1483 if ($page !==
false)
1485 $this->
sanitize->set_image_handler($page .
'?' . $qs .
'=');
1489 $this->image_handler =
'';
1501 $this->item_limit = (int) $limit;
1507 if ((function_exists(
'version_compare') && version_compare(PHP_VERSION,
'4.3.0',
'<')) || !extension_loaded(
'xml') || !extension_loaded(
'pcre'))
1512 elseif (!extension_loaded(
'xmlreader'))
1514 static $xml_is_sane = null;
1515 if ($xml_is_sane === null)
1517 $parser_check = xml_parser_create();
1518 xml_parse_into_struct($parser_check,
'<foo>&</foo>', $values);
1519 xml_parser_free($parser_check);
1520 $xml_is_sane = isset($values[0][
'value']);
1528 if (isset($_GET[$this->javascript]))
1535 $this->
sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class);
1538 if ($this->feed_url !== null || $this->raw_data !== null)
1540 $this->data = array();
1541 $this->multifeed_objects = array();
1544 if ($this->feed_url !== null)
1548 if ($this->cache && $parsed_feed_url[
'scheme'] !==
'')
1550 $cache = call_user_func(array($this->cache_class,
'create'), $this->cache_location, call_user_func($this->cache_name_function, $this->feed_url),
'spc');
1553 if (
$cache && !$this->xml_dump)
1556 $this->data =
$cache->load();
1557 if (!empty($this->data))
1560 if (!isset($this->data[
'build']) || $this->data[
'build'] !==
SIMPLEPIE_BUILD)
1563 $this->data = array();
1566 elseif (isset($this->data[
'url']) && $this->data[
'url'] !== $this->feed_url)
1569 $this->data = array();
1572 elseif (isset($this->data[
'feed_url']))
1575 if (
$cache->mtime() + $this->autodiscovery_cache_duration > time())
1578 if ($this->data[
'feed_url'] === $this->data[
'url'])
1581 $this->data = array();
1586 return $this->
init();
1591 elseif (
$cache->mtime() + $this->cache_duration < time())
1594 if (isset($this->data[
'headers'][
'last-modified']) || isset($this->data[
'headers'][
'etag']))
1597 if (isset($this->data[
'headers'][
'last-modified']))
1599 $headers[
'if-modified-since'] = $this->data[
'headers'][
'last-modified'];
1601 if (isset($this->data[
'headers'][
'etag']))
1603 $headers[
'if-none-match'] =
'"' . $this->data[
'headers'][
'etag'] .
'"';
1605 $file =
new $this->file_class($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->
force_fsockopen);
1608 if (
$file->status_code === 304)
1615 $headers =
$file->headers;
1634 $this->data = array();
1640 if (is_a($this->file,
'SimplePie_File') && $this->file->url === $this->feed_url)
1646 $file =
new $this->file_class($this->feed_url, $this->timeout, 5, null, $this->useragent, $this->
force_fsockopen);
1653 if (!empty($this->data))
1666 $locate =
new $this->locator_class(
$file, $this->timeout, $this->useragent, $this->file_class, $this->max_checked_feeds, $this->content_type_sniffer_class);
1667 if (!$locate->is_feed(
$file))
1671 if (
$file = $locate->find($this->autodiscovery, $this->all_discovered_feeds))
1675 $this->data = array(
'url' => $this->feed_url,
'feed_url' =>
$file->url,
'build' =>
SIMPLEPIE_BUILD);
1676 if (!
$cache->save($this))
1678 trigger_error(
"$this->cache_location is not writeable", E_USER_WARNING);
1680 $cache = call_user_func(array($this->cache_class,
'create'), $this->cache_location, call_user_func($this->cache_name_function,
$file->url),
'spc');
1682 $this->feed_url =
$file->url;
1686 $this->
error =
"A feed could not be found at $this->feed_url";
1694 $headers =
$file->headers;
1696 $sniffer =
new $this->content_type_sniffer_class(
$file);
1697 $sniffed = $sniffer->get_type();
1705 $encodings = array();
1708 if ($this->input_encoding !==
false)
1713 $application_types = array(
'application/xml',
'application/xml-dtd',
'application/xml-external-parsed-entity');
1714 $text_types = array(
'text/xml',
'text/xml-external-parsed-entity');
1717 if (isset($sniffed))
1719 if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) ===
'application/' && substr($sniffed, -4) ===
'+xml')
1721 if (isset($headers[
'content-type']) && preg_match(
'/;\x20?charset=([^;]*)/i', $headers[
'content-type'], $charset))
1723 $encodings[] = strtoupper($charset[1]);
1726 $encodings[] =
'UTF-8';
1728 elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) ===
'text/' && substr($sniffed, -4) ===
'+xml')
1730 if (isset($headers[
'content-type']) && preg_match(
'/;\x20?charset=([^;]*)/i', $headers[
'content-type'], $charset))
1732 $encodings[] = $charset[1];
1734 $encodings[] =
'US-ASCII';
1737 elseif (substr($sniffed, 0, 5) ===
'text/')
1739 $encodings[] =
'US-ASCII';
1745 $encodings[] =
'UTF-8';
1746 $encodings[] =
'ISO-8859-1';
1749 $encodings = array_unique($encodings);
1752 if ($this->xml_dump)
1754 header(
'Content-type: text/xml; charset=' . $encodings[0]);
1760 foreach ($encodings as $encoding)
1766 $parser =
new $this->parser_class();
1769 if ($parser->parse($utf8_data,
'UTF-8'))
1771 $this->data = $parser->get_data();
1774 if (isset($headers))
1776 $this->data[
'headers'] = $headers;
1783 trigger_error(
"$cache->name is not writeable", E_USER_WARNING);
1789 $this->
error =
"A feed could not be found at $this->feed_url";
1799 $this->
error = sprintf(
'XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1803 $this->
error =
'The data could not be converted to UTF-8';
1808 elseif (!empty($this->multifeed_url))
1812 $this->multifeed_objects = array();
1813 foreach ($this->multifeed_url as $url)
1818 $this->multifeed_objects[$i] = clone($this);
1822 $this->multifeed_objects[$i] = $this;
1824 $this->multifeed_objects[$i]->set_feed_url($url);
1825 $success |= $this->multifeed_objects[$i]->init();
1828 return (
bool) $success;
1849 return $this->
sanitize->output_encoding;
1854 if (!headers_sent())
1856 $header =
"Content-type: $mime;";
1863 $header .=
' charset=UTF-8';
1871 if (!isset($this->data[
'type']))
1885 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'image'])
1886 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'item'])
1887 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'textinput']))
1892 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'image'])
1893 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'item'])
1894 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'textinput']))
1902 if (isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'attribs'][
''][
'version']))
1904 switch (trim($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'attribs'][
''][
'version']))
1908 if (isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'skiphours'][
'hour'][0][
'data']))
1910 switch (trim($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'skiphours'][
'hour'][0][
'data']))
1946 return $this->data[
'type'];
1962 elseif (($url = $this->
get_link()) !== null && preg_match(
'/^http(s)?:\/\//i', $url))
1966 if ($this->cache && $this->favicon_handler)
1968 $favicon_filename = call_user_func($this->cache_name_function, $favicon);
1969 $cache = call_user_func(array($this->cache_class,
'create'), $this->cache_location, $favicon_filename,
'spi');
1977 $file =
new $this->file_class($favicon, $this->timeout / 10, 5, array(
'X-FORWARDED-FOR' => $_SERVER[
'REMOTE_ADDR']), $this->useragent, $this->
force_fsockopen);
1981 $sniffer =
new $this->content_type_sniffer_class(
$file);
1982 if (substr($sniffer->get_type(), 0, 6) ===
'image/')
1984 if (
$cache->save(array(
'headers' =>
$file->headers,
'body' =>
$file->body)))
1990 trigger_error(
"$cache->name is not writeable", E_USER_WARNING);
2017 if ($this->feed_url !== null)
2029 if ($this->feed_url !== null)
2041 if ($this->feed_url !== null)
2053 if ($this->feed_url !== null)
2065 if ($this->feed_url !== null)
2088 $return =
$feed_url . rawurlencode($this->feed_url);
2089 if ($site_url !== null && $this->
get_link() !== null)
2091 $return .= $site_url . rawurlencode($this->
get_link());
2123 return $this->
subscribe_service(
'http://www.feedster.com/myfeedster.php?action=addrss&confirm=no&rssurl=');
2133 return $this->
subscribe_service(
'http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl=');
2138 return $this->
subscribe_service(
'http://my.msn.com/addtomymsn.armx?id=rss&ut=',
'&ru=');
2153 return $this->
subscribe_service(
'http://www.newsgator.com/ngs/subscriber/subext.aspx?url=');
2163 return $this->
subscribe_service(
'http://www.podnova.com/index_your_podcasts.srf?action=add&url=');
2168 return $this->
subscribe_service(
'http://www.rojo.com/add-subscription?resource=');
2224 if (isset($channel[0][
'child'][$namespace][$tag]))
2226 return $channel[0][
'child'][$namespace][$tag];
2234 if (isset($channel[0][
'child'][$namespace][$tag]))
2236 return $channel[0][
'child'][$namespace][$tag];
2244 if (isset($channel[0][
'child'][$namespace][$tag]))
2246 return $channel[0][
'child'][$namespace][$tag];
2260 if (isset($image[0][
'child'][$namespace][$tag]))
2262 return $image[0][
'child'][$namespace][$tag];
2270 if (isset($image[0][
'child'][$namespace][$tag]))
2272 return $image[0][
'child'][$namespace][$tag];
2280 if (isset($image[0][
'child'][$namespace][$tag]))
2282 return $image[0][
'child'][$namespace][$tag];
2293 return $element[
'xml_base'];
2295 elseif ($this->
get_link() !== null)
2349 if (isset($categories[$key]))
2351 return $categories[$key];
2361 $categories = array();
2368 if (isset($category[
'attribs'][
''][
'term']))
2372 if (isset($category[
'attribs'][
''][
'scheme']))
2376 if (isset($category[
'attribs'][
''][
'label']))
2380 $categories[] =
new $this->category_class($term, $scheme, $label);
2387 if (isset($category[
'attribs'][
''][
'domain']))
2395 $categories[] =
new $this->category_class($term, $scheme, null);
2406 if (!empty($categories))
2419 if (isset($authors[$key]))
2421 return $authors[$key];
2441 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
2445 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
2449 if ($name !== null || $email !== null || $uri !== null)
2451 $authors[] =
new $this->author_class($name, $uri, $email);
2463 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
2465 $url = $this->
sanitize($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
2467 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
2471 if ($name !== null || $email !== null || $url !== null)
2473 $authors[] =
new $this->author_class($name, $url, $email);
2489 if (!empty($authors))
2502 if (isset($contributors[$key]))
2504 return $contributors[$key];
2514 $contributors = array();
2524 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
2526 $uri = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0]));
2528 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
2532 if ($name !== null || $email !== null || $uri !== null)
2534 $contributors[] =
new $this->author_class($name, $uri, $email);
2546 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
2548 $url = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
2550 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
2554 if ($name !== null || $email !== null || $url !== null)
2556 $contributors[] =
new $this->author_class($name, $url, $email);
2560 if (!empty($contributors))
2573 if (isset($links[$key]))
2575 return $links[$key];
2593 if (!isset($this->data[
'links']))
2595 $this->data[
'links'] = array();
2598 foreach ($links as $link)
2600 if (isset($link[
'attribs'][
''][
'href']))
2602 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
2609 foreach ($links as $link)
2611 if (isset($link[
'attribs'][
''][
'href']))
2613 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
2632 $keys = array_keys($this->data[
'links']);
2633 foreach ($keys as $key)
2649 $this->data[
'links'][substr($key, 41)] =& $this->data[
'links'][$key];
2651 $this->data[
'links'][$key] = array_unique($this->data[
'links'][$key]);
2655 if (isset($this->data[
'links'][$rel]))
2657 return $this->data[
'links'][$rel];
2768 elseif (isset($this->data[
'headers'][
'content-language']))
2782 return (
float) $return[0][
'data'];
2786 return (
float) $match[1];
2798 return (
float) $return[0][
'data'];
2802 return (
float) $return[0][
'data'];
2806 return (
float) $match[2];
2898 return round($return[0][
'data']);
2914 return round($return[0][
'data']);
2936 return ($qty > $max) ? $max : $qty;
2943 if (isset($items[$key]))
2945 return $items[$key];
2955 if (!isset($this->data[
'items']))
2957 if (!empty($this->multifeed_objects))
2959 $this->data[
'items'] =
SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2963 $this->data[
'items'] = array();
2966 $keys = array_keys($items);
2967 foreach ($keys as $key)
2969 $this->data[
'items'][] =
new $this->item_class($this, $items[$key]);
2974 $keys = array_keys($items);
2975 foreach ($keys as $key)
2977 $this->data[
'items'][] =
new $this->item_class($this, $items[$key]);
2982 $keys = array_keys($items);
2983 foreach ($keys as $key)
2985 $this->data[
'items'][] =
new $this->item_class($this, $items[$key]);
2990 $keys = array_keys($items);
2991 foreach ($keys as $key)
2993 $this->data[
'items'][] =
new $this->item_class($this, $items[$key]);
2998 $keys = array_keys($items);
2999 foreach ($keys as $key)
3001 $this->data[
'items'][] =
new $this->item_class($this, $items[$key]);
3007 if (!empty($this->data[
'items']))
3010 if ($this->order_by_date && empty($this->multifeed_objects))
3012 if (!isset($this->data[
'ordered_items']))
3015 foreach ($this->data[
'items'] as $item)
3017 if (!$item->get_date(
'U'))
3024 $this->data[
'ordered_items'] = $this->data[
'items'];
3027 usort($this->data[
'ordered_items'], array(&$this,
'sort_items'));
3030 $items = $this->data[
'ordered_items'];
3034 $items = $this->data[
'items'];
3040 return array_slice($items, $start);
3044 return array_slice($items, $start, $end);
3058 return $a->get_date(
'U') <= $b->get_date(
'U');
3066 if (is_array($urls) &&
sizeof($urls) > 0)
3069 foreach ($urls as $arg)
3071 if (is_a($arg,
'SimplePie'))
3073 $items = array_merge($items, $arg->get_items(0, $limit));
3077 trigger_error(
'Arguments must be SimplePie objects', E_USER_WARNING);
3082 foreach ($items as $item)
3084 if (!$item->get_date(
'U'))
3093 usort($items, array(
'SimplePie',
'sort_items'));
3098 return array_slice($items, $start);
3102 return array_slice($items, $start, $end);
3107 trigger_error(
'Cannot merge zero SimplePie objects', E_USER_WARNING);
3120 $this->feed =
$feed;
3121 $this->data =
$data;
3126 return md5(serialize($this->data));
3134 if ((version_compare(PHP_VERSION,
'5.3',
'<') || !gc_enabled()) && !ini_get(
'zend.ze1_compatibility_mode'))
3142 if (isset($this->data[
'child'][$namespace][$tag]))
3144 return $this->data[
'child'][$namespace][$tag];
3154 return $this->feed->get_base($element);
3159 return $this->feed->sanitize(
$data, $type, $base);
3195 elseif (($return = $this->
get_title()) !== null)
3206 return md5(serialize($this->data));
3212 if (!isset($this->data[
'title']))
3244 $this->data[
'title'] = null;
3247 return $this->data[
'title'];
3284 elseif (!$description_only)
3308 elseif (!$content_only)
3321 if (isset($categories[$key]))
3323 return $categories[$key];
3333 $categories = array();
3340 if (isset($category[
'attribs'][
''][
'term']))
3344 if (isset($category[
'attribs'][
''][
'scheme']))
3348 if (isset($category[
'attribs'][
''][
'label']))
3352 $categories[] =
new $this->feed->category_class($term, $scheme, $label);
3359 if (isset($category[
'attribs'][
''][
'domain']))
3367 $categories[] =
new $this->feed->category_class($term, $scheme, null);
3378 if (!empty($categories))
3391 if (isset($authors[$key]))
3393 return $authors[$key];
3404 if (isset($contributors[$key]))
3406 return $contributors[$key];
3416 $contributors = array();
3426 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
3428 $uri = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0]));
3430 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
3434 if ($name !== null || $email !== null || $uri !== null)
3436 $contributors[] =
new $this->feed->author_class($name, $uri, $email);
3448 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
3450 $url = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
3452 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
3456 if ($name !== null || $email !== null || $url !== null)
3458 $contributors[] =
new $this->feed->author_class($name, $url, $email);
3462 if (!empty($contributors))
3484 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
3488 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
3492 if ($name !== null || $email !== null || $uri !== null)
3494 $authors[] =
new $this->feed->author_class($name, $uri, $email);
3506 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
3508 $url = $this->
sanitize($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
3510 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
3514 if ($name !== null || $email !== null || $url !== null)
3516 $authors[] =
new $this->feed->author_class($name, $url, $email);
3536 if (!empty($authors))
3540 elseif (($source = $this->
get_source()) && ($authors = $source->get_authors()))
3544 elseif ($authors = $this->feed->get_authors())
3576 if (!isset($this->data[
'date']))
3580 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3584 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3588 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3592 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3596 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3600 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3604 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3608 $this->data[
'date'][
'raw'] = $return[0][
'data'];
3611 if (!empty($this->data[
'date'][
'raw']))
3614 $this->data[
'date'][
'parsed'] = $parser->parse($this->data[
'date'][
'raw']);
3618 $this->data[
'date'] = null;
3621 if ($this->data[
'date'])
3623 $date_format = (string) $date_format;
3624 switch ($date_format)
3630 return $this->data[
'date'][
'parsed'];
3633 return date($date_format, $this->data[
'date'][
'parsed']);
3648 elseif (($date = $this->
get_date(
'U')) !== null)
3650 return strftime($date_format, $date);
3666 elseif ($enclosure !== null)
3668 return $enclosure->get_link();
3679 if ($links[$key] !== null)
3681 return $links[$key];
3691 if (!isset($this->data[
'links']))
3693 $this->data[
'links'] = array();
3696 if (isset($link[
'attribs'][
''][
'href']))
3698 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
3705 if (isset($link[
'attribs'][
''][
'href']))
3707 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
3725 if (!isset($links[0][
'attribs'][
''][
'isPermaLink']) || strtolower(trim($links[0][
'attribs'][
''][
'isPermaLink'])) ===
'true')
3731 $keys = array_keys($this->data[
'links']);
3732 foreach ($keys as $key)
3748 $this->data[
'links'][substr($key, 41)] =& $this->data[
'links'][$key];
3750 $this->data[
'links'][$key] = array_unique($this->data[
'links'][$key]);
3753 if (isset($this->data[
'links'][$rel]))
3755 return $this->data[
'links'][$rel];
3769 if (isset($enclosures[$key]))
3771 return $enclosures[$key];
3791 if (!isset($this->data[
'enclosures']))
3793 $this->data[
'enclosures'] = array();
3796 $captions_parent = null;
3797 $categories_parent = null;
3798 $copyrights_parent = null;
3799 $credits_parent = null;
3800 $description_parent = null;
3801 $duration_parent = null;
3802 $hashes_parent = null;
3803 $keywords_parent = null;
3804 $player_parent = null;
3805 $ratings_parent = null;
3806 $restrictions_parent = null;
3807 $thumbnails_parent = null;
3808 $title_parent = null;
3816 foreach ($captions as $caption)
3818 $caption_type = null;
3819 $caption_lang = null;
3820 $caption_startTime = null;
3821 $caption_endTime = null;
3822 $caption_text = null;
3823 if (isset($caption[
'attribs'][
''][
'type']))
3827 if (isset($caption[
'attribs'][
''][
'lang']))
3831 if (isset($caption[
'attribs'][
''][
'start']))
3835 if (isset($caption[
'attribs'][
''][
'end']))
3839 if (isset($caption[
'data']))
3843 $captions_parent[] =
new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3848 foreach ($captions as $caption)
3850 $caption_type = null;
3851 $caption_lang = null;
3852 $caption_startTime = null;
3853 $caption_endTime = null;
3854 $caption_text = null;
3855 if (isset($caption[
'attribs'][
''][
'type']))
3859 if (isset($caption[
'attribs'][
''][
'lang']))
3863 if (isset($caption[
'attribs'][
''][
'start']))
3867 if (isset($caption[
'attribs'][
''][
'end']))
3871 if (isset($caption[
'data']))
3875 $captions_parent[] =
new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
3878 if (is_array($captions_parent))
3889 if (isset($category[
'data']))
3893 if (isset($category[
'attribs'][
''][
'scheme']))
3899 $scheme =
'http://search.yahoo.com/mrss/category_schema';
3901 if (isset($category[
'attribs'][
''][
'label']))
3905 $categories_parent[] =
new $this->feed->category_class($term, $scheme, $label);
3912 if (isset($category[
'data']))
3916 if (isset($category[
'attribs'][
''][
'scheme']))
3922 $scheme =
'http://search.yahoo.com/mrss/category_schema';
3924 if (isset($category[
'attribs'][
''][
'label']))
3928 $categories_parent[] =
new $this->feed->category_class($term, $scheme, $label);
3933 $scheme =
'http://www.itunes.com/dtds/podcast-1.0.dtd';
3935 if (isset($category[
'attribs'][
''][
'text']))
3939 $categories_parent[] =
new $this->feed->category_class($term, $scheme, $label);
3943 foreach ((array) $category[
'child'][SIMPLEPIE_NAMESPACE_ITUNES][
'category'] as $subcategory)
3945 if (isset($subcategory[
'attribs'][
''][
'text']))
3949 $categories_parent[] =
new $this->feed->category_class($term, $scheme, $label);
3953 if (is_array($categories_parent))
3961 $copyright_url = null;
3962 $copyright_label = null;
3963 if (isset($copyright[0][
'attribs'][
''][
'url']))
3967 if (isset($copyright[0][
'data']))
3971 $copyrights_parent =
new $this->feed->copyright_class($copyright_url, $copyright_label);
3975 $copyright_url = null;
3976 $copyright_label = null;
3977 if (isset($copyright[0][
'attribs'][
''][
'url']))
3981 if (isset($copyright[0][
'data']))
3985 $copyrights_parent =
new $this->feed->copyright_class($copyright_url, $copyright_label);
3991 foreach ($credits as $credit)
3993 $credit_role = null;
3994 $credit_scheme = null;
3995 $credit_name = null;
3996 if (isset($credit[
'attribs'][
''][
'role']))
4000 if (isset($credit[
'attribs'][
''][
'scheme']))
4006 $credit_scheme =
'urn:ebu';
4008 if (isset($credit[
'data']))
4012 $credits_parent[] =
new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4017 foreach ($credits as $credit)
4019 $credit_role = null;
4020 $credit_scheme = null;
4021 $credit_name = null;
4022 if (isset($credit[
'attribs'][
''][
'role']))
4026 if (isset($credit[
'attribs'][
''][
'scheme']))
4032 $credit_scheme =
'urn:ebu';
4034 if (isset($credit[
'data']))
4038 $credits_parent[] =
new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4041 if (is_array($credits_parent))
4049 if (isset($description_parent[0][
'data']))
4056 if (isset($description_parent[0][
'data']))
4068 if (isset($duration_parent[0][
'data']))
4071 if (
sizeof($temp) > 0)
4073 (int) $seconds = array_pop($temp);
4075 if (
sizeof($temp) > 0)
4077 (int) $minutes = array_pop($temp);
4078 $seconds += $minutes * 60;
4080 if (
sizeof($temp) > 0)
4082 (int) $hours = array_pop($temp);
4083 $seconds += $hours * 3600;
4086 $duration_parent = $seconds;
4093 foreach ($hashes_iterator as $hash)
4097 if (isset($hash[
'data']))
4101 if (isset($hash[
'attribs'][
''][
'algo']))
4109 $hashes_parent[] = $algo.
':'.$value;
4114 foreach ($hashes_iterator as $hash)
4118 if (isset($hash[
'data']))
4122 if (isset($hash[
'attribs'][
''][
'algo']))
4130 $hashes_parent[] = $algo.
':'.$value;
4133 if (is_array($hashes_parent))
4141 if (isset($keywords[0][
'data']))
4144 foreach ($temp as $word)
4146 $keywords_parent[] = trim($word);
4153 if (isset($keywords[0][
'data']))
4156 foreach ($temp as $word)
4158 $keywords_parent[] = trim($word);
4165 if (isset($keywords[0][
'data']))
4168 foreach ($temp as $word)
4170 $keywords_parent[] = trim($word);
4177 if (isset($keywords[0][
'data']))
4180 foreach ($temp as $word)
4182 $keywords_parent[] = trim($word);
4187 if (is_array($keywords_parent))
4195 if (isset($player_parent[0][
'attribs'][
''][
'url']))
4202 if (isset($player_parent[0][
'attribs'][
''][
'url']))
4211 foreach ($ratings as $rating)
4213 $rating_scheme = null;
4214 $rating_value = null;
4215 if (isset($rating[
'attribs'][
''][
'scheme']))
4221 $rating_scheme =
'urn:simple';
4223 if (isset($rating[
'data']))
4227 $ratings_parent[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4232 foreach ($ratings as $rating)
4234 $rating_scheme =
'urn:itunes';
4235 $rating_value = null;
4236 if (isset($rating[
'data']))
4240 $ratings_parent[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4245 foreach ($ratings as $rating)
4247 $rating_scheme = null;
4248 $rating_value = null;
4249 if (isset($rating[
'attribs'][
''][
'scheme']))
4255 $rating_scheme =
'urn:simple';
4257 if (isset($rating[
'data']))
4261 $ratings_parent[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4266 foreach ($ratings as $rating)
4268 $rating_scheme =
'urn:itunes';
4269 $rating_value = null;
4270 if (isset($rating[
'data']))
4274 $ratings_parent[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4277 if (is_array($ratings_parent))
4285 foreach ($restrictions as $restriction)
4287 $restriction_relationship = null;
4288 $restriction_type = null;
4289 $restriction_value = null;
4290 if (isset($restriction[
'attribs'][
''][
'relationship']))
4294 if (isset($restriction[
'attribs'][
''][
'type']))
4298 if (isset($restriction[
'data']))
4302 $restrictions_parent[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4307 foreach ($restrictions as $restriction)
4309 $restriction_relationship =
'allow';
4310 $restriction_type = null;
4311 $restriction_value =
'itunes';
4312 if (isset($restriction[
'data']) && strtolower($restriction[
'data']) ===
'yes')
4314 $restriction_relationship =
'deny';
4316 $restrictions_parent[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4321 foreach ($restrictions as $restriction)
4323 $restriction_relationship = null;
4324 $restriction_type = null;
4325 $restriction_value = null;
4326 if (isset($restriction[
'attribs'][
''][
'relationship']))
4330 if (isset($restriction[
'attribs'][
''][
'type']))
4334 if (isset($restriction[
'data']))
4338 $restrictions_parent[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4343 foreach ($restrictions as $restriction)
4345 $restriction_relationship =
'allow';
4346 $restriction_type = null;
4347 $restriction_value =
'itunes';
4348 if (isset($restriction[
'data']) && strtolower($restriction[
'data']) ===
'yes')
4350 $restriction_relationship =
'deny';
4352 $restrictions_parent[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4355 if (is_array($restrictions_parent))
4363 foreach ($thumbnails as $thumbnail)
4365 if (isset($thumbnail[
'attribs'][
''][
'url']))
4373 foreach ($thumbnails as $thumbnail)
4375 if (isset($thumbnail[
'attribs'][
''][
'url']))
4385 if (isset($title_parent[0][
'data']))
4392 if (isset($title_parent[0][
'data']))
4412 $samplingrate = null;
4422 $description = null;
4427 $restrictions = null;
4437 if (isset($content[
'attribs'][
''][
'url']))
4450 $samplingrate = null;
4460 $description = null;
4465 $restrictions = null;
4470 if (isset($content[
'attribs'][
''][
'bitrate']))
4474 if (isset($content[
'attribs'][
''][
'channels']))
4478 if (isset($content[
'attribs'][
''][
'duration']))
4484 $duration = $duration_parent;
4486 if (isset($content[
'attribs'][
''][
'expression']))
4490 if (isset($content[
'attribs'][
''][
'framerate']))
4494 if (isset($content[
'attribs'][
''][
'height']))
4498 if (isset($content[
'attribs'][
''][
'lang']))
4502 if (isset($content[
'attribs'][
''][
'fileSize']))
4504 $length = ceil($content[
'attribs'][
''][
'fileSize']);
4506 if (isset($content[
'attribs'][
''][
'medium']))
4510 if (isset($content[
'attribs'][
''][
'samplingrate']))
4514 if (isset($content[
'attribs'][
''][
'type']))
4518 if (isset($content[
'attribs'][
''][
'width']))
4529 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'text'] as $caption)
4531 $caption_type = null;
4532 $caption_lang = null;
4533 $caption_startTime = null;
4534 $caption_endTime = null;
4535 $caption_text = null;
4536 if (isset($caption[
'attribs'][
''][
'type']))
4540 if (isset($caption[
'attribs'][
''][
'lang']))
4544 if (isset($caption[
'attribs'][
''][
'start']))
4548 if (isset($caption[
'attribs'][
''][
'end']))
4552 if (isset($caption[
'data']))
4556 $captions[] =
new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4558 if (is_array($captions))
4563 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'text']))
4565 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'text'] as $caption)
4567 $caption_type = null;
4568 $caption_lang = null;
4569 $caption_startTime = null;
4570 $caption_endTime = null;
4571 $caption_text = null;
4572 if (isset($caption[
'attribs'][
''][
'type']))
4576 if (isset($caption[
'attribs'][
''][
'lang']))
4580 if (isset($caption[
'attribs'][
''][
'start']))
4584 if (isset($caption[
'attribs'][
''][
'end']))
4588 if (isset($caption[
'data']))
4592 $captions[] =
new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
4594 if (is_array($captions))
4601 $captions = $captions_parent;
4605 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category']))
4607 foreach ((array) $content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category'] as $category)
4612 if (isset($category[
'data']))
4616 if (isset($category[
'attribs'][
''][
'scheme']))
4622 $scheme =
'http://search.yahoo.com/mrss/category_schema';
4624 if (isset($category[
'attribs'][
''][
'label']))
4628 $categories[] =
new $this->feed->category_class($term, $scheme, $label);
4631 if (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category']))
4633 foreach ((array) $group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category'] as $category)
4638 if (isset($category[
'data']))
4642 if (isset($category[
'attribs'][
''][
'scheme']))
4648 $scheme =
'http://search.yahoo.com/mrss/category_schema';
4650 if (isset($category[
'attribs'][
''][
'label']))
4654 $categories[] =
new $this->feed->category_class($term, $scheme, $label);
4657 if (is_array($categories) && is_array($categories_parent))
4661 elseif (is_array($categories))
4665 elseif (is_array($categories_parent))
4671 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright']))
4673 $copyright_url = null;
4674 $copyright_label = null;
4675 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'attribs'][
''][
'url']))
4679 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'data']))
4683 $copyrights =
new $this->feed->copyright_class($copyright_url, $copyright_label);
4685 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright']))
4687 $copyright_url = null;
4688 $copyright_label = null;
4689 if (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'attribs'][
''][
'url']))
4693 if (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'data']))
4697 $copyrights =
new $this->feed->copyright_class($copyright_url, $copyright_label);
4701 $copyrights = $copyrights_parent;
4705 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit']))
4707 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit'] as $credit)
4709 $credit_role = null;
4710 $credit_scheme = null;
4711 $credit_name = null;
4712 if (isset($credit[
'attribs'][
''][
'role']))
4716 if (isset($credit[
'attribs'][
''][
'scheme']))
4722 $credit_scheme =
'urn:ebu';
4724 if (isset($credit[
'data']))
4728 $credits[] =
new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4730 if (is_array($credits))
4735 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit']))
4737 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit'] as $credit)
4739 $credit_role = null;
4740 $credit_scheme = null;
4741 $credit_name = null;
4742 if (isset($credit[
'attribs'][
''][
'role']))
4746 if (isset($credit[
'attribs'][
''][
'scheme']))
4752 $credit_scheme =
'urn:ebu';
4754 if (isset($credit[
'data']))
4758 $credits[] =
new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
4760 if (is_array($credits))
4767 $credits = $credits_parent;
4771 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'description']))
4775 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'description']))
4781 $description = $description_parent;
4785 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash']))
4787 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash'] as $hash)
4791 if (isset($hash[
'data']))
4795 if (isset($hash[
'attribs'][
''][
'algo']))
4803 $hashes[] = $algo.
':'.$value;
4805 if (is_array($hashes))
4810 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash']))
4812 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash'] as $hash)
4816 if (isset($hash[
'data']))
4820 if (isset($hash[
'attribs'][
''][
'algo']))
4828 $hashes[] = $algo.
':'.$value;
4830 if (is_array($hashes))
4837 $hashes = $hashes_parent;
4841 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords']))
4843 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords'][0][
'data']))
4846 foreach ($temp as $word)
4848 $keywords[] = trim($word);
4852 if (is_array($keywords))
4857 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords']))
4859 if (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords'][0][
'data']))
4862 foreach ($temp as $word)
4864 $keywords[] = trim($word);
4868 if (is_array($keywords))
4875 $keywords = $keywords_parent;
4879 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'player']))
4883 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'player']))
4889 $player = $player_parent;
4893 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating']))
4895 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating'] as $rating)
4897 $rating_scheme = null;
4898 $rating_value = null;
4899 if (isset($rating[
'attribs'][
''][
'scheme']))
4905 $rating_scheme =
'urn:simple';
4907 if (isset($rating[
'data']))
4911 $ratings[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4913 if (is_array($ratings))
4918 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating']))
4920 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating'] as $rating)
4922 $rating_scheme = null;
4923 $rating_value = null;
4924 if (isset($rating[
'attribs'][
''][
'scheme']))
4930 $rating_scheme =
'urn:simple';
4932 if (isset($rating[
'data']))
4936 $ratings[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
4938 if (is_array($ratings))
4945 $ratings = $ratings_parent;
4949 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction']))
4951 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction'] as $restriction)
4953 $restriction_relationship = null;
4954 $restriction_type = null;
4955 $restriction_value = null;
4956 if (isset($restriction[
'attribs'][
''][
'relationship']))
4960 if (isset($restriction[
'attribs'][
''][
'type']))
4964 if (isset($restriction[
'data']))
4968 $restrictions[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4970 if (is_array($restrictions))
4975 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction']))
4977 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction'] as $restriction)
4979 $restriction_relationship = null;
4980 $restriction_type = null;
4981 $restriction_value = null;
4982 if (isset($restriction[
'attribs'][
''][
'relationship']))
4986 if (isset($restriction[
'attribs'][
''][
'type']))
4990 if (isset($restriction[
'data']))
4994 $restrictions[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
4996 if (is_array($restrictions))
5003 $restrictions = $restrictions_parent;
5007 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail']))
5009 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail'] as $thumbnail)
5013 if (is_array($thumbnails))
5018 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail']))
5020 foreach ($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail'] as $thumbnail)
5024 if (is_array($thumbnails))
5031 $thumbnails = $thumbnails_parent;
5035 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'title']))
5039 elseif (isset($group[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'title']))
5045 $title = $title_parent;
5048 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
5056 foreach ((array) $this->data[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'content'] as $content)
5058 if (isset($content[
'attribs'][
''][
'url']))
5071 $samplingrate = null;
5081 $description = null;
5086 $restrictions = null;
5091 if (isset($content[
'attribs'][
''][
'bitrate']))
5095 if (isset($content[
'attribs'][
''][
'channels']))
5099 if (isset($content[
'attribs'][
''][
'duration']))
5105 $duration = $duration_parent;
5107 if (isset($content[
'attribs'][
''][
'expression']))
5111 if (isset($content[
'attribs'][
''][
'framerate']))
5115 if (isset($content[
'attribs'][
''][
'height']))
5119 if (isset($content[
'attribs'][
''][
'lang']))
5123 if (isset($content[
'attribs'][
''][
'fileSize']))
5125 $length = ceil($content[
'attribs'][
''][
'fileSize']);
5127 if (isset($content[
'attribs'][
''][
'medium']))
5131 if (isset($content[
'attribs'][
''][
'samplingrate']))
5135 if (isset($content[
'attribs'][
''][
'type']))
5139 if (isset($content[
'attribs'][
''][
'width']))
5148 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'text']))
5150 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'text'] as $caption)
5152 $caption_type = null;
5153 $caption_lang = null;
5154 $caption_startTime = null;
5155 $caption_endTime = null;
5156 $caption_text = null;
5157 if (isset($caption[
'attribs'][
''][
'type']))
5161 if (isset($caption[
'attribs'][
''][
'lang']))
5165 if (isset($caption[
'attribs'][
''][
'start']))
5169 if (isset($caption[
'attribs'][
''][
'end']))
5173 if (isset($caption[
'data']))
5177 $captions[] =
new $this->feed->caption_class($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text);
5179 if (is_array($captions))
5186 $captions = $captions_parent;
5190 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category']))
5192 foreach ((array) $content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'category'] as $category)
5197 if (isset($category[
'data']))
5201 if (isset($category[
'attribs'][
''][
'scheme']))
5207 $scheme =
'http://search.yahoo.com/mrss/category_schema';
5209 if (isset($category[
'attribs'][
''][
'label']))
5213 $categories[] =
new $this->feed->category_class($term, $scheme, $label);
5216 if (is_array($categories) && is_array($categories_parent))
5220 elseif (is_array($categories))
5224 elseif (is_array($categories_parent))
5234 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright']))
5236 $copyright_url = null;
5237 $copyright_label = null;
5238 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'attribs'][
''][
'url']))
5242 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'copyright'][0][
'data']))
5246 $copyrights =
new $this->feed->copyright_class($copyright_url, $copyright_label);
5250 $copyrights = $copyrights_parent;
5254 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit']))
5256 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'credit'] as $credit)
5258 $credit_role = null;
5259 $credit_scheme = null;
5260 $credit_name = null;
5261 if (isset($credit[
'attribs'][
''][
'role']))
5265 if (isset($credit[
'attribs'][
''][
'scheme']))
5271 $credit_scheme =
'urn:ebu';
5273 if (isset($credit[
'data']))
5277 $credits[] =
new $this->feed->credit_class($credit_role, $credit_scheme, $credit_name);
5279 if (is_array($credits))
5286 $credits = $credits_parent;
5290 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'description']))
5296 $description = $description_parent;
5300 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash']))
5302 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'hash'] as $hash)
5306 if (isset($hash[
'data']))
5310 if (isset($hash[
'attribs'][
''][
'algo']))
5318 $hashes[] = $algo.
':'.$value;
5320 if (is_array($hashes))
5327 $hashes = $hashes_parent;
5331 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords']))
5333 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'keywords'][0][
'data']))
5336 foreach ($temp as $word)
5338 $keywords[] = trim($word);
5342 if (is_array($keywords))
5349 $keywords = $keywords_parent;
5353 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'player']))
5359 $player = $player_parent;
5363 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating']))
5365 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'rating'] as $rating)
5367 $rating_scheme = null;
5368 $rating_value = null;
5369 if (isset($rating[
'attribs'][
''][
'scheme']))
5375 $rating_scheme =
'urn:simple';
5377 if (isset($rating[
'data']))
5381 $ratings[] =
new $this->feed->rating_class($rating_scheme, $rating_value);
5383 if (is_array($ratings))
5390 $ratings = $ratings_parent;
5394 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction']))
5396 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'restriction'] as $restriction)
5398 $restriction_relationship = null;
5399 $restriction_type = null;
5400 $restriction_value = null;
5401 if (isset($restriction[
'attribs'][
''][
'relationship']))
5405 if (isset($restriction[
'attribs'][
''][
'type']))
5409 if (isset($restriction[
'data']))
5413 $restrictions[] =
new $this->feed->restriction_class($restriction_relationship, $restriction_type, $restriction_value);
5415 if (is_array($restrictions))
5422 $restrictions = $restrictions_parent;
5426 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail']))
5428 foreach ($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'thumbnail'] as $thumbnail)
5432 if (is_array($thumbnails))
5439 $thumbnails = $thumbnails_parent;
5443 if (isset($content[
'child'][SIMPLEPIE_NAMESPACE_MEDIARSS][
'title']))
5449 $title = $title_parent;
5452 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions, $categories, $channels, $copyrights, $credits, $description, $duration, $expression, $framerate, $hashes, $height, $keywords, $lang, $medium, $player, $ratings, $restrictions, $samplingrate, $thumbnails, $title, $width);
5459 if (isset($link[
'attribs'][
''][
'href']) && !empty($link[
'attribs'][
''][
'rel']) && $link[
'attribs'][
''][
'rel'] ===
'enclosure')
5472 $samplingrate = null;
5478 if (isset($link[
'attribs'][
''][
'type']))
5482 if (isset($link[
'attribs'][
''][
'length']))
5484 $length = ceil($link[
'attribs'][
''][
'length']);
5488 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
5494 if (isset($link[
'attribs'][
''][
'href']) && !empty($link[
'attribs'][
''][
'rel']) && $link[
'attribs'][
''][
'rel'] ===
'enclosure')
5507 $samplingrate = null;
5513 if (isset($link[
'attribs'][
''][
'type']))
5517 if (isset($link[
'attribs'][
''][
'length']))
5519 $length = ceil($link[
'attribs'][
''][
'length']);
5523 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
5529 if (isset($enclosure[0][
'attribs'][
''][
'url']))
5542 $samplingrate = null;
5548 if (isset($enclosure[0][
'attribs'][
''][
'type']))
5552 if (isset($enclosure[0][
'attribs'][
''][
'length']))
5554 $length = ceil($enclosure[0][
'attribs'][
''][
'length']);
5558 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
5562 if (
sizeof($this->data[
'enclosures']) === 0 && ($url || $type || $length || $bitrate || $captions_parent || $categories_parent || $channels || $copyrights_parent || $credits_parent || $description_parent || $duration_parent || $expression || $framerate || $hashes_parent || $height || $keywords_parent || $lang || $medium || $player_parent || $ratings_parent || $restrictions_parent || $samplingrate || $thumbnails_parent || $title_parent || $width))
5565 $this->data[
'enclosures'][] =
new $this->feed->enclosure_class($url, $type, $length, $this->feed->javascript, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width);
5570 if (!empty($this->data[
'enclosures']))
5572 return $this->data[
'enclosures'];
5584 return (
float) $return[0][
'data'];
5588 return (
float) $match[1];
5600 return (
float) $return[0][
'data'];
5604 return (
float) $return[0][
'data'];
5608 return (
float) $match[2];
5620 return new $this->feed->source_class($this, $return[0]);
5642 if ($title_url !== null && $this->
get_title() !== null)
5644 $return .= $title_url . rawurlencode($this->
get_title());
5660 return $this->
add_to_service(
'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=',
'&Title=');
5665 return $this->
add_to_service(
'http://blogmarks.net/my/new.php?mini=1&simple=1&url=',
'&title=');
5670 return $this->
add_to_service(
'http://del.icio.us/post/?v=4&url=',
'&title=');
5675 return $this->
add_to_service(
'http://digg.com/submit?url=',
'&title=',
'&bodytext=');
5680 return $this->
add_to_service(
'http://www.furl.net/storeIt.jsp?u=',
'&t=');
5685 return $this->
add_to_service(
'http://ma.gnolia.com/bookmarklet/add?url=',
'&title=');
5690 return $this->
add_to_service(
'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=',
'&t=');
5695 return $this->
add_to_service(
'http://www.newsvine.com/_wine/save?u=',
'&h=');
5700 return $this->
add_to_service(
'http://reddit.com/submit?url=',
'&title=');
5705 return $this->
add_to_service(
'http://segnalo.com/post.html.php?url=',
'&title=');
5710 return $this->
add_to_service(
'http://www.simpy.com/simpy/LinkAdd.do?href=',
'&title=');
5715 return $this->
add_to_service(
'http://www.spurl.net/spurl.php?v=3&url=',
'&title=');
5720 return $this->
add_to_service(
'http://wists.com/r.php?c=&r=',
'&title=');
5725 return $this->
add_to_service(
'http://www.technorati.com/search/');
5736 $this->item =
$item;
5737 $this->data =
$data;
5742 return md5(serialize($this->data));
5747 if (isset($this->data[
'child'][$namespace][$tag]))
5749 return $this->data[
'child'][$namespace][$tag];
5759 return $this->item->get_base($element);
5764 return $this->item->sanitize(
$data, $type, $base);
5811 if (isset($categories[$key]))
5813 return $categories[$key];
5823 $categories = array();
5830 if (isset($category[
'attribs'][
''][
'term']))
5834 if (isset($category[
'attribs'][
''][
'scheme']))
5838 if (isset($category[
'attribs'][
''][
'label']))
5842 $categories[] =
new $this->item->feed->category_class($term, $scheme, $label);
5849 if (isset($category[
'attribs'][
''][
'domain']))
5857 $categories[] =
new $this->item->feed->category_class($term, $scheme, null);
5868 if (!empty($categories))
5881 if (isset($authors[$key]))
5883 return $authors[$key];
5903 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
5907 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
5911 if ($name !== null || $email !== null || $uri !== null)
5913 $authors[] =
new $this->item->feed->author_class($name, $uri, $email);
5925 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
5927 $url = $this->
sanitize($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
5929 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
5933 if ($name !== null || $email !== null || $url !== null)
5935 $authors[] =
new $this->item->feed->author_class($name, $url, $email);
5951 if (!empty($authors))
5964 if (isset($contributors[$key]))
5966 return $contributors[$key];
5976 $contributors = array();
5986 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
5988 $uri = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0]));
5990 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
5994 if ($name !== null || $email !== null || $uri !== null)
5996 $contributors[] =
new $this->item->feed->author_class($name, $uri, $email);
6008 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
6010 $url = $this->
sanitize($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data'],
SIMPLEPIE_CONSTRUCT_IRI, $this->
get_base($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0]));
6012 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
6016 if ($name !== null || $email !== null || $url !== null)
6018 $contributors[] =
new $this->item->feed->author_class($name, $url, $email);
6022 if (!empty($contributors))
6035 if (isset($links[$key]))
6037 return $links[$key];
6055 if (!isset($this->data[
'links']))
6057 $this->data[
'links'] = array();
6060 foreach ($links as $link)
6062 if (isset($link[
'attribs'][
''][
'href']))
6064 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
6071 foreach ($links as $link)
6073 if (isset($link[
'attribs'][
''][
'href']))
6075 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
6094 $keys = array_keys($this->data[
'links']);
6095 foreach ($keys as $key)
6111 $this->data[
'links'][substr($key, 41)] =& $this->data[
'links'][$key];
6113 $this->data[
'links'][$key] = array_unique($this->data[
'links'][$key]);
6117 if (isset($this->data[
'links'][$rel]))
6119 return $this->data[
'links'][$rel];
6213 elseif (isset($this->data[
'xml_lang']))
6227 return (
float) $return[0][
'data'];
6231 return (
float) $match[1];
6243 return (
float) $return[0][
'data'];
6247 return (
float) $return[0][
'data'];
6251 return (
float) $match[2];
6289 $this->name =
$name;
6290 $this->link =
$link;
6297 return md5(serialize($this));
6302 if ($this->name !== null)
6314 if ($this->link !== null)
6326 if ($this->email !== null)
6346 $this->term =
$term;
6354 return md5(serialize($this));
6359 if ($this->term !== null)
6371 if ($this->scheme !== null)
6383 if ($this->label !== null)
6425 function SimplePie_Enclosure(
$link = null,
$type = null,
$length = null,
$javascript = null,
$bitrate = null,
$captions = null,
$categories = null,
$channels = null,
$copyright = null,
$credits = null,
$description = null,
$duration = null,
$expression = null,
$framerate = null,
$hashes = null,
$height = null,
$keywords = null,
$lang = null,
$medium = null,
$player = null,
$ratings = null,
$restrictions = null,
$samplingrate = null,
$thumbnails = null,
$title = null,
$width = null)
6441 $this->lang =
$lang;
6443 $this->link =
$link;
6451 $this->type =
$type;
6453 if (class_exists(
'idna_convert'))
6465 return md5(serialize($this));
6470 if ($this->bitrate !== null)
6495 if ($this->captions !== null)
6520 if ($this->categories !== null)
6532 if ($this->channels !== null)
6544 if ($this->copyright !== null)
6569 if ($this->credits !== null)
6581 if ($this->description !== null)
6593 if ($this->duration !== null)
6613 if ($this->expression !== null)
6625 if ($this->link !== null)
6628 if ($url[
'path'] !==
'')
6630 return pathinfo($url[
'path'], PATHINFO_EXTENSION);
6638 if ($this->framerate !== null)
6668 if ($this->hashes !== null)
6680 if ($this->height !== null)
6692 if ($this->lang !== null)
6717 if ($this->keywords !== null)
6729 if ($this->length !== null)
6741 if ($this->link !== null)
6743 return urldecode($this->link);
6753 if ($this->medium !== null)
6765 if ($this->player !== null)
6790 if ($this->ratings !== null)
6815 if ($this->restrictions !== null)
6827 if ($this->samplingrate !== null)
6842 return round(
$length/1048576, 2);
6865 if ($this->thumbnails !== null)
6877 if ($this->title !== null)
6889 if ($this->type !== null)
6901 if ($this->width !== null)
6913 return $this->
embed($options,
true);
6919 function embed($options =
'', $native =
false)
6929 $bgcolor =
'#ffffff';
6931 $widescreen =
false;
6936 if (is_array($options))
6942 $options = explode(
',', $options);
6943 foreach($options as $option)
6945 $opt = explode(
':', $option, 2);
6946 if (isset($opt[0], $opt[1]))
6948 $opt[0] = trim($opt[0]);
6949 $opt[1] = trim($opt[1]);
6965 $altclass = $opt[1];
6985 $mediaplayer = $opt[1];
6989 $widescreen = $opt[1];
6996 $mime = explode(
'/',
$type, 2);
7002 if ($mime ===
'video')
7008 elseif ($widescreen)
7025 if ($mime ===
'audio')
7029 elseif ($mime ===
'video')
7042 elseif ($widescreen)
7056 elseif ($mime ===
'audio')
7062 if ($mime ===
'audio')
7064 $placeholder = $audio;
7066 elseif ($mime ===
'video')
7068 $placeholder = $video;
7076 static $javascript_outputted = null;
7077 if (!$javascript_outputted && $this->javascript)
7079 $embed .=
'<script type="text/javascript" src="?' . htmlspecialchars($this->javascript) .
'"></script>';
7080 $javascript_outputted =
true;
7089 $embed .=
'<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url=' . $this->
get_link() .
'"></embed>';
7093 $embed .=
'<script type="text/javascript">embed_odeo("' . $this->
get_link() .
'");</script>';
7102 $embed .=
"<embed src=\"" . $this->
get_link() .
"\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
7106 $embed .=
"<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->
get_link() .
"', '$loop', '$type');</script>";
7112 elseif (
$handler ===
'fmedia' || (
$handler ===
'mp3' && $mediaplayer !==
''))
7117 $embed .=
"<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->
get_link().
'?file_extension=.'.$this->
get_extension()) .
"&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
7121 $embed .=
"<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->
get_link().
'?file_extension=.'.$this->
get_extension()) .
"', '$placeholder', '$loop', '$mediaplayer');</script>";
7127 elseif (
$handler ===
'quicktime' || (
$handler ===
'mp3' && $mediaplayer ===
''))
7132 if ($placeholder !==
'')
7134 $embed .=
"<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->
get_link() .
"\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7138 $embed .=
"<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->
get_link() .
"\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7143 $embed .=
"<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->
get_link() .
"', '$placeholder', '$loop');</script>";
7153 $embed .=
"<embed type=\"application/x-mplayer2\" src=\"" . $this->
get_link() .
"\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
7157 $embed .=
"<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->
get_link() .
"');</script>";
7162 else $embed .=
'<a href="' . $this->
get_link() .
'" class="' . $altclass .
'">' . $alt .
'</a>';
7170 if (substr(strtolower($this->
get_link()), 0, 15) ===
'http://odeo.com')
7176 $types_flash = array(
'application/x-shockwave-flash',
'application/futuresplash');
7177 $types_fmedia = array(
'video/flv',
'video/x-flv',
'flv-application/octet-stream');
7178 $types_quicktime = array(
'audio/3gpp',
'audio/3gpp2',
'audio/aac',
'audio/x-aac',
'audio/aiff',
'audio/x-aiff',
'audio/mid',
'audio/midi',
'audio/x-midi',
'audio/mp4',
'audio/m4a',
'audio/x-m4a',
'audio/wav',
'audio/x-wav',
'video/3gpp',
'video/3gpp2',
'video/m4v',
'video/x-m4v',
'video/mp4',
'video/mpeg',
'video/x-mpeg',
'video/quicktime',
'video/sd-video');
7179 $types_wmedia = array(
'application/asx',
'application/x-mplayer2',
'audio/x-ms-wma',
'audio/x-ms-wax',
'video/x-ms-asf-plugin',
'video/x-ms-asf',
'video/x-ms-wm',
'video/x-ms-wmv',
'video/x-ms-wvx');
7180 $types_mp3 = array(
'audio/mp3',
'audio/x-mp3',
'audio/mpeg',
'audio/x-mpeg');
7184 $type = strtolower($this->type);
7192 if (!in_array(
$type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
7199 $type =
'audio/acc';
7206 $type =
'audio/aiff';
7210 $type =
'audio/wav';
7217 $type =
'audio/midi';
7221 $type =
'audio/x-m4a';
7226 $type =
'audio/mp3';
7230 $type =
'audio/wav';
7234 $type =
'audio/x-ms-wax';
7238 $type =
'audio/x-ms-wma';
7244 $type =
'video/3gpp';
7249 $type =
'video/3gpp2';
7253 $type =
'video/x-ms-asf';
7257 $type =
'video/x-flv';
7271 $type =
'video/mpeg';
7275 $type =
'video/x-m4v';
7280 $type =
'video/quicktime';
7285 $type =
'video/mp4';
7289 $type =
'video/sd-video';
7293 $type =
'video/x-ms-wm';
7297 $type =
'video/x-ms-wmv';
7301 $type =
'video/x-ms-wvx';
7306 $type =
'application/futuresplash';
7310 $type =
'application/x-shockwave-flash';
7317 if (in_array(
$type, $types_flash))
7321 elseif (in_array(
$type, $types_fmedia))
7325 elseif (in_array(
$type, $types_quicktime))
7329 elseif (in_array(
$type, $types_wmedia))
7333 elseif (in_array(
$type, $types_mp3))
7360 $this->type =
$type;
7361 $this->lang =
$lang;
7364 $this->text =
$text;
7370 return md5(serialize($this));
7375 if ($this->endTime !== null)
7387 if ($this->lang !== null)
7399 if ($this->startTime !== null)
7411 if ($this->text !== null)
7423 if ($this->type !== null)
7443 $this->role =
$role;
7445 $this->name =
$name;
7451 return md5(serialize($this));
7456 if ($this->role !== null)
7468 if ($this->scheme !== null)
7480 if ($this->name !== null)
7506 return md5(serialize($this));
7511 if ($this->url !== null)
7523 if ($this->label !== null)
7549 return md5(serialize($this));
7554 if ($this->scheme !== null)
7566 if ($this->value !== null)
7587 $this->type =
$type;
7594 return md5(serialize($this));
7599 if ($this->relationship !== null)
7611 if ($this->type !== null)
7623 if ($this->value !== null)
7651 if (class_exists(
'idna_convert'))
7659 if (preg_match(
'/^http(s)?:\/\//i',
$url))
7670 if (!$force_fsockopen && function_exists(
'curl_exec'))
7674 $headers2 = array();
7675 foreach (
$headers as $key => $value)
7677 $headers2[] =
"$key: $value";
7681 curl_setopt($fp, CURLOPT_ENCODING,
'');
7683 curl_setopt($fp, CURLOPT_URL,
$url);
7684 curl_setopt($fp, CURLOPT_HEADER, 1);
7685 curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
7686 curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
7687 curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
7688 curl_setopt($fp, CURLOPT_REFERER,
$url);
7689 curl_setopt($fp, CURLOPT_USERAGENT,
$useragent);
7690 curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
7693 curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1);
7694 curl_setopt($fp, CURLOPT_MAXREDIRS,
$redirects);
7697 $this->headers = curl_exec($fp);
7698 if (curl_errno($fp) === 23 || curl_errno($fp) === 61)
7700 curl_setopt($fp, CURLOPT_ENCODING,
'none');
7701 $this->headers = curl_exec($fp);
7703 if (curl_errno($fp))
7705 $this->error =
'cURL error ' . curl_errno($fp) .
': ' . curl_error($fp);
7706 $this->success =
false;
7710 $info = curl_getinfo($fp);
7712 $this->headers = explode(
"\r\n\r\n", $this->headers, $info[
'redirect_count'] + 1);
7713 $this->headers = array_pop($this->headers);
7715 if ($parser->parse())
7717 $this->headers = $parser->headers;
7718 $this->body = $parser->body;
7719 $this->status_code = $parser->status_code;
7720 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers[
'location']) && $this->redirects <
$redirects)
7732 $url_parts = parse_url(
$url);
7733 if (isset($url_parts[
'scheme']) && strtolower($url_parts[
'scheme']) ===
'https')
7735 $url_parts[
'host'] =
"ssl://$url_parts[host]";
7736 $url_parts[
'port'] = 443;
7738 if (!isset($url_parts[
'port']))
7740 $url_parts[
'port'] = 80;
7742 $fp = @fsockopen($url_parts[
'host'], $url_parts[
'port'], $errno, $errstr, $timeout);
7745 $this->error =
'fsockopen error: ' . $errstr;
7746 $this->success =
false;
7750 stream_set_timeout($fp, $timeout);
7751 if (isset($url_parts[
'path']))
7753 if (isset($url_parts[
'query']))
7755 $get =
"$url_parts[path]?$url_parts[query]";
7759 $get = $url_parts[
'path'];
7766 $out =
"GET $get HTTP/1.0\r\n";
7767 $out .=
"Host: $url_parts[host]\r\n";
7768 $out .=
"User-Agent: $useragent\r\n";
7769 if (extension_loaded(
'zlib'))
7771 $out .=
"Accept-Encoding: x-gzip,gzip,deflate\r\n";
7774 if (isset($url_parts[
'user']) && isset($url_parts[
'pass']))
7776 $out .=
"Authorization: Basic " . base64_encode(
"$url_parts[user]:$url_parts[pass]") .
"\r\n";
7778 foreach (
$headers as $key => $value)
7780 $out .=
"$key: $value\r\n";
7782 $out .=
"Connection: Close\r\n\r\n";
7785 $info = stream_get_meta_data($fp);
7787 $this->headers =
'';
7788 while (!$info[
'eof'] && !$info[
'timed_out'])
7790 $this->headers .= fread($fp, 1160);
7791 $info = stream_get_meta_data($fp);
7793 if (!$info[
'timed_out'])
7796 if ($parser->parse())
7798 $this->headers = $parser->headers;
7799 $this->body = $parser->body;
7800 $this->status_code = $parser->status_code;
7801 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers[
'location']) && $this->redirects <
$redirects)
7807 if (isset($this->headers[
'content-encoding']))
7810 switch (strtolower(trim($this->headers[
'content-encoding'],
"\x09\x0A\x0D\x20")))
7815 if (!$decoder->parse())
7817 $this->error =
'Unable to decode HTTP "gzip" stream';
7818 $this->success =
false;
7822 $this->body = $decoder->data;
7827 if ((
$body = gzuncompress($this->body)) ===
false)
7829 if ((
$body = gzinflate($this->body)) ===
false)
7831 $this->error =
'Unable to decode HTTP "deflate" stream';
7832 $this->success =
false;
7835 $this->body =
$body;
7839 $this->error =
'Unknown content coding';
7840 $this->success =
false;
7847 $this->error =
'fsocket timed out';
7848 $this->success =
false;
7857 if (!$this->body = file_get_contents(
$url))
7859 $this->error =
'file_get_contents could not read the file';
7860 $this->success =
false;
7969 $this->data =
$data;
7970 $this->data_length = strlen($this->data);
7981 while ($this->state && $this->state !==
'emit' && $this->
has_data())
7987 if ($this->state ===
'emit' || $this->state ===
'body')
7994 $this->status_code =
'';
7996 $this->headers = array();
8024 && isset($this->data[$this->position + 1])
8025 && ($this->data[$this->position + 1] ===
"\x09" || $this->data[$this->position + 1] ===
"\x20")));
8035 if (strpos($this->data,
"\x0A") !==
false && strtoupper(substr($this->data, 0, 5)) ===
'HTTP/')
8037 $len = strspn($this->data,
'0123456789.', 5);
8039 $this->position += 5 + $len;
8043 $this->position += strspn($this->data,
"\x09\x20", $this->position);
8044 $this->state =
'status';
8048 $this->state =
false;
8053 $this->state =
false;
8064 if ($len = strspn($this->data,
'0123456789', $this->position))
8066 $this->status_code = (int) substr($this->data, $this->position, $len);
8067 $this->position += $len;
8068 $this->state =
'reason';
8072 $this->state =
false;
8083 $len = strcspn($this->data,
"\x0A", $this->position);
8084 $this->
reason = trim(substr($this->data, $this->position, $len),
"\x09\x0D\x20");
8085 $this->position += $len + 1;
8086 $this->state =
'new_line';
8096 $this->
value = trim($this->
value,
"\x0D\x20");
8097 if ($this->
name !==
'' && $this->
value !==
'')
8099 $this->
name = strtolower($this->
name);
8100 if (isset($this->headers[$this->
name]))
8111 if (substr($this->data[$this->position], 0, 2) ===
"\x0D\x0A")
8113 $this->position += 2;
8114 $this->state =
'body';
8116 elseif ($this->data[$this->position] ===
"\x0A")
8119 $this->state =
'body';
8123 $this->state =
'name';
8134 $len = strcspn($this->data,
"\x0A:", $this->position);
8135 if (isset($this->data[$this->position + $len]))
8137 if ($this->data[$this->position + $len] ===
"\x0A")
8139 $this->position += $len;
8140 $this->state =
'new_line';
8144 $this->
name = substr($this->data, $this->position, $len);
8145 $this->position += $len + 1;
8146 $this->state =
'value';
8151 $this->state =
false;
8164 if (substr($this->data, $this->position, 2) ===
"\x0D\x0A")
8166 $this->position += 2;
8168 elseif ($this->data[$this->position] ===
"\x0A")
8172 $this->position += strspn($this->data,
"\x09\x20", $this->position);
8174 $this->
value .=
"\x20";
8190 switch ($this->data[$this->position])
8194 $this->state =
'quote';
8199 $this->state =
'new_line';
8203 $this->state =
'value_char';
8216 $len = strcspn($this->data,
"\x09\x20\x0A\"", $this->position);
8217 $this->
value .= substr($this->data, $this->position, $len);
8218 $this->position += $len;
8219 $this->state =
'value';
8235 switch ($this->data[$this->position])
8239 $this->state =
'value';
8244 $this->state =
'new_line';
8249 $this->state =
'quote_escaped';
8253 $this->state =
'quote_char';
8266 $len = strcspn($this->data,
"\x09\x20\x0A\"\\", $this->position);
8267 $this->
value .= substr($this->data, $this->position, $len);
8268 $this->position += $len;
8269 $this->state =
'value';
8281 $this->state =
'quote';
8291 $this->
body = substr($this->data, $this->position);
8292 $this->state =
'emit';
8416 trigger_error(
"Cannot write property $name", E_USER_ERROR);
8426 $this->compressed_data =
$data;
8427 $this->compressed_size = strlen(
$data);
8437 if ($this->compressed_size >= $this->min_compressed_size)
8440 if (substr($this->compressed_data, 0, 3) !==
"\x1F\x8B\x08")
8446 $this->flags = ord($this->compressed_data[3]);
8449 if ($this->flags > 0x1F)
8455 $this->position += 4;
8458 $mtime = substr($this->compressed_data, $this->position, 4);
8460 if (current(unpack(
'S',
"\x00\x01")) === 1)
8462 $mtime = strrev($mtime);
8464 $this->MTIME = current(unpack(
'l', $mtime));
8465 $this->position += 4;
8468 $this->XFL = ord($this->compressed_data[$this->position++]);
8471 $this->OS = ord($this->compressed_data[$this->position++]);
8474 if ($this->flags & 4)
8477 $this->SI1 = $this->compressed_data[$this->position++];
8478 $this->SI2 = $this->compressed_data[$this->position++];
8481 if ($this->SI2 ===
"\x00")
8487 $len = current(unpack(
'v', substr($this->compressed_data, $this->position, 2)));
8491 $this->min_compressed_size += $len + 4;
8492 if ($this->compressed_size >= $this->min_compressed_size)
8495 $this->extra_field = substr($this->compressed_data, $this->position, $len);
8496 $this->position += $len;
8505 if ($this->flags & 8)
8508 $len = strcspn($this->compressed_data,
"\x00", $this->position);
8511 $this->min_compressed_size += $len + 1;
8512 if ($this->compressed_size >= $this->min_compressed_size)
8515 $this->filename = substr($this->compressed_data, $this->position, $len);
8516 $this->position += $len + 1;
8525 if ($this->flags & 16)
8528 $len = strcspn($this->compressed_data,
"\x00", $this->position);
8531 $this->min_compressed_size += $len + 1;
8532 if ($this->compressed_size >= $this->min_compressed_size)
8535 $this->comment = substr($this->compressed_data, $this->position, $len);
8536 $this->position += $len + 1;
8545 if ($this->flags & 2)
8548 $this->min_compressed_size += $len + 2;
8549 if ($this->compressed_size >= $this->min_compressed_size)
8552 $crc = current(unpack(
'v', substr($this->compressed_data, $this->position, 2)));
8555 if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
8557 $this->position += 2;
8571 if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) ===
false)
8577 $this->position = $this->compressed_size - 8;
8581 $crc = current(unpack(
'V', substr($this->compressed_data, $this->position, 4)));
8582 $this->position += 4;
8589 $isize = current(unpack(
'V', substr($this->compressed_data, $this->position, 4)));
8590 $this->position += 4;
8591 if (sprintf(
'%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf(
'%u', $isize))
8615 trigger_error(
'Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
8624 function create($location, $filename, $extension)
8627 switch ($location_iri->get_scheme())
8630 if (extension_loaded(
'mysql'))
8654 $this->name =
"$this->location/$this->filename.$this->extension";
8659 if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
8661 if (is_a($data,
'SimplePie'))
8663 $data = $data->data;
8666 $data = serialize($data);
8668 if (function_exists(
'file_put_contents'))
8670 return (
bool) file_put_contents($this->name, $data);
8674 $fp = fopen($this->name,
'wb');
8688 if (file_exists($this->name) && is_readable($this->name))
8690 return unserialize(file_get_contents($this->name));
8697 if (file_exists($this->name))
8699 return filemtime($this->name);
8706 if (file_exists($this->name))
8708 return touch($this->name);
8715 if (file_exists($this->name))
8717 return unlink($this->name);
8727 $items = $data->get_items();
8728 $items_by_id = array();
8732 foreach ($items as $item)
8734 $items_by_id[$item->get_id()] = $item;
8737 if (count($items_by_id) !== count($items))
8739 $items_by_id = array();
8740 foreach ($items as $item)
8742 $items_by_id[$item->get_id(
true)] = $item;
8767 if ($channel !== null)
8771 unset($channel[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'entry']);
8775 unset($channel[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'entry']);
8779 unset($channel[
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'item']);
8783 unset($channel[
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'item']);
8785 if (isset($channel[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'item']))
8787 unset($channel[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'item']);
8790 if (isset($data->data[
'items']))
8792 unset($data->data[
'items']);
8794 if (isset($data->data[
'ordered_items']))
8796 unset($data->data[
'ordered_items']);
8799 return array(serialize($data->data), $items_by_id);
8811 $host = $mysql_location->get_host();
8814 $server =
':' . substr($host, 5, -1);
8819 if ($mysql_location->get_port() !== null)
8821 $server .=
':' . $mysql_location->get_port();
8825 if (strpos($mysql_location->get_userinfo(),
':') !==
false)
8827 list($username, $password) = explode(
':', $mysql_location->get_userinfo(), 2);
8831 $username = $mysql_location->get_userinfo();
8835 if ($this->mysql = mysql_connect($server, $username, $password))
8837 $this->
id = $name . $extension;
8839 if (!isset($this->options[
'prefix'][0]))
8841 $this->options[
'prefix'][0] =
'';
8844 if (mysql_select_db(ltrim($mysql_location->get_path(),
'/'))
8845 && mysql_query(
'SET NAMES utf8')
8846 && ($query = mysql_unbuffered_query(
'SHOW TABLES')))
8849 while ($row = mysql_fetch_row($query))
8854 if (!in_array($this->options[
'prefix'][0] .
'cache_data', $db))
8856 if (!mysql_query(
'CREATE TABLE `' . $this->options[
'prefix'][0] .
'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'))
8858 $this->mysql = null;
8862 if (!in_array($this->options[
'prefix'][0] .
'items', $db))
8864 if (!mysql_query(
'CREATE TABLE `' . $this->options[
'prefix'][0] .
'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'))
8866 $this->mysql = null;
8872 $this->mysql = null;
8881 $feed_id =
"'" . mysql_real_escape_string($this->
id) .
"'";
8883 if (is_a($data,
'SimplePie'))
8888 $data = clone($data);
8893 if ($query = mysql_query(
'SELECT `id` FROM `' . $this->options[
'prefix'][0] .
'cache_data` WHERE `id` = ' . $feed_id, $this->mysql))
8895 if (mysql_num_rows($query))
8897 $items = count($prepared[1]);
8900 $sql =
'UPDATE `' . $this->options[
'prefix'][0] .
'cache_data` SET `items` = ' . $items .
', `data` = \'' . mysql_real_escape_string($prepared[0]) .
'\', `
mtime` =
' . time() . ' WHERE `
id` =
' . $feed_id;
8904 $sql = 'UPDATE `
' . $this->options['prefix
'][0] . 'cache_data` SET `data` = \
'' . mysql_real_escape_string($prepared[0]) .
'\', `
mtime` =
' . time() . ' WHERE `
id` =
' . $feed_id;
8907 if (!mysql_query($sql, $this->mysql))
8912 elseif (!mysql_query('INSERT INTO `
' . $this->options['prefix
'][0] . 'cache_data` (`
id`, `items`, `data`, `
mtime`) VALUES(
' . $feed_id . ',
' . count($prepared[1]) . ', \
'' . mysql_real_escape_string($prepared[0]) .
'\',
' . time() . ')
', $this->mysql))
8917 $ids = array_keys($prepared[1]);
8920 foreach ($ids as $id)
8922 $database_ids[] = mysql_real_escape_string($id);
8925 if ($query = mysql_unbuffered_query('SELECT `
id` FROM `
' . $this->options['prefix
'][0] . 'items` WHERE `
id` = \
'' . implode(
'\' OR `
id` = \
'', $database_ids) .
'\' AND `feed_id` =
' . $feed_id, $this->mysql))
8927 $existing_ids = array();
8928 while ($row = mysql_fetch_row($query))
8930 $existing_ids[] = $row[0];
8933 $new_ids = array_diff($ids, $existing_ids);
8935 foreach ($new_ids as $new_id)
8937 if (!($date = $prepared[1][$new_id]->get_date('U
')))
8942 if (!mysql_query('INSERT INTO `
' . $this->options['prefix
'][0] . 'items` (`feed_id`, `
id`, `data`, `posted`) VALUES(
' . $feed_id . ', \
'' . mysql_real_escape_string($new_id) .
'\', \
'' . mysql_real_escape_string(serialize($prepared[1][$new_id]->data)) .
'\',
' . $date . ')
', $this->mysql))
8956 elseif ($query = mysql_query('SELECT `
id` FROM `
' . $this->options['prefix
'][0] . 'cache_data` WHERE `
id` =
' . $feed_id, $this->mysql))
8958 if (mysql_num_rows($query))
8960 if (mysql_query('UPDATE `
' . $this->options['prefix
'][0] . 'cache_data` SET `items` = 0, `data` = \
'' . mysql_real_escape_string(serialize($data)) .
'\', `
mtime` =
' . time() . ' WHERE `
id` =
' . $feed_id, $this->mysql))
8965 elseif (mysql_query('INSERT INTO `
' . $this->options['prefix
'][0] . 'cache_data` (`
id`, `items`, `data`, `
mtime`) VALUES(\
'' . mysql_real_escape_string($this->
id) .
'\', 0, \
'' . mysql_real_escape_string(serialize($data)) .
'\',
' . time() . ')
', $this->mysql))
8976 if ($this->mysql && ($query = mysql_query('SELECT `items`, `data` FROM `
' . $this->options['prefix
'][0] . 'cache_data` WHERE `
id` = \
'' . mysql_real_escape_string($this->
id) .
"'",
$this->mysql)) && ($row = mysql_fetch_row($query)))
8978 $data = unserialize($row[1]);
8980 if (isset($this->options[
'items'][0]))
8982 $items = (int) $this->options[
'items'][0];
8986 $items = (int) $row[0];
9014 $sql =
'SELECT `data` FROM `' . $this->options[
'prefix'][0] .
'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->
id) .
'\' ORDER BY `posted` DESC
';
9017 $sql .= ' LIMIT
' . $items;
9020 if ($query = mysql_unbuffered_query($sql, $this->mysql))
9022 while ($row = mysql_fetch_row($query))
9024 $feed['child
'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry
'][] = unserialize($row[0]);
9040 if ($this->mysql && ($query = mysql_query('SELECT `
mtime` FROM `
' . $this->options['prefix
'][0] . 'cache_data` WHERE `
id` = \
'' . mysql_real_escape_string($this->
id) .
"'",
$this->mysql)) && ($row = mysql_fetch_row($query)))
9052 if ($this->mysql && ($query = mysql_query(
'UPDATE `' . $this->options[
'prefix'][0] .
'cache_data` SET `mtime` = ' . time() .
' WHERE `id` = \'' . mysql_real_escape_string($this->
id) .
"'", $this->mysql)) && mysql_affected_rows($this->mysql))
9064 if ($this->mysql && ($query = mysql_query(
'DELETE FROM `' . $this->options[
'prefix'][0] .
'cache_data` WHERE `id` = \'' . mysql_real_escape_string($this->
id) .
"'", $this->mysql)) && ($query2 = mysql_query(
'DELETE FROM `' . $this->options[
'prefix'][0] .
'items` WHERE `feed_id` = \'' . mysql_real_escape_string($this->
id) .
"'", $this->mysql)))
9077 function time_hms($seconds)
9081 $hours = floor($seconds / 3600);
9082 $remainder = $seconds % 3600;
9085 $time .= $hours.
':';
9088 $minutes = floor($remainder / 60);
9089 $seconds = $remainder % 60;
9090 if ($minutes < 10 && $hours > 0)
9092 $minutes =
'0' . $minutes;
9096 $seconds =
'0' . $seconds;
9099 $time .= $minutes.
':';
9105 function absolutize_url($relative, $base)
9108 return $iri->get_iri();
9111 function remove_dot_segments($input)
9114 while (strpos($input,
'./') !==
false || strpos($input,
'/.') !==
false || $input ===
'.' || $input ===
'..')
9117 if (strpos($input,
'../') === 0)
9119 $input = substr($input, 3);
9121 elseif (strpos($input,
'./') === 0)
9123 $input = substr($input, 2);
9126 elseif (strpos($input,
'/./') === 0)
9128 $input = substr_replace($input,
'/', 0, 3);
9130 elseif ($input ===
'/.')
9135 elseif (strpos($input,
'/../') === 0)
9137 $input = substr_replace($input,
'/', 0, 4);
9138 $output = substr_replace($output,
'', strrpos($output,
'/'));
9140 elseif ($input ===
'/..')
9143 $output = substr_replace($output,
'', strrpos($output,
'/'));
9146 elseif ($input ===
'.' || $input ===
'..')
9151 elseif (($pos = strpos($input,
'/', 1)) !==
false)
9153 $output .= substr($input, 0, $pos);
9154 $input = substr_replace($input,
'', 0, $pos);
9162 return $output . $input;
9165 function get_element($realname, $string)
9168 $name = preg_quote($realname,
'/');
9169 if (preg_match_all(
"/<($name)" .
SIMPLEPIE_PCRE_HTML_ATTRIBUTE .
"(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
9171 for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
9173 $return[$i][
'tag'] = $realname;
9174 $return[$i][
'full'] = $matches[$i][0][0];
9175 $return[$i][
'offset'] = $matches[$i][0][1];
9176 if (strlen($matches[$i][3][0]) <= 2)
9178 $return[$i][
'self_closing'] =
true;
9182 $return[$i][
'self_closing'] =
false;
9183 $return[$i][
'content'] = $matches[$i][4][0];
9185 $return[$i][
'attribs'] = array();
9186 if (isset($matches[$i][2][0]) && preg_match_all(
'/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/',
' ' . $matches[$i][2][0] .
' ', $attribs, PREG_SET_ORDER))
9188 for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
9190 if (count($attribs[$j]) === 2)
9192 $attribs[$j][2] = $attribs[$j][1];
9202 function element_implode($element)
9204 $full =
"<$element[tag]";
9205 foreach ($element[
'attribs'] as $key => $value)
9207 $key = strtolower($key);
9208 $full .=
" $key=\"" . htmlspecialchars($value[
'data']) .
'"';
9210 if ($element[
'self_closing'])
9216 $full .=
">$element[content]</$element[tag]>";
9221 function error($message, $level, $file, $line)
9223 if ((ini_get(
'error_reporting') & $level) > 0)
9228 $note =
'PHP Error';
9230 case E_USER_WARNING:
9231 $note =
'PHP Warning';
9234 $note =
'PHP Notice';
9237 $note =
'Unknown Error';
9240 error_log(
"$note: $message in $file on line $line", 0);
9267 function display_cached_file($identifier_url, $cache_location =
'./cache', $cache_extension =
'spc', $cache_class =
'SimplePie_Cache', $cache_name_function =
'md5')
9269 $cache = call_user_func(array($cache_class,
'create'), $cache_location, $identifier_url, $cache_extension);
9271 if ($file = $cache->load())
9273 if (isset($file[
'headers'][
'content-type']))
9275 header(
'Content-type:' . $file[
'headers'][
'content-type']);
9279 header(
'Content-type: application/octet-stream');
9281 header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', time() + 604800) .
' GMT');
9286 die(
'Cached file for ' . $identifier_url .
' cannot be found.');
9289 function fix_protocol($url, $http = 1)
9293 if ($parsed[
'scheme'] !==
'' && $parsed[
'scheme'] !==
'http' && $parsed[
'scheme'] !==
'https')
9298 if ($parsed[
'scheme'] ===
'' && $parsed[
'authority'] ===
'' && !file_exists($url))
9303 if ($http === 2 && $parsed[
'scheme'] !==
'')
9307 elseif ($http === 3 && strtolower($parsed[
'scheme']) ===
'http')
9309 return substr_replace($url,
'podcast', 0, 4);
9311 elseif ($http === 4 && strtolower($parsed[
'scheme']) ===
'http')
9313 return substr_replace($url,
'itpc', 0, 4);
9321 function parse_url($url)
9325 'scheme' => (
string) $iri->get_scheme(),
9326 'authority' => (string) $iri->get_authority(),
9327 'path' => (string) $iri->get_path(),
9328 'query' => (string) $iri->get_query(),
9329 'fragment' => (string) $iri->get_fragment()
9333 function compress_parse_url($scheme =
'', $authority =
'', $path =
'', $query =
'', $fragment =
'')
9336 $iri->set_scheme($scheme);
9337 $iri->set_authority($authority);
9338 $iri->set_path($path);
9339 $iri->set_query($query);
9340 $iri->set_fragment($fragment);
9341 return $iri->get_iri();
9344 function normalize_url($url)
9347 return $iri->get_iri();
9350 function percent_encoding_normalization($match)
9352 $integer = hexdec($match[1]);
9353 if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
9355 return chr($integer);
9359 return strtoupper($match[0]);
9376 if (function_exists(
'iconv') && ($return = @iconv(
'UTF-8',
'UTF-8//IGNORE', $str)))
9380 elseif (function_exists(
'mb_convert_encoding') && ($return = @mb_convert_encoding($str,
'UTF-8',
'UTF-8')))
9384 elseif (preg_match_all(
'/(?:[\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})+/', $str, $matches))
9386 return implode(
"\xEF\xBF\xBD", $matches[0]);
9388 elseif ($str !==
'')
9390 return "\xEF\xBF\xBD";
9406 function windows_1252_to_utf8($string)
9408 static $convert_table = array(
"\x80" =>
"\xE2\x82\xAC",
"\x81" =>
"\xEF\xBF\xBD",
"\x82" =>
"\xE2\x80\x9A",
"\x83" =>
"\xC6\x92",
"\x84" =>
"\xE2\x80\x9E",
"\x85" =>
"\xE2\x80\xA6",
"\x86" =>
"\xE2\x80\xA0",
"\x87" =>
"\xE2\x80\xA1",
"\x88" =>
"\xCB\x86",
"\x89" =>
"\xE2\x80\xB0",
"\x8A" =>
"\xC5\xA0",
"\x8B" =>
"\xE2\x80\xB9",
"\x8C" =>
"\xC5\x92",
"\x8D" =>
"\xEF\xBF\xBD",
"\x8E" =>
"\xC5\xBD",
"\x8F" =>
"\xEF\xBF\xBD",
"\x90" =>
"\xEF\xBF\xBD",
"\x91" =>
"\xE2\x80\x98",
"\x92" =>
"\xE2\x80\x99",
"\x93" =>
"\xE2\x80\x9C",
"\x94" =>
"\xE2\x80\x9D",
"\x95" =>
"\xE2\x80\xA2",
"\x96" =>
"\xE2\x80\x93",
"\x97" =>
"\xE2\x80\x94",
"\x98" =>
"\xCB\x9C",
"\x99" =>
"\xE2\x84\xA2",
"\x9A" =>
"\xC5\xA1",
"\x9B" =>
"\xE2\x80\xBA",
"\x9C" =>
"\xC5\x93",
"\x9D" =>
"\xEF\xBF\xBD",
"\x9E" =>
"\xC5\xBE",
"\x9F" =>
"\xC5\xB8",
"\xA0" =>
"\xC2\xA0",
"\xA1" =>
"\xC2\xA1",
"\xA2" =>
"\xC2\xA2",
"\xA3" =>
"\xC2\xA3",
"\xA4" =>
"\xC2\xA4",
"\xA5" =>
"\xC2\xA5",
"\xA6" =>
"\xC2\xA6",
"\xA7" =>
"\xC2\xA7",
"\xA8" =>
"\xC2\xA8",
"\xA9" =>
"\xC2\xA9",
"\xAA" =>
"\xC2\xAA",
"\xAB" =>
"\xC2\xAB",
"\xAC" =>
"\xC2\xAC",
"\xAD" =>
"\xC2\xAD",
"\xAE" =>
"\xC2\xAE",
"\xAF" =>
"\xC2\xAF",
"\xB0" =>
"\xC2\xB0",
"\xB1" =>
"\xC2\xB1",
"\xB2" =>
"\xC2\xB2",
"\xB3" =>
"\xC2\xB3",
"\xB4" =>
"\xC2\xB4",
"\xB5" =>
"\xC2\xB5",
"\xB6" =>
"\xC2\xB6",
"\xB7" =>
"\xC2\xB7",
"\xB8" =>
"\xC2\xB8",
"\xB9" =>
"\xC2\xB9",
"\xBA" =>
"\xC2\xBA",
"\xBB" =>
"\xC2\xBB",
"\xBC" =>
"\xC2\xBC",
"\xBD" =>
"\xC2\xBD",
"\xBE" =>
"\xC2\xBE",
"\xBF" =>
"\xC2\xBF",
"\xC0" =>
"\xC3\x80",
"\xC1" =>
"\xC3\x81",
"\xC2" =>
"\xC3\x82",
"\xC3" =>
"\xC3\x83",
"\xC4" =>
"\xC3\x84",
"\xC5" =>
"\xC3\x85",
"\xC6" =>
"\xC3\x86",
"\xC7" =>
"\xC3\x87",
"\xC8" =>
"\xC3\x88",
"\xC9" =>
"\xC3\x89",
"\xCA" =>
"\xC3\x8A",
"\xCB" =>
"\xC3\x8B",
"\xCC" =>
"\xC3\x8C",
"\xCD" =>
"\xC3\x8D",
"\xCE" =>
"\xC3\x8E",
"\xCF" =>
"\xC3\x8F",
"\xD0" =>
"\xC3\x90",
"\xD1" =>
"\xC3\x91",
"\xD2" =>
"\xC3\x92",
"\xD3" =>
"\xC3\x93",
"\xD4" =>
"\xC3\x94",
"\xD5" =>
"\xC3\x95",
"\xD6" =>
"\xC3\x96",
"\xD7" =>
"\xC3\x97",
"\xD8" =>
"\xC3\x98",
"\xD9" =>
"\xC3\x99",
"\xDA" =>
"\xC3\x9A",
"\xDB" =>
"\xC3\x9B",
"\xDC" =>
"\xC3\x9C",
"\xDD" =>
"\xC3\x9D",
"\xDE" =>
"\xC3\x9E",
"\xDF" =>
"\xC3\x9F",
"\xE0" =>
"\xC3\xA0",
"\xE1" =>
"\xC3\xA1",
"\xE2" =>
"\xC3\xA2",
"\xE3" =>
"\xC3\xA3",
"\xE4" =>
"\xC3\xA4",
"\xE5" =>
"\xC3\xA5",
"\xE6" =>
"\xC3\xA6",
"\xE7" =>
"\xC3\xA7",
"\xE8" =>
"\xC3\xA8",
"\xE9" =>
"\xC3\xA9",
"\xEA" =>
"\xC3\xAA",
"\xEB" =>
"\xC3\xAB",
"\xEC" =>
"\xC3\xAC",
"\xED" =>
"\xC3\xAD",
"\xEE" =>
"\xC3\xAE",
"\xEF" =>
"\xC3\xAF",
"\xF0" =>
"\xC3\xB0",
"\xF1" =>
"\xC3\xB1",
"\xF2" =>
"\xC3\xB2",
"\xF3" =>
"\xC3\xB3",
"\xF4" =>
"\xC3\xB4",
"\xF5" =>
"\xC3\xB5",
"\xF6" =>
"\xC3\xB6",
"\xF7" =>
"\xC3\xB7",
"\xF8" =>
"\xC3\xB8",
"\xF9" =>
"\xC3\xB9",
"\xFA" =>
"\xC3\xBA",
"\xFB" =>
"\xC3\xBB",
"\xFC" =>
"\xC3\xBC",
"\xFD" =>
"\xC3\xBD",
"\xFE" =>
"\xC3\xBE",
"\xFF" =>
"\xC3\xBF");
9410 return strtr($string, $convert_table);
9413 function change_encoding($data, $input, $output)
9419 if ($input ===
'US-ASCII')
9421 static $non_ascii_octects =
'';
9422 if (!$non_ascii_octects)
9424 for ($i = 0x80; $i <= 0xFF; $i++)
9426 $non_ascii_octects .= chr($i);
9429 $data = substr($data, 0, strcspn($data, $non_ascii_octects));
9433 if ($input ===
'Windows-1252' && $output ===
'UTF-8')
9438 elseif (function_exists(
'mb_convert_encoding') && @mb_convert_encoding(
"\x80",
'UTF-16BE', $input) !==
"\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
9443 elseif (function_exists(
'iconv') && ($return = @iconv($input, $output, $data)))
9454 function encoding($charset)
9457 switch (strtolower(preg_replace(
'/(?:[^a-zA-Z0-9]+|([^0-9])0+)/',
'\1', $charset)))
9459 case 'adobestandardencoding':
9460 case 'csadobestandardencoding':
9461 return 'Adobe-Standard-Encoding';
9463 case 'adobesymbolencoding':
9465 return 'Adobe-Symbol-Encoding';
9469 return 'Amiga-1251';
9471 case 'ansix31101983':
9473 case 'csiso99naplps':
9476 return 'ANSI_X3.110-1983';
9480 case 'csiso89asmo449':
9491 return 'Big5-HKSCS';
9502 case 'csiso4unitedkingdom':
9510 case 'csiso47bsviewdata':
9512 return 'BS_viewdata';
9520 case 'csaz243419851':
9521 case 'csiso121canadian1':
9524 return 'CSA_Z243.4-1985-1';
9527 case 'csaz243419852':
9528 case 'csiso122canadian2':
9531 return 'CSA_Z243.4-1985-2';
9533 case 'csaz24341985gr':
9534 case 'csiso123csaz24341985gr':
9536 return 'CSA_Z243.4-1985-gr';
9538 case 'csiso139csn369103':
9541 return 'CSN_369103';
9548 case 'csiso21german':
9559 case 'csiso646danish':
9565 case 'csibmebcdicatde':
9567 return 'EBCDIC-AT-DE';
9569 case 'csebcdicatdea':
9571 return 'EBCDIC-AT-DE-A';
9573 case 'csebcdiccafr':
9575 return 'EBCDIC-CA-FR';
9577 case 'csebcdicdkno':
9579 return 'EBCDIC-DK-NO';
9581 case 'csebcdicdknoa':
9583 return 'EBCDIC-DK-NO-A';
9591 return 'EBCDIC-ES-A';
9595 return 'EBCDIC-ES-S';
9597 case 'csebcdicfise':
9599 return 'EBCDIC-FI-SE';
9601 case 'csebcdicfisea':
9603 return 'EBCDIC-FI-SE-A';
9625 case 'csiso111ecmacyrillic':
9626 case 'ecmacyrillic':
9629 return 'ECMA-cyrillic';
9631 case 'csiso17spanish':
9637 case 'csiso85spanish2':
9643 case 'cseucfixwidjapanese':
9644 case 'extendedunixcodefixedwidthforjapanese':
9645 return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
9647 case 'cseucpkdfmtjapanese':
9649 case 'extendedunixcodepackedformatforjapanese':
9650 return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
9658 case 'csiso58gb231280':
9668 case 'csiso57gb1988':
9672 return 'GB_1988-80';
9674 case 'csiso153gost1976874':
9678 return 'GOST_19768-74';
9681 case 'csiso150greekccitt':
9684 return 'greek-ccitt';
9686 case 'csiso88greek7':
9691 case 'csiso18greek7old':
9694 return 'greek7-old';
9698 return 'HP-DeskTop';
9710 return 'HP-Pi-font';
9719 return 'HZ-GB-2312';
9721 case 'csibmsymbols':
9723 return 'IBM-Symbols';
9732 case 'pcmultilingual850euro':
9737 case 'ebcdiclatin9euro':
9743 case 'ebcdicus37euro':
9749 case 'ebcdicde273euro':
9755 case 'ebcdicdk277euro':
9756 case 'ebcdicno277euro':
9762 case 'ebcdicfi278euro':
9763 case 'ebcdicse278euro':
9769 case 'ebcdicit280euro':
9775 case 'ebcdices284euro':
9781 case 'ebcdicgb285euro':
9787 case 'ebcdicfr297euro':
9793 case 'ebcdicinternational500euro':
9799 case 'ebcdicis871euro':
9874 case 'ebcdicjpkana':
9904 case 'cspc8codepage437':
9916 case 'cspc775baltic':
9922 case 'cspc850multilingual':
9965 case 'cspc862latinhebrew':
10007 case 'ebcdiccproece':
10020 case 'ebcdiccyrillic':
10048 case 'ebcdiccpar2':
10060 case 'csiso143iecp271':
10063 return 'IEC_P27-1';
10065 case 'csiso49inis':
10070 case 'csiso50inis8':
10075 case 'csiso51iniscyrillic':
10076 case 'iniscyrillic':
10078 return 'INIS-cyrillic';
10080 case 'csinvariant':
10082 return 'INVARIANT';
10085 return 'ISO-2022-CN';
10087 case 'iso2022cnext':
10088 return 'ISO-2022-CN-EXT';
10090 case 'csiso2022jp':
10092 return 'ISO-2022-JP';
10094 case 'csiso2022jp2':
10096 return 'ISO-2022-JP-2';
10098 case 'csiso2022kr':
10100 return 'ISO-2022-KR';
10102 case 'cswindows30latin1':
10103 case 'iso88591windows30latin1':
10104 return 'ISO-8859-1-Windows-3.0-Latin-1';
10106 case 'cswindows31latin1':
10107 case 'iso88591windows31latin1':
10108 return 'ISO-8859-1-Windows-3.1-Latin-1';
10110 case 'csisolatin2':
10112 case 'iso885921987':
10116 return 'ISO-8859-2';
10118 case 'cswindows31latin2':
10119 case 'iso88592windowslatin2':
10120 return 'ISO-8859-2-Windows-Latin-2';
10122 case 'csisolatin3':
10124 case 'iso885931988':
10128 return 'ISO-8859-3';
10130 case 'csisolatin4':
10132 case 'iso885941988':
10136 return 'ISO-8859-4';
10138 case 'csisolatincyrillic':
10141 case 'iso885951988':
10143 return 'ISO-8859-5';
10147 case 'csisolatinarabic':
10150 case 'iso885961987':
10152 return 'ISO-8859-6';
10154 case 'csiso88596e':
10156 return 'ISO-8859-6-E';
10158 case 'csiso88596i':
10160 return 'ISO-8859-6-I';
10162 case 'csisolatingreek':
10168 case 'iso885971987':
10170 return 'ISO-8859-7';
10172 case 'csisolatinhebrew':
10175 case 'iso885981988':
10177 return 'ISO-8859-8';
10179 case 'csiso88598e':
10181 return 'ISO-8859-8-E';
10183 case 'csiso88598i':
10185 return 'ISO-8859-8-I';
10187 case 'cswindows31latin5':
10188 case 'iso88599windowslatin5':
10189 return 'ISO-8859-9-Windows-Latin-5';
10191 case 'csisolatin6':
10193 case 'iso8859101992':
10197 return 'ISO-8859-10';
10200 return 'ISO-8859-13';
10203 case 'iso8859141998':
10208 return 'ISO-8859-14';
10212 return 'ISO-8859-15';
10215 case 'iso8859162001':
10219 return 'ISO-8859-16';
10222 return 'ISO-10646-J-1';
10225 case 'iso10646ucs2':
10226 return 'ISO-10646-UCS-2';
10229 case 'iso10646ucs4':
10230 return 'ISO-10646-UCS-4';
10232 case 'csunicodeascii':
10233 case 'iso10646ucsbasic':
10234 return 'ISO-10646-UCS-Basic';
10236 case 'csunicodelatin1':
10238 case 'iso10646unicodelatin1':
10239 return 'ISO-10646-Unicode-Latin1';
10241 case 'csiso10646utf1':
10242 case 'iso10646utf1':
10243 return 'ISO-10646-UTF-1';
10245 case 'csiso115481':
10247 case 'isotr115481':
10248 return 'ISO-11548-1';
10252 return 'iso-ir-90';
10254 case 'csunicodeibm1261':
10255 case 'isounicodeibm1261':
10256 return 'ISO-Unicode-IBM-1261';
10258 case 'csunicodeibm1264':
10259 case 'isounicodeibm1264':
10260 return 'ISO-Unicode-IBM-1264';
10262 case 'csunicodeibm1265':
10263 case 'isounicodeibm1265':
10264 return 'ISO-Unicode-IBM-1265';
10266 case 'csunicodeibm1268':
10267 case 'isounicodeibm1268':
10268 return 'ISO-Unicode-IBM-1268';
10270 case 'csunicodeibm1276':
10271 case 'isounicodeibm1276':
10272 return 'ISO-Unicode-IBM-1276';
10274 case 'csiso646basic1983':
10275 case 'iso646basic1983':
10277 return 'ISO_646.basic:1983';
10279 case 'csiso2intlrefversion':
10281 case 'iso646irv1983':
10283 return 'ISO_646.irv:1983';
10287 case 'iso20331983':
10289 return 'ISO_2033-1983';
10291 case 'csiso5427cyrillic':
10296 case 'iso5427cyrillic1981':
10297 case 'iso54271981':
10299 return 'ISO_5427:1981';
10301 case 'csiso5428greek':
10302 case 'iso54281980':
10304 return 'ISO_5428:1980';
10306 case 'csiso6937add':
10309 return 'ISO_6937-2-25';
10311 case 'csisotextcomm':
10312 case 'iso69372add':
10314 return 'ISO_6937-2-add';
10316 case 'csiso8859supp':
10317 case 'iso8859supp':
10320 return 'ISO_8859-supp';
10322 case 'csiso10367box':
10323 case 'iso10367box':
10325 return 'ISO_10367-box';
10327 case 'csiso15italian':
10333 case 'csiso13jisc6220jp':
10335 case 'jisc62201969':
10336 case 'jisc62201969jp':
10339 return 'JIS_C6220-1969-jp';
10341 case 'csiso14jisc6220ro':
10344 case 'jisc62201969ro':
10346 return 'JIS_C6220-1969-ro';
10348 case 'csiso42jisc62261978':
10350 case 'jisc62261978':
10351 return 'JIS_C6226-1978';
10353 case 'csiso87jisx208':
10355 case 'jisc62261983':
10356 case 'jisx2081983':
10358 return 'JIS_C6226-1983';
10360 case 'csiso91jisc62291984a':
10362 case 'jisc62291984a':
10364 return 'JIS_C6229-1984-a';
10366 case 'csiso92jisc62991984b':
10367 case 'iso646jpocrb':
10369 case 'jisc62291984b':
10371 return 'JIS_C6229-1984-b';
10373 case 'csiso93jis62291984badd':
10375 case 'jisc62291984badd':
10377 return 'JIS_C6229-1984-b-add';
10379 case 'csiso94jis62291984hand':
10381 case 'jisc62291984hand':
10383 return 'JIS_C6229-1984-hand';
10385 case 'csiso95jis62291984handadd':
10387 case 'jisc62291984handadd':
10388 case 'jpocrhandadd':
10389 return 'JIS_C6229-1984-hand-add';
10391 case 'csiso96jisc62291984kana':
10393 case 'jisc62291984kana':
10394 return 'JIS_C6229-1984-kana';
10396 case 'csjisencoding':
10397 case 'jisencoding':
10398 return 'JIS_Encoding';
10400 case 'cshalfwidthkatakana':
10403 return 'JIS_X0201';
10405 case 'csiso159jisx2121990':
10407 case 'jisx2121990':
10409 return 'JIS_X0212-1990';
10411 case 'csiso141jusib1002':
10417 return 'JUS_I.B1.002';
10419 case 'csiso147macedonian':
10421 case 'jusib1003mac':
10423 return 'JUS_I.B1.003-mac';
10425 case 'csiso146serbian':
10427 case 'jusib1003serb':
10429 return 'JUS_I.B1.003-serb';
10431 case 'koi7switched':
10432 return 'KOI7-switched';
10449 case 'strk10482002':
10452 case 'csiso19latingreek':
10455 return 'latin-greek';
10457 case 'csiso27latingreek1':
10459 case 'latingreek1':
10460 return 'Latin-greek-1';
10462 case 'csiso158lap':
10466 return 'latin-lap';
10468 case 'csmacintosh':
10471 return 'macintosh';
10473 case 'csmicrosoftpublishing':
10474 case 'microsoftpublishing':
10475 return 'Microsoft-Publishing';
10485 case 'csiso86hungarian':
10490 return 'MSZ_7795.3';
10495 return 'NATS-DANO';
10497 case 'csnatsdanoadd':
10499 case 'natsdanoadd':
10500 return 'NATS-DANO-ADD';
10505 return 'NATS-SEFI';
10507 case 'csnatssefiadd':
10509 case 'natssefiadd':
10510 return 'NATS-SEFI-ADD';
10512 case 'csiso151cuba':
10517 return 'NC_NC00-10:81';
10519 case 'csiso69french':
10524 return 'NF_Z_62-010';
10526 case 'csiso25french':
10529 case 'nfz620101973':
10530 return 'NF_Z_62-010_(1973)';
10532 case 'csiso60danishnorwegian':
10533 case 'csiso60norwegian1':
10538 return 'NS_4551-1';
10540 case 'csiso61norwegian2':
10545 return 'NS_4551-2';
10547 case 'osdebcdicdf3irv':
10548 return 'OSD_EBCDIC_DF03_IRV';
10550 case 'osdebcdicdf41':
10551 return 'OSD_EBCDIC_DF04_1';
10553 case 'osdebcdicdf415':
10554 return 'OSD_EBCDIC_DF04_15';
10556 case 'cspc8danishnorwegian':
10557 case 'pc8danishnorwegian':
10558 return 'PC8-Danish-Norwegian';
10560 case 'cspc8turkish':
10562 return 'PC8-Turkish';
10564 case 'csiso16portuguese':
10570 case 'csiso84portuguese2':
10578 case 'cyrillicasian':
10586 case 'csiso10swedish':
10593 return 'SEN_850200_B';
10595 case 'csiso11swedishfornames':
10600 return 'SEN_850200_C';
10605 return 'Shift_JIS';
10607 case 'csiso102t617bit':
10610 return 'T.61-7bit';
10612 case 'csiso103t618bit':
10616 return 'T.61-8bit';
10618 case 'csiso128t101g2':
10627 case 'csunicode11':
10629 return 'UNICODE-1-1';
10631 case 'csunicode11utf7':
10632 case 'unicode11utf7':
10633 return 'UNICODE-1-1-UTF-7';
10635 case 'csunknown8bit':
10636 case 'unknown8bit':
10637 return 'UNKNOWN-8BIT';
10639 case 'ansix341968':
10640 case 'ansix341986':
10645 case 'iso646irv1991':
10680 case 'csventurainternational':
10681 case 'venturainternational':
10682 return 'Ventura-International';
10684 case 'csventuramath':
10685 case 'venturamath':
10686 return 'Ventura-Math';
10688 case 'csventuraus':
10690 return 'Ventura-US';
10692 case 'csiso70videotexsupp1':
10694 case 'videotexsuppl':
10695 return 'videotex-suppl';
10705 case 'cswindows31j':
10707 return 'Windows-31J';
10711 return 'windows-874';
10714 case 'csksc56011987':
10719 case 'ksc56011987':
10720 case 'ksc56011989':
10722 return 'windows-949';
10724 case 'windows1250':
10725 return 'windows-1250';
10727 case 'windows1251':
10728 return 'windows-1251';
10731 case 'csisolatin1':
10734 case 'iso885911987':
10738 case 'windows1252':
10739 return 'windows-1252';
10741 case 'windows1253':
10742 return 'windows-1253';
10744 case 'csisolatin5':
10746 case 'iso885991989':
10750 case 'windows1254':
10751 return 'windows-1254';
10753 case 'windows1255':
10754 return 'windows-1255';
10756 case 'windows1256':
10757 return 'windows-1256';
10759 case 'windows1257':
10760 return 'windows-1257';
10762 case 'windows1258':
10763 return 'windows-1258';
10770 function get_curl_version()
10772 if (is_array($curl = curl_version()))
10774 $curl = $curl[
'version'];
10776 elseif (substr($curl, 0, 5) ===
'curl/')
10778 $curl = substr($curl, 5, strcspn($curl,
"\x09\x0A\x0B\x0C\x0D", 5));
10780 elseif (substr($curl, 0, 8) ===
'libcurl/')
10782 $curl = substr($curl, 8, strcspn($curl,
"\x09\x0A\x0B\x0C\x0D", 8));
10791 function is_subclass_of($class1, $class2)
10793 if (func_num_args() !== 2)
10795 trigger_error(
'Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
10797 elseif (version_compare(PHP_VERSION,
'5.0.3',
'>=') || is_object($class1))
10799 return is_subclass_of($class1, $class2);
10801 elseif (is_string($class1) && is_string($class2))
10803 if (class_exists($class1))
10805 if (class_exists($class2))
10807 $class2 = strtolower($class2);
10808 while ($class1 = strtolower(get_parent_class($class1)))
10810 if ($class1 === $class2)
10819 trigger_error(
'Unknown class passed as parameter', E_USER_WARNNG);
10832 function strip_comments($data)
10835 while (($start = strpos($data,
'<!--')) !==
false)
10837 $output .= substr($data, 0, $start);
10838 if (($end = strpos($data,
'-->', $start)) !==
false)
10840 $data = substr_replace($data,
'', 0, $end + 3);
10847 return $output . $data;
10850 function parse_date($dt)
10853 return $parser->parse($dt);
10864 function entities_decode($data)
10867 return $decoder->parse();
10877 function uncomment_rfc822($string)
10879 $string = (string) $string;
10881 $length = strlen($string);
10886 while ($position < $length && ($pos = strpos($string,
'(', $position)) !==
false)
10888 $output .= substr($string, $position, $pos - $position);
10889 $position = $pos + 1;
10890 if ($string[$pos - 1] !==
'\\')
10893 while ($depth && $position < $length)
10895 $position += strcspn($string,
'()', $position);
10896 if ($string[$position - 1] ===
'\\')
10901 elseif (isset($string[$position]))
10903 switch ($string[$position])
10926 $output .= substr($string, $position);
10931 function parse_mime($mime)
10933 if (($pos = strpos($mime,
';')) ===
false)
10935 return trim($mime);
10939 return trim(substr($mime, 0, $pos));
10943 function htmlspecialchars_decode($string, $quote_style)
10945 if (function_exists(
'htmlspecialchars_decode'))
10947 return htmlspecialchars_decode($string, $quote_style);
10951 return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
10955 function atom_03_construct_type($attribs)
10957 if (isset($attribs[
''][
'mode']) && strtolower(trim($attribs[
''][
'mode']) ===
'base64'))
10965 if (isset($attribs[
''][
'type']))
10967 switch (strtolower(trim($attribs[
''][
'type'])))
10978 case 'application/xhtml+xml':
10991 function atom_10_construct_type($attribs)
10993 if (isset($attribs[
''][
'type']))
10995 switch (strtolower(trim($attribs[
''][
'type'])))
11013 function atom_10_content_construct_type($attribs)
11015 if (isset($attribs[
''][
'type']))
11017 $type = strtolower(trim($attribs[
''][
'type']));
11029 if (in_array(substr($type, -4), array(
'+xml',
'/xml')) || substr($type, 0, 5) ===
'text/')
11044 function is_isegment_nz_nc($string)
11046 return (
bool) preg_match(
'/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
11049 function space_seperated_tokens($string)
11051 $space_characters =
"\x20\x09\x0A\x0B\x0C\x0D";
11052 $string_length = strlen($string);
11054 $position = strspn($string, $space_characters);
11057 while ($position < $string_length)
11059 $len = strcspn($string, $space_characters, $position);
11060 $tokens[] = substr($string, $position, $len);
11062 $position += strspn($string, $space_characters, $position);
11068 function array_unique($array)
11070 if (version_compare(PHP_VERSION,
'5.2',
'>='))
11072 return array_unique($array);
11076 $array = (array) $array;
11077 $new_array = array();
11078 $new_array_strings = array();
11079 foreach ($array as $key => $value)
11081 if (is_object($value))
11083 if (method_exists($value,
'__toString'))
11085 $cmp = $value->__toString();
11089 trigger_error(
'Object of class ' . get_class($value) .
' could not be converted to string', E_USER_ERROR);
11092 elseif (is_array($value))
11094 $cmp = (string) reset($value);
11098 $cmp = (string) $value;
11100 if (!in_array($cmp, $new_array_strings))
11102 $new_array[$key] = $value;
11103 $new_array_strings[] = $cmp;
11118 function codepoint_to_utf8($codepoint)
11120 $codepoint = (int) $codepoint;
11121 if ($codepoint < 0)
11125 else if ($codepoint <= 0x7f)
11127 return chr($codepoint);
11129 else if ($codepoint <= 0x7ff)
11131 return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
11133 else if ($codepoint <= 0xffff)
11135 return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
11137 else if ($codepoint <= 0x10ffff)
11139 return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
11144 return "\xEF\xBF\xBD";
11165 function stripos($haystack, $needle, $offset = 0)
11167 if (function_exists(
'stripos'))
11169 return stripos($haystack, $needle, $offset);
11173 if (is_string($needle))
11175 $needle = strtolower($needle);
11177 elseif (is_int($needle) || is_bool($needle) || is_double($needle))
11179 $needle = strtolower(chr($needle));
11183 trigger_error(
'needle is not a string or an integer', E_USER_WARNING);
11187 return strpos(strtolower($haystack), $needle, $offset);
11202 function parse_str($str)
11205 $str = explode(
'&', $str);
11207 foreach ($str as $section)
11209 if (strpos($section,
'=') !==
false)
11211 list($name, $value) = explode(
'=', $section, 2);
11212 $return[urldecode($name)][] = urldecode($value);
11216 $return[urldecode($section)][] = null;
11230 function xml_encoding($data)
11233 if (substr($data, 0, 4) ===
"\x00\x00\xFE\xFF")
11235 $encoding[] =
'UTF-32BE';
11238 elseif (substr($data, 0, 4) ===
"\xFF\xFE\x00\x00")
11240 $encoding[] =
'UTF-32LE';
11243 elseif (substr($data, 0, 2) ===
"\xFE\xFF")
11245 $encoding[] =
'UTF-16BE';
11248 elseif (substr($data, 0, 2) ===
"\xFF\xFE")
11250 $encoding[] =
'UTF-16LE';
11253 elseif (substr($data, 0, 3) ===
"\xEF\xBB\xBF")
11255 $encoding[] =
'UTF-8';
11258 elseif (substr($data, 0, 20) ===
"\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
11260 if ($pos = strpos($data,
"\x00\x00\x00\x3F\x00\x00\x00\x3E"))
11263 if ($parser->parse())
11265 $encoding[] = $parser->encoding;
11268 $encoding[] =
'UTF-32BE';
11271 elseif (substr($data, 0, 20) ===
"\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
11273 if ($pos = strpos($data,
"\x3F\x00\x00\x00\x3E\x00\x00\x00"))
11276 if ($parser->parse())
11278 $encoding[] = $parser->encoding;
11281 $encoding[] =
'UTF-32LE';
11284 elseif (substr($data, 0, 10) ===
"\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
11286 if ($pos = strpos($data,
"\x00\x3F\x00\x3E"))
11289 if ($parser->parse())
11291 $encoding[] = $parser->encoding;
11294 $encoding[] =
'UTF-16BE';
11297 elseif (substr($data, 0, 10) ===
"\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
11299 if ($pos = strpos($data,
"\x3F\x00\x3E\x00"))
11302 if ($parser->parse())
11304 $encoding[] = $parser->encoding;
11307 $encoding[] =
'UTF-16LE';
11310 elseif (substr($data, 0, 5) ===
"\x3C\x3F\x78\x6D\x6C")
11312 if ($pos = strpos($data,
"\x3F\x3E"))
11315 if ($parser->parse())
11317 $encoding[] = $parser->encoding;
11320 $encoding[] =
'UTF-8';
11325 $encoding[] =
'UTF-8';
11330 function output_javascript()
11332 if (function_exists(
'ob_gzhandler'))
11334 ob_start(
'ob_gzhandler');
11336 header(
'Content-type: text/javascript; charset: UTF-8');
11337 header(
'Cache-Control: must-revalidate');
11338 header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', time() + 604800) .
' GMT');
11340 function embed_odeo(link) {
11341 document.writeln(
'<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+
'"></embed>');
11344 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
11345 if (placeholder !=
'')
11347 document.writeln(
'<embed type="'+type+
'" style="cursor:hand; cursor:pointer;" href="'+link+
'" src="'+placeholder+
'" width="'+width+
'" height="'+height+
'" autoplay="false" target="myself" controller="false" loop="'+loop+
'" scale="aspect" bgcolor="'+bgcolor+
'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
11350 document.writeln(
'<embed type="'+type+
'" style="cursor:hand; cursor:pointer;" src="'+link+
'" width="'+width+
'" height="'+height+
'" autoplay="false" target="myself" controller="true" loop="'+loop+
'" scale="aspect" bgcolor="'+bgcolor+
'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
11354 function embed_flash(bgcolor, width, height, link, loop, type) {
11355 document.writeln(
'<embed src="'+link+
'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+
'" quality="high" width="'+width+
'" height="'+height+
'" bgcolor="'+bgcolor+
'" loop="'+loop+
'"></embed>');
11358 function embed_flv(width, height, link, placeholder, loop, player) {
11359 document.writeln(
'<embed src="'+player+
'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+
'" height="'+height+
'" wmode="transparent" flashvars="file='+link+
'&autostart=false&repeat='+loop+
'&showdigits=true&showfsbutton=false"></embed>');
11362 function embed_wmedia(width, height, link) {
11363 document.writeln(
'<embed type="application/x-mplayer2" src="'+link+
'" autosize="1" width="'+width+
'" height="'+height+
'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
11392 var $consumed =
'';
11410 $this->data = $data;
11421 while (($this->position = strpos($this->data,
'&', $this->position)) !==
false)
11425 $this->consumed =
'';
11427 return $this->data;
11438 if (isset($this->data[$this->position]))
11440 $this->consumed .= $this->data[$this->position];
11441 return $this->data[$this->position++];
11456 function consume_range($chars)
11458 if ($len = strspn($this->data, $chars, $this->position))
11460 $data = substr($this->data, $this->position, $len);
11461 $this->consumed .= $data;
11462 $this->position += $len;
11476 function unconsume()
11478 $this->consumed = substr($this->consumed, 0, -1);
11489 switch ($this->consume())
11503 switch ($this->consume())
11507 $range =
'0123456789ABCDEFabcdef';
11512 $range =
'0123456789';
11514 $this->unconsume();
11518 if ($codepoint = $this->consume_range($range))
11520 static $windows_1252_specials = array(0x0D =>
"\x0A", 0x80 =>
"\xE2\x82\xAC", 0x81 =>
"\xEF\xBF\xBD", 0x82 =>
"\xE2\x80\x9A", 0x83 =>
"\xC6\x92", 0x84 =>
"\xE2\x80\x9E", 0x85 =>
"\xE2\x80\xA6", 0x86 =>
"\xE2\x80\xA0", 0x87 =>
"\xE2\x80\xA1", 0x88 =>
"\xCB\x86", 0x89 =>
"\xE2\x80\xB0", 0x8A =>
"\xC5\xA0", 0x8B =>
"\xE2\x80\xB9", 0x8C =>
"\xC5\x92", 0x8D =>
"\xEF\xBF\xBD", 0x8E =>
"\xC5\xBD", 0x8F =>
"\xEF\xBF\xBD", 0x90 =>
"\xEF\xBF\xBD", 0x91 =>
"\xE2\x80\x98", 0x92 =>
"\xE2\x80\x99", 0x93 =>
"\xE2\x80\x9C", 0x94 =>
"\xE2\x80\x9D", 0x95 =>
"\xE2\x80\xA2", 0x96 =>
"\xE2\x80\x93", 0x97 =>
"\xE2\x80\x94", 0x98 =>
"\xCB\x9C", 0x99 =>
"\xE2\x84\xA2", 0x9A =>
"\xC5\xA1", 0x9B =>
"\xE2\x80\xBA", 0x9C =>
"\xC5\x93", 0x9D =>
"\xEF\xBF\xBD", 0x9E =>
"\xC5\xBE", 0x9F =>
"\xC5\xB8");
11524 $codepoint = hexdec($codepoint);
11528 $codepoint = intval($codepoint);
11531 if (isset($windows_1252_specials[$codepoint]))
11533 $replacement = $windows_1252_specials[$codepoint];
11540 if (!in_array($this->consume(), array(
';',
false),
true))
11542 $this->unconsume();
11545 $consumed_length = strlen($this->consumed);
11546 $this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
11547 $this->position += strlen($replacement) - $consumed_length;
11552 static $entities = array(
'Aacute' =>
"\xC3\x81",
'aacute' =>
"\xC3\xA1",
'Aacute;' =>
"\xC3\x81",
'aacute;' =>
"\xC3\xA1",
'Acirc' =>
"\xC3\x82",
'acirc' =>
"\xC3\xA2",
'Acirc;' =>
"\xC3\x82",
'acirc;' =>
"\xC3\xA2",
'acute' =>
"\xC2\xB4",
'acute;' =>
"\xC2\xB4",
'AElig' =>
"\xC3\x86",
'aelig' =>
"\xC3\xA6",
'AElig;' =>
"\xC3\x86",
'aelig;' =>
"\xC3\xA6",
'Agrave' =>
"\xC3\x80",
'agrave' =>
"\xC3\xA0",
'Agrave;' =>
"\xC3\x80",
'agrave;' =>
"\xC3\xA0",
'alefsym;' =>
"\xE2\x84\xB5",
'Alpha;' =>
"\xCE\x91",
'alpha;' =>
"\xCE\xB1",
'AMP' =>
"\x26",
'amp' =>
"\x26",
'AMP;' =>
"\x26",
'amp;' =>
"\x26",
'and;' =>
"\xE2\x88\xA7",
'ang;' =>
"\xE2\x88\xA0",
'apos;' =>
"\x27",
'Aring' =>
"\xC3\x85",
'aring' =>
"\xC3\xA5",
'Aring;' =>
"\xC3\x85",
'aring;' =>
"\xC3\xA5",
'asymp;' =>
"\xE2\x89\x88",
'Atilde' =>
"\xC3\x83",
'atilde' =>
"\xC3\xA3",
'Atilde;' =>
"\xC3\x83",
'atilde;' =>
"\xC3\xA3",
'Auml' =>
"\xC3\x84",
'auml' =>
"\xC3\xA4",
'Auml;' =>
"\xC3\x84",
'auml;' =>
"\xC3\xA4",
'bdquo;' =>
"\xE2\x80\x9E",
'Beta;' =>
"\xCE\x92",
'beta;' =>
"\xCE\xB2",
'brvbar' =>
"\xC2\xA6",
'brvbar;' =>
"\xC2\xA6",
'bull;' =>
"\xE2\x80\xA2",
'cap;' =>
"\xE2\x88\xA9",
'Ccedil' =>
"\xC3\x87",
'ccedil' =>
"\xC3\xA7",
'Ccedil;' =>
"\xC3\x87",
'ccedil;' =>
"\xC3\xA7",
'cedil' =>
"\xC2\xB8",
'cedil;' =>
"\xC2\xB8",
'cent' =>
"\xC2\xA2",
'cent;' =>
"\xC2\xA2",
'Chi;' =>
"\xCE\xA7",
'chi;' =>
"\xCF\x87",
'circ;' =>
"\xCB\x86",
'clubs;' =>
"\xE2\x99\xA3",
'cong;' =>
"\xE2\x89\x85",
'COPY' =>
"\xC2\xA9",
'copy' =>
"\xC2\xA9",
'COPY;' =>
"\xC2\xA9",
'copy;' =>
"\xC2\xA9",
'crarr;' =>
"\xE2\x86\xB5",
'cup;' =>
"\xE2\x88\xAA",
'curren' =>
"\xC2\xA4",
'curren;' =>
"\xC2\xA4",
'Dagger;' =>
"\xE2\x80\xA1",
'dagger;' =>
"\xE2\x80\xA0",
'dArr;' =>
"\xE2\x87\x93",
'darr;' =>
"\xE2\x86\x93",
'deg' =>
"\xC2\xB0",
'deg;' =>
"\xC2\xB0",
'Delta;' =>
"\xCE\x94",
'delta;' =>
"\xCE\xB4",
'diams;' =>
"\xE2\x99\xA6",
'divide' =>
"\xC3\xB7",
'divide;' =>
"\xC3\xB7",
'Eacute' =>
"\xC3\x89",
'eacute' =>
"\xC3\xA9",
'Eacute;' =>
"\xC3\x89",
'eacute;' =>
"\xC3\xA9",
'Ecirc' =>
"\xC3\x8A",
'ecirc' =>
"\xC3\xAA",
'Ecirc;' =>
"\xC3\x8A",
'ecirc;' =>
"\xC3\xAA",
'Egrave' =>
"\xC3\x88",
'egrave' =>
"\xC3\xA8",
'Egrave;' =>
"\xC3\x88",
'egrave;' =>
"\xC3\xA8",
'empty;' =>
"\xE2\x88\x85",
'emsp;' =>
"\xE2\x80\x83",
'ensp;' =>
"\xE2\x80\x82",
'Epsilon;' =>
"\xCE\x95",
'epsilon;' =>
"\xCE\xB5",
'equiv;' =>
"\xE2\x89\xA1",
'Eta;' =>
"\xCE\x97",
'eta;' =>
"\xCE\xB7",
'ETH' =>
"\xC3\x90",
'eth' =>
"\xC3\xB0",
'ETH;' =>
"\xC3\x90",
'eth;' =>
"\xC3\xB0",
'Euml' =>
"\xC3\x8B",
'euml' =>
"\xC3\xAB",
'Euml;' =>
"\xC3\x8B",
'euml;' =>
"\xC3\xAB",
'euro;' =>
"\xE2\x82\xAC",
'exist;' =>
"\xE2\x88\x83",
'fnof;' =>
"\xC6\x92",
'forall;' =>
"\xE2\x88\x80",
'frac12' =>
"\xC2\xBD",
'frac12;' =>
"\xC2\xBD",
'frac14' =>
"\xC2\xBC",
'frac14;' =>
"\xC2\xBC",
'frac34' =>
"\xC2\xBE",
'frac34;' =>
"\xC2\xBE",
'frasl;' =>
"\xE2\x81\x84",
'Gamma;' =>
"\xCE\x93",
'gamma;' =>
"\xCE\xB3",
'ge;' =>
"\xE2\x89\xA5",
'GT' =>
"\x3E",
'gt' =>
"\x3E",
'GT;' =>
"\x3E",
'gt;' =>
"\x3E",
'hArr;' =>
"\xE2\x87\x94",
'harr;' =>
"\xE2\x86\x94",
'hearts;' =>
"\xE2\x99\xA5",
'hellip;' =>
"\xE2\x80\xA6",
'Iacute' =>
"\xC3\x8D",
'iacute' =>
"\xC3\xAD",
'Iacute;' =>
"\xC3\x8D",
'iacute;' =>
"\xC3\xAD",
'Icirc' =>
"\xC3\x8E",
'icirc' =>
"\xC3\xAE",
'Icirc;' =>
"\xC3\x8E",
'icirc;' =>
"\xC3\xAE",
'iexcl' =>
"\xC2\xA1",
'iexcl;' =>
"\xC2\xA1",
'Igrave' =>
"\xC3\x8C",
'igrave' =>
"\xC3\xAC",
'Igrave;' =>
"\xC3\x8C",
'igrave;' =>
"\xC3\xAC",
'image;' =>
"\xE2\x84\x91",
'infin;' =>
"\xE2\x88\x9E",
'int;' =>
"\xE2\x88\xAB",
'Iota;' =>
"\xCE\x99",
'iota;' =>
"\xCE\xB9",
'iquest' =>
"\xC2\xBF",
'iquest;' =>
"\xC2\xBF",
'isin;' =>
"\xE2\x88\x88",
'Iuml' =>
"\xC3\x8F",
'iuml' =>
"\xC3\xAF",
'Iuml;' =>
"\xC3\x8F",
'iuml;' =>
"\xC3\xAF",
'Kappa;' =>
"\xCE\x9A",
'kappa;' =>
"\xCE\xBA",
'Lambda;' =>
"\xCE\x9B",
'lambda;' =>
"\xCE\xBB",
'lang;' =>
"\xE3\x80\x88",
'laquo' =>
"\xC2\xAB",
'laquo;' =>
"\xC2\xAB",
'lArr;' =>
"\xE2\x87\x90",
'larr;' =>
"\xE2\x86\x90",
'lceil;' =>
"\xE2\x8C\x88",
'ldquo;' =>
"\xE2\x80\x9C",
'le;' =>
"\xE2\x89\xA4",
'lfloor;' =>
"\xE2\x8C\x8A",
'lowast;' =>
"\xE2\x88\x97",
'loz;' =>
"\xE2\x97\x8A",
'lrm;' =>
"\xE2\x80\x8E",
'lsaquo;' =>
"\xE2\x80\xB9",
'lsquo;' =>
"\xE2\x80\x98",
'LT' =>
"\x3C",
'lt' =>
"\x3C",
'LT;' =>
"\x3C",
'lt;' =>
"\x3C",
'macr' =>
"\xC2\xAF",
'macr;' =>
"\xC2\xAF",
'mdash;' =>
"\xE2\x80\x94",
'micro' =>
"\xC2\xB5",
'micro;' =>
"\xC2\xB5",
'middot' =>
"\xC2\xB7",
'middot;' =>
"\xC2\xB7",
'minus;' =>
"\xE2\x88\x92",
'Mu;' =>
"\xCE\x9C",
'mu;' =>
"\xCE\xBC",
'nabla;' =>
"\xE2\x88\x87",
'nbsp' =>
"\xC2\xA0",
'nbsp;' =>
"\xC2\xA0",
'ndash;' =>
"\xE2\x80\x93",
'ne;' =>
"\xE2\x89\xA0",
'ni;' =>
"\xE2\x88\x8B",
'not' =>
"\xC2\xAC",
'not;' =>
"\xC2\xAC",
'notin;' =>
"\xE2\x88\x89",
'nsub;' =>
"\xE2\x8A\x84",
'Ntilde' =>
"\xC3\x91",
'ntilde' =>
"\xC3\xB1",
'Ntilde;' =>
"\xC3\x91",
'ntilde;' =>
"\xC3\xB1",
'Nu;' =>
"\xCE\x9D",
'nu;' =>
"\xCE\xBD",
'Oacute' =>
"\xC3\x93",
'oacute' =>
"\xC3\xB3",
'Oacute;' =>
"\xC3\x93",
'oacute;' =>
"\xC3\xB3",
'Ocirc' =>
"\xC3\x94",
'ocirc' =>
"\xC3\xB4",
'Ocirc;' =>
"\xC3\x94",
'ocirc;' =>
"\xC3\xB4",
'OElig;' =>
"\xC5\x92",
'oelig;' =>
"\xC5\x93",
'Ograve' =>
"\xC3\x92",
'ograve' =>
"\xC3\xB2",
'Ograve;' =>
"\xC3\x92",
'ograve;' =>
"\xC3\xB2",
'oline;' =>
"\xE2\x80\xBE",
'Omega;' =>
"\xCE\xA9",
'omega;' =>
"\xCF\x89",
'Omicron;' =>
"\xCE\x9F",
'omicron;' =>
"\xCE\xBF",
'oplus;' =>
"\xE2\x8A\x95",
'or;' =>
"\xE2\x88\xA8",
'ordf' =>
"\xC2\xAA",
'ordf;' =>
"\xC2\xAA",
'ordm' =>
"\xC2\xBA",
'ordm;' =>
"\xC2\xBA",
'Oslash' =>
"\xC3\x98",
'oslash' =>
"\xC3\xB8",
'Oslash;' =>
"\xC3\x98",
'oslash;' =>
"\xC3\xB8",
'Otilde' =>
"\xC3\x95",
'otilde' =>
"\xC3\xB5",
'Otilde;' =>
"\xC3\x95",
'otilde;' =>
"\xC3\xB5",
'otimes;' =>
"\xE2\x8A\x97",
'Ouml' =>
"\xC3\x96",
'ouml' =>
"\xC3\xB6",
'Ouml;' =>
"\xC3\x96",
'ouml;' =>
"\xC3\xB6",
'para' =>
"\xC2\xB6",
'para;' =>
"\xC2\xB6",
'part;' =>
"\xE2\x88\x82",
'permil;' =>
"\xE2\x80\xB0",
'perp;' =>
"\xE2\x8A\xA5",
'Phi;' =>
"\xCE\xA6",
'phi;' =>
"\xCF\x86",
'Pi;' =>
"\xCE\xA0",
'pi;' =>
"\xCF\x80",
'piv;' =>
"\xCF\x96",
'plusmn' =>
"\xC2\xB1",
'plusmn;' =>
"\xC2\xB1",
'pound' =>
"\xC2\xA3",
'pound;' =>
"\xC2\xA3",
'Prime;' =>
"\xE2\x80\xB3",
'prime;' =>
"\xE2\x80\xB2",
'prod;' =>
"\xE2\x88\x8F",
'prop;' =>
"\xE2\x88\x9D",
'Psi;' =>
"\xCE\xA8",
'psi;' =>
"\xCF\x88",
'QUOT' =>
"\x22",
'quot' =>
"\x22",
'QUOT;' =>
"\x22",
'quot;' =>
"\x22",
'radic;' =>
"\xE2\x88\x9A",
'rang;' =>
"\xE3\x80\x89",
'raquo' =>
"\xC2\xBB",
'raquo;' =>
"\xC2\xBB",
'rArr;' =>
"\xE2\x87\x92",
'rarr;' =>
"\xE2\x86\x92",
'rceil;' =>
"\xE2\x8C\x89",
'rdquo;' =>
"\xE2\x80\x9D",
'real;' =>
"\xE2\x84\x9C",
'REG' =>
"\xC2\xAE",
'reg' =>
"\xC2\xAE",
'REG;' =>
"\xC2\xAE",
'reg;' =>
"\xC2\xAE",
'rfloor;' =>
"\xE2\x8C\x8B",
'Rho;' =>
"\xCE\xA1",
'rho;' =>
"\xCF\x81",
'rlm;' =>
"\xE2\x80\x8F",
'rsaquo;' =>
"\xE2\x80\xBA",
'rsquo;' =>
"\xE2\x80\x99",
'sbquo;' =>
"\xE2\x80\x9A",
'Scaron;' =>
"\xC5\xA0",
'scaron;' =>
"\xC5\xA1",
'sdot;' =>
"\xE2\x8B\x85",
'sect' =>
"\xC2\xA7",
'sect;' =>
"\xC2\xA7",
'shy' =>
"\xC2\xAD",
'shy;' =>
"\xC2\xAD",
'Sigma;' =>
"\xCE\xA3",
'sigma;' =>
"\xCF\x83",
'sigmaf;' =>
"\xCF\x82",
'sim;' =>
"\xE2\x88\xBC",
'spades;' =>
"\xE2\x99\xA0",
'sub;' =>
"\xE2\x8A\x82",
'sube;' =>
"\xE2\x8A\x86",
'sum;' =>
"\xE2\x88\x91",
'sup;' =>
"\xE2\x8A\x83",
'sup1' =>
"\xC2\xB9",
'sup1;' =>
"\xC2\xB9",
'sup2' =>
"\xC2\xB2",
'sup2;' =>
"\xC2\xB2",
'sup3' =>
"\xC2\xB3",
'sup3;' =>
"\xC2\xB3",
'supe;' =>
"\xE2\x8A\x87",
'szlig' =>
"\xC3\x9F",
'szlig;' =>
"\xC3\x9F",
'Tau;' =>
"\xCE\xA4",
'tau;' =>
"\xCF\x84",
'there4;' =>
"\xE2\x88\xB4",
'Theta;' =>
"\xCE\x98",
'theta;' =>
"\xCE\xB8",
'thetasym;' =>
"\xCF\x91",
'thinsp;' =>
"\xE2\x80\x89",
'THORN' =>
"\xC3\x9E",
'thorn' =>
"\xC3\xBE",
'THORN;' =>
"\xC3\x9E",
'thorn;' =>
"\xC3\xBE",
'tilde;' =>
"\xCB\x9C",
'times' =>
"\xC3\x97",
'times;' =>
"\xC3\x97",
'TRADE;' =>
"\xE2\x84\xA2",
'trade;' =>
"\xE2\x84\xA2",
'Uacute' =>
"\xC3\x9A",
'uacute' =>
"\xC3\xBA",
'Uacute;' =>
"\xC3\x9A",
'uacute;' =>
"\xC3\xBA",
'uArr;' =>
"\xE2\x87\x91",
'uarr;' =>
"\xE2\x86\x91",
'Ucirc' =>
"\xC3\x9B",
'ucirc' =>
"\xC3\xBB",
'Ucirc;' =>
"\xC3\x9B",
'ucirc;' =>
"\xC3\xBB",
'Ugrave' =>
"\xC3\x99",
'ugrave' =>
"\xC3\xB9",
'Ugrave;' =>
"\xC3\x99",
'ugrave;' =>
"\xC3\xB9",
'uml' =>
"\xC2\xA8",
'uml;' =>
"\xC2\xA8",
'upsih;' =>
"\xCF\x92",
'Upsilon;' =>
"\xCE\xA5",
'upsilon;' =>
"\xCF\x85",
'Uuml' =>
"\xC3\x9C",
'uuml' =>
"\xC3\xBC",
'Uuml;' =>
"\xC3\x9C",
'uuml;' =>
"\xC3\xBC",
'weierp;' =>
"\xE2\x84\x98",
'Xi;' =>
"\xCE\x9E",
'xi;' =>
"\xCE\xBE",
'Yacute' =>
"\xC3\x9D",
'yacute' =>
"\xC3\xBD",
'Yacute;' =>
"\xC3\x9D",
'yacute;' =>
"\xC3\xBD",
'yen' =>
"\xC2\xA5",
'yen;' =>
"\xC2\xA5",
'yuml' =>
"\xC3\xBF",
'Yuml;' =>
"\xC5\xB8",
'yuml;' =>
"\xC3\xBF",
'Zeta;' =>
"\xCE\x96",
'zeta;' =>
"\xCE\xB6",
'zwj;' =>
"\xE2\x80\x8D",
'zwnj;' =>
"\xE2\x80\x8C");
11554 for ($i = 0, $match = null; $i < 9 && $this->consume() !==
false; $i++)
11556 $consumed = substr($this->consumed, 1);
11557 if (isset($entities[$consumed]))
11559 $match = $consumed;
11563 if ($match !== null)
11565 $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
11566 $this->position += strlen($entities[$match]) - strlen($consumed) - 1;
11642 var $valid = array();
11650 function __toString()
11652 return $this->get_iri();
11664 $iri = (string) $iri;
11667 $parsed = $this->parse_iri($iri);
11668 $this->set_scheme($parsed[
'scheme']);
11669 $this->set_authority($parsed[
'authority']);
11670 $this->set_path($parsed[
'path']);
11671 $this->set_query($parsed[
'query']);
11672 $this->set_fragment($parsed[
'fragment']);
11685 function absolutize($base, $relative)
11687 $relative = (string) $relative;
11688 if ($relative !==
'')
11691 if ($relative->get_scheme() !== null)
11693 $target = $relative;
11695 elseif ($base->get_iri() !== null)
11697 if ($relative->get_authority() !== null)
11699 $target = $relative;
11700 $target->set_scheme($base->get_scheme());
11705 $target->set_scheme($base->get_scheme());
11706 $target->set_userinfo($base->get_userinfo());
11707 $target->set_host($base->get_host());
11708 $target->set_port($base->get_port());
11709 if ($relative->get_path() !== null)
11711 if (strpos($relative->get_path(),
'/') === 0)
11713 $target->set_path($relative->get_path());
11715 elseif (($base->get_userinfo() !== null || $base->get_host() !== null || $base->get_port() !== null) && $base->get_path() === null)
11717 $target->set_path(
'/' . $relative->get_path());
11719 elseif (($last_segment = strrpos($base->get_path(),
'/')) !==
false)
11721 $target->set_path(substr($base->get_path(), 0, $last_segment + 1) . $relative->get_path());
11725 $target->set_path($relative->get_path());
11727 $target->set_query($relative->get_query());
11731 $target->set_path($base->get_path());
11732 if ($relative->get_query() !== null)
11734 $target->set_query($relative->get_query());
11736 elseif ($base->get_query() !== null)
11738 $target->set_query($base->get_query());
11742 $target->set_fragment($relative->get_fragment());
11747 $target = $relative;
11764 function parse_iri($iri)
11766 preg_match(
'/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $iri, $match);
11767 for ($i = count($match); $i <= 9; $i++)
11771 return array(
'scheme' => $match[2],
'authority' => $match[4],
'path' => $match[5],
'query' => $match[7],
'fragment' => $match[9]);
11781 function remove_dot_segments($input)
11784 while (strpos($input,
'./') !==
false || strpos($input,
'/.') !==
false || $input ===
'.' || $input ===
'..')
11787 if (strpos($input,
'../') === 0)
11789 $input = substr($input, 3);
11791 elseif (strpos($input,
'./') === 0)
11793 $input = substr($input, 2);
11796 elseif (strpos($input,
'/./') === 0)
11798 $input = substr_replace($input,
'/', 0, 3);
11800 elseif ($input ===
'/.')
11805 elseif (strpos($input,
'/../') === 0)
11807 $input = substr_replace($input,
'/', 0, 4);
11808 $output = substr_replace($output,
'', strrpos($output,
'/'));
11810 elseif ($input ===
'/..')
11813 $output = substr_replace($output,
'', strrpos($output,
'/'));
11816 elseif ($input ===
'.' || $input ===
'..')
11821 elseif (($pos = strpos($input,
'/', 1)) !==
false)
11823 $output .= substr($input, 0, $pos);
11824 $input = substr_replace($input,
'', 0, $pos);
11832 return $output . $input;
11849 $string = strtolower($string);
11853 $string = strtoupper($string);
11858 $strlen = strlen($string);
11861 while (($position += strspn($string, $valid_chars, $position)) < $strlen)
11864 if ($string[$position] ===
'%')
11867 if ($position + 2 < $strlen && strspn($string,
'0123456789ABCDEFabcdef', $position + 1, 2) === 2)
11870 $chr = chr(hexdec(substr($string, $position + 1, 2)));
11873 if (strpos($valid_chars, $chr) !==
false)
11875 if ($case & SIMPLEPIE_LOWERCASE)
11877 $chr = strtolower($chr);
11879 elseif ($case & SIMPLEPIE_UPPERCASE)
11881 $chr = strtoupper($chr);
11883 $string = substr_replace($string, $chr, $position, 3);
11891 $string = substr_replace($string, strtoupper(substr($string, $position + 1, 2)), $position + 1, 2);
11898 $string = substr_replace($string,
'%25', $position, 1);
11906 $replacement = sprintf(
"%%%02X", ord($string[$position]));
11907 $string = str_replace($string[$position], $replacement, $string);
11908 $strlen = strlen($string);
11920 function is_valid()
11922 return array_sum($this->valid) === count($this->valid);
11933 function set_scheme($scheme)
11935 if ($scheme === null || $scheme ===
'')
11937 $this->scheme = null;
11941 $len = strlen($scheme);
11945 if (!strspn($scheme,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
11947 $this->scheme = null;
11948 $this->valid[__FUNCTION__] =
false;
11953 if (!strspn($scheme,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
11955 $this->scheme = null;
11956 $this->valid[__FUNCTION__] =
false;
11960 $this->scheme = strtolower($scheme);
11962 $this->valid[__FUNCTION__] =
true;
11974 function set_authority($authority)
11976 if (($userinfo_end = strrpos($authority,
'@')) !==
false)
11978 $userinfo = substr($authority, 0, $userinfo_end);
11979 $authority = substr($authority, $userinfo_end + 1);
11986 if (($port_start = strpos($authority,
':')) !==
false)
11988 $port = substr($authority, $port_start + 1);
11989 $authority = substr($authority, 0, $port_start);
11996 return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
12006 function set_userinfo($userinfo)
12008 if ($userinfo === null || $userinfo ===
'')
12010 $this->userinfo = null;
12014 $this->userinfo = $this->replace_invalid_with_pct_encoding($userinfo,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:');
12016 $this->valid[__FUNCTION__] =
true;
12028 function set_host($host)
12030 if ($host === null || $host ===
'')
12032 $this->host = null;
12033 $this->valid[__FUNCTION__] =
true;
12036 elseif ($host[0] ===
'[' && substr($host, -1) ===
']')
12038 if (Net_IPv6::checkIPv6(substr($host, 1, -1)))
12040 $this->host = $host;
12041 $this->valid[__FUNCTION__] =
true;
12046 $this->host = null;
12047 $this->valid[__FUNCTION__] =
false;
12053 $this->host = $this->replace_invalid_with_pct_encoding($host,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=',
SIMPLEPIE_LOWERCASE);
12054 $this->valid[__FUNCTION__] =
true;
12067 function set_port($port)
12069 if ($port === null || $port ===
'')
12071 $this->port = null;
12072 $this->valid[__FUNCTION__] =
true;
12075 elseif (strspn($port,
'0123456789') === strlen($port))
12077 $this->port = (int) $port;
12078 $this->valid[__FUNCTION__] =
true;
12083 $this->port = null;
12084 $this->valid[__FUNCTION__] =
false;
12096 function set_path($path)
12098 if ($path === null || $path ===
'')
12100 $this->path = null;
12101 $this->valid[__FUNCTION__] =
true;
12104 elseif (substr($path, 0, 2) ===
'//' && $this->userinfo === null && $this->host === null && $this->port === null)
12106 $this->path = null;
12107 $this->valid[__FUNCTION__] =
false;
12112 $this->path = $this->replace_invalid_with_pct_encoding($path,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=@/');
12113 if ($this->scheme !== null)
12115 $this->path = $this->remove_dot_segments($this->path);
12117 $this->valid[__FUNCTION__] =
true;
12129 function set_query($query)
12131 if ($query === null || $query ===
'')
12133 $this->query = null;
12137 $this->query = $this->replace_invalid_with_pct_encoding($query,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
12139 $this->valid[__FUNCTION__] =
true;
12150 function set_fragment($fragment)
12152 if ($fragment === null || $fragment ===
'')
12154 $this->fragment = null;
12158 $this->fragment = $this->replace_invalid_with_pct_encoding($fragment,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&\'()*+,;=:@/?');
12160 $this->valid[__FUNCTION__] =
true;
12173 if ($this->scheme !== null)
12175 $iri .= $this->scheme .
':';
12177 if (($authority = $this->get_authority()) !== null)
12179 $iri .=
'//' . $authority;
12181 if ($this->path !== null)
12183 $iri .= $this->path;
12185 if ($this->query !== null)
12187 $iri .=
'?' . $this->query;
12189 if ($this->fragment !== null)
12191 $iri .=
'#' . $this->fragment;
12210 function get_scheme()
12212 return $this->scheme;
12221 function get_authority()
12224 if ($this->userinfo !== null)
12226 $authority .= $this->userinfo .
'@';
12228 if ($this->host !== null)
12230 $authority .= $this->host;
12232 if ($this->port !== null)
12234 $authority .=
':' . $this->port;
12237 if ($authority !==
'')
12253 function get_userinfo()
12255 return $this->userinfo;
12264 function get_host()
12266 return $this->host;
12275 function get_port()
12277 return $this->port;
12286 function get_path()
12288 return $this->path;
12297 function get_query()
12299 return $this->query;
12308 function get_fragment()
12310 return $this->fragment;
12337 function removeNetmaskSpec($ip)
12339 if (strpos($ip,
'/') !==
false)
12341 list($addr, $nm) = explode(
'/', $ip);
12365 function Uncompress($ip)
12370 if (strpos($ip,
'::') !==
false)
12372 list($ip1, $ip2) = explode(
'::', $ip);
12380 if (($pos = substr_count($ip1,
':')) > 0)
12396 if (($pos = substr_count($ip2,
':')) > 0)
12405 if (strstr($ip2,
'.'))
12410 if ($c1 === -1 && $c2 === -1)
12412 $uip =
'0:0:0:0:0:0:0:0';
12415 else if ($c1 === -1)
12417 $fill = str_repeat(
'0:', 7 - $c2);
12418 $uip = str_replace(
'::', $fill, $uip);
12421 else if ($c2 === -1)
12423 $fill = str_repeat(
':0', 7 - $c1);
12424 $uip = str_replace(
'::', $fill, $uip);
12429 $fill = str_repeat(
':0:', 6 - $c2 - $c1);
12430 $uip = str_replace(
'::', $fill, $uip);
12431 $uip = str_replace(
'::',
':', $uip);
12451 function SplitV64($ip)
12454 if (strstr($ip,
'.'))
12456 $pos = strrpos($ip,
':');
12458 $ipPart = explode(
'_', $ip);
12463 return array($ip,
'');
12477 function checkIPv6($ip)
12481 if (!empty($ipPart[0]))
12483 $ipv6 = explode(
':', $ipPart[0]);
12484 for ($i = 0; $i < count($ipv6); $i++)
12486 $dec = hexdec($ipv6[$i]);
12487 $hex = strtoupper(preg_replace(
'/^[0]{1,3}(.*[0-9a-fA-F])$/',
'\\1', $ipv6[$i]));
12488 if ($ipv6[$i] >= 0 && $dec <= 65535 && $hex === strtoupper(dechex($dec)))
12497 elseif ($count === 6 && !empty($ipPart[1]))
12499 $ipv4 = explode(
'.', $ipPart[1]);
12501 foreach ($ipv4 as $ipv4_part)
12503 if ($ipv4_part >= 0 && $ipv4_part <= 255 && preg_match(
'/^\d{1,3}$/', $ipv4_part))
12607 'keskiviikko' => 3,
12636 var $month = array(
12781 var $timezone = array(
13005 var $built_in = array();
13013 var $user = array();
13023 $this->day_pcre =
'(' . implode(array_keys($this->day),
'|') .
')';
13024 $this->month_pcre =
'(' . implode(array_keys($this->month),
'|') .
')';
13027 if (!isset($cache[get_class($this)]))
13029 $all_methods = get_class_methods($this);
13031 foreach ($all_methods as $method)
13033 if (strtolower(substr($method, 0, 5)) ===
'date_')
13035 $cache[get_class($this)][] = $method;
13040 foreach ($cache[get_class($this)] as $method)
13042 $this->built_in[] = $method;
13069 function parse($date)
13071 foreach ($this->user as $method)
13073 if (($returned = call_user_func($method, $date)) !==
false)
13079 foreach ($this->built_in as $method)
13081 if (($returned = call_user_func(array(&$this, $method), $date)) !==
false)
13097 function add_callback($callback)
13099 if (is_callable($callback))
13101 $this->user[] = $callback;
13105 trigger_error(
'User-supplied function must be a valid callback', E_USER_WARNING);
13117 function date_w3cdtf($date)
13122 $year =
'([0-9]{4})';
13123 $month = $day = $hour = $minute = $second =
'([0-9]{2})';
13124 $decimal =
'([0-9]*)';
13125 $zone =
'(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
13126 $pcre =
'/^' . $year .
'(?:-?' . $month .
'(?:-?' . $day .
'(?:[Tt\x09\x20]+' . $hour .
'(?::?' . $minute .
'(?::?' . $second .
'(?:.' . $decimal .
')?)?)?' . $zone .
')?)?)?$/';
13128 if (preg_match($pcre, $date, $match))
13146 for ($i = count($match); $i <= 3; $i++)
13151 for ($i = count($match); $i <= 7; $i++)
13157 if (isset($match[9]) && $match[9] !==
'')
13159 $timezone = $match[10] * 3600;
13160 $timezone += $match[11] * 60;
13161 if ($match[9] ===
'-')
13163 $timezone = 0 - $timezone;
13172 $second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
13174 return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
13189 function remove_rfc2822_comments($string)
13191 $string = (string) $string;
13193 $length = strlen($string);
13198 while ($position < $length && ($pos = strpos($string,
'(', $position)) !==
false)
13200 $output .= substr($string, $position, $pos - $position);
13201 $position = $pos + 1;
13202 if ($string[$pos - 1] !==
'\\')
13205 while ($depth && $position < $length)
13207 $position += strcspn($string,
'()', $position);
13208 if ($string[$position - 1] ===
'\\')
13213 elseif (isset($string[$position]))
13215 switch ($string[$position])
13238 $output .= substr($string, $position);
13249 function date_rfc2822($date)
13254 $wsp =
'[\x09\x20]';
13255 $fws =
'(?:' . $wsp .
'+|' . $wsp .
'*(?:\x0D\x0A' . $wsp .
'+)+)';
13256 $optional_fws = $fws .
'?';
13257 $day_name = $this->day_pcre;
13258 $month = $this->month_pcre;
13259 $day =
'([0-9]{1,2})';
13260 $hour = $minute = $second =
'([0-9]{2})';
13261 $year =
'([0-9]{2,4})';
13262 $num_zone =
'([+\-])([0-9]{2})([0-9]{2})';
13263 $character_zone =
'([A-Z]{1,5})';
13264 $zone =
'(?:' . $num_zone .
'|' . $character_zone .
')';
13265 $pcre =
'/(?:' . $optional_fws . $day_name . $optional_fws .
',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws .
':' . $optional_fws . $minute .
'(?:' . $optional_fws .
':' . $optional_fws . $second .
')?' . $fws . $zone .
'/i';
13267 if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
13285 $month = $this->month[strtolower($match[3])];
13288 if ($match[8] !==
'')
13290 $timezone = $match[9] * 3600;
13291 $timezone += $match[10] * 60;
13292 if ($match[8] ===
'-')
13294 $timezone = 0 - $timezone;
13298 elseif (isset($this->timezone[strtoupper($match[11])]))
13300 $timezone = $this->timezone[strtoupper($match[11])];
13309 if ($match[4] < 50)
13313 elseif ($match[4] < 1000)
13319 if ($match[7] !==
'')
13321 $second = $match[7];
13328 return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
13342 function date_rfc850($date)
13347 $space =
'[\x09\x20]+';
13348 $day_name = $this->day_pcre;
13349 $month = $this->month_pcre;
13350 $day =
'([0-9]{1,2})';
13351 $year = $hour = $minute = $second =
'([0-9]{2})';
13352 $zone =
'([A-Z]{1,5})';
13353 $pcre =
'/^' . $day_name .
',' . $space . $day .
'-' . $month .
'-' . $year . $space . $hour .
':' . $minute .
':' . $second . $space . $zone .
'$/i';
13355 if (preg_match($pcre, $date, $match))
13370 $month = $this->month[strtolower($match[3])];
13373 if (isset($this->timezone[strtoupper($match[8])]))
13375 $timezone = $this->timezone[strtoupper($match[8])];
13384 if ($match[4] < 50)
13393 return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
13407 function date_asctime($date)
13412 $space =
'[\x09\x20]+';
13413 $wday_name = $this->day_pcre;
13414 $mon_name = $this->month_pcre;
13415 $day =
'([0-9]{1,2})';
13416 $hour = $sec = $min =
'([0-9]{2})';
13417 $year =
'([0-9]{4})';
13418 $terminator =
'\x0A?\x00?';
13419 $pcre =
'/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour .
':' . $min .
':' . $sec . $space . $year . $terminator .
'$/i';
13421 if (preg_match($pcre, $date, $match))
13434 $month = $this->month[strtolower($match[2])];
13435 return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
13449 function date_strtotime($date)
13451 $strtotime = strtotime($date);
13452 if ($strtotime === -1 || $strtotime ===
false)
13486 $this->file = $file;
13495 function get_type()
13497 if (isset($this->file->headers[
'content-type']))
13499 if (!isset($this->file->headers[
'content-encoding'])
13500 && ($this->file->headers[
'content-type'] ===
'text/plain'
13501 || $this->file->headers[
'content-type'] ===
'text/plain; charset=ISO-8859-1'
13502 || $this->file->headers[
'content-type'] ===
'text/plain; charset=iso-8859-1'))
13504 return $this->text_or_binary();
13507 if (($pos = strpos($this->file->headers[
'content-type'],
';')) !==
false)
13509 $official = substr($this->file->headers[
'content-type'], 0, $pos);
13513 $official = $this->file->headers[
'content-type'];
13515 $official = strtolower($official);
13517 if ($official ===
'unknown/unknown'
13518 || $official ===
'application/unknown')
13520 return $this->unknown();
13522 elseif (substr($official, -4) ===
'+xml'
13523 || $official ===
'text/xml'
13524 || $official ===
'application/xml')
13528 elseif (substr($official, 0, 6) ===
'image/')
13530 if ($return = $this->image())
13539 elseif ($official ===
'text/html')
13541 return $this->feed_or_html();
13550 return $this->unknown();
13560 function text_or_binary()
13562 if (substr($this->file->body, 0, 2) ===
"\xFE\xFF"
13563 || substr($this->file->body, 0, 2) ===
"\xFF\xFE"
13564 || substr($this->file->body, 0, 4) ===
"\x00\x00\xFE\xFF"
13565 || substr($this->file->body, 0, 3) ===
"\xEF\xBB\xBF")
13567 return 'text/plain';
13569 elseif (preg_match(
'/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
13571 return 'application/octect-stream';
13575 return 'text/plain';
13587 $ws = strspn($this->file->body,
"\x09\x0A\x0B\x0C\x0D\x20");
13588 if (strtolower(substr($this->file->body, $ws, 14)) ===
'<!doctype html'
13589 || strtolower(substr($this->file->body, $ws, 5)) ===
'<html'
13590 || strtolower(substr($this->file->body, $ws, 7)) ===
'<script')
13592 return 'text/html';
13594 elseif (substr($this->file->body, 0, 5) ===
'%PDF-')
13596 return 'application/pdf';
13598 elseif (substr($this->file->body, 0, 11) ===
'%!PS-Adobe-')
13600 return 'application/postscript';
13602 elseif (substr($this->file->body, 0, 6) ===
'GIF87a'
13603 || substr($this->file->body, 0, 6) ===
'GIF89a')
13605 return 'image/gif';
13607 elseif (substr($this->file->body, 0, 8) ===
"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
13609 return 'image/png';
13611 elseif (substr($this->file->body, 0, 3) ===
"\xFF\xD8\xFF")
13613 return 'image/jpeg';
13615 elseif (substr($this->file->body, 0, 2) ===
"\x42\x4D")
13617 return 'image/bmp';
13621 return $this->text_or_binary();
13633 if (substr($this->file->body, 0, 6) ===
'GIF87a'
13634 || substr($this->file->body, 0, 6) ===
'GIF89a')
13636 return 'image/gif';
13638 elseif (substr($this->file->body, 0, 8) ===
"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
13640 return 'image/png';
13642 elseif (substr($this->file->body, 0, 3) ===
"\xFF\xD8\xFF")
13644 return 'image/jpeg';
13646 elseif (substr($this->file->body, 0, 2) ===
"\x42\x4D")
13648 return 'image/bmp';
13662 function feed_or_html()
13664 $len = strlen($this->file->body);
13665 $pos = strspn($this->file->body,
"\x09\x0A\x0D\x20");
13667 while ($pos < $len)
13669 switch ($this->file->body[$pos])
13675 $pos += strspn($this->file->body,
"\x09\x0A\x0D\x20", $pos);
13683 return 'text/html';
13686 if (substr($this->file->body, $pos, 3) ===
'!--')
13689 if ($pos < $len && ($pos = strpos($this->file->body,
'-->', $pos)) !==
false)
13695 return 'text/html';
13698 elseif (substr($this->file->body, $pos, 1) ===
'!')
13700 if ($pos < $len && ($pos = strpos($this->file->body,
'>', $pos)) !==
false)
13706 return 'text/html';
13709 elseif (substr($this->file->body, $pos, 1) ===
'?')
13711 if ($pos < $len && ($pos = strpos($this->file->body,
'?>', $pos)) !==
false)
13717 return 'text/html';
13720 elseif (substr($this->file->body, $pos, 3) ===
'rss'
13721 || substr($this->file->body, $pos, 7) ===
'rdf:RDF')
13723 return 'application/rss+xml';
13725 elseif (substr($this->file->body, $pos, 4) ===
'feed')
13727 return 'application/atom+xml';
13731 return 'text/html';
13735 return 'text/html';
13752 var $version =
'1.0';
13760 var $encoding =
'UTF-8';
13768 var $standalone =
false;
13776 var $state =
'before_version_name';
13792 var $data_length = 0;
13810 $this->data = $data;
13811 $this->data_length = strlen($this->data);
13822 while ($this->state && $this->state !==
'emit' && $this->has_data())
13824 $state = $this->state;
13828 if ($this->state ===
'emit')
13834 $this->version =
'';
13835 $this->encoding =
'';
13836 $this->standalone =
'';
13847 function has_data()
13849 return (
bool) ($this->position < $this->data_length);
13857 function skip_whitespace()
13859 $whitespace = strspn($this->data,
"\x09\x0A\x0D\x20", $this->position);
13860 $this->position += $whitespace;
13861 return $whitespace;
13867 function get_value()
13869 $quote = substr($this->data, $this->position, 1);
13870 if ($quote ===
'"' || $quote ===
"'")
13873 $len = strcspn($this->data, $quote, $this->position);
13874 if ($this->has_data())
13876 $value = substr($this->data, $this->position, $len);
13877 $this->position += $len + 1;
13884 function before_version_name()
13886 if ($this->skip_whitespace())
13888 $this->state =
'version_name';
13892 $this->state =
false;
13896 function version_name()
13898 if (substr($this->data, $this->position, 7) ===
'version')
13900 $this->position += 7;
13901 $this->skip_whitespace();
13902 $this->state =
'version_equals';
13906 $this->state =
false;
13910 function version_equals()
13912 if (substr($this->data, $this->position, 1) ===
'=')
13915 $this->skip_whitespace();
13916 $this->state =
'version_value';
13920 $this->state =
false;
13924 function version_value()
13926 if ($this->version = $this->get_value())
13928 $this->skip_whitespace();
13929 if ($this->has_data())
13931 $this->state =
'encoding_name';
13935 $this->state =
'emit';
13940 $this->state =
'standalone_name';
13944 function encoding_name()
13946 if (substr($this->data, $this->position, 8) ===
'encoding')
13948 $this->position += 8;
13949 $this->skip_whitespace();
13950 $this->state =
'encoding_equals';
13954 $this->state =
false;
13958 function encoding_equals()
13960 if (substr($this->data, $this->position, 1) ===
'=')
13963 $this->skip_whitespace();
13964 $this->state =
'encoding_value';
13968 $this->state =
false;
13972 function encoding_value()
13974 if ($this->encoding = $this->get_value())
13976 $this->skip_whitespace();
13977 if ($this->has_data())
13979 $this->state =
'standalone_name';
13983 $this->state =
'emit';
13988 $this->state =
false;
13992 function standalone_name()
13994 if (substr($this->data, $this->position, 10) ===
'standalone')
13996 $this->position += 10;
13997 $this->skip_whitespace();
13998 $this->state =
'standalone_equals';
14002 $this->state =
false;
14006 function standalone_equals()
14008 if (substr($this->data, $this->position, 1) ===
'=')
14011 $this->skip_whitespace();
14012 $this->state =
'standalone_value';
14016 $this->state =
false;
14020 function standalone_value()
14022 if ($standalone = $this->get_value())
14024 switch ($standalone)
14027 $this->standalone =
true;
14031 $this->standalone =
false;
14035 $this->state =
false;
14039 $this->skip_whitespace();
14040 if ($this->has_data())
14042 $this->state =
false;
14046 $this->state =
'emit';
14051 $this->state =
false;
14061 var $local = array();
14062 var $elsewhere = array();
14063 var $file_class =
'SimplePie_File';
14064 var $cached_entities = array();
14067 var $base_location = 0;
14068 var $checked_feeds = 0;
14069 var $max_checked_feeds = 10;
14070 var $content_type_sniffer_class =
'SimplePie_Content_Type_Sniffer';
14072 function SimplePie_Locator(&$file, $timeout = 10, $useragent = null, $file_class =
'SimplePie_File', $max_checked_feeds = 10, $content_type_sniffer_class =
'SimplePie_Content_Type_Sniffer')
14074 $this->file =& $file;
14075 $this->file_class = $file_class;
14076 $this->useragent = $useragent;
14077 $this->timeout = $timeout;
14078 $this->max_checked_feeds = $max_checked_feeds;
14079 $this->content_type_sniffer_class = $content_type_sniffer_class;
14084 if ($this->is_feed($this->file))
14086 return $this->file;
14091 $sniffer =
new $this->content_type_sniffer_class($this->file);
14092 if ($sniffer->get_type() !==
'text/html')
14105 return $working[0];
14133 function is_feed(&$file)
14137 $sniffer =
new $this->content_type_sniffer_class($file);
14138 $sniffed = $sniffer->get_type();
14139 if (in_array($sniffed, array(
'application/rss+xml',
'application/rdf+xml',
'text/rdf',
'application/atom+xml',
'text/xml',
'application/xml')))
14158 function get_base()
14160 $this->http_base = $this->file->url;
14161 $this->base = $this->http_base;
14163 foreach ($elements as $element)
14165 if ($element[
'attribs'][
'href'][
'data'] !==
'')
14168 $this->base_location = $element[
'offset'];
14174 function autodiscovery()
14179 foreach ($links as $link)
14181 if ($this->checked_feeds === $this->max_checked_feeds)
14185 if (isset($link[
'attribs'][
'href'][
'data']) && isset($link[
'attribs'][
'rel'][
'data']))
14189 if ($this->base_location < $link[
'offset'])
14198 if (!in_array($href, $done) && in_array(
'feed', $rel) || (in_array(
'alternate', $rel) && !empty($link[
'attribs'][
'type'][
'data']) && in_array(strtolower(
SimplePie_Misc::parse_mime($link[
'attribs'][
'type'][
'data'])), array(
'application/rss+xml',
'application/atom+xml'))) && !isset($feeds[$href]))
14200 $this->checked_feeds++;
14201 $feed =
new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
14202 if ($feed->success && ($feed->method &
SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
14204 $feeds[$href] = $feed;
14211 if (!empty($feeds))
14213 return array_values($feeds);
14221 function get_links()
14224 foreach ($links as $link)
14226 if (isset($link[
'attribs'][
'href'][
'data']))
14228 $href = trim($link[
'attribs'][
'href'][
'data']);
14230 if ($parsed[
'scheme'] ===
'' || preg_match(
'/^(http(s)|feed)?$/i', $parsed[
'scheme']))
14232 if ($this->base_location < $link[
'offset'])
14243 if ($parsed[
'authority'] ===
'' || $parsed[
'authority'] === $current[
'authority'])
14245 $this->local[] = $href;
14249 $this->elsewhere[] = $href;
14254 $this->local = array_unique($this->local);
14255 $this->elsewhere = array_unique($this->elsewhere);
14256 if (!empty($this->local) || !empty($this->elsewhere))
14263 function extension(&$array)
14265 foreach ($array as $key => $value)
14267 if ($this->checked_feeds === $this->max_checked_feeds)
14271 if (in_array(strtolower(strrchr($value,
'.')), array(
'.rss',
'.rdf',
'.atom',
'.xml')))
14273 $this->checked_feeds++;
14274 $feed =
new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
14275 if ($feed->success && ($feed->method &
SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
14281 unset($array[$key]);
14288 function body(&$array)
14290 foreach ($array as $key => $value)
14292 if ($this->checked_feeds === $this->max_checked_feeds)
14296 if (preg_match(
'/(rss|rdf|atom|xml)/i', $value))
14298 $this->checked_feeds++;
14299 $feed =
new $this->file_class($value, $this->timeout, 5, null, $this->useragent);
14300 if ($feed->success && ($feed->method &
SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
14306 unset($array[$key]);
14321 var $separator =
' ';
14322 var $namespace = array(
'');
14323 var $element = array(
'');
14324 var $xml_base = array(
'');
14325 var $xml_base_explicit = array(
false);
14326 var $xml_lang = array(
'');
14327 var $data = array();
14328 var $datas = array(array());
14329 var $current_xhtml_construct = -1;
14332 function parse(&$data, $encoding)
14335 if (strtoupper($encoding) ===
'US-ASCII')
14337 $this->encoding =
'UTF-8';
14341 $this->encoding = $encoding;
14346 if (substr($data, 0, 4) ===
"\x00\x00\xFE\xFF")
14348 $data = substr($data, 4);
14351 elseif (substr($data, 0, 4) ===
"\xFF\xFE\x00\x00")
14353 $data = substr($data, 4);
14356 elseif (substr($data, 0, 2) ===
"\xFE\xFF")
14358 $data = substr($data, 2);
14361 elseif (substr($data, 0, 2) ===
"\xFF\xFE")
14363 $data = substr($data, 2);
14366 elseif (substr($data, 0, 3) ===
"\xEF\xBB\xBF")
14368 $data = substr($data, 3);
14371 if (substr($data, 0, 5) ===
'<?xml' && strspn(substr($data, 5, 1),
"\x09\x0A\x0D\x20") && ($pos = strpos($data,
'?>')) !==
false)
14374 if ($declaration->parse())
14376 $data = substr($data, $pos + 2);
14377 $data =
'<?xml version="' . $declaration->version .
'" encoding="' . $encoding .
'" standalone="' . (($declaration->standalone) ?
'yes' :
'no') .
'"?>' . $data;
14381 $this->error_string =
'SimplePie bug! Please report this!';
14388 static $xml_is_sane = null;
14389 if ($xml_is_sane === null)
14391 $parser_check = xml_parser_create();
14392 xml_parse_into_struct($parser_check,
'<foo>&</foo>', $values);
14393 xml_parser_free($parser_check);
14394 $xml_is_sane = isset($values[0][
'value']);
14400 $xml = xml_parser_create_ns($this->encoding, $this->separator);
14401 xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
14402 xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, 0);
14403 xml_set_object($xml, $this);
14404 xml_set_character_data_handler($xml,
'cdata');
14405 xml_set_element_handler($xml,
'tag_open',
'tag_close');
14408 if (!xml_parse($xml, $data,
true))
14410 $this->error_code = xml_get_error_code($xml);
14411 $this->error_string = xml_error_string($this->error_code);
14414 $this->current_line = xml_get_current_line_number($xml);
14415 $this->current_column = xml_get_current_column_number($xml);
14416 $this->current_byte = xml_get_current_byte_index($xml);
14417 xml_parser_free($xml);
14422 libxml_clear_errors();
14423 $xml =
new XMLReader();
14425 while (@$xml->read())
14427 switch ($xml->nodeType)
14430 case constant(
'XMLReader::END_ELEMENT'):
14431 if ($xml->namespaceURI !==
'')
14433 $tagName =
"{$xml->namespaceURI}{$this->separator}{$xml->localName}";
14437 $tagName = $xml->localName;
14439 $this->tag_close(null, $tagName);
14441 case constant(
'XMLReader::ELEMENT'):
14442 $empty = $xml->isEmptyElement;
14443 if ($xml->namespaceURI !==
'')
14445 $tagName =
"{$xml->namespaceURI}{$this->separator}{$xml->localName}";
14449 $tagName = $xml->localName;
14451 $attributes = array();
14452 while ($xml->moveToNextAttribute())
14454 if ($xml->namespaceURI !==
'')
14456 $attrName =
"{$xml->namespaceURI}{$this->separator}{$xml->localName}";
14460 $attrName = $xml->localName;
14462 $attributes[$attrName] = $xml->value;
14464 $this->tag_open(null, $tagName, $attributes);
14467 $this->tag_close(null, $tagName);
14470 case constant(
'XMLReader::TEXT'):
14472 case constant(
'XMLReader::CDATA'):
14473 $this->cdata(null, $xml->value);
14477 if ($error = libxml_get_last_error())
14479 $this->error_code = $error->code;
14480 $this->error_string = $error->message;
14481 $this->current_line = $error->line;
14482 $this->current_column = $error->column;
14492 function get_error_code()
14494 return $this->error_code;
14497 function get_error_string()
14499 return $this->error_string;
14502 function get_current_line()
14504 return $this->current_line;
14507 function get_current_column()
14509 return $this->current_column;
14512 function get_current_byte()
14514 return $this->current_byte;
14517 function get_data()
14519 return $this->data;
14522 function tag_open($parser, $tag, $attributes)
14524 list($this->
namespace[], $this->element[]) = $this->split_ns($tag);
14526 $attribs = array();
14527 foreach ($attributes as $name => $value)
14529 list($attrib_namespace, $attribute) = $this->split_ns($name);
14530 $attribs[$attrib_namespace][$attribute] = $value;
14536 $this->xml_base_explicit[] =
true;
14540 $this->xml_base[] = end($this->xml_base);
14541 $this->xml_base_explicit[] = end($this->xml_base_explicit);
14544 if (isset($attribs[SIMPLEPIE_NAMESPACE_XML][
'lang']))
14550 $this->xml_lang[] = end($this->xml_lang);
14553 if ($this->current_xhtml_construct >= 0)
14555 $this->current_xhtml_construct++;
14558 $this->data[
'data'] .=
'<' . end($this->element);
14559 if (isset($attribs[
'']))
14561 foreach ($attribs[
''] as $name => $value)
14563 $this->data[
'data'] .=
' ' . $name .
'="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) .
'"';
14566 $this->data[
'data'] .=
'>';
14571 $this->datas[] =& $this->data;
14572 $this->data =& $this->data[
'child'][end($this->
namespace)][end($this->element)][];
14573 $this->data = array(
'data' =>
'',
'attribs' => $attribs,
'xml_base' => end($this->xml_base),
'xml_base_explicit' => end($this->xml_base_explicit),
'xml_lang' => end($this->xml_lang));
14574 if ((end($this->
namespace) ===
SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array(
'title',
'tagline',
'copyright',
'info',
'summary',
'content')) && isset($attribs[
''][
'mode']) && $attribs[
''][
'mode'] ===
'xml')
14575 || (end($this->
namespace) ===
SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array(
'rights',
'subtitle',
'summary',
'info',
'title',
'content')) && isset($attribs[
''][
'type']) && $attribs[
''][
'type'] ===
'xhtml'))
14577 $this->current_xhtml_construct = 0;
14582 function cdata($parser, $cdata)
14584 if ($this->current_xhtml_construct >= 0)
14586 $this->data[
'data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
14590 $this->data[
'data'] .= $cdata;
14594 function tag_close($parser, $tag)
14596 if ($this->current_xhtml_construct >= 0)
14598 $this->current_xhtml_construct--;
14599 if (end($this->
namespace) ===
SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array(
'area',
'base',
'basefont',
'br',
'col',
'frame',
'hr',
'img',
'input',
'isindex',
'link',
'meta',
'param')))
14601 $this->data[
'data'] .=
'</' . end($this->element) .
'>';
14604 if ($this->current_xhtml_construct === -1)
14606 $this->data =& $this->datas[count($this->datas) - 1];
14607 array_pop($this->datas);
14610 array_pop($this->element);
14611 array_pop($this->
namespace);
14612 array_pop($this->xml_base);
14613 array_pop($this->xml_base_explicit);
14614 array_pop($this->xml_lang);
14617 function split_ns($string)
14619 static $cache = array();
14620 if (!isset($cache[$string]))
14622 if ($pos = strpos($string, $this->separator))
14624 static $separator_length;
14625 if (!$separator_length)
14627 $separator_length = strlen($this->separator);
14629 $namespace = substr($string, 0, $pos);
14630 $local_name = substr($string, $pos + $separator_length);
14641 $cache[$string] = array($namespace, $local_name);
14645 $cache[$string] = array(
'', $string);
14648 return $cache[$string];
14661 var $remove_div =
true;
14662 var $image_handler =
'';
14663 var $strip_htmltags = array(
'base',
'blink',
'body',
'doctype',
'embed',
'font',
'form',
'frame',
'frameset',
'html',
'iframe',
'input',
'marquee',
'meta',
'noscript',
'object',
'param',
'script',
'style');
14664 var $encode_instead_of_strip =
false;
14665 var $strip_attributes = array(
'bgsound',
'class',
'expr',
'id',
'style',
'onclick',
'onerror',
'onfinish',
'onmouseover',
'onmouseout',
'onfocus',
'onblur',
'lowsrc',
'dynsrc');
14666 var $strip_comments =
false;
14667 var $output_encoding =
'UTF-8';
14668 var $enable_cache =
true;
14669 var $cache_location =
'./cache';
14670 var $cache_name_function =
'md5';
14671 var $cache_class =
'SimplePie_Cache';
14672 var $file_class =
'SimplePie_File';
14674 var $useragent =
'';
14675 var $force_fsockopen =
false;
14677 var $replace_url_attributes = array(
14680 'blockquote' =>
'cite',
14682 'form' =>
'action',
14683 'img' => array(
'longdesc',
'src'),
14689 function remove_div($enable =
true)
14691 $this->remove_div = (bool) $enable;
14694 function set_image_handler($page =
false)
14698 $this->image_handler = (string) $page;
14702 $this->image_handler =
false;
14706 function pass_cache_data($enable_cache =
true, $cache_location =
'./cache', $cache_name_function =
'md5', $cache_class =
'SimplePie_Cache')
14708 if (isset($enable_cache))
14710 $this->enable_cache = (bool) $enable_cache;
14713 if ($cache_location)
14715 $this->cache_location = (string) $cache_location;
14718 if ($cache_name_function)
14720 $this->cache_name_function = (string) $cache_name_function;
14725 $this->cache_class = (string) $cache_class;
14729 function pass_file_data($file_class =
'SimplePie_File', $timeout = 10, $useragent =
'', $force_fsockopen =
false)
14733 $this->file_class = (string) $file_class;
14738 $this->timeout = (string) $timeout;
14743 $this->useragent = (string) $useragent;
14746 if ($force_fsockopen)
14748 $this->force_fsockopen = (string) $force_fsockopen;
14752 function strip_htmltags($tags = array(
'base',
'blink',
'body',
'doctype',
'embed',
'font',
'form',
'frame',
'frameset',
'html',
'iframe',
'input',
'marquee',
'meta',
'noscript',
'object',
'param',
'script',
'style'))
14756 if (is_array($tags))
14758 $this->strip_htmltags = $tags;
14762 $this->strip_htmltags = explode(
',', $tags);
14767 $this->strip_htmltags =
false;
14771 function encode_instead_of_strip($encode =
false)
14773 $this->encode_instead_of_strip = (bool) $encode;
14776 function strip_attributes($attribs = array(
'bgsound',
'class',
'expr',
'id',
'style',
'onclick',
'onerror',
'onfinish',
'onmouseover',
'onmouseout',
'onfocus',
'onblur',
'lowsrc',
'dynsrc'))
14780 if (is_array($attribs))
14782 $this->strip_attributes = $attribs;
14786 $this->strip_attributes = explode(
',', $attribs);
14791 $this->strip_attributes =
false;
14795 function strip_comments($strip =
false)
14797 $this->strip_comments = (bool) $strip;
14800 function set_output_encoding($encoding =
'UTF-8')
14802 $this->output_encoding = (string) $encoding;
14813 function set_url_replacements($element_attribute = array(
'a' =>
'href',
'area' =>
'href',
'blockquote' =>
'cite',
'del' =>
'cite',
'form' =>
'action',
'img' => array(
'longdesc',
'src'),
'input' =>
'src',
'ins' =>
'cite',
'q' =>
'cite'))
14815 $this->replace_url_attributes = (array) $element_attribute;
14818 function sanitize($data, $type, $base =
'')
14820 $data = trim($data);
14825 if (preg_match(
'/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' .
SIMPLEPIE_PCRE_HTML_ATTRIBUTE .
'>)/', $data))
14837 $data = base64_decode($data);
14842 if ($this->remove_div)
14845 $data = preg_replace(
'/<\/div>$/',
'', $data);
14856 if ($this->strip_comments)
14864 if ($this->strip_htmltags)
14866 foreach ($this->strip_htmltags as $tag)
14869 while (preg_match($pcre, $data))
14871 $data = preg_replace_callback($pcre, array(&$this,
'do_strip_htmltags'), $data);
14876 if ($this->strip_attributes)
14878 foreach ($this->strip_attributes as $attrib)
14880 $data = preg_replace(
'/(<[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*)' .
SIMPLEPIE_PCRE_HTML_ATTRIBUTE . trim($attrib) .
'(?:\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?' .
SIMPLEPIE_PCRE_HTML_ATTRIBUTE .
'>/',
'\1\2\3>', $data);
14885 $this->base = $base;
14886 foreach ($this->replace_url_attributes as $element => $attributes)
14888 $data = $this->replace_urls($data, $element, $attributes);
14892 if (isset($this->image_handler) && ((
string) $this->image_handler) !==
'' && $this->enable_cache)
14895 foreach ($images as $img)
14897 if (isset($img[
'attribs'][
'src'][
'data']))
14899 $image_url = call_user_func($this->cache_name_function, $img[
'attribs'][
'src'][
'data']);
14900 $cache = call_user_func(array($this->cache_class,
'create'), $this->cache_location, $image_url,
'spi');
14902 if ($cache->load())
14904 $img[
'attribs'][
'src'][
'data'] = $this->image_handler . $image_url;
14909 $file =
new $this->file_class($img[
'attribs'][
'src'][
'data'], $this->timeout, 5, array(
'X-FORWARDED-FOR' => $_SERVER[
'REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
14910 $headers = $file->headers;
14912 if ($file->success && ($file->method &
SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
14914 if ($cache->save(array(
'headers' => $file->headers,
'body' => $file->body)))
14916 $img[
'attribs'][
'src'][
'data'] = $this->image_handler . $image_url;
14921 trigger_error(
"$this->cache_location is not writeable", E_USER_WARNING);
14930 $data = trim($data);
14933 if ($type & SIMPLEPIE_CONSTRUCT_IRI)
14940 $data = htmlspecialchars($data, ENT_COMPAT,
'UTF-8');
14943 if ($this->output_encoding !==
'UTF-8')
14951 function replace_urls($data, $tag, $attributes)
14953 if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
14956 foreach ($elements as $element)
14958 if (is_array($attributes))
14960 foreach ($attributes as $attribute)
14962 if (isset($element[
'attribs'][$attribute][
'data']))
14966 $data = str_replace($element[
'full'], $new_element, $data);
14967 $element[
'full'] = $new_element;
14971 elseif (isset($element[
'attribs'][$attributes][
'data']))
14981 function do_strip_htmltags($match)
14983 if ($this->encode_instead_of_strip)
14985 if (isset($match[4]) && !in_array(strtolower($match[1]), array(
'script',
'style')))
14987 $match[1] = htmlspecialchars($match[1], ENT_COMPAT,
'UTF-8');
14988 $match[2] = htmlspecialchars($match[2], ENT_COMPAT,
'UTF-8');
14989 return "<$match[1]$match[2]>$match[3]</$match[1]>";
14993 return htmlspecialchars($match[0], ENT_COMPAT,
'UTF-8');
14996 elseif (isset($match[4]) && !in_array(strtolower($match[1]), array(
'script',
'style')))