summaryrefslogtreecommitdiff
path: root/includes/sys_template.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/sys_template.php')
-rw-r--r--includes/sys_template.php65
1 files changed, 40 insertions, 25 deletions
diff --git a/includes/sys_template.php b/includes/sys_template.php
index 8c260140..98ed1207 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -1,5 +1,7 @@
<?php
+use Engelsystem\Renderer\Twig\Extensions\Assets;
+
/**
* Render a stat for dashborad (big number with label).
* If no style given, style is danger if number > 0, and success if number == 0.
@@ -231,12 +233,12 @@ function toolbar_popover($glyphicon, $label, $content, $class = '')
. ' <span class="caret"></span></a>
<script type="text/javascript">
$(function(){
- $("#' . $dom_id . '").popover({
- trigger: "focus",
+ $(\'#' . $dom_id . '\').popover({
+ trigger: \'focus\',
html: true,
- content: "' . addslashes(join('', $content)) . '",
- placement: "bottom",
- container: "#navbar-collapse-1"
+ content: \'' . addslashes(join('', $content)) . '\',
+ placement: \'bottom\',
+ container: \'#navbar-collapse-1\'
})
});
</script></li>';
@@ -450,26 +452,39 @@ function table_body($array)
*/
function ReplaceSmilies($msg)
{
- $msg = str_replace(';o))', '<img src="pic/smiles/icon_redface.gif">', $msg);
- $msg = str_replace(':-))', '<img src="pic/smiles/icon_redface.gif">', $msg);
- $msg = str_replace(';o)', '<img src="pic/smiles/icon_wind.gif">', $msg);
- $msg = str_replace(':)', '<img src="pic/smiles/icon_smile.gif">', $msg);
- $msg = str_replace(':-)', '<img src="pic/smiles/icon_smile.gif">', $msg);
- $msg = str_replace(':(', '<img src="pic/smiles/icon_sad.gif">', $msg);
- $msg = str_replace(':-(', '<img src="pic/smiles/icon_sad.gif">', $msg);
- $msg = str_replace(':o(', '<img src="pic/smiles/icon_sad.gif">', $msg);
- $msg = str_replace(':o)', '<img src="pic/smiles/icon_lol.gif">', $msg);
- $msg = str_replace(';o(', '<img src="pic/smiles/icon_cry.gif">', $msg);
- $msg = str_replace(';(', '<img src="pic/smiles/icon_cry.gif">', $msg);
- $msg = str_replace(';-(', '<img src="pic/smiles/icon_cry.gif">', $msg);
- $msg = str_replace('8)', '<img src="pic/smiles/icon_rolleyes.gif">', $msg);
- $msg = str_replace('8o)', '<img src="pic/smiles/icon_rolleyes.gif">', $msg);
- $msg = str_replace(':P', '<img src="pic/smiles/icon_evil.gif">', $msg);
- $msg = str_replace(':-P', '<img src="pic/smiles/icon_evil.gif">', $msg);
- $msg = str_replace(':oP', '<img src="pic/smiles/icon_evil.gif">', $msg);
- $msg = str_replace(';P', '<img src="pic/smiles/icon_mad.gif">', $msg);
- $msg = str_replace(';oP', '<img src="pic/smiles/icon_mad.gif">', $msg);
- $msg = str_replace('?)', '<img src="pic/smiles/icon_question.gif">', $msg);
+ /** @var Assets $assets */
+ $assets = app('twig.extension.assets');
+
+ foreach (
+ [
+ ';o))' => 'redface',
+ ':-))' => 'redface',
+ ';o)' => 'wind',
+ ':)' => 'smile',
+ ':-)' => 'smile',
+ ':(' => 'sad',
+ ':-(' => 'sad',
+ ':o(' => 'sad',
+ ':o)' => 'lol',
+ ':D' => 'lol',
+ ';o(' => 'cry',
+ ';(' => 'cry',
+ ';-(' => 'cry',
+ '8)' => 'rolleyes',
+ '8o)' => 'rolleyes',
+ ':P' => 'evil',
+ ':-P' => 'evil',
+ ':oP' => 'evil',
+ ';P' => 'mad',
+ ';oP' => 'mad',
+ '?)' => 'question',
+ ] as $search => $replace
+ ) {
+ $msg = str_ireplace($search, sprintf(
+ '<img src="%s">',
+ sprintf($assets->getAsset('assets/emojis/%s.gif'), $replace)
+ ), $msg);
+ }
return $msg;
}