]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/3rdparty/libraries/simplepie/library/SimplePie/Parser.php
[change] we now use Full-Text RSS 3.1, thank you so much @fivefilters
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / simplepie / library / SimplePie / Parser.php
similarity index 90%
rename from inc/3rdparty/simplepie/SimplePie/Parser.php
rename to inc/3rdparty/libraries/simplepie/library/SimplePie/Parser.php
index 182bf8610ea784ade2f0c40097c5eb17ce0e7f6c..d698552ca7c4536e9b2ff3f3a6cffeb8a36e374e 100644 (file)
@@ -5,7 +5,7 @@
  * A PHP-Based RSS and Atom Feed Framework.
  * Takes the hard work out of managing a complete RSS/Atom solution.
  *
- * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * @package SimplePie
- * @version 1.3-dev
- * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
  * @author Ryan Parman
  * @author Geoffrey Sneddon
  * @author Ryan McCue
  * @link http://simplepie.org/ SimplePie
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @todo phpDoc comments
  */
 
-
+/**
+ * Parses XML into something sane
+ *
+ *
+ * This class can be overloaded with {@see SimplePie::set_parser_class()}
+ *
+ * @package SimplePie
+ * @subpackage Parsing
+ */
 class SimplePie_Parser
 {
        var $error_code;
@@ -61,6 +68,12 @@ class SimplePie_Parser
        var $datas = array(array());
        var $current_xhtml_construct = -1;
        var $encoding;
+       protected $registry;
+
+       public function set_registry(SimplePie_Registry $registry)
+       {
+               $this->registry = $registry;
+       }
 
        public function parse(&$data, $encoding)
        {
@@ -103,7 +116,7 @@ class SimplePie_Parser
 
                if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
                {
-                       $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                       $declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
                        if ($declaration->parse())
                        {
                                $data = substr($data, $pos + 2);
@@ -265,8 +278,12 @@ class SimplePie_Parser
 
                if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['base']))
                {
-                       $this->xml_base[] = SimplePie_Misc::absolutize_url($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base));
-                       $this->xml_base_explicit[] = true;
+                       $base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
+                       if ($base !== false)
+                       {
+                               $this->xml_base[] = $base;
+                               $this->xml_base_explicit[] = true;
+                       }
                }
                else
                {
@@ -305,7 +322,10 @@ class SimplePie_Parser
                        $this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
                        $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));
                        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')
-                       || (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'))
+                       || (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')
+                       || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title')))
+                       || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title')))
+                       || (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title'))))
                        {
                                $this->current_xhtml_construct = 0;
                        }