From fa3317be48f0d255ddba75d5ae45b86c163016cc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 23 Mar 2010 14:38:58 +0300 Subject: allow filtering by article author (bump schema) --- functions.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index a1aabf9a5..28f49b61e 100644 --- a/functions.php +++ b/functions.php @@ -1181,7 +1181,7 @@ // error_reporting(0); $article_filters = get_article_filters($filters, $entry_title, - $entry_content, $entry_link, $entry_timestamp); + $entry_content, $entry_link, $entry_timestamp, $entry_author); if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) { _debug("update_rss_feed: article filters: "); @@ -1505,7 +1505,7 @@ print ""; } - function get_article_filters($filters, $title, $content, $link, $timestamp) { + function get_article_filters($filters, $title, $content, $link, $timestamp, $author) { $matches = array(); if ($filters["title"]) { @@ -1590,6 +1590,18 @@ } } + if ($filters["author"]) { + foreach ($filters["author"] as $filter) { + $reg_exp = $filter["reg_exp"]; + $inverse = $filter["inverse"]; + if ((!$inverse && preg_match("/$reg_exp/i", $author)) || + ($inverse && !preg_match("/$reg_exp/i", $author))) { + + array_push($matches, array($filter["action"], $filter["action_param"])); + } + } + } + return $matches; } -- cgit v1.2.3