scorify the emoticons extension
This commit is contained in:
parent
737d2f4268
commit
fc9eddd08b
@ -6,22 +6,14 @@
|
|||||||
* Description: Turn :smile: into a link to smile.gif
|
* Description: Turn :smile: into a link to smile.gif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Emoticons implements Extension {
|
class Emoticons extends FormatterExtension {
|
||||||
public function receive_event(Event $event) {
|
public function format($text) {
|
||||||
if($event instanceof TextFormattingEvent) {
|
|
||||||
$event->formatted = $this->bbcode_to_html($event->formatted);
|
|
||||||
$event->stripped = $this->bbcode_to_text($event->stripped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function bbcode_to_html($text) {
|
|
||||||
$data_href = get_base_href();
|
$data_href = get_base_href();
|
||||||
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
|
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function bbcode_to_text($text) {
|
public function strip($text) {
|
||||||
// $text = preg_replace("/:([a-z]*?):/s", "\\1", $text);
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user