From 40451970a02f427b4bacb504b2ab9b518675241a Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 10 May 2023 14:28:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/theme/wp/listpostplugins.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/theme/wp/listpostplugins.go b/app/theme/wp/listpostplugins.go index 04593d6..3b58a86 100644 --- a/app/theme/wp/listpostplugins.go +++ b/app/theme/wp/listpostplugins.go @@ -70,15 +70,11 @@ func PostPlugin(calls ...PostsPlugin) PostsPlugin { } func UsePostsPlugins() PostsPlugin { - p := config.GetConfig().ListPagePlugins - var pluginss []func(PostsPlugin, *Handle, *models.Posts) m := pluginFns.Load() - for _, s := range p { - f, ok := m[s] - if ok { - pluginss = append(pluginss, f) - } - } + pluginss := slice.FilterAndMap(config.GetConfig().ListPagePlugins, func(t string) (func(PostsPlugin, *Handle, *models.Posts), bool) { + f, ok := m[t] + return f, ok + }) slice.Unshift(&pluginss, PasswordProject) return PostsPlugins(PostPlugin(ordinaryPlugin.Load()...), pluginss...) }