]> git.wh0rd.org Git - tt-rss.git/commitdiff
category parsing fixes
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 20 Nov 2007 05:29:12 +0000 (06:29 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 20 Nov 2007 05:29:12 +0000 (06:29 +0100)
functions.php

index acfc88db5a68e1390f150fa3ccef0686500ae724..943e5fb0d6197db669beea10f5cf630d0c05e320 100644 (file)
 
                        foreach ($iterator as $item) {
 
+                               print_r($item);
+
                                if (ENABLE_SIMPLEPIE) {
                                        $entry_guid = $item->get_id();
                                        if (!$entry_guid) $entry_guid = $item->get_link();
        
                                        if ($t_ctr == 0) {
                                                $additional_tags = false;
-                                       } else if ($t_ctr == 1) {
+                                       } else if ($t_ctr > 0) {
                                                $additional_tags = array($item['category']);
-                                       } else {
-                                               $additional_tags = array();
+
+                                               if ($item['category@term']) {
+                                                       array_push($additional_tags, $item['category@term']);
+                                               }
+
                                                for ($i = 0; $i <= $t_ctr; $i++ ) {
                                                        if ($item["category#$i"]) {
                                                                array_push($additional_tags, $item["category#$i"]);
                                                        }
+
+                                                       if ($item["category#$i@term"]) {
+                                                               array_push($additional_tags, $item["category#$i@term"]);
+                                                       }
                                                }
                                        }
        
        
                                        $t_ctr = $item['dc']['subject#'];
        
-                                       if ($t_ctr == 1) {
+                                       if ($t_ctr > 0) {
                                                $additional_tags = array($item['dc']['subject']);
-                                       } else if ($t_ctr > 1) {
-                                               $additional_tags = array();
+
                                                for ($i = 0; $i <= $t_ctr; $i++ ) {
                                                        if ($item['dc']["subject#$i"]) {
                                                                array_push($additional_tags, $item['dc']["subject#$i"]);
 
                                                array_push($enclosures, $e_item);
 
-                                               for ($i = 2; $i <= $e_ctr; $i++ ) {
-                                                       $e_item = array($item["enclosure#$i@url"],
-                                                               $item["enclosure#$i@type"],
-                                                               $item["enclosure#$i@length"]);
-                                                       array_push($enclosures, $e_item);
+                                               for ($i = 0; $i <= $e_ctr; $i++ ) {
+
+                                                       if ($item["enclosure#$i@url"]) {
+                                                               $e_item = array($item["enclosure#$i@url"],
+                                                                       $item["enclosure#$i@type"],
+                                                                       $item["enclosure#$i@length"]);
+                                                               array_push($enclosures, $e_item);
+                                                       }
                                                }
                                        }