emoticons formatter

git-svn-id: file:///home/shish/svn/shimmie2/trunk@243 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-08 19:57:57 +00:00
parent ffcf86df17
commit ef412f6efd
24 changed files with 24 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

BIN
contrib/emoticons/default/cry.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

BIN
contrib/emoticons/default/eek.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

BIN
contrib/emoticons/default/lol.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

BIN
contrib/emoticons/default/mad.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

BIN
contrib/emoticons/default/sad.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

View file

@ -0,0 +1,24 @@
<?php
class Emoticons extends Extension {
public function receive_event($event) {
if(is_a($event, 'TextFormattingEvent')) {
$event->formatted = $this->bbcode_to_html($event->formatted);
$event->stripped = $this->bbcode_to_text($event->stripped);
}
}
private function bbcode_to_html($text) {
global $config;
$data_href = $config->get_string("data_href");
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
return $text;
}
private function bbcode_to_text($text) {
$text = preg_replace("/:([a-z]*?):/s", "\\1", $text);
return $text;
}
}
add_event_listener(new Emoticons());
?>