2007-07-08 19:57:57 +00:00
|
|
|
<?php
|
2009-08-20 23:37:17 +01:00
|
|
|
/*
|
2007-07-08 20:21:21 +00:00
|
|
|
* Name: Emoticon Filter
|
|
|
|
* Author: Shish <webmaster@shishnet.org>
|
|
|
|
* License: GPLv2
|
2009-01-16 00:18:41 -08:00
|
|
|
* Description: Lets users use graphical smilies
|
|
|
|
* Documentation:
|
|
|
|
* This extension will turn colon-something-colon into a link
|
|
|
|
* to an image with that something as the name, eg :smile:
|
|
|
|
* becomes a link to smile.gif
|
|
|
|
* <p>Images are stored in /ext/emoticons/default/, and you can
|
|
|
|
* add more emoticons by uploading images into that folder.
|
2007-07-08 20:21:21 +00:00
|
|
|
*/
|
2007-07-08 19:57:57 +00:00
|
|
|
|
2009-01-04 08:33:32 -08:00
|
|
|
class Emoticons extends FormatterExtension {
|
|
|
|
public function format($text) {
|
2007-07-16 21:30:28 +00:00
|
|
|
$data_href = get_base_href();
|
2007-07-08 19:57:57 +00:00
|
|
|
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
2009-01-04 08:33:32 -08:00
|
|
|
public function strip($text) {
|
2007-07-08 19:57:57 +00:00
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_event_listener(new Emoticons());
|
2009-08-08 17:43:18 +01:00
|
|
|
|
|
|
|
class EmoticonList extends SimpleExtension {
|
|
|
|
public function onPageRequest($event) {
|
|
|
|
if($event->page_matches("emote/list")) {
|
|
|
|
$this->theme->display_emotes(glob("ext/emoticons/default/*"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-07-08 19:57:57 +00:00
|
|
|
?>
|