wordfilter -> simpleext

This commit is contained in:
Shish 2012-01-30 03:39:00 +00:00
parent 18d6fa317c
commit 0ea3ff5af3

View File

@ -6,21 +6,20 @@
* Description: Simple search and replace * Description: Simple search and replace
*/ */
class WordFilter implements Extension { class WordFilter extends SimpleExtension {
// before emoticon filter // before emoticon filter
public function get_priority() {return 40;} public function get_priority() {return 40;}
public function receive_event(Event $event) { public function onTextFormatting($event) {
if($event instanceof TextFormattingEvent) { $event->formatted = $this->filter($event->formatted);
$event->formatted = $this->filter($event->formatted); $event->stripped = $this->filter($event->stripped);
$event->stripped = $this->filter($event->stripped); }
}
if(($event instanceof SetupBuildingEvent)) { public function onSetupBuilding($event) {
$sb = new SetupBlock("Word Filter"); $sb = new SetupBlock("Word Filter");
$sb->add_longtext_option("word_filter"); $sb->add_longtext_option("word_filter");
$sb->add_label("<br>(each line should be search term and replace term, separated by a comma)"); $sb->add_label("<br>(each line should be search term and replace term, separated by a comma)");
$event->panel->add_block($sb); $event->panel->add_block($sb);
}
} }
private function filter($text) { private function filter($text) {