This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/contrib/emoticons/main.php
2009-01-16 00:18:41 -08:00

27 lines
776 B
PHP

<?php
/**
* Name: Emoticon Filter
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* 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.
*/
class Emoticons extends FormatterExtension {
public function format($text) {
$data_href = get_base_href();
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
return $text;
}
public function strip($text) {
return $text;
}
}
add_event_listener(new Emoticons());
?>