From 951755598a9f93e3c88c3f94fa033b8a93ae9b98 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 1 Mar 2020 02:36:54 +0100 Subject: [PATCH] Removed ReplaceSmilies from news --- includes/pages/user_news.php | 5 ++- includes/sys_template.php | 43 ------------------------- package.json | 3 +- resources/assets/emojis/cry.gif | Bin 498 -> 0 bytes resources/assets/emojis/evil.gif | Bin 236 -> 0 bytes resources/assets/emojis/lol.gif | Bin 336 -> 0 bytes resources/assets/emojis/mad.gif | Bin 174 -> 0 bytes resources/assets/emojis/question.gif | Bin 248 -> 0 bytes resources/assets/emojis/redface.gif | Bin 650 -> 0 bytes resources/assets/emojis/rolleyes.gif | Bin 485 -> 0 bytes resources/assets/emojis/sad.gif | Bin 171 -> 0 bytes resources/assets/emojis/smile.gif | Bin 174 -> 0 bytes resources/assets/emojis/wind.gif | Bin 170 -> 0 bytes resources/assets/scripts/copyAssets.js | 25 -------------- 14 files changed, 3 insertions(+), 73 deletions(-) delete mode 100644 resources/assets/emojis/cry.gif delete mode 100644 resources/assets/emojis/evil.gif delete mode 100644 resources/assets/emojis/lol.gif delete mode 100644 resources/assets/emojis/mad.gif delete mode 100644 resources/assets/emojis/question.gif delete mode 100644 resources/assets/emojis/redface.gif delete mode 100644 resources/assets/emojis/rolleyes.gif delete mode 100644 resources/assets/emojis/sad.gif delete mode 100644 resources/assets/emojis/smile.gif delete mode 100644 resources/assets/emojis/wind.gif delete mode 100644 resources/assets/scripts/copyAssets.js diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index f196f22f..771311fe 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -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", '

', $text); + $text = preg_replace("/\r\n\r\n/m", '

', $news->text); return $text; } @@ -91,7 +90,7 @@ function display_news(News $news): string $html = ''; $html .= '
'; $html .= '
'; - $html .= '

' . ($news->is_meeting ? '[Meeting] ' : '') . ReplaceSmilies($news->title) . '

'; + $html .= '

' . ($news->is_meeting ? '[Meeting] ' : '') . $news->title . '

