drop BACKEND_RSS_TYPE from update_rss_feed, support detection of dc:subject as tags in Atom feeds

This commit is contained in:
Andrew Dolgov 2006-12-25 08:53:57 +01:00
parent 8fd2dc95ba
commit be832a1a56
1 changed files with 98 additions and 79 deletions

View File

@ -488,8 +488,6 @@
foreach ($iterator as $item) {
if (RSS_BACKEND_TYPE == "magpie") {
$entry_guid = $item["id"];
if (!$entry_guid) $entry_guid = $item["guid"];
@ -537,7 +535,7 @@
if (!$entry_content) $entry_content = $item["summary"];
if (!$entry_content) $entry_content = $item["description"];
// if (!$entry_content) continue;
// if (!$entry_content) continue;
// WTF
if (is_array($entry_content)) {
@ -545,9 +543,9 @@
if (!$entry_content) $entry_content = $entry_content["escaped"];
}
// print_r($item);
// print_r(htmlspecialchars($entry_content));
// print "<br>";
// print_r($item);
// print_r(htmlspecialchars($entry_content));
// print "<br>";
$entry_content_unescaped = $entry_content;
$content_hash = "SHA1:" . sha1(strip_tags($entry_content));
@ -573,6 +571,15 @@
$num_comments = db_escape_string($item["slash"]["comments"]);
if (!$num_comments) $num_comments = 0;
$dc_subject = $item['dc']['subject'];
$subject_tags = false;
if (is_array($dc_subject)) {
$subject_tags = $dc_subject;
} else if ($dc_subject) {
$subject_tags = array($dc_subject);
}
# sanitize content
@ -762,7 +769,15 @@
$manual_tags = trim_array(split(",", $filter_param));
foreach ($manual_tags as $tag) {
if (!preg_match("/^[0-9]*$/", $tag) && $tag != '') {
if (tag_is_valid($tag)) {
array_push($entry_tags, $tag);
}
}
}
if ($subject_tags) {
foreach ($subject_tags as $tag) {
if (tag_is_valid($tag)) {
array_push($entry_tags, $tag);
}
}
@ -3112,4 +3127,8 @@
return $tmp;
}
function tag_is_valid($tag) {
return ($tag !='' && !preg_match("/^[0-9]*$/", $tag));
}
?>