8b20fa3bc2
having preg_replace return string|array|null is a pain, string|exception is much cleaner
23 lines
455 B
PHP
23 lines
455 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shimmie2;
|
|
|
|
/**
|
|
* Class Emoticons
|
|
*/
|
|
class Emoticons extends FormatterExtension
|
|
{
|
|
public function format(string $text): string
|
|
{
|
|
$data_href = get_base_href();
|
|
$text = preg_replace_ex("/:([a-z]*?):/s", "<img alt='\1' src='$data_href/ext/emoticons/default/\\1.gif'>", $text);
|
|
return $text;
|
|
}
|
|
|
|
public function strip(string $text): string
|
|
{
|
|
return $text;
|
|
}
|
|
}
|