fix: 修复发版前代码质量问题
- 修复 functions.php 中 get_article_words() 函数的逻辑错误:循环中检查 $str 改为 $line - 修复 argontheme.js 中 reply() 函数的 null/undefined 访问风险:添加元素存在性检查 - 修复 argontheme.js 中潜在的 XSS 风险:使用 .text() 替代 .html() 输出用户内容 - 修复 functions.php 中 post_analytics_info() 使用 HTTP 改为 HTTPS - 删除临时分析文件(不应包含在发版中)
This commit is contained in:
@@ -932,12 +932,17 @@ if (argonConfig.waterflow_columns != "1") {
|
|||||||
cancelEdit(false);
|
cancelEdit(false);
|
||||||
replying = true;
|
replying = true;
|
||||||
replyID = commentID;
|
replyID = commentID;
|
||||||
$("#post_comment_reply_name").html($("#comment-" + commentID + " .comment-item-title > .comment-name")[0].innerHTML);
|
let nameEl = $("#comment-" + commentID + " .comment-item-title > .comment-name")[0];
|
||||||
let preview = $("#comment-" + commentID + " .comment-item-text")[0].innerHTML;
|
let textEl = $("#comment-" + commentID + " .comment-item-text")[0];
|
||||||
if ($("#comment-" + commentID + " .comment-item-source")[0].innerHTML != ''){
|
let sourceEl = $("#comment-" + commentID + " .comment-item-source")[0];
|
||||||
preview = $("#comment-" + commentID + " .comment-item-source")[0].innerHTML.replace(/\n/g, "</br>");
|
if (nameEl) {
|
||||||
|
$("#post_comment_reply_name").text(nameEl.textContent);
|
||||||
}
|
}
|
||||||
$("#post_comment_reply_preview").html(preview);
|
let preview = textEl ? textEl.textContent : '';
|
||||||
|
if (sourceEl && sourceEl.innerHTML !== '') {
|
||||||
|
preview = sourceEl.textContent;
|
||||||
|
}
|
||||||
|
$("#post_comment_reply_preview").text(preview);
|
||||||
if ($("#comment-" + commentID + " .comment-item-title .badge-private-comment").length > 0){
|
if ($("#comment-" + commentID + " .comment-item-title .badge-private-comment").length > 0){
|
||||||
$("#post_comment").addClass("post-comment-force-privatemode-on");
|
$("#post_comment").addClass("post-comment-force-privatemode-on");
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -836,7 +836,7 @@ function post_analytics_info(){
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = file_get_contents('http://api.solstice23.top/argon_analytics/index.php?domain=' . urlencode($_SERVER['HTTP_HOST']) . '&version='. urlencode($GLOBALS['theme_version']), false, $contexts);
|
$result = @file_get_contents('https://api.solstice23.top/argon_analytics/index.php?domain=' . urlencode($_SERVER['HTTP_HOST']) . '&version='. urlencode($GLOBALS['theme_version']), false, $contexts);
|
||||||
update_option('argon_has_inited', 'true');
|
update_option('argon_has_inited', 'true');
|
||||||
return $result;
|
return $result;
|
||||||
}else{
|
}else{
|
||||||
@@ -1237,7 +1237,7 @@ function get_article_words($str){
|
|||||||
foreach ($codeSegments as $codeSegment){
|
foreach ($codeSegments as $codeSegment){
|
||||||
$codeLines = preg_split('/\r\n|\n|\r/', $codeSegment);
|
$codeLines = preg_split('/\r\n|\n|\r/', $codeSegment);
|
||||||
foreach ($codeLines as $line){
|
foreach ($codeLines as $line){
|
||||||
if (strlen(trim($str)) > 0){
|
if (strlen(trim($line)) > 0){
|
||||||
$codeTotal++;
|
$codeTotal++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user