2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2007-12-06 11:01:18 +00:00
|
|
|
/*
|
|
|
|
* A generic extension class, for subclassing
|
|
|
|
*/
|
2008-08-23 12:05:24 +00:00
|
|
|
interface Extension {
|
|
|
|
public function receive_event(Event $event);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Several extensions have this in common, make a common API
|
|
|
|
*/
|
|
|
|
abstract class FormatterExtension implements Extension {
|
|
|
|
public function receive_event(Event $event) {
|
|
|
|
if($event instanceof TextFormattingEvent) {
|
|
|
|
$event->formatted = $this->format($event->formatted);
|
|
|
|
$event->stripped = $this->strip($event->stripped);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract public function format($text);
|
|
|
|
abstract public function strip($text);
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
?>
|