diff --git a/README.MD b/README.MD index 6a9a8ec..d811aa4 100644 --- a/README.MD +++ b/README.MD @@ -32,4 +32,10 @@ - 增加系统显示设置 - 增加浏览器信息显示设置 - 修复pjax模式下的404跳转 - \ No newline at end of file + +--- + +### 2024-07-07 表情短代码解析集成 + - 1.1.5 + + - 将表情短代码(如 :smile:)自动解析为图片表情,集成到主题评论内容输出中。 \ No newline at end of file diff --git a/comments.php b/comments.php index fff6bc8..8d00fd7 100644 --- a/comments.php +++ b/comments.php @@ -178,7 +178,7 @@
- parent) {echo getPermalinkFromCoid($comments->parent);} $comments->content();?> + parent) {echo getPermalinkFromCoid($comments->parent);} echo parse_smiley_shortcode($comments->content);?>
agent); diff --git a/functions.php b/functions.php index 8cf0027..27ce07b 100644 --- a/functions.php +++ b/functions.php @@ -918,4 +918,51 @@ class AttachmentHelper { 'doubt.png', + ':razz:' => 'razz.png', + ':sad:' => 'sad.png', + ':evil:' => 'evil.png', + ':naughty:' => 'naughty.png', + ':!:' => 'scare.png', + ':smile:' => 'smile.png', + ':oops:' => 'oops.png', + ':neutral:' => 'neutral.png', + ':cry:' => 'cry.png', + ':mrgreen:' => 'mrgreen.png', + ':grin:' => 'grin.png', + ':eek:' => 'eek.png', + ':shock:' => 'shock.png', + ':???:' => 'bz.png', + ':cool:' => 'cool.png', + ':lol:' => 'lol.png', + ':mad:' => 'mad.png', + ':twisted:' => 'twisted.png', + ':roll:' => 'roll.png', + ':wink:' => 'wink.png', + ':idea:' => 'idea.png', + ':despise:' => 'despise.png', + ':celebrate:' => 'celebrate.png', + ':watermelon:' => 'watermelon.png', + ':xmas:' => 'xmas.png', + ':warn:' => 'warn.png', + ':rainbow:' => 'rainbow.png', + ':loveyou:' => 'loveyou.png', + ':love:' => 'love.png', + ':beer:' => 'beer.png', + ]; + $themeUrl = Helper::options()->themeUrl . '/assets/img/smiley/'; + foreach ($smileys as $code => $img) { + $imgTag = '' . $code . ''; + $content = str_replace($code, $imgTag, $content); + } + return $content; +} ?> \ No newline at end of file diff --git a/index.php b/index.php index 4f919ab..4c6f550 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ * * @package Typecho Pouck Theme * @author 老孙博客 - * @version 1.1.4 + * @version 1.1.5 * @link http://www.imsun.org */