git-svn-id: file:///home/shish/svn/shimmie2/trunk@1002 7f39781d-f577-437e-ae19-be835c7a54ca
		
			
				
	
	
		
			25 lines
		
	
	
		
			555 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			555 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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);
 | 
						|
}
 | 
						|
?>
 |