summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-03-23 11:48:53 +0000
committerDries Buytaert <dries@buytaert.net>2003-03-23 11:48:53 +0000
commit016b8336f86fe5a1204153dfb30e82eb98d4bc02 (patch)
tree39fef8a3c7f3902a87467c5be3683fe78a7c927b /modules/aggregator
parente2ab17fbaee2372714866801c31e27494a2f1f65 (diff)
downloadbrdo-016b8336f86fe5a1204153dfb30e82eb98d4bc02.tar.gz
brdo-016b8336f86fe5a1204153dfb30e82eb98d4bc02.tar.bz2
- Bugfix: ignore "textinput" and "image" tags, for now. Reported by Al Maw.
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.module47
1 files changed, 37 insertions, 10 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 606d2eb18..a9255357a 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -167,10 +167,16 @@ function import_remove($feed) {
// Call-back function used by XML parser:
function import_element_start($parser, $name, $attributes) {
- global $item, $tag;
+ global $item, $element, $tag;
- if ($name == "ITEM") {
- $item += 1;
+ switch ($name) {
+ case "IMAGE":
+ case "TEXTINPUT":
+ $element = $name;
+ break;
+ case "ITEM":
+ $element = $name;
+ $item += 1;
}
$tag = $name;
@@ -178,17 +184,34 @@ function import_element_start($parser, $name, $attributes) {
// Call-back function used by XML parser:
function import_element_end($parser, $name) {
+ global $element;
+
+ switch ($name) {
+ case "IMAGE":
+ case "TEXTINPUT":
+ case "ITEM":
+ $element = "";
+ }
}
// Call-back function used by XML parser:
function import_element_data($parser, $data) {
- global $channel, $items, $item, $tag;
-
- if ($item) {
- $items[$item][$tag] .= $data;
- }
- else {
- $channel[$tag] .= $data;
+ global $channel, $element, $items, $item, $tag;
+
+ switch ($element) {
+ case "ITEM":
+ $items[$item][$tag] .= $data;
+ break;
+ case "IMAGE":
+ case "TEXTINPUT":
+ /*
+ ** The sub-elements "image" and "textinput" are not supported
+ ** but we have recognize them or their content will end up in
+ ** the items-array.
+ */
+ break;
+ default:
+ $channel[$tag] .= $data;
}
}
@@ -216,6 +239,10 @@ function import_refresh($feed) {
}
fclose($fp);
+ // unset the global variables:
+ unset($GLOBALS["channel"], $GLOBAL["element"], $GLOBALS["item"], $GLOBAL["items"]);
+
+ // parse the data:
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "import_element_start", "import_element_end");
xml_set_character_data_handler($xml_parser, "import_element_data");