feat: remove forum feature (Phase 1)

This commit is contained in:
kate522 committed 2026-08-02 20:02:44 +08:00
1 parent f3e4cdd9cf
commit 2bbd7c01a3
173 files changed
+51 -27360

No files matched your search

+4 -48
View File
@@ -1,8 +1,9 @@
<?php
/**
* Forum frontend URL helpers.
* Generic page-template URL helpers.
*
* Page-template assignment is the source of truth for forum home / compose URLs.
* Page-template assignment is the source of truth for resolving public URLs
* for custom page templates (submit form, etc.).
*
* @package AKSRT
*/
@@ -13,7 +14,7 @@ if (!function_exists('aksrt_get_page_url_by_template')) :
/**
* Resolve the first published page that uses a given page template file.
*
* @param string $template_file Relative theme template path (e.g. templates/pages/page-forums.php).
* @param string $template_file Relative theme template path (e.g. templates/pages/page-submit.php).
*/
function aksrt_get_page_url_by_template(string $template_file): string {
$template_file = ltrim(str_replace('\\', '/', $template_file), '/');
@@ -51,48 +52,3 @@ if (!function_exists('aksrt_get_page_url_by_template')) :
return $url;
}
endif;
if (!function_exists('aksrt_get_forum_home_url')) :
/**
* Public forum home URL (page template AKSRT - 论坛).
*/
function aksrt_get_forum_home_url(): string {
$url = aksrt_get_page_url_by_template('templates/pages/page-forums.php');
return $url !== '' ? $url : home_url('/');
}
endif;
if (!function_exists('aksrt_get_forum_compose_url')) :
/**
* Public forum compose URL (page template AKSRT - 发帖).
*
* @param array<string, scalar> $args Optional query args (board, plate, …).
*/
function aksrt_get_forum_compose_url(array $args = []): string {
$url = aksrt_get_page_url_by_template('templates/forum/forum-compose.php');
if ($url === '') {
$url = home_url('/');
}
// Normalize plate → board for compose form contract.
if (isset($args['plate']) && !isset($args['board'])) {
$args['board'] = $args['plate'];
unset($args['plate']);
}
$clean = [];
foreach ($args as $key => $value) {
$key = sanitize_key((string) $key);
if ($key === '') {
continue;
}
if (is_bool($value)) {
$clean[$key] = $value ? '1' : '0';
} else {
$clean[$key] = (string) $value;
}
}
return !empty($clean) ? add_query_arg($clean, $url) : $url;
}
endif;