summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-03-28 15:17:44 -0400
committerEvan Prodromou <evan@status.net>2010-03-28 15:17:44 -0400
commit482faf661451b499240eb41234234607355e3aa8 (patch)
treeed680c46fa19539ce2f56c4e8d1720cda4e1a787 /plugins
parent642adc3b00ce5ae6907abf99b8443a5c1ed81f1e (diff)
don't try to get to database at initialize time
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Blacklist/BlacklistPlugin.php34
1 files changed, 16 insertions, 18 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php
index c2b60b7d2..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,7 +259,9 @@ class BlacklistPlugin extends Plugin
private function _checkUrl($url)
{
- foreach ($this->_urlPatterns as $pattern) {
+ $patterns = $this->_getUrlPatterns();
+
+ foreach ($patterns as $pattern) {
if (preg_match("/$pattern/", $url)) {
return false;
}
@@ -286,7 +282,9 @@ class BlacklistPlugin extends Plugin
private function _checkNickname($nickname)
{
- foreach ($this->_nicknamePatterns as $pattern) {
+ $patterns = $this->_getNicknamePatterns();
+
+ foreach ($patterns as $pattern) {
if (preg_match("/$pattern/", $nickname)) {
return false;
}