refactor(autoload): migrate theme classes to Composer PSR-4

Move 288 types from global AKSRT_* + inc/classes manual requires into
namespace AKSRT\{Domain} under src/AKSRT/, wire composer.json psr-4,
and slim bootstrap to helpers/modules/hooks only. Split multi-class
widget/gateway files, update admin contract audit paths, and document
the layout in ADR/README.
This commit is contained in:
kate522 committed 2026-07-17 13:29:22 +08:00
1 parent 8f349b40fb
commit aaf458af1c
404 files changed
+13602 -7705

No files matched your search

+9 -9
View File
@@ -206,11 +206,11 @@ if (!function_exists('aksrt_renderer_curated_images')) {
$images = [];
$limit = max(1, min(8, $limit));
if (!class_exists('AKSRT_Post_Meta_Box')) {
if (!class_exists('\AKSRT\Core\PostMetaBox')) {
return [];
}
$cover_images = (string) AKSRT_Post_Meta_Box::get_meta_value($post_id, 'cover_images', '');
$cover_images = (string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'cover_images', '');
if ($cover_images === '') {
return [];
}
@@ -267,8 +267,8 @@ if (!function_exists('aksrt_renderer_random_fallback_image')) {
get_template_directory_uri() . '/assets/img/placeholder.svg',
];
if (class_exists('AKSRT_Settings')) {
$thumb = AKSRT_Settings::get_post_thumb_settings();
if (class_exists('\AKSRT\Settings\Settings')) {
$thumb = \AKSRT\Settings\Settings::get_post_thumb_settings();
$spare = $thumb['spare_images'] ?? [];
if (is_array($spare) && !empty($spare)) {
foreach ($spare as $url) {
@@ -327,7 +327,7 @@ if (!function_exists('aksrt_renderer_resolve_images')) {
$has_real = true;
}
$thumb_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_post_thumb_settings() : [];
$thumb_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_thumb_settings() : [];
$allow_fallback = !empty($thumb_settings['rand_thumb']) || !empty($cfg['thumb_if_has']);
if ($primary === '' && $allow_fallback) {
$primary = aksrt_renderer_random_fallback_image($post_id);
@@ -349,8 +349,8 @@ if (!function_exists('aksrt_renderer_lazyload_config')) {
* @return array<string,mixed>
*/
function aksrt_renderer_lazyload_config(): array {
if (class_exists('AKSRT_Settings')) {
$lazy = AKSRT_Settings::get_lazyload_config();
if (class_exists('\AKSRT\Settings\Settings')) {
$lazy = \AKSRT\Settings\Settings::get_lazyload_config();
return [
'enabled' => !empty($lazy['enabled']) && !empty($lazy['posts_thumb_enabled']),
'placeholder_url' => (string) ($lazy['placeholder_url'] ?? ''),
@@ -411,8 +411,8 @@ if (!function_exists('aksrt_renderer_collect_post_data')) {
$categories = get_the_category($post_id) ?: [];
$tags = get_the_tags($post_id) ?: [];
$custom_excerpt = class_exists('AKSRT_Post_Meta_Box')
? (string) AKSRT_Post_Meta_Box::get_meta_value($post_id, 'custom_excerpt', '')
$custom_excerpt = class_exists('\AKSRT\Core\PostMetaBox')
? (string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'custom_excerpt', '')
: '';
$custom_subtitle = (string) get_post_meta($post_id, '_subtitle', true);
$excerpt_source = $custom_excerpt !== '' ? $custom_excerpt : (string) get_the_excerpt($post_id);