diff options
author | Evan Prodromou <evan@status.net> | 2010-03-28 15:25:02 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-03-28 15:25:02 -0400 |
commit | f0d905112ede6e45594b6ceceea3a6af4d9954f9 (patch) | |
tree | 4f10a268f5ea5f93ac3cb558972fed8360ce7993 /plugins/Blacklist/BlacklistPlugin.php | |
parent | 5b7b38ab661c9556800db1e822748b2d0c16d225 (diff) | |
parent | 482faf661451b499240eb41234234607355e3aa8 (diff) |
Merge branch 'master' into 0.9.x
Conflicts:
lib/attachmentlist.php
Diffstat (limited to 'plugins/Blacklist/BlacklistPlugin.php')
-rw-r--r-- | plugins/Blacklist/BlacklistPlugin.php | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index a7d0942da..adc4d9d7e 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -49,32 +49,26 @@ class BlacklistPlugin extends Plugin public $urls = array(); public $canAdmin = true; - private $_nicknamePatterns = array(); - private $_urlPatterns = array(); - - /** - * Initialize the plugin - * - * @return void - */ - - function initialize() + function _getNicknamePatterns() { $confNicknames = $this->_configArray('blacklist', 'nicknames'); $dbNicknames = Nickname_blacklist::getPatterns(); - $this->_nicknamePatterns = array_merge($this->nicknames, - $confNicknames, - $dbNicknames); + return array_merge($this->nicknames, + $confNicknames, + $dbNicknames); + } + function _getUrlPatterns() + { $confURLs = $this->_configArray('blacklist', 'urls'); $dbURLs = Homepage_blacklist::getPatterns(); - $this->_urlPatterns = array_merge($this->urls, - $confURLs, - $dbURLs); + return array_merge($this->urls, + $confURLs, + $dbURLs); } /** @@ -265,8 +259,9 @@ class BlacklistPlugin extends Plugin private function _checkUrl($url) { - foreach ($this->_urlPatterns as $pattern) { - common_debug("Checking $url against $pattern"); + $patterns = $this->_getUrlPatterns(); + + foreach ($patterns as $pattern) { if (preg_match("/$pattern/", $url)) { return false; } @@ -287,8 +282,9 @@ class BlacklistPlugin extends Plugin private function _checkNickname($nickname) { - foreach ($this->_nicknamePatterns as $pattern) { - common_debug("Checking $nickname against $pattern"); + $patterns = $this->_getNicknamePatterns(); + + foreach ($patterns as $pattern) { if (preg_match("/$pattern/", $nickname)) { return false; } |