refactor(admin): consolidate duplicate configuration

Remove duplicate comment, captcha, filing, and website-security configuration paths.

Move front submission verification to the captcha scene matrix and retire obsolete admin routes and components.
This commit is contained in:
2026-08-13 02:26:17 +08:00
parent 0752a2fbf6
commit ab70a5eae9
32 changed files with 86 additions and 912 deletions
+7 -13
View File
@@ -295,7 +295,7 @@ class FrontSubmit {
public function ajax_submit_post(): void {
$this->verify_nonce();
$this->maybe_verify_captcha();
$this->verify_captcha();
$data = wp_unslash($_POST);
$result = $this->persist(is_array($data) ? $data : [], 'posts_save');
@@ -385,21 +385,15 @@ class FrontSubmit {
}
}
private function maybe_verify_captcha(): void {
$settings = $this->settings();
if (empty($settings['captcha'])) {
return;
}
private function verify_captcha(): void {
if (!function_exists('aksrt_require_captcha')) {
return;
}
$payload = [];
if (isset($_POST['captcha']) && is_array($_POST['captcha'])) {
$payload = wp_unslash($_POST['captcha']);
}
$verify = aksrt_require_captcha('submit', is_array($payload) ? $payload : []);
if (is_wp_error($verify)) {
wp_send_json_error(['message' => $verify->get_error_message()]);
$verify = aksrt_require_captcha('front_submit', $_POST);
if ($verify !== true) {
wp_send_json_error([
'message' => is_string($verify) ? $verify : __('人机验证失败,请重试', 'aksrt'),
], 400);
}
}