2 rcs_id('$Id: RssParser.php,v 1.7 2004-05-24 17:31:31 rurban Exp $');
4 * Simple RSSParser Class
5 * Based on Duncan Gough RSSParser class
6 * Copyleft Arnaud Fontaine
8 * See lib/plugin/RssFeed.php and lib/XmlParser.php
12 This file is part of PhpWiki.
14 PhpWiki is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
19 PhpWiki is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with PhpWiki; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 * 2004-04-09 16:30:50 rurban:
31 * added fsockopen allow_url_fopen = Off workaround
32 * 2004-04-12 20:04:12 rurban:
33 * fixes for IMAGE element (sf.net)
36 require_once('lib/XmlParser.php');
43 var $description = "";
44 var $inside_item = false;
47 var $channel = array();
51 function tag_open($parser, $name, $attrs=''){
56 $this->inside_item = true;
57 elseif ($name == "IMAGE")
58 $this->inside_item = true;
61 function tag_close($parser, $tagName, $attrs=''){
64 if ($tagName == "ITEM") {
65 $this->items[] = array("title" => $this->item['TITLE'],
66 "description" => $this->item['DESCRIPTION'],
67 "link" => $this->item['LINK']);
68 $this->item['TITLE'] = "";
69 $this->item['DESCRIPTION'] = "";
70 $this->item['LINK'] = "";
71 $this->inside_item = false;
72 } elseif ($tagName == "IMAGE") {
73 $this->item['TITLE'] = "";
74 $this->item['DESCRIPTION'] = "";
75 $this->item['LINK'] = "";
76 $this->inside_item = false;
77 } elseif ($tagName == "CHANNEL") {
78 $this->channel = array("title" => $this->title,
79 "description" => $this->description,
80 "link" => $this->link,
81 "date" => $this->date,
82 "divers" => $this->divers);
84 $this->description = "";
91 function cdata($parser, $data){
94 if ($this->inside_item) {
95 if (empty($this->item[$current_tag]))
96 $this->item[$current_tag] = '';
97 if ($current_tag == 'LINK') {
99 $this->item[$current_tag] = trim($data);
101 $this->item[$current_tag] .= trim($data);
104 switch ($current_tag) {
107 $this->title .= " " . trim($data);
111 $this->description .= trim($data);
115 $this->link = trim($data);
119 $this->date .= " " . trim($data);
122 $this->divers .= " " . $current_tag."/".$data;
129 // $Log: not supported by cvs2svn $
130 // Revision 1.6 2004/05/18 16:18:36 rurban
131 // AutoSplit at subpage seperators
132 // RssFeed stability fix for empty feeds or broken connections
134 // Revision 1.5 2004/04/26 20:44:34 rurban
135 // locking table specific for better databases
137 // Revision 1.4 2004/04/18 01:11:51 rurban
138 // more numeric pagename fixes.
139 // fixed action=upload with merge conflict warnings.
140 // charset changed from constant to global (dynamic utf-8 switching)
148 // c-hanging-comment-ender-p: nil
149 // indent-tabs-mode: nil