wp-go/app/plugins/wpposts/posts.go

20 lines
650 B
Go
Raw Normal View History

2023-03-02 15:49:28 +00:00
package wpposts
2023-01-12 12:42:16 +00:00
import (
"fmt"
2023-05-04 12:37:06 +00:00
"github.com/fthvgb1/wp-go/app/pkg/models"
2023-01-12 12:42:16 +00:00
)
func PasswordProjectTitle(post *models.Posts) {
2023-02-06 14:56:36 +00:00
post.PostTitle = fmt.Sprintf("密码保护:%s", post.PostTitle)
2023-01-12 12:42:16 +00:00
}
func PasswdProjectContent(post *models.Posts) {
2023-02-06 14:56:36 +00:00
format := `
2023-01-12 12:42:16 +00:00
<form action="/login" class="post-password-form" method="post">
<p>此内容受密码保护如需查阅请在下列字段中输入您的密码</p>
<p><label for="pwbox-%d">密码 <input name="post_password" id="pwbox-%d" type="password" size="20"></label> <input type="submit" name="Submit" value="提交"></p>
</form>`
2023-02-06 14:56:36 +00:00
post.PostContent = fmt.Sprintf(format, post.Id, post.Id)
2023-01-12 12:42:16 +00:00
}