refactor: 规范化 PHP 模板文件
- header.php: 修复箭头操作符空格, 移除多余空行 (1520 -> 1481 行) - footer.php: 修复箭头操作符空格, 移除多余空行 (177 -> 168 行) - sidebar.php: 修复箭头操作符空格, 移除多余空行 (1311 -> 1288 行) - single.php: 修复箭头操作符空格, 移除多余空行 (214 -> 196 行) - comments.php: 修复箭头操作符空格 - search.php: 修复箭头操作符空格
This commit is contained in:
@@ -383,16 +383,14 @@ function resetGeetestCaptcha() {
|
||||
<?php
|
||||
$captcha_type = get_option('argon_captcha_type', 'math');
|
||||
if ($captcha_type === 'geetest') { ?>
|
||||
<!-- Geetest 验证码容器 -->
|
||||
<div id="geetest-captcha" class="mb-4"></div>
|
||||
<!-- Geetest 验证码容器 --><div id="geetest-captcha" class="mb-4"></div>
|
||||
<input type="hidden" id="geetest_lot_number" name="lot_number" value="">
|
||||
<input type="hidden" id="geetest_captcha_output" name="captcha_output" value="">
|
||||
<input type="hidden" id="geetest_pass_token" name="pass_token" value="">
|
||||
<input type="hidden" id="geetest_gen_time" name="gen_time" value="">
|
||||
<input type="hidden" id="argon_comment_nonce" value="<?php echo wp_create_nonce('argon_comment'); ?>">
|
||||
<?php } else { ?>
|
||||
<!-- 原有的数学验证码 -->
|
||||
<div class="input-group input-group-alternative mb-4 post-comment-captcha-container" captcha="<?php echo get_comment_captcha(get_comment_captcha_seed());?>">
|
||||
<!-- 原有的数学验证码 --><div class="input-group input-group-alternative mb-4 post-comment-captcha-container" captcha="<?php echo get_comment_captcha(get_comment_captcha_seed());?>">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-key"></i></span>
|
||||
</div>
|
||||
|
||||
11
footer.php
11
footer.php
@@ -29,8 +29,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 加载主题核心 JS -->
|
||||
<?php $assets_version = function_exists('argon_get_assets_version') ? argon_get_assets_version() : $GLOBALS['theme_version']; ?>
|
||||
<!-- 加载主题核心 JS --><?php $assets_version = function_exists('argon_get_assets_version') ? argon_get_assets_version() : $GLOBALS['theme_version']; ?>
|
||||
<script src="<?php echo $GLOBALS['assets_path']; ?>/argontheme.js?v=<?php echo $assets_version; ?>"></script>
|
||||
|
||||
<?php if (get_option('argon_math_render') == 'mathjax3') { /*Mathjax V3*/?>
|
||||
@@ -149,16 +148,12 @@
|
||||
|
||||
<?php }?>
|
||||
|
||||
|
||||
|
||||
<?php if (get_option('argon_enable_code_highlight') == 'true') { /*Highlight.js*/?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/highlight/styles/<?php echo get_option('argon_code_theme') == '' ? 'vs2015' : get_option('argon_code_theme'); ?>.css">
|
||||
|
||||
<?php }?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -167,10 +162,6 @@
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
<?php echo get_option('argon_custom_html_foot'); ?>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
49
header.php
49
header.php
@@ -196,8 +196,6 @@
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$seo_keywords = get_seo_keywords();
|
||||
@@ -208,8 +206,6 @@
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
if (is_single() || is_page()){
|
||||
@@ -232,8 +228,6 @@
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<meta name="theme-color" content="<?php echo $themecolor; ?>">
|
||||
|
||||
<meta name="theme-color-rgb" content="<?php echo hex2str($themecolor); ?>">
|
||||
@@ -242,20 +236,12 @@
|
||||
|
||||
<meta name="argon-enable-custom-theme-color" content="<?php echo (get_option('argon_show_customize_theme_color_picker') != 'false' ? 'true' : 'false'); ?>">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="theme-card-radius" content="<?php echo $cardradius; ?>">
|
||||
|
||||
<meta name="theme-card-radius-origin" content="<?php echo $cardradius_origin; ?>">
|
||||
|
||||
|
||||
|
||||
<meta name="theme-version" content="<?php echo $GLOBALS['theme_version']; ?>">
|
||||
|
||||
|
||||
|
||||
<link rel="profile" href="http://gmpg.org/xfn/11">
|
||||
|
||||
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
|
||||
@@ -293,8 +279,7 @@
|
||||
<?php wp_head(); ?>
|
||||
|
||||
<?php if (function_exists('argon_is_force_refresh_enabled') && argon_is_force_refresh_enabled()): ?>
|
||||
<!-- 强制刷新缓存 - 清除浏览器和 Service Worker 缓存 -->
|
||||
<script>
|
||||
<!-- 强制刷新缓存 - 清除浏览器和 Service Worker 缓存 --><script>
|
||||
(function() {
|
||||
var forceRefreshKey = 'argon_force_refresh_version';
|
||||
var currentVersion = '<?php echo get_option('argon_force_refresh_enabled_time', 0); ?>';
|
||||
@@ -337,8 +322,7 @@
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 移动端资源加载修复 - 确保 CSS 完全应用 -->
|
||||
<script>
|
||||
<!-- 移动端资源加载修复 - 确保 CSS 完全应用 --><script>
|
||||
(function() {
|
||||
// 检测移动端并强制重新计算样式
|
||||
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
@@ -370,8 +354,7 @@
|
||||
window.argonUserRole = '<?php echo current_user_can('administrator') ? 'administrator' : (is_user_logged_in() ? 'user' : 'guest'); ?>';
|
||||
</script>
|
||||
|
||||
<!-- Argon 修复补丁 - 必须在 wp_head() 之后立即执行 -->
|
||||
<script src="<?php echo get_template_directory_uri(); ?>/assets/js/argon.min.js?ver=<?php echo $assets_version; ?>"></script>
|
||||
<!-- Argon 修复补丁 - 必须在 wp_head() 之后立即执行 --><script src="<?php echo get_template_directory_uri(); ?>/assets/js/argon.min.js?ver=<?php echo $assets_version; ?>"></script>
|
||||
|
||||
<?php $GLOBALS['wp_path'] = get_option('argon_wp_path') == '' ? '/' : get_option('argon_wp_path'); ?>
|
||||
|
||||
@@ -565,8 +548,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function toggleAmoledDarkMode(){
|
||||
|
||||
document.documentElement.classList.toggle("amoled-dark");
|
||||
@@ -605,8 +586,6 @@
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?php if (get_option('argon_enable_smoothscroll_type') == '2') { /*平滑滚动*/?>
|
||||
|
||||
<script src="<?php echo $GLOBALS['assets_path']; ?>/assets/vendor/smoothscroll/smoothscroll2.js"></script>
|
||||
@@ -627,12 +606,8 @@
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<?php echo get_option('argon_custom_html_head'); ?>
|
||||
|
||||
|
||||
|
||||
<style id="themecolor_css">
|
||||
|
||||
<?php
|
||||
@@ -770,8 +745,6 @@ if ($animation_style == 'apple') {
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<body <?php body_class(); ?>>
|
||||
|
||||
<?php /*wp_body_open();*/ ?>
|
||||
@@ -1064,9 +1037,7 @@ if ($animation_style == 'apple') {
|
||||
|
||||
</div>
|
||||
|
||||
<!--Banner-->
|
||||
|
||||
<section id="banner" class="banner section section-lg section-shaped">
|
||||
<!--Banner--><section id="banner" class="banner section section-lg section-shaped">
|
||||
|
||||
<div class="shape <?php echo get_option('argon_banner_background_hide_shapes') == 'true' ? '' : 'shape-style-1' ?> <?php echo get_option('argon_banner_background_color_type') == '' ? 'shape-primary' : get_option('argon_banner_background_color_type'); ?>">
|
||||
|
||||
@@ -1090,8 +1061,6 @@ if ($animation_style == 'apple') {
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$banner_title = get_option('argon_banner_title') == '' ? get_bloginfo('name') : get_option('argon_banner_title');
|
||||
@@ -1144,8 +1113,6 @@ if ($animation_style == 'apple') {
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<?php if (apply_filters('argon_page_background_url', get_option('argon_page_background_url')) != '') { ?>
|
||||
|
||||
<style>
|
||||
@@ -1286,8 +1253,7 @@ if ($animation_style == 'apple') {
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!-- 毛玻璃效果 - 独立于背景图片设置(无背景图时也生效) -->
|
||||
<?php
|
||||
<!-- 毛玻璃效果 - 独立于背景图片设置(无背景图时也生效) --><?php
|
||||
$card_blur_standalone = intval(get_option('argon_card_blur', '20'));
|
||||
$card_saturate_standalone = intval(get_option('argon_card_saturate', '180'));
|
||||
$post_bg_opacity_standalone = get_option('argon_post_background_opacity', '0.7');
|
||||
@@ -1328,7 +1294,6 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
</style>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (get_option('argon_show_toolbar_mask') == 'true') { ?>
|
||||
|
||||
<style>
|
||||
@@ -1365,8 +1330,6 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<div id="float_action_buttons" class="float-action-buttons fabtns-unloaded">
|
||||
|
||||
<button id="fabtn_toggle_sides" class="btn btn-icon btn-neutral fabtn shadow-sm" type="button" aria-hidden="true" tooltip-move-to-left="<?php _e('移至左侧', 'argon'); ?>" tooltip-move-to-right="<?php _e('移至右侧', 'argon'); ?>">
|
||||
@@ -1513,7 +1476,5 @@ if (apply_filters('argon_page_background_url', get_option('argon_page_background
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="content" class="site-content">
|
||||
|
||||
|
||||
47
sidebar.php
47
sidebar.php
@@ -15,10 +15,8 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
|
||||
<aside id="leftbar" class="<?php echo $leftbar_class; ?>" role="complementary">
|
||||
|
||||
<!-- 移动端侧边栏 - 重新设计的布局 -->
|
||||
<div id="leftbar_mobile_nav" class="leftbar-mobile-nav">
|
||||
<!-- 顶部用户信息区 -->
|
||||
<div class="leftbar-mobile-profile">
|
||||
<!-- 移动端侧边栏 - 重新设计的布局 --><div id="leftbar_mobile_nav" class="leftbar-mobile-nav">
|
||||
<!-- 顶部用户信息区 --><div class="leftbar-mobile-profile">
|
||||
<div class="leftbar-mobile-close" id="leftbar_close_btn">
|
||||
<i class="fa fa-times"></i>
|
||||
</div>
|
||||
@@ -48,8 +46,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
<div class="leftbar-mobile-user-desc"><?php echo esc_html($author_desc); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<!-- 统计数据 -->
|
||||
<div class="leftbar-mobile-stats">
|
||||
<!-- 统计数据 --><div class="leftbar-mobile-stats">
|
||||
<div class="leftbar-mobile-stat">
|
||||
<span class="stat-num"><?php echo wp_count_posts()->publish; ?></span>
|
||||
<span class="stat-label"><?php _e('文章', 'argon'); ?></span>
|
||||
@@ -65,16 +62,14 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="leftbar-mobile-search">
|
||||
<!-- 搜索框 --><div class="leftbar-mobile-search">
|
||||
<div class="leftbar-mobile-search-inner">
|
||||
<i class="fa fa-search"></i>
|
||||
<input type="text" id="leftbar_mobile_search_input" placeholder="<?php _e('搜索...', 'argon'); ?>" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 导航菜单 -->
|
||||
<?php if ( has_nav_menu('toolbar_menu') ) : ?>
|
||||
<!-- 导航菜单 --><?php if ( has_nav_menu('toolbar_menu') ) : ?>
|
||||
<div class="leftbar-mobile-menu-section">
|
||||
<div class="leftbar-mobile-section-title"><?php _e('导航', 'argon'); ?></div>
|
||||
<ul class="leftbar-mobile-menu">
|
||||
@@ -117,8 +112,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 侧边栏菜单 -->
|
||||
<?php if ( has_nav_menu('leftbar_menu') ) : ?>
|
||||
<!-- 侧边栏菜单 --><?php if ( has_nav_menu('leftbar_menu') ) : ?>
|
||||
<div class="leftbar-mobile-menu-section">
|
||||
<div class="leftbar-mobile-section-title"><?php _e('更多', 'argon'); ?></div>
|
||||
<ul class="leftbar-mobile-menu">
|
||||
@@ -135,8 +129,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 文章目录折叠面板 (仅在文章页显示) -->
|
||||
<?php if (have_catalog()) : ?>
|
||||
<!-- 文章目录折叠面板 (仅在文章页显示) --><?php if (have_catalog()) : ?>
|
||||
<div class="leftbar-mobile-collapse-section">
|
||||
<div class="leftbar-mobile-collapse-header" id="mobile_catalog_toggle">
|
||||
<div class="collapse-header-left">
|
||||
@@ -151,8 +144,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- TODO折叠面板 -->
|
||||
<?php if (get_option('argon_show_todo_list', 'true') == 'true') : ?>
|
||||
<!-- TODO折叠面板 --><?php if (get_option('argon_show_todo_list', 'true') == 'true') : ?>
|
||||
<?php
|
||||
$mobile_todos = argon_get_todo_list();
|
||||
$mobile_is_author = current_user_can('publish_posts');
|
||||
@@ -259,8 +251,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 顶栏自定义链接 -->
|
||||
<?php
|
||||
<!-- 顶栏自定义链接 --><?php
|
||||
$toolbar_links_left = get_option('argon_toolbar_links_left', '');
|
||||
$toolbar_links_right = get_option('argon_toolbar_links_right', '');
|
||||
$has_custom_links = !empty(trim($toolbar_links_left)) || !empty(trim($toolbar_links_right));
|
||||
@@ -307,8 +298,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 底部操作区 -->
|
||||
<div class="leftbar-mobile-footer">
|
||||
<!-- 底部操作区 --><div class="leftbar-mobile-footer">
|
||||
<div class="leftbar-mobile-actions">
|
||||
<button class="leftbar-mobile-action" onclick="toggleDarkmode()">
|
||||
<i class="fa fa-moon-o"></i>
|
||||
@@ -326,8 +316,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 桌面端原有侧边栏内容 -->
|
||||
<div class="leftbar-desktop-content">
|
||||
<!-- 桌面端原有侧边栏内容 --><div class="leftbar-desktop-content">
|
||||
<?php if (get_option('argon_sidebar_announcement') != '') { ?>
|
||||
|
||||
<div id="leftbar_announcement" class="card bg-white shadow-sm border-0">
|
||||
@@ -350,8 +339,6 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
|
||||
<span class="leftbar-banner-title text-white"><?php echo get_option('argon_sidebar_banner_title') == '' ? bloginfo('name') : get_option('argon_sidebar_banner_title'); ?></span>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$sidebar_subtitle = get_option('argon_sidebar_banner_subtitle');
|
||||
@@ -370,12 +357,8 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
|
||||
<?php } /*顶栏标题*/?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
/*侧栏上部菜单*/
|
||||
@@ -661,8 +644,6 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( has_nav_menu('leftbar_author_links') ){
|
||||
|
||||
echo "<div class='site-author-links'>";
|
||||
@@ -719,8 +700,6 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( has_nav_menu('leftbar_friend_links') ){
|
||||
|
||||
echo "<div class='site-friend-links'>
|
||||
@@ -1178,9 +1157,7 @@ $author_desc = get_option('argon_sidebar_author_description');
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
</div><!-- .leftbar-desktop-content -->
|
||||
|
||||
</aside>
|
||||
</div><!-- .leftbar-desktop-content --></aside>
|
||||
|
||||
<div class="modal fade" id="blog_categories" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
|
||||
|
||||
|
||||
18
single.php
18
single.php
@@ -1,15 +1,9 @@
|
||||
<?php get_header(); ?>
|
||||
|
||||
|
||||
|
||||
<div class="page-information-card-container"></div>
|
||||
|
||||
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
|
||||
|
||||
<div id="primary" class="content-area">
|
||||
|
||||
<main id="main" class="site-main" role="main">
|
||||
@@ -20,12 +14,8 @@
|
||||
|
||||
the_post();
|
||||
|
||||
|
||||
|
||||
get_template_part( 'template-parts/content', 'single' );
|
||||
|
||||
|
||||
|
||||
// 文章操作按钮(分享和评论)
|
||||
get_template_part( 'template-parts/post-actions' );
|
||||
|
||||
@@ -33,8 +23,6 @@
|
||||
comments_template();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( is_singular( 'post' ) ) {
|
||||
|
||||
if (get_previous_post() || get_next_post()){
|
||||
@@ -67,8 +55,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$relatedPosts = get_option('argon_related_post', 'disabled');
|
||||
|
||||
if ($relatedPosts != "disabled"){
|
||||
@@ -201,13 +187,9 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
endwhile;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php get_footer(); ?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user