This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/core/extension.class.php

25 lines
555 B
PHP
Raw Normal View History

<?php
/*
* A generic extension class, for subclassing
*/
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);
}
?>