From 509f2d78596eb13aa1e964c08314b4a18f25c7de Mon Sep 17 00:00:00 2001 From: Seaton Jiang Date: Fri, 27 May 2022 12:30:20 +0800 Subject: [PATCH] fix: post smilies --- inc/theme-article.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/inc/theme-article.php b/inc/theme-article.php index 8b094e9..da5afd6 100644 --- a/inc/theme-article.php +++ b/inc/theme-article.php @@ -319,6 +319,10 @@ function comment_callbacks($comment, $args, $depth = 2) } // 文章评论表情 +if (empty(get_option('use_smilies'))) { + update_option('use_smilies', 1); +} + function custom_smilies_src($img_src, $img, $siteurl) { return ASSET_PATH . '/assets/img/smilies/' . $img; @@ -329,12 +333,10 @@ function disable_emojis_tinymce($plugins) { return array_diff($plugins, array('wpemoji')); } + function smilies_reset() { - global $wpsmiliestrans, $wp_smiliessearch, $wp_version; - if (!get_option('use_smilies') || $wp_version < 4.2) { - return; - } + global $wpsmiliestrans; $wpsmiliestrans = array( ':mrgreen:' => 'mrgreen.png', @@ -364,7 +366,7 @@ smilies_reset(); function smilies_custom_button() { - printf('' . __('添加表情', 'kratos') . '
' . get_wpsmiliestrans() . '
'); + printf('' . __('添加表情', 'kratos') . '
' . get_wpsmiliestrans() . '
'); } add_action('media_buttons', 'smilies_custom_button'); @@ -372,6 +374,7 @@ function get_wpsmiliestrans() { global $wpsmiliestrans; global $output; + $wpsmilies = array_unique($wpsmiliestrans); foreach ($wpsmilies as $alt => $src_path) { $output .= '';