Active
Project:
FeedAPI Item Filter
Version:
5.x-0.1
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Aug 2009 at 14:36 UTC
Updated:
20 Feb 2010 at 15:26 UTC
Hi, first thanks for your great work =)
I found a little bug in the keyword filter: a feed item is kept only if it matches a positive keyword. This means that if you only specified a negative keyword, it will not be kept...
Here is my suggestion of patch for feedapi_keyword_filter.module (lines 98+):
// Get through each feed item.
foreach ($feed->items as $key=>$item) {
// If negative keyword has been found then move directly to next item.
foreach ($worldlist['neg'] as $value) {
// Number 2 here means that we are stepping out from both foreach statement.
if (stristr($item->description, $value)) continue 2;
}
// And now we process positive keywords.
$keepitem = false;
// If no positive keyword to match
if (count($worldlist['pos']) == 0) {
$keepitem = true;
} else {
foreach ($worldlist['pos'] as $value) {
if (stristr($item->description, $value)) {
// If keyword found then the item is worth saving.
// And there is no reason to try out remaining keywords --> move to the next item.
$keepitem = true;
continue;
}
}
}
// Keep the item if a positive keyword was matched or no positive keyword to match
if ($keepitem) {
$newfeed[] = $feed->items[$key];
}
} // end of items parsing
Regards,
Julien Nicoulaud
This is still no perfect to me, because
Comments
Comment #1
Ek0 commentedComment #2
Poznii commentedHi, Ek0!
Many thanks for patch.