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/ext/emoticons/main.php

50 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2009-08-20 23:37:17 +01:00
/*
* Name: Emoticon Filter
* Author: Shish <webmaster@shishnet.org>
2012-02-09 23:04:37 -05:00
* Link: http://code.shishnet.org/shimmie2/
* 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.
*/
2014-04-29 17:45:13 -04:00
/**
* Class Emoticons
*/
2009-01-04 08:33:32 -08:00
class Emoticons extends FormatterExtension {
2014-04-29 17:45:13 -04:00
/**
* @param string $text
* @return string
*/
public function format(/*string*/ $text) {
$data_href = get_base_href();
$text = preg_replace("/:([a-z]*?):/s", "<img src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
return $text;
}
2014-04-29 17:45:13 -04:00
/**
* @param string $text
* @return string
*/
public function strip(/*string*/ $text) {
return $text;
}
}
2009-08-08 17:43:18 +01:00
2014-04-29 17:45:13 -04:00
/**
* Class EmoticonList
*/
class EmoticonList extends Extension {
public function onPageRequest(PageRequestEvent $event) {
2009-08-08 17:43:18 +01:00
if($event->page_matches("emote/list")) {
$this->theme->display_emotes(glob("ext/emoticons/default/*"));
}
}
}