修订版 | 3cea92fae68499d07c7d045a2bb9825f854f4b3a (tree) |
---|---|
时间 | 2017-10-21 15:07:48 |
作者 | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2444 showrss plugin support RSS/Atom
@@ -281,26 +281,33 @@ class ShowRSS_XML | ||
281 | 281 | // Tag start |
282 | 282 | function start_element($parser, $name, $attrs) |
283 | 283 | { |
284 | - if ($this->is_item) { | |
285 | - $this->tag = $name; | |
286 | - } else if ($name == 'ITEM') { | |
287 | - $this->is_item = TRUE; | |
284 | + if ($this->is_item !== FALSE) { | |
285 | + $this->tag = $name; | |
286 | + if ($this->is_item === 'ENTRY' && $name === 'LINK' && isset($attrs['HREF'])) { | |
287 | + if (! isset($this->item[$name])) $this->item[$name] = ''; | |
288 | + $this->item[$name] .= $attrs['HREF']; | |
289 | + } | |
290 | + } else if ($name === 'ITEM') { | |
291 | + $this->is_item = 'ITEM'; | |
292 | + } else if ($name === 'ENTRY') { | |
293 | + $this->is_item = 'ENTRY'; | |
288 | 294 | } |
289 | 295 | } |
290 | 296 | |
291 | 297 | // Tag end |
292 | 298 | function end_element($parser, $name) |
293 | 299 | { |
294 | - if (! $this->is_item || $name != 'ITEM') return; | |
300 | + if ($this->is_item === FALSE || $name !== $this->is_item) return; | |
295 | 301 | |
296 | 302 | $item = array_map(array(& $this, 'escape'), $this->item); |
297 | 303 | $this->item = array(); |
298 | 304 | |
299 | 305 | if (isset($item['DC:DATE'])) { |
300 | 306 | $time = plugin_showrss_get_timestamp($item['DC:DATE'], $this->modified_date); |
301 | - | |
302 | 307 | } else if (isset($item['PUBDATE'])) { |
303 | 308 | $time = plugin_showrss_get_timestamp($item['PUBDATE'], $this->modified_date); |
309 | + } else if (isset($item['UPDATED'])) { | |
310 | + $time = plugin_showrss_get_timestamp($item['UPDATED'], $this->time); | |
304 | 311 | } else { |
305 | 312 | $time_from_desc = FALSE; |
306 | 313 | if (isset($item['DESCRIPTION']) && |
@@ -322,7 +329,7 @@ class ShowRSS_XML | ||
322 | 329 | |
323 | 330 | function character_data($parser, $data) |
324 | 331 | { |
325 | - if (! $this->is_item) return; | |
332 | + if ($this->is_item === FALSE) return; | |
326 | 333 | if (! isset($this->item[$this->tag])) $this->item[$this->tag] = ''; |
327 | 334 | $this->item[$this->tag] .= $data; |
328 | 335 | } |