From 3cea92fae68499d07c7d045a2bb9825f854f4b3a Mon Sep 17 00:00:00 2001 From: umorigu Date: Sat, 21 Oct 2017 15:07:48 +0900 Subject: [PATCH] BugTrack/2444 showrss plugin support RSS/Atom --- plugin/showrss.inc.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugin/showrss.inc.php b/plugin/showrss.inc.php index a42157f..29415f4 100644 --- a/plugin/showrss.inc.php +++ b/plugin/showrss.inc.php @@ -281,26 +281,33 @@ class ShowRSS_XML // Tag start function start_element($parser, $name, $attrs) { - if ($this->is_item) { - $this->tag = $name; - } else if ($name == 'ITEM') { - $this->is_item = TRUE; + if ($this->is_item !== FALSE) { + $this->tag = $name; + if ($this->is_item === 'ENTRY' && $name === 'LINK' && isset($attrs['HREF'])) { + if (! isset($this->item[$name])) $this->item[$name] = ''; + $this->item[$name] .= $attrs['HREF']; + } + } else if ($name === 'ITEM') { + $this->is_item = 'ITEM'; + } else if ($name === 'ENTRY') { + $this->is_item = 'ENTRY'; } } // Tag end function end_element($parser, $name) { - if (! $this->is_item || $name != 'ITEM') return; + if ($this->is_item === FALSE || $name !== $this->is_item) return; $item = array_map(array(& $this, 'escape'), $this->item); $this->item = array(); if (isset($item['DC:DATE'])) { $time = plugin_showrss_get_timestamp($item['DC:DATE'], $this->modified_date); - } else if (isset($item['PUBDATE'])) { $time = plugin_showrss_get_timestamp($item['PUBDATE'], $this->modified_date); + } else if (isset($item['UPDATED'])) { + $time = plugin_showrss_get_timestamp($item['UPDATED'], $this->time); } else { $time_from_desc = FALSE; if (isset($item['DESCRIPTION']) && @@ -322,7 +329,7 @@ class ShowRSS_XML function character_data($parser, $data) { - if (! $this->is_item) return; + if ($this->is_item === FALSE) return; if (! isset($this->item[$this->tag])) $this->item[$this->tag] = ''; $this->item[$this->tag] .= $data; } -- 2.11.0