'; $html .= '
'; $html .= '
' . news_text($news) . '
'; diff --git a/includes/sys_template.php b/includes/sys_template.php index 491dc2fe..2f764309 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -414,46 +414,3 @@ function table_buttons($buttons = []) { return '
' . join(' ', $buttons) . '
'; } - -/** - * @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( - '', - sprintf($assets->getAsset('assets/emojis/%s.gif'), $replace) - ), $msg); - } - - return $msg; -} diff --git a/package.json b/package.json index 06619fa1..8b4a0568 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/resources/assets/emojis/cry.gif b/resources/assets/emojis/cry.gif deleted file mode 100644 index 7d54b1f994bb20c2a17c6e9e53edb39e0444b380..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 498 zcmZ?wbhEHbivPL&TtkAL9RpmA^bD98ftnS6varfA2r%e?3<5cWfi*@! zrOPq0Pa{O{R3VSL)CLZwJI;bVj@ow|9P^f2{b_KV;g#sD#JTIhK{X4eRSZoFOA4&E zE?xGWjgRM;Ia^8kzR>%TOS23r6eRl<`~6;g|7yg@*31^DX`|+%tO&MH1Y{u#11keN z5Hhd|DyTR-@tBu#X^wBxK7*WjP8?uWTo6?pKs7*@va%&Sa#%9C1z8HDof#;_rJ&H~ zFsWx*ry9h3B%L5>ZUqL1B|!6=oIFuX25Dyj%JU{%Vn~@hA!8Mj(`_aU6Ueh0) diff --git a/resources/assets/emojis/evil.gif b/resources/assets/emojis/evil.gif deleted file mode 100644 index ab1aa8e123fe263608d06126ce08c560ad419f97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 236 zcmZ?wbhEHbgxLc6$23bKgaO@B*VYC4FCTM|KGy!A1Lx~^8f$G|7kJ& z%VnN6ZQB2*4FCVX1}P;4DE?$&WMB|r&;e-z*~!3~slec{BxBNqoiq9;sWfXDwJwx! zTfpypu*1~B&zgxLc6$23b2ZD19|4%af-@@>3F2n!7!vFtG{{R2@|NpQ5 zKLsg(0LA~@ey$E)D;vwK1$ZJE z)->GK{b0hvv^Z;7;HB1zIS=v}c`BF7qB`mkh55UYFL448CX~YJS?+%vC0^DXyTAT=mC2Y$ux)_YXI57TebiI diff --git a/resources/assets/emojis/mad.gif b/resources/assets/emojis/mad.gif deleted file mode 100644 index 1f6c3c2fb401596ec44f4a1189bde2cbc45364aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 174 zcmZ?wbhEHb3F2nzSlmGt}{tp7j|Nnpe z|0z%&3KV~`FfuUkGU$N#ATtgxLc6~q5?4F69u{F}@0e+$F^zrz3jO@4oyp}v#>2=1R{ z`2YX-`F#xhd<^^7GyH$bps&p^e-cpewY&^Nd^p4X4Gi!1Fzlbske>!pj|LQfvM@3* zNHOSu#6fm4u$C@R>vD+fTM_1WrjSFOYeSph9VW&ehisimT`Ynp-iELv_k~jmS4OEzz h1Q^5k8{BNVn8hT-nI{@Cu+CwP)wEG_S5{=O1_1NkQKJ9= diff --git a/resources/assets/emojis/redface.gif b/resources/assets/emojis/redface.gif deleted file mode 100644 index ad7628320c3d15756c84794c8c0523f1072da640..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 650 zcmZ?wbhEHb&Qw$Gs7{2#K|NnmWcSgp)ZKdDmF#NyN{%1+%|LxoV z&6x4L*vr+`_5YJ6|9^e`f9A~pR}4QI8vg%z`Rh8vzsC$emo5AMNBH0A=KudDKaP*T z>0!pe!0`X+%wGqqfegj}+zPv3R$%UgcxPlMx(u7qxxxfZd?$&YQ;PGndxWo3ZY ziH`8-T?`B&DNk$k=JGRs=w-6FQO@h2ko&aap$ji#VOF!1O><{wyHRCMkfx2Ai?Slv zYA%q~j0}tnyg^Qv|J?fJ`y}Jo`B}5IcZU0i%+^)m>vp{!Bqu6#)+xQyYu&8=mRY(7 z)}5aCNL5gG*%{+AHF>K87ridk_T^KXg3qiu^$yZP~SpxtUz5smy diff --git a/resources/assets/emojis/rolleyes.gif b/resources/assets/emojis/rolleyes.gif deleted file mode 100644 index d7f5f2f4b18f8a141c7a5dd1e09ff106a2f9fa1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 485 zcmZ?wbhEHbgxLc6$23bKgaO@B*Xvz|NqTp_`ikW|G&xq{~!PVSNQ)^ zpx|qe3NTRo&+X?L671|4;A*62z|05~RQ$=p%EiFTpaW6>GM0fQZi6Rh*4!PT(*&f% z*$TRZ<}@?I^CYG*?eW$Pd$isBan+(fO1gn0b6dW=x%w~q}~tKE&`I~ zWZ+_80zw8BmJOU2m9Ux1yJ3o3D&v+$ZG#t4ZLVMy3?Qu_ZQMY+8CYaDcq&S-H42Fh z{c)CE%Sn@EnS+n-#i)qLlhWcv5Vs)dU<2w9+u*4hy}}}Vq4ah~j;>ScENX^v3nduQ d4TmZP8gAjeGaoDCD!-THXQ zaD}Q`!Ef~@t%4VS^H`jpHe@qRnmW&T1rN_M_11z^Th4v=m-`t@{9)jl*%hj`3F2nzSlmGt}{tp7jjg5`} z|9}1eDNqRrDE?$&WMJT9&;fBkW-zcsU+|R7ntLO3**QsZu>uaJIn9DTj_MrhAC|2y zn^DM@#l<(@zDcWq`B+oyDaGR~0+SdoFXD`_(PqAxy<2o0Q>0^(jhH~$tb+>(~Mkip?iSJVUa9D@n#Zhbsv zutHU>;J1F0R>6zE2`tV}8xE^#?@bGklrZsUYAp!;dbG*vY{CM88Jk-qvwbqQUtQFY Pm?x1IA$CiJiNP8Goi0B( diff --git a/resources/assets/scripts/copyAssets.js b/resources/assets/scripts/copyAssets.js deleted file mode 100644 index 1c8e9e24..00000000 --- a/resources/assets/scripts/copyAssets.js +++ /dev/null @@ -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); - } - }); -});