more readable spoilers
git-svn-id: file:///home/shish/svn/shimmie2/trunk@693 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
		
							parent
							
								
									3e25a08db2
								
							
						
					
					
						commit
						52bdd38cfd
					
				| @ -10,11 +10,18 @@ class Spoiler extends Extension { | |||||||
| 	public function receive_event($event) { | 	public function receive_event($event) { | ||||||
| 		if(is_a($event, 'TextFormattingEvent')) { | 		if(is_a($event, 'TextFormattingEvent')) { | ||||||
| 			$event->formatted = $this->filter($event->formatted); | 			$event->formatted = $this->filter($event->formatted); | ||||||
| 			$event->stripped  = $this->filter($event->stripped); | 			$event->stripped  = $this->strip($event->stripped); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private function filter($text) { | 	private function filter($text) { | ||||||
|  | 		return str_replace( | ||||||
|  | 			array("[spoiler]","[/spoiler]"), | ||||||
|  | 			array("<span style=\"background-color:#000; color:#000;\">","</span>"), | ||||||
|  | 			$text); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	private function strip($text) { | ||||||
| 		$l1 = strlen("[spoiler]"); | 		$l1 = strlen("[spoiler]"); | ||||||
| 		$l2 = strlen("[/spoiler]"); | 		$l2 = strlen("[/spoiler]"); | ||||||
| 		while(true) { | 		while(true) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user