From: umorigu Date: Sat, 21 Oct 2017 06:07:48 +0000 (+0900) Subject: BugTrack/2444 showrss plugin support RSS/Atom X-Git-Tag: r1_5_4~168 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3cea92fae68499d07c7d045a2bb9825f854f4b3a;p=pukiwiki%2Fpukiwiki.git BugTrack/2444 showrss plugin support RSS/Atom --- 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; }