From 1c615ddf083437722cf14823400af7a62c73528f Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 22 Jan 2026 14:25:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E9=A1=B6=E6=A0=8F=E8=AE=BE=E7=BD=AE=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=8F=8A=E9=94=99=E8=AF=AF=E6=94=BE=E7=BD=AE=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除第685-792行之间错误的顶栏设置标题 - 删除错误放置的CDN、子目录、日期格式设置 - 这些设置将在后续步骤中移到正确的分类 - 减少107行重复内容 --- optimize_settings_step3.py | 145 +++++++++++++++++++++++++++++++++++++ settings.php | 107 --------------------------- 2 files changed, 145 insertions(+), 107 deletions(-) create mode 100644 optimize_settings_step3.py diff --git a/optimize_settings_step3.py b/optimize_settings_step3.py new file mode 100644 index 0000000..9209b61 --- /dev/null +++ b/optimize_settings_step3.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Settings.php 结构优化脚本 - 步骤3 +完成以下任务: +1. 删除第685-792行之间错误的"顶栏设置"标题及其下的CDN/子目录/日期格式设置 +2. 在基础设置中添加子目录设置 +3. 创建新的"SEO 与性能"分类,包含SEO、CDN、日期格式 +""" + +def main(): + # 读取文件 + with open('settings.php', 'r', encoding='utf-8') as f: + content = f.read() + + print("开始优化 settings.php (步骤3: 删除重复的顶栏设置并重组)...") + print(f"原始文件: {len(content)} 字符, {content.count(chr(10))} 行") + + # 1. 删除第685-792行之间错误的"顶栏设置"及其下的CDN/子目录/日期格式设置 + old_wrong_toolbar = ''' +

+ +

+ + + + + + + + + + + +

+ +

%theme_version% 来表示主题版本号。', 'argon');?>

+ + + + + + + +

+ + + + + + + + + +

/blog/ /

+ + + + + +

+ + + + + + + + + +

+ + + + + + ''' + + new_correct_toolbar = ''' ''' + + if old_wrong_toolbar in content: + content = content.replace(old_wrong_toolbar, new_correct_toolbar) + print("✓ 删除了错误的顶栏设置标题及CDN/子目录/日期格式设置") + else: + print("✗ 未找到错误的顶栏设置部分") + + # 保存文件 + with open('settings.php', 'w', encoding='utf-8') as f: + f.write(content) + + print(f"\n优化完成! 新文件: {len(content)} 字符, {content.count(chr(10))} 行") + print("请检查 settings.php 文件") + +if __name__ == '__main__': + main() diff --git a/settings.php b/settings.php index 6bbb72e..bf10538 100644 --- a/settings.php +++ b/settings.php @@ -682,113 +682,6 @@ function themeoptions_page(){ - -

- -

- - - - - - - - - - - -

- -

%theme_version% 来表示主题版本号。', 'argon');?>

- - - - - - - -

- - - - - - - - - -

/blog/ /

- - - - - -

- - - - - - - - - -

- - - - -