小优化
This commit is contained in:
parent
dfe7bb3181
commit
40451970a0
|
@ -70,15 +70,11 @@ func PostPlugin(calls ...PostsPlugin) PostsPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UsePostsPlugins() PostsPlugin {
|
func UsePostsPlugins() PostsPlugin {
|
||||||
p := config.GetConfig().ListPagePlugins
|
|
||||||
var pluginss []func(PostsPlugin, *Handle, *models.Posts)
|
|
||||||
m := pluginFns.Load()
|
m := pluginFns.Load()
|
||||||
for _, s := range p {
|
pluginss := slice.FilterAndMap(config.GetConfig().ListPagePlugins, func(t string) (func(PostsPlugin, *Handle, *models.Posts), bool) {
|
||||||
f, ok := m[s]
|
f, ok := m[t]
|
||||||
if ok {
|
return f, ok
|
||||||
pluginss = append(pluginss, f)
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
slice.Unshift(&pluginss, PasswordProject)
|
slice.Unshift(&pluginss, PasswordProject)
|
||||||
return PostsPlugins(PostPlugin(ordinaryPlugin.Load()...), pluginss...)
|
return PostsPlugins(PostPlugin(ordinaryPlugin.Load()...), pluginss...)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user