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:
2026-01-16 00:03:17 +08:00
parent 0547e165ab
commit 6015f074cb
2 changed files with 12 additions and 7 deletions

View File

@@ -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');
return $result;
}else{
@@ -1237,7 +1237,7 @@ function get_article_words($str){
foreach ($codeSegments as $codeSegment){
$codeLines = preg_split('/\r\n|\n|\r/', $codeSegment);
foreach ($codeLines as $line){
if (strlen(trim($str)) > 0){
if (strlen(trim($line)) > 0){
$codeTotal++;
}
}