Update plugin.emoticons.php

- js-script in the head
This commit is contained in:
Frank Hochmuth 2024-03-02 22:33:31 +01:00 committed by GitHub
parent 9f2248418a
commit 4976edbe07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,7 +37,6 @@ function plugin_emoticons() {
global $plugin_emoticons; global $plugin_emoticons;
if (!count($plugin_emoticons)) if (!count($plugin_emoticons))
return true; return true;
echo '<script src="' . plugin_geturl('emoticons') . 'res/emoticons.js"></script>';
echo '<div class="emoticons">'; echo '<div class="emoticons">';
foreach ($plugin_emoticons as $text => $emoticon) { foreach ($plugin_emoticons as $text => $emoticon) {
echo '<a href="#content" title="' . htmlentities($text) . '" onclick="emoticons(unescape(\'' . urlencode($text) . '\')); return false;">'; echo '<a href="#content" title="' . htmlentities($text) . '" onclick="emoticons(unescape(\'' . urlencode($text) . '\')); return false;">';
@ -63,16 +62,17 @@ function plugin_emoticons_filter ($emostring) {
} }
// css file // css file
function plugin_emoticons_css() { function plugin_emoticons_head() {
$pdir = plugin_geturl('emoticons'); $pdir = plugin_geturl('emoticons');
echo ' echo '
<!-- BOF Emoticons css file --> <!-- BOF Emoticons -->
<link rel="stylesheet" type="text/css" href="' . $pdir . 'res/emoticons.css"> <link rel="stylesheet" type="text/css" href="' . $pdir . 'res/emoticons.css">
<!-- EOF Emoticons css file -->'; <script src="' . plugin_geturl('emoticons') . 'res/emoticons.js"></script>
<!-- EOF Emoticons -->';
} }
// register css file // register emoticon head
add_action('wp_head', 'plugin_emoticons_css', 0); add_action('wp_head', 'plugin_emoticons_head', 10);
// register editor toolbar // register editor toolbar
add_filter('simple_toolbar_form', 'plugin_emoticons',); add_filter('simple_toolbar_form', 'plugin_emoticons',);
// register to the hook // register to the hook