diff options
Diffstat (limited to 'plugins/Blacklist')
-rw-r--r-- | plugins/Blacklist/BlacklistPlugin.php | 34 | ||||
-rw-r--r-- | plugins/Blacklist/Homepage_blacklist.php | 9 | ||||
-rw-r--r-- | plugins/Blacklist/Nickname_blacklist.php | 9 | ||||
-rw-r--r-- | plugins/Blacklist/blacklistadminpanel.php | 24 |
4 files changed, 16 insertions, 60 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index 63bffe2c6..000834838 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class BlacklistPlugin extends Plugin { const VERSION = STATUSNET_VERSION; @@ -76,13 +75,11 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onCheckSchema() { $schema = Schema::get(); // For storing blacklist patterns for nicknames - $schema->ensureTable('nickname_blacklist', array(new ColumnDef('pattern', 'varchar', @@ -118,7 +115,6 @@ class BlacklistPlugin extends Plugin * * @return array configuration values */ - function _configArray($section, $setting) { $config = common_config($section, $setting); @@ -143,14 +139,13 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onStartRegistrationTry($action) { $homepage = strtolower($action->trimmed('homepage')); if (!empty($homepage)) { if (!$this->_checkUrl($homepage)) { - $msg = sprintf(_m("You may not register with homepage '%s'"), + $msg = sprintf(_m("You may not register with homepage '%s'."), $homepage); throw new ClientException($msg); } @@ -160,7 +155,7 @@ class BlacklistPlugin extends Plugin if (!empty($nickname)) { if (!$this->_checkNickname($nickname)) { - $msg = sprintf(_m("You may not register with nickname '%s'"), + $msg = sprintf(_m("You may not register with nickname '%s'."), $nickname); throw new ClientException($msg); } @@ -178,14 +173,13 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onStartProfileSaveForm($action) { $homepage = strtolower($action->trimmed('homepage')); if (!empty($homepage)) { if (!$this->_checkUrl($homepage)) { - $msg = sprintf(_m("You may not use homepage '%s'"), + $msg = sprintf(_m("You may not use homepage '%s'."), $homepage); throw new ClientException($msg); } @@ -195,7 +189,7 @@ class BlacklistPlugin extends Plugin if (!empty($nickname)) { if (!$this->_checkNickname($nickname)) { - $msg = sprintf(_m("You may not use nickname '%s'"), + $msg = sprintf(_m("You may not use nickname '%s'."), $nickname); throw new ClientException($msg); } @@ -213,7 +207,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onStartNoticeSave(&$notice) { common_replace_urls_callback($notice->content, @@ -230,7 +223,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function checkNoticeUrl($url) { // It comes in special'd, so we unspecial it @@ -239,7 +231,7 @@ class BlacklistPlugin extends Plugin $url = htmlspecialchars_decode($url); if (!$this->_checkUrl($url)) { - $msg = sprintf(_m("You may not use url '%s' in notices"), + $msg = sprintf(_m("You may not use UTL \"%s\" in notices."), $url); throw new ClientException($msg); } @@ -256,7 +248,6 @@ class BlacklistPlugin extends Plugin * * @return boolean true means it's OK, false means it's bad */ - private function _checkUrl($url) { $patterns = $this->_getUrlPatterns(); @@ -279,7 +270,6 @@ class BlacklistPlugin extends Plugin * * @return boolean true means it's OK, false means it's bad */ - private function _checkNickname($nickname) { $patterns = $this->_getNicknamePatterns(); @@ -300,7 +290,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook return */ - function onRouterInitialized($m) { $m->connect('admin/blacklist', array('action' => 'blacklistadminpanel')); @@ -314,7 +303,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook return */ - function onAutoload($cls) { switch (strtolower($cls)) @@ -339,7 +327,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onPluginVersion(&$versions) { $versions[] = array('name' => 'Blacklist', @@ -348,7 +335,7 @@ class BlacklistPlugin extends Plugin 'homepage' => 'http://status.net/wiki/Plugin:Blacklist', 'description' => - _m('Keep a blacklist of forbidden nickname '. + _m('Keeps a blacklist of forbidden nickname '. 'and URL patterns.')); return true; } @@ -379,7 +366,6 @@ class BlacklistPlugin extends Plugin * * @return boolean hook value */ - function onEndAdminPanelNav($nav) { if (AdminPanelAction::canAdmin('blacklist')) { @@ -387,8 +373,8 @@ class BlacklistPlugin extends Plugin $action_name = $nav->action->trimmed('action'); $nav->out->menuItem(common_local_url('blacklistadminpanel'), - _('Blacklist'), - _('Blacklist configuration'), + _m('Blacklist'), + _m('Blacklist configuration'), $action_name == 'blacklistadminpanel', 'nav_blacklist_admin_panel'); } @@ -414,7 +400,7 @@ class BlacklistPlugin extends Plugin $action->elementStart('li'); $this->checkboxAndText($action, 'blacklistnickname', - _('Add this nickname pattern to blacklist'), + _m('Add this nickname pattern to blacklist'), 'blacklistnicknamepattern', $this->patternizeNickname($user->nickname)); $action->elementEnd('li'); @@ -423,7 +409,7 @@ class BlacklistPlugin extends Plugin $action->elementStart('li'); $this->checkboxAndText($action, 'blacklisthomepage', - _('Add this homepage pattern to blacklist'), + _m('Add this homepage pattern to blacklist'), 'blacklisthomepagepattern', $this->patternizeHomepage($profile->homepage)); $action->elementEnd('li'); diff --git a/plugins/Blacklist/Homepage_blacklist.php b/plugins/Blacklist/Homepage_blacklist.php index ec89ee4bd..2820294fa 100644 --- a/plugins/Blacklist/Homepage_blacklist.php +++ b/plugins/Blacklist/Homepage_blacklist.php @@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ - class Homepage_blacklist extends Memcached_DataObject { public $__table = 'homepage_blacklist'; // table name @@ -62,7 +61,6 @@ class Homepage_blacklist extends Memcached_DataObject * @return Homepage_blacklist object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Homepage_blacklist', $k, $v); @@ -76,7 +74,6 @@ class Homepage_blacklist extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('pattern' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, @@ -91,7 +88,6 @@ class Homepage_blacklist extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array_keys($this->keyTypes()); @@ -105,7 +101,6 @@ class Homepage_blacklist extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('pattern' => 'K'); @@ -116,7 +111,6 @@ class Homepage_blacklist extends Memcached_DataObject * * @return array string patterns to check */ - static function getPatterns() { $patterns = self::cacheGet('homepage_blacklist:patterns'); @@ -144,17 +138,14 @@ class Homepage_blacklist extends Memcached_DataObject * * @return array of patterns to check */ - static function saveNew($newPatterns) { $oldPatterns = self::getPatterns(); // Delete stuff that's old that not in new - $toDelete = array_diff($oldPatterns, $newPatterns); // Insert stuff that's in new and not in old - $toInsert = array_diff($newPatterns, $oldPatterns); foreach ($toDelete as $pattern) { diff --git a/plugins/Blacklist/Nickname_blacklist.php b/plugins/Blacklist/Nickname_blacklist.php index e8545292d..d5d46a949 100644 --- a/plugins/Blacklist/Nickname_blacklist.php +++ b/plugins/Blacklist/Nickname_blacklist.php @@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ - class Nickname_blacklist extends Memcached_DataObject { public $__table = 'nickname_blacklist'; // table name @@ -62,7 +61,6 @@ class Nickname_blacklist extends Memcached_DataObject * @return Nickname_blacklist object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Nickname_blacklist', $k, $v); @@ -73,7 +71,6 @@ class Nickname_blacklist extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('pattern' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, @@ -85,7 +82,6 @@ class Nickname_blacklist extends Memcached_DataObject * * @return array key definitions */ - function keys() { return array_keys($this->keyTypes()); @@ -96,7 +92,6 @@ class Nickname_blacklist extends Memcached_DataObject * * @return array key definitions */ - function keyTypes() { return array('pattern' => 'K'); @@ -107,7 +102,6 @@ class Nickname_blacklist extends Memcached_DataObject * * @return array string patterns to check */ - static function getPatterns() { $patterns = self::cacheGet('nickname_blacklist:patterns'); @@ -135,17 +129,14 @@ class Nickname_blacklist extends Memcached_DataObject * * @return array of patterns to check */ - static function saveNew($newPatterns) { $oldPatterns = self::getPatterns(); // Delete stuff that's old that not in new - $toDelete = array_diff($oldPatterns, $newPatterns); // Insert stuff that's in new and not in old - $toInsert = array_diff($newPatterns, $oldPatterns); foreach ($toDelete as $pattern) { diff --git a/plugins/Blacklist/blacklistadminpanel.php b/plugins/Blacklist/blacklistadminpanel.php index 4289dec1b..9019bb9ad 100644 --- a/plugins/Blacklist/blacklistadminpanel.php +++ b/plugins/Blacklist/blacklistadminpanel.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ - class BlacklistadminpanelAction extends AdminPanelAction { /** @@ -48,10 +47,9 @@ class BlacklistadminpanelAction extends AdminPanelAction * * @return string title */ - function title() { - return _('Blacklist'); + return _m('Blacklist'); } /** @@ -59,10 +57,9 @@ class BlacklistadminpanelAction extends AdminPanelAction * * @return string instructions */ - function getInstructions() { - return _('Blacklisted URLs and nicknames'); + return _m('Blacklisted URLs and nicknames'); } /** @@ -72,7 +69,6 @@ class BlacklistadminpanelAction extends AdminPanelAction * * @see BlacklistAdminPanelForm */ - function showForm() { $form = new BlacklistAdminPanelForm($this); @@ -85,7 +81,6 @@ class BlacklistadminpanelAction extends AdminPanelAction * * @return void */ - function saveSettings() { $nickPatterns = $this->splitPatterns($this->trimmed('blacklist-nicknames')); @@ -116,7 +111,6 @@ class BlacklistadminpanelAction extends AdminPanelAction * * @return boolean success flag */ - function validate(&$values) { return true; @@ -132,7 +126,6 @@ class BlacklistadminpanelAction extends AdminPanelAction * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ - class BlacklistAdminPanelForm extends Form { /** @@ -140,7 +133,6 @@ class BlacklistAdminPanelForm extends Form * * @return string ID */ - function id() { return 'blacklistadminpanel'; @@ -151,7 +143,6 @@ class BlacklistAdminPanelForm extends Form * * @return string class */ - function formClass() { return 'form_settings'; @@ -162,7 +153,6 @@ class BlacklistAdminPanelForm extends Form * * @return string action URL */ - function action() { return common_local_url('blacklistadminpanel'); @@ -173,7 +163,6 @@ class BlacklistAdminPanelForm extends Form * * @return void */ - function formData() { $this->out->elementStart('ul', 'form_data'); @@ -184,7 +173,7 @@ class BlacklistAdminPanelForm extends Form $this->out->textarea('blacklist-nicknames', _m('Nicknames'), implode("\r\n", $nickPatterns), - _('Patterns of nicknames to block, one per line')); + _m('Patterns of nicknames to block, one per line')); $this->out->elementEnd('li'); $urlPatterns = Homepage_blacklist::getPatterns(); @@ -192,7 +181,7 @@ class BlacklistAdminPanelForm extends Form $this->out->elementStart('li'); $this->out->textarea('blacklist-urls', _m('URLs'), implode("\r\n", $urlPatterns), - _('Patterns of URLs to block, one per line')); + _m('Patterns of URLs to block, one per line')); $this->out->elementEnd('li'); $this->out->elementEnd('ul'); @@ -203,13 +192,12 @@ class BlacklistAdminPanelForm extends Form * * @return void */ - function formActions() { $this->out->submit('submit', - _('Save'), + _m('Save'), 'submit', null, - _('Save site settings')); + _m('Save site settings')); } } |