From 0ea3ff5af39e1183ad13738be71cf157f4a1f831 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 30 Jan 2012 03:39:00 +0000 Subject: [PATCH] wordfilter -> simpleext --- contrib/word_filter/main.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/contrib/word_filter/main.php b/contrib/word_filter/main.php index 5e4cddd2..1ce8e259 100644 --- a/contrib/word_filter/main.php +++ b/contrib/word_filter/main.php @@ -6,21 +6,20 @@ * Description: Simple search and replace */ -class WordFilter implements Extension { +class WordFilter extends SimpleExtension { // before emoticon filter public function get_priority() {return 40;} - public function receive_event(Event $event) { - if($event instanceof TextFormattingEvent) { - $event->formatted = $this->filter($event->formatted); - $event->stripped = $this->filter($event->stripped); - } - if(($event instanceof SetupBuildingEvent)) { - $sb = new SetupBlock("Word Filter"); - $sb->add_longtext_option("word_filter"); - $sb->add_label("
(each line should be search term and replace term, separated by a comma)"); - $event->panel->add_block($sb); - } + public function onTextFormatting($event) { + $event->formatted = $this->filter($event->formatted); + $event->stripped = $this->filter($event->stripped); + } + + public function onSetupBuilding($event) { + $sb = new SetupBlock("Word Filter"); + $sb->add_longtext_option("word_filter"); + $sb->add_label("
(each line should be search term and replace term, separated by a comma)"); + $event->panel->add_block($sb); } private function filter($text) {