This repository was archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtension.php
More file actions
46 lines (35 loc) 路 2.07 KB
/
Copy pathExtension.php
File metadata and controls
46 lines (35 loc) 路 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
// FontEmoticons comment thread Extension for Bolt
namespace Bolt\Extension\Mikescops\FontEmoticons;
use Bolt\BaseExtension;
use Bolt\Extensions\Snippets\Location as SnippetLocation;
class Extension extends BaseExtension
{
public function getName()
{
return "Font Emoticons";
}
public function initialize()
{
if ($this->app['config']->getWhichEnd()=== 'frontend'){
$this->addTwigFunction('emocontent', 'emocontent');
$this->addSnippet('aftercss', '<link rel="stylesheet" type="text/css" href="'. $this->app['paths']['extensions'] .'vendor/mikescops/fontemoticons/css/fontello.css">');
}
}
public function emocontent($content="")
{
$html = $this->smiley($content);
return new \Twig_Markup($html, 'UTF-8');
}
function smiley($content) {
$smiley_array = [' :)', ' :-)', '(-:', '(:', ':smile:', ':(', ':-(', ':sad:',';)', ';-)', ':wink:', ':P', ':-P', ':razz:', '-.-', '-_-', ':sleep:','>:)', '>:-)', ':devil:', ':twisted:',':o', ':-o', ':eek:', '8O', '8o', '8-O', '8-o', ':shock:', ':coffee:', ':D', ':-D', ':grin:','8)', '8-)', 'B)', 'B-)', ':cool:', 'x(', 'x-(', 'X(', 'X-(', ':angry:', 'O:)', '0:)','o:)','O:-)', '0:-)', 'o:-)', ':saint:', ":'(", ":'-(", ':cry:', ':shoot:', '|)', ':squint:', '^^', '^_^', ':lol:', ':/', ':-/', ':beer:'];
$smiley_xhtml = ['happy','happy','happy','happy','happy','unhappy','unhappy','unhappy','wink2','wink2','wink2','tongue','tongue','tongue','sleep','sleep','sleep','devil','devil','devil','devil','surprised','surprised','surprised','surprised','surprised','surprised','surprised','surprised','coffee','grin','grin','grin','sunglasses' ,'sunglasses' ,'sunglasses' ,'sunglasses' ,'sunglasses','angry','angry','angry','angry','angry','saint','saint','saint','saint','saint','saint','saint','cry','cry','cry','shoot','squint','squint','laugh','laugh','laugh','displeased','displeased','beer'];
for ($i = 0; $i<count($smiley_array); $i++)
{
$word = $smiley_array[$i];
$smiley_img = '<i class="icon-emo-' . $smiley_xhtml[$i] . '"></i>';
$content = str_replace($word, $smiley_img, $content);
}
return $content;
}
}