Removed ReplaceSmilies from news

This commit is contained in:
Igor Scheller 2020-03-01 02:36:54 +01:00 committed by msquare
parent ba4db7a7ff
commit 951755598a
14 changed files with 3 additions and 73 deletions

View File

@ -77,8 +77,7 @@ function user_meetings()
*/
function news_text(News $news): string
{
$text = ReplaceSmilies($news->text);
$text = preg_replace("/\r\n\r\n/m", '<br><br>', $text);
$text = preg_replace("/\r\n\r\n/m", '<br><br>', $news->text);
return $text;
}
@ -91,7 +90,7 @@ function display_news(News $news): string
$html = '';
$html .= '<div class="panel' . ($news->is_meeting ? ' panel-info' : ' panel-default') . '">';
$html .= '<div class="panel-heading">';
$html .= '<h3 class="panel-title">' . ($news->is_meeting ? '[Meeting] ' : '') . ReplaceSmilies($news->title) . '</h3>';
$html .= '<h3 class="panel-title">' . ($news->is_meeting ? '[Meeting] ' : '') . $news->title . '</h3>';
$html .= '</div>';
$html .= '<div class="panel-body">' . news_text($news) . '</div>';

View File

@ -414,46 +414,3 @@ function table_buttons($buttons = [])
{
return '<div class="btn-group">' . join(' ', $buttons) . '</div>';
}
/**
* @param string $msg
* @return mixed
*/
function ReplaceSmilies($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;
}

View File

@ -6,9 +6,8 @@
"author": "https://github.com/engelsystem/engelsystem/contributors",
"license": "GPL-2.0-only",
"scripts": {
"build": "npm run -s build:clean && NODE_ENV=production run-p build:assets build:webpack",
"build": "npm run -s build:clean && NODE_ENV=production run-p build:webpack",
"build:clean": "rimraf public/assets",
"build:assets": "node resources/assets/scripts/copyAssets.js",
"build:webpack": "webpack",
"build:watch": "webpack --watch"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

View File

@ -1,25 +0,0 @@
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const baseAssetPath = {
src: path.resolve('resources/assets'),
target: path.resolve('public/assets')
};
const emojiPath = {
src: baseAssetPath.src + '/emojis',
target: baseAssetPath.target + '/emojis'
};
mkdirp.sync(emojiPath.target);
const emojis = fs.readdirSync(emojiPath.src);
emojis.forEach((e) => {
fs.copyFile(`${emojiPath.src}/${e}`, `${emojiPath.target}/${e}`, (e) => {
if (e) {
console.error(e);
}
});
});