-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
改善多行个人说明文本显示 #975
base: main
Are you sure you want to change the base?
改善多行个人说明文本显示 #975
Conversation
修改author页面css,以支持正常显示多行个人介绍说明
1.修复多行作者个人介绍无法正常换行显示问题 2.添加xss代码攻击过滤处理步骤
添加个人介绍文本转义步骤,防止xss攻击
@@ -63,9 +63,12 @@ | |||
if (empty($author_description)) { | |||
$author_description = __('This author has not provided a description.', 'sakurairo'); | |||
} | |||
// 对描述内容进行转义,防止XSS攻击 | |||
$safe_description = htmlspecialchars($author_description, ENT_QUOTES, 'UTF-8'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要设置$flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因已有代码进行空字符串判断和填充,为尽量减少对已有代码的改动,故新设置变量$safe_description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但你只设置ENT_QUOTES而不设置HTML实体的FLAG的话实现不了你注释的效果吧
本身就没有必要去硬适配过长的介绍 适度增加即可 不需要滚动栏 |
1.修改css和php代码,以适应多行的个人说明文本正常显示
2.增加获取个人说明函数get_the_author_meta('description')后,进行文本过滤转义步骤,防止xss攻击