refactor(classes): organize inc/classes into domain folders
Move ~94 root class shells and root *-traits into domain directories (core, auth, user, credits, content, payment/gateways, forum, shop, sms, ai, messages, extensions, widgets, settings, admin). Update bootstrap require paths, co-locate traits with owners, fix forum/user relative requires, drop duplicate shop controller requires, and wire home-modules load. Path-only; class names and init order unchanged.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* AKSRT Scripts & Styles
|
||||
*
|
||||
* 前端资源加载:CSS、JS、内联样式变量
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
class AKSRT_Scripts {
|
||||
use AKSRT_Scripts_Part_1b;
|
||||
use AKSRT_Scripts_Part_2;
|
||||
|
||||
|
||||
private static $instance = null;
|
||||
|
||||
private function __construct() {}
|
||||
|
||||
public static function get_instance(): self {
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function init(): void {
|
||||
add_action('wp_enqueue_scripts', [$this, 'enqueue_public']);
|
||||
add_action('admin_enqueue_scripts', [$this, 'enqueue_admin']);
|
||||
add_action('admin_enqueue_scripts', [$this, 'enqueue_passive_polyfill'], 1);
|
||||
add_action('wp_head', [$this, 'inline_css_vars']);
|
||||
add_action('wp_head', [$this, 'output_custom_codes']);
|
||||
add_action('wp_body_open', [$this, 'output_loading_overlay'], 1);
|
||||
add_action('wp_footer', [$this, 'output_custom_footer_codes'], 99);
|
||||
add_action('wp_ajax_aksrt_frontend_debug', [$this, 'handle_frontend_debug']);
|
||||
add_action('wp_ajax_nopriv_aksrt_frontend_debug', [$this, 'handle_frontend_debug']);
|
||||
add_action('wp_ajax_aksrt_search_history', [$this, 'handle_search_history']);
|
||||
add_action('wp_ajax_aksrt_search_suggestions', [$this, 'handle_search_suggestions']);
|
||||
add_action('wp_ajax_nopriv_aksrt_search_suggestions', [$this, 'handle_search_suggestions']);
|
||||
add_filter('body_class', [$this, 'body_classes']);
|
||||
add_filter('wp_resource_hints', [$this, 'resource_hints'], 10, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字体 CDN 的 preconnect 提示(提前 DNS + TLS 握手,加速首屏字体加载)
|
||||
*/
|
||||
public function resource_hints(array $hints, string $relation): array {
|
||||
if ('preconnect' === $relation) {
|
||||
$hints[] = [
|
||||
'href' => 'https://fonts.googleapis.com',
|
||||
'crossorigin',
|
||||
];
|
||||
$hints[] = [
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin',
|
||||
];
|
||||
$hints[] = [
|
||||
'href' => 'https://cdn.jsdelivr.net',
|
||||
'crossorigin',
|
||||
];
|
||||
}
|
||||
return $hints;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AKSRT_Scripts::get_instance();
|
||||
Reference in New Issue
Block a user