48 define(
'SIMPLEPIE_NAME',
'SimplePie');
53 define(
'SIMPLEPIE_VERSION',
'1.3.1');
64 define(
'SIMPLEPIE_URL',
'http://simplepie.org');
81 define(
'SIMPLEPIE_LOCATOR_NONE', 0);
87 define(
'SIMPLEPIE_LOCATOR_AUTODISCOVERY', 1);
93 define(
'SIMPLEPIE_LOCATOR_LOCAL_EXTENSION', 2);
99 define(
'SIMPLEPIE_LOCATOR_LOCAL_BODY', 4);
105 define(
'SIMPLEPIE_LOCATOR_REMOTE_EXTENSION', 8);
111 define(
'SIMPLEPIE_LOCATOR_REMOTE_BODY', 16);
117 define(
'SIMPLEPIE_LOCATOR_ALL', 31);
122 define(
'SIMPLEPIE_TYPE_NONE', 0);
127 define(
'SIMPLEPIE_TYPE_RSS_090', 1);
132 define(
'SIMPLEPIE_TYPE_RSS_091_NETSCAPE', 2);
137 define(
'SIMPLEPIE_TYPE_RSS_091_USERLAND', 4);
142 define(
'SIMPLEPIE_TYPE_RSS_091', 6);
147 define(
'SIMPLEPIE_TYPE_RSS_092', 8);
152 define(
'SIMPLEPIE_TYPE_RSS_093', 16);
157 define(
'SIMPLEPIE_TYPE_RSS_094', 32);
162 define(
'SIMPLEPIE_TYPE_RSS_10', 64);
167 define(
'SIMPLEPIE_TYPE_RSS_20', 128);
172 define(
'SIMPLEPIE_TYPE_RSS_RDF', 65);
177 define(
'SIMPLEPIE_TYPE_RSS_SYNDICATION', 190);
182 define(
'SIMPLEPIE_TYPE_RSS_ALL', 255);
187 define(
'SIMPLEPIE_TYPE_ATOM_03', 256);
192 define(
'SIMPLEPIE_TYPE_ATOM_10', 512);
197 define(
'SIMPLEPIE_TYPE_ATOM_ALL', 768);
202 define(
'SIMPLEPIE_TYPE_ALL', 1023);
207 define(
'SIMPLEPIE_CONSTRUCT_NONE', 0);
212 define(
'SIMPLEPIE_CONSTRUCT_TEXT', 1);
217 define(
'SIMPLEPIE_CONSTRUCT_HTML', 2);
222 define(
'SIMPLEPIE_CONSTRUCT_XHTML', 4);
227 define(
'SIMPLEPIE_CONSTRUCT_BASE64', 8);
232 define(
'SIMPLEPIE_CONSTRUCT_IRI', 16);
237 define(
'SIMPLEPIE_CONSTRUCT_MAYBE_HTML', 32);
242 define(
'SIMPLEPIE_CONSTRUCT_ALL', 63);
247 define(
'SIMPLEPIE_SAME_CASE', 1);
252 define(
'SIMPLEPIE_LOWERCASE', 2);
257 define(
'SIMPLEPIE_UPPERCASE', 4);
262 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]*');
267 define(
'SIMPLEPIE_PCRE_XML_ATTRIBUTE',
'((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*');
272 define(
'SIMPLEPIE_NAMESPACE_XML',
'http://www.w3.org/XML/1998/namespace');
277 define(
'SIMPLEPIE_NAMESPACE_ATOM_10',
'http://www.w3.org/2005/Atom');
282 define(
'SIMPLEPIE_NAMESPACE_ATOM_03',
'http://purl.org/atom/ns#');
287 define(
'SIMPLEPIE_NAMESPACE_RDF',
'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
292 define(
'SIMPLEPIE_NAMESPACE_RSS_090',
'http://my.netscape.com/rdf/simple/0.9/');
297 define(
'SIMPLEPIE_NAMESPACE_RSS_10',
'http://purl.org/rss/1.0/');
302 define(
'SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT',
'http://purl.org/rss/1.0/modules/content/');
308 define(
'SIMPLEPIE_NAMESPACE_RSS_20',
'');
313 define(
'SIMPLEPIE_NAMESPACE_DC_10',
'http://purl.org/dc/elements/1.0/');
318 define(
'SIMPLEPIE_NAMESPACE_DC_11',
'http://purl.org/dc/elements/1.1/');
323 define(
'SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO',
'http://www.w3.org/2003/01/geo/wgs84_pos#');
328 define(
'SIMPLEPIE_NAMESPACE_GEORSS',
'http://www.georss.org/georss');
333 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS',
'http://search.yahoo.com/mrss/');
338 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG',
'http://search.yahoo.com/mrss');
343 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2',
'http://video.search.yahoo.com/mrss');
348 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3',
'http://video.search.yahoo.com/mrss/');
353 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4',
'http://www.rssboard.org/media-rss');
358 define(
'SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5',
'http://www.rssboard.org/media-rss/');
363 define(
'SIMPLEPIE_NAMESPACE_ITUNES',
'http://www.itunes.com/dtds/podcast-1.0.dtd');
368 define(
'SIMPLEPIE_NAMESPACE_XHTML',
'http://www.w3.org/1999/xhtml');
373 define(
'SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY',
'http://www.iana.org/assignments/relation/');
378 define(
'SIMPLEPIE_FILE_SOURCE_NONE', 0);
383 define(
'SIMPLEPIE_FILE_SOURCE_REMOTE', 1);
388 define(
'SIMPLEPIE_FILE_SOURCE_LOCAL', 2);
393 define(
'SIMPLEPIE_FILE_SOURCE_FSOCKOPEN', 4);
398 define(
'SIMPLEPIE_FILE_SOURCE_CURL', 8);
403 define(
'SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
602 public $strip_attributes = array(
'bgsound',
'class',
'expr',
'id',
'style',
'onclick',
'onerror',
'onfinish',
'onmouseover',
'onmouseout',
'onfocus',
'onblur',
'lowsrc',
'dynsrc');
609 public $strip_htmltags = array(
'base',
'blink',
'body',
'doctype',
'embed',
'font',
'form',
'frame',
'frameset',
'html',
'iframe',
'input',
'marquee',
'meta',
'noscript',
'object',
'param',
'script',
'style');
627 if (version_compare(PHP_VERSION,
'5.2',
'<'))
629 trigger_error(
'PHP 4.x, 5.0 and 5.1 are no longer supported. Please upgrade to PHP 5.2 or newer.');
637 if (func_num_args() > 0)
639 $level = defined(
'E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
640 trigger_error(
'Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.', $level);
642 $args = func_get_args();
643 switch (count($args)) {
660 return md5(serialize($this->data));
668 if ((version_compare(PHP_VERSION,
'5.3',
'<') || !gc_enabled()) && !ini_get(
'zend.ze1_compatibility_mode'))
670 if (!empty($this->data[
'items']))
672 foreach ($this->data[
'items'] as $item)
676 unset($item, $this->data[
'items']);
678 if (!empty($this->data[
'ordered_items']))
680 foreach ($this->data[
'ordered_items'] as $item)
684 unset($item, $this->data[
'ordered_items']);
720 $this->multifeed_url = array();
723 foreach ($url as $value)
725 $this->multifeed_url[] = $this->registry->call(
'Misc',
'fix_protocol', array($value, 1));
730 $this->feed_url = $this->registry->call(
'Misc',
'fix_protocol', array($url, 1));
744 $this->feed_url =
$file->url;
745 $this->file =&
$file;
766 $this->raw_data =
$data;
805 $this->cache = (bool) $enable;
816 $this->cache_duration = (int) $seconds;
827 $this->autodiscovery_cache_duration = (int) $seconds;
837 $this->cache_location = (string) $location;
847 $this->order_by_date = (bool) $enable;
862 $this->input_encoding = (string) $encoding;
866 $this->input_encoding =
false;
884 $this->autodiscovery = (int) $level;
912 return $this->registry->register(
'Cache', $class,
true);
920 return $this->registry->register(
'Locator', $class,
true);
928 return $this->registry->register(
'Parser', $class,
true);
936 return $this->registry->register(
'File', $class,
true);
944 return $this->registry->register(
'Sanitize', $class,
true);
952 return $this->registry->register(
'Item', $class,
true);
960 return $this->registry->register(
'Author', $class,
true);
968 return $this->registry->register(
'Category', $class,
true);
976 return $this->registry->register(
'Enclosure', $class,
true);
984 return $this->registry->register(
'Caption', $class,
true);
992 return $this->registry->register(
'Copyright', $class,
true);
1000 return $this->registry->register(
'Credit', $class,
true);
1008 return $this->registry->register(
'Rating', $class,
true);
1016 return $this->registry->register(
'Restriction', $class,
true);
1024 return $this->registry->register(
'Content_Type_Sniffer', $class,
true);
1032 return $this->registry->register(
'Source', $class,
true);
1043 $this->useragent = (string) $ua;
1053 if (is_callable($function))
1055 $this->cache_name_function = $function;
1087 $this->max_checked_feeds = (int) $max;
1092 $this->
sanitize->remove_div($enable);
1101 $this->
sanitize->strip_htmltags($tags);
1102 if ($encode !== null)
1104 $this->
sanitize->encode_instead_of_strip($tags);
1110 $this->
sanitize->encode_instead_of_strip($enable);
1115 if ($attribs ===
'')
1119 $this->
sanitize->strip_attributes($attribs);
1146 $this->
sanitize->set_output_encoding($encoding);
1151 $this->
sanitize->strip_comments($strip);
1167 $this->
sanitize->set_url_replacements($element_attribute);
1178 if ($page !==
false)
1180 $this->
sanitize->set_image_handler($page .
'?' . $qs .
'=');
1184 $this->image_handler =
'';
1195 $this->item_limit = (int) $limit;
1210 if (!extension_loaded(
'xml') || !extension_loaded(
'pcre'))
1215 elseif (!extension_loaded(
'xmlreader'))
1217 static $xml_is_sane = null;
1218 if ($xml_is_sane === null)
1220 $parser_check = xml_parser_create();
1221 xml_parse_into_struct($parser_check,
'<foo>&</foo>', $values);
1222 xml_parser_free($parser_check);
1223 $xml_is_sane = isset($values[0][
'value']);
1231 if (method_exists($this->
sanitize,
'set_registry'))
1233 $this->
sanitize->set_registry($this->registry);
1238 $this->
sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class(
'Cache'));
1241 if (!empty($this->multifeed_url))
1245 $this->multifeed_objects = array();
1246 $this->
error = array();
1247 foreach ($this->multifeed_url as $url)
1249 $this->multifeed_objects[$i] = clone $this;
1250 $this->multifeed_objects[$i]->set_feed_url($url);
1251 $single_success = $this->multifeed_objects[$i]->init();
1252 $success |= $single_success;
1253 if (!$single_success)
1255 $this->
error[$i] = $this->multifeed_objects[$i]->error();
1259 return (
bool) $success;
1261 elseif ($this->feed_url === null && $this->raw_data === null)
1266 $this->
error = null;
1267 $this->data = array();
1268 $this->multifeed_objects = array();
1271 if ($this->feed_url !== null)
1273 $parsed_feed_url = $this->registry->call(
'Misc',
'parse_url', array($this->feed_url));
1276 if ($this->cache && $parsed_feed_url[
'scheme'] !==
'')
1278 $cache = $this->registry->call(
'Cache',
'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url),
'spc'));
1286 elseif ($fetched ===
false) {
1290 list($headers, $sniffed) = $fetched;
1294 $encodings = array();
1297 if ($this->input_encoding !==
false)
1302 $application_types = array(
'application/xml',
'application/xml-dtd',
'application/xml-external-parsed-entity');
1303 $text_types = array(
'text/xml',
'text/xml-external-parsed-entity');
1306 if (isset($sniffed))
1308 if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) ===
'application/' && substr($sniffed, -4) ===
'+xml')
1310 if (isset($headers[
'content-type']) && preg_match(
'/;\x20?charset=([^;]*)/i', $headers[
'content-type'], $charset))
1312 $encodings[] = strtoupper($charset[1]);
1314 $encodings = array_merge($encodings, $this->registry->call(
'Misc',
'xml_encoding', array($this->raw_data, &$this->registry)));
1315 $encodings[] =
'UTF-8';
1317 elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) ===
'text/' && substr($sniffed, -4) ===
'+xml')
1319 if (isset($headers[
'content-type']) && preg_match(
'/;\x20?charset=([^;]*)/i', $headers[
'content-type'], $charset))
1321 $encodings[] = $charset[1];
1323 $encodings[] =
'US-ASCII';
1326 elseif (substr($sniffed, 0, 5) ===
'text/')
1328 $encodings[] =
'US-ASCII';
1333 $encodings = array_merge($encodings, $this->registry->call(
'Misc',
'xml_encoding', array($this->raw_data, &$this->registry)));
1334 $encodings[] =
'UTF-8';
1335 $encodings[] =
'ISO-8859-1';
1338 $encodings = array_unique($encodings);
1341 foreach ($encodings as $encoding)
1344 if ($utf8_data = $this->registry->call(
'Misc',
'change_encoding', array($this->raw_data, $encoding,
'UTF-8')))
1347 $parser = $this->registry->create(
'Parser');
1350 if ($parser->parse($utf8_data,
'UTF-8'))
1352 $this->data = $parser->get_data();
1355 $this->
error =
"A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed.";
1356 $this->registry->call(
'Misc',
'error', array($this->
error, E_USER_NOTICE, __FILE__, __LINE__));
1360 if (isset($headers))
1362 $this->data[
'headers'] = $headers;
1369 trigger_error(
"$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
1379 $this->
error = sprintf(
'This XML document is invalid, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1383 $this->
error =
'The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.';
1386 $this->registry->call(
'Misc',
'error', array($this->
error, E_USER_NOTICE, __FILE__, __LINE__));
1404 $this->data =
$cache->load();
1405 if (!empty($this->data))
1408 if (!isset($this->data[
'build']) || $this->data[
'build'] !==
SIMPLEPIE_BUILD)
1411 $this->data = array();
1414 elseif (isset($this->data[
'url']) && $this->data[
'url'] !== $this->feed_url)
1417 $this->data = array();
1420 elseif (isset($this->data[
'feed_url']))
1423 if (
$cache->mtime() + $this->autodiscovery_cache_duration > time())
1426 if ($this->data[
'feed_url'] !== $this->data[
'url'])
1429 return $this->
init();
1433 $this->data = array();
1437 elseif (
$cache->mtime() + $this->cache_duration < time())
1440 if (isset($this->data[
'headers'][
'last-modified']) || isset($this->data[
'headers'][
'etag']))
1443 'Accept' =>
'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
1445 if (isset($this->data[
'headers'][
'last-modified']))
1447 $headers[
'if-modified-since'] = $this->data[
'headers'][
'last-modified'];
1449 if (isset($this->data[
'headers'][
'etag']))
1451 $headers[
'if-none-match'] = $this->data[
'headers'][
'etag'];
1454 $file = $this->registry->create(
'File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->
force_fsockopen));
1458 if (
$file->status_code === 304)
1473 $this->raw_data =
false;
1481 $this->data = array();
1487 if ($this->file instanceof
SimplePie_File && $this->file->url === $this->feed_url)
1494 'Accept' =>
'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
1496 $file = $this->registry->create(
'File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->
force_fsockopen));
1503 return !empty($this->data);
1509 $locate = $this->registry->create(
'Locator', array(&
$file, $this->timeout, $this->useragent, $this->max_checked_feeds));
1511 if (!$locate->is_feed(
$file))
1517 if (!(
$file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
1519 $this->
error =
"A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " .
SIMPLEPIE_NAME .
" was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.";
1520 $this->registry->call(
'Misc',
'error', array($this->
error, E_USER_NOTICE, __FILE__, __LINE__));
1527 $this->
error = $e->getMessage();
1528 $this->registry->call(
'Misc',
'error', array($this->
error, E_USER_NOTICE, $e->getFile(), $e->getLine()));
1533 $this->data = array(
'url' => $this->feed_url,
'feed_url' =>
$file->url,
'build' =>
SIMPLEPIE_BUILD);
1534 if (!
$cache->save($this))
1536 trigger_error(
"$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
1538 $cache = $this->registry->call(
'Cache',
'get_handler', array($this->cache_location, call_user_func($this->cache_name_function,
$file->url),
'spc'));
1540 $this->feed_url =
$file->url;
1545 $this->raw_data =
$file->body;
1547 $headers =
$file->headers;
1548 $sniffer = $this->registry->create(
'Content_Type_Sniffer', array(&
$file));
1549 $sniffed = $sniffer->get_type();
1551 return array($headers, $sniffed);
1585 return $this->
sanitize->output_encoding;
1609 if (!headers_sent())
1611 $header =
"Content-type: $mime;";
1618 $header .=
' charset=UTF-8';
1652 if (!isset($this->data[
'type']))
1666 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'image'])
1667 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'item'])
1668 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_10][
'textinput']))
1673 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'image'])
1674 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'item'])
1675 || isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RDF][
'RDF'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_090][
'textinput']))
1683 if (isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'attribs'][
''][
'version']))
1685 switch (trim($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'attribs'][
''][
'version']))
1689 if (isset($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'skiphours'][
'hour'][0][
'data']))
1691 switch (trim($this->data[
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'rss'][0][
'child'][SIMPLEPIE_NAMESPACE_RSS_20][
'skiphours'][
'hour'][0][
'data']))
1727 return $this->data[
'type'];
1744 if ($this->feed_url !== null)
1847 if (isset($channel[0][
'child'][$namespace][$tag]))
1849 return $channel[0][
'child'][$namespace][$tag];
1857 if (isset($channel[0][
'child'][$namespace][$tag]))
1859 return $channel[0][
'child'][$namespace][$tag];
1867 if (isset($channel[0][
'child'][$namespace][$tag]))
1869 return $channel[0][
'child'][$namespace][$tag];
1897 if (isset($image[0][
'child'][$namespace][$tag]))
1899 return $image[0][
'child'][$namespace][$tag];
1907 if (isset($image[0][
'child'][$namespace][$tag]))
1909 return $image[0][
'child'][$namespace][$tag];
1917 if (isset($image[0][
'child'][$namespace][$tag]))
1919 return $image[0][
'child'][$namespace][$tag];
1942 return $element[
'xml_base'];
1944 elseif ($this->
get_link() !== null)
1981 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_10_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
1985 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_03_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
2023 if (isset($categories[$key]))
2025 return $categories[$key];
2043 $categories = array();
2050 if (isset($category[
'attribs'][
''][
'term']))
2054 if (isset($category[
'attribs'][
''][
'scheme']))
2058 if (isset($category[
'attribs'][
''][
'label']))
2062 $categories[] = $this->registry->create(
'Category', array($term, $scheme, $label));
2069 if (isset($category[
'attribs'][
''][
'domain']))
2077 $categories[] = $this->registry->create(
'Category', array($term, $scheme, null));
2088 if (!empty($categories))
2090 return array_unique($categories);
2108 if (isset($authors[$key]))
2110 return $authors[$key];
2138 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
2142 if (isset($author[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
2146 if ($name !== null || $email !== null || $uri !== null)
2148 $authors[] = $this->registry->create(
'Author', array($name, $uri, $email));
2160 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
2162 $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]));
2164 if (isset($author[0][
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
2168 if ($name !== null || $email !== null || $url !== null)
2170 $authors[] = $this->registry->create(
'Author', array($name, $url, $email));
2186 if (!empty($authors))
2188 return array_unique($authors);
2206 if (isset($contributors[$key]))
2208 return $contributors[$key];
2226 $contributors = array();
2236 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'uri'][0][
'data']))
2238 $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]));
2240 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_10][
'email'][0][
'data']))
2244 if ($name !== null || $email !== null || $uri !== null)
2246 $contributors[] = $this->registry->create(
'Author', array($name, $uri, $email));
2258 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'url'][0][
'data']))
2260 $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]));
2262 if (isset($contributor[
'child'][SIMPLEPIE_NAMESPACE_ATOM_03][
'email'][0][
'data']))
2266 if ($name !== null || $email !== null || $url !== null)
2268 $contributors[] = $this->registry->create(
'Author', array($name, $url, $email));
2272 if (!empty($contributors))
2274 return array_unique($contributors);
2293 if (isset($links[$key]))
2295 return $links[$key];
2330 if (!isset($this->data[
'links']))
2332 $this->data[
'links'] = array();
2335 foreach ($links as $link)
2337 if (isset($link[
'attribs'][
''][
'href']))
2339 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
2346 foreach ($links as $link)
2348 if (isset($link[
'attribs'][
''][
'href']))
2350 $link_rel = (isset($link[
'attribs'][
''][
'rel'])) ? $link[
'attribs'][
''][
'rel'] :
'alternate';
2369 $keys = array_keys($this->data[
'links']);
2370 foreach ($keys as $key)
2372 if ($this->registry->call(
'Misc',
'is_isegment_nz_nc', array($key)))
2386 $this->data[
'links'][substr($key, 41)] =& $this->data[
'links'][$key];
2388 $this->data[
'links'][$key] = array_unique($this->data[
'links'][$key]);
2392 if (isset($this->data[
'links'][$rel]))
2394 return $this->data[
'links'][$rel];
2420 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_10_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
2424 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_03_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
2472 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_10_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
2476 return $this->
sanitize($return[0][
'data'], $this->registry->call(
'Misc',
'atom_03_construct_type', array($return[0][
'attribs'])), $this->
get_base($return[0]));
2530 elseif (isset($this->data[
'headers'][
'content-language']))
2557 return (
float) $return[0][
'data'];
2561 return (
float) $match[1];
2585 return (
float) $return[0][
'data'];
2589 return (
float) $return[0][
'data'];
2593 return (
float) $match[2];
2727 return round($return[0][
'data']);
2753 return round($return[0][
'data']);
2784 return ($qty > $max) ? $max : $qty;
2803 if (isset($items[$key]))
2805 return $items[$key];
2828 if (!isset($this->data[
'items']))
2830 if (!empty($this->multifeed_objects))
2832 $this->data[
'items'] =
SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
2836 $this->data[
'items'] = array();
2839 $keys = array_keys($items);
2840 foreach ($keys as $key)
2842 $this->data[
'items'][] = $this->registry->create(
'Item', array($this, $items[$key]));
2847 $keys = array_keys($items);
2848 foreach ($keys as $key)
2850 $this->data[
'items'][] = $this->registry->create(
'Item', array($this, $items[$key]));
2855 $keys = array_keys($items);
2856 foreach ($keys as $key)
2858 $this->data[
'items'][] = $this->registry->create(
'Item', array($this, $items[$key]));
2863 $keys = array_keys($items);
2864 foreach ($keys as $key)
2866 $this->data[
'items'][] = $this->registry->create(
'Item', array($this, $items[$key]));
2871 $keys = array_keys($items);
2872 foreach ($keys as $key)
2874 $this->data[
'items'][] = $this->registry->create(
'Item', array($this, $items[$key]));
2880 if (!empty($this->data[
'items']))
2883 if ($this->order_by_date && empty($this->multifeed_objects))
2885 if (!isset($this->data[
'ordered_items']))
2888 foreach ($this->data[
'items'] as $item)
2890 if (!$item->get_date(
'U'))
2897 $this->data[
'ordered_items'] = $this->data[
'items'];
2900 usort($this->data[
'ordered_items'], array(get_class($this),
'sort_items'));
2903 $items = $this->data[
'ordered_items'];
2907 $items = $this->data[
'items'];
2913 return array_slice($items, $start);
2917 return array_slice($items, $start, $end);
2933 $level = defined(
'E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
2934 trigger_error(
'Favicon handling has been removed, please use your own handling', $level);
2945 $level = defined(
'E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
2946 trigger_error(
'Favicon handling has been removed, please use your own handling', $level);
2948 if (($url = $this->
get_link()) !== null)
2950 return 'http://g.etfv.co/' . urlencode($url);
2965 if (strpos($method,
'subscribe_') === 0)
2967 $level = defined(
'E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
2968 trigger_error(
'subscribe_*() has been deprecated, implement the callback yourself', $level);
2971 if ($method ===
'enable_xml_dump')
2973 $level = defined(
'E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
2974 trigger_error(
'enable_xml_dump() has been deprecated, use get_raw_data() instead', $level);
2978 $class = get_class($this);
2979 $trace = debug_backtrace();
2980 $file = $trace[0][
'file'];
2981 $line = $trace[0][
'line'];
2982 trigger_error(
"Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
2995 return $a->get_date(
'U') <= $b->get_date(
'U');
3011 public static function merge_items($urls, $start = 0, $end = 0, $limit = 0)
3013 if (is_array($urls) &&
sizeof($urls) > 0)
3016 foreach ($urls as $arg)
3020 $items = array_merge($items, $arg->get_items(0, $limit));
3024 trigger_error(
'Arguments must be SimplePie objects', E_USER_WARNING);
3029 foreach ($items as $item)
3031 if (!$item->get_date(
'U'))
3040 usort($items, array(get_class($urls[0]),
'sort_items'));
3045 return array_slice($items, $start);
3049 return array_slice($items, $start, $end);
3054 trigger_error(
'Cannot merge zero SimplePie objects', E_USER_WARNING);