Skip to content

Commit

Permalink
refactor: optimize code structure (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
n0099 authored Nov 12, 2022
1 parent 2bb8f1a commit 655d3eb
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions pages/page-smilies.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@
* @license GPL-3.0 License
* @version 2022.01.26
*/
$smilies = '
<a href="javascript:grin(\':razz:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/razz.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':evil:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/evil.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':exclaim:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/exclaim.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':smile:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/smile.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':redface:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/redface.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':biggrin:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/biggrin.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':eek:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/eek.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':confused:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/confused.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':idea:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/idea.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':lol:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/lol.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':mad:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/mad.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':twisted:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/twisted.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':rolleyes:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/rolleyes.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':wink:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/wink.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':cool:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/cool.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':arrow:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/arrow.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':neutral:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/neutral.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':cry:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/cry.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':mrgreen:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/mrgreen.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':drooling:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/drooling.png" alt="" class="d-block"/></a>
<a href="javascript:grin(\':persevering:\')"><img src="' . ASSET_PATH . '/assets/img/smilies/persevering.png" alt="" class="d-block"/></a>';
$smilies = join("\n", array_map(function ($s) {
return '<a href="javascript:grin(\':' . $s . ':\')"><img src="'
. apply_filter('smilies_src', ASSET_PATH . "/assets/img/smilies/{$s}.png", "{$s}.png", site_url())
. '" alt="' . $s . '" class="d-block"/></a>';
}, [
'razz',
'evil',
'exclaim',
'smile',
'redface',
'biggrin',
'eek',
'confused',
'idea',
'lol',
'mad',
'twisted',
'rolleyes',
'wink',
'cool',
'arrow',
'neutral',
'cry',
'mrgreen',
'drooling',
'persevering'
]));

0 comments on commit 655d3eb

Please sign in to comment.