refactor: flatten src/AKSRT → src (drop theme-identifier dir)

Move all domain folders from src/AKSRT/{Domain} to src/{Domain}; remap
Composer PSR-4 "AKSRT\\": "src/"; update audit script + README + ADR
paths; remove dead tools/build-psr4-map.php (scanned deleted inc/classes).
This commit is contained in:
2026-08-02 22:06:06 +08:00
parent 56f1a8175f
commit 8c5b1555c9
285 changed files with 26 additions and 3600 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* @package AKSRT
*/
namespace AKSRT\Frontend;
defined('ABSPATH') || exit;
class CustomCodeRenderer {
public function output_header(): void {
$custom_css = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::custom_css()
: aksrt_get_setting('custom_css', '');
$head_code = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::custom_head_code()
: aksrt_get_setting('custom_head_code', get_option('aksrt_custom_head_code', ''));
$trackcode = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::trackcode()
: '';
echo $this->format((string) $custom_css, 'css', 'aksrt-custom-css');
if ($head_code) {
echo $this->format((string) $head_code, 'js', 'aksrt-custom-js-header');
}
if ($trackcode) {
echo $this->format((string) $trackcode, 'js', 'aksrt-trackcode');
}
}
public function output_footer(): void {
$footer_code = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::custom_footer_code()
: aksrt_get_setting('custom_footer_code', get_option('aksrt_custom_footer_code', ''));
if ($footer_code) {
echo $this->format((string) $footer_code, 'js', 'aksrt-custom-js-footer');
}
}
private function format(string $code, string $type, string $id): string {
$code = trim($code);
if ($code === '') {
return '';
}
if (preg_match('/<\s*(script|style|meta|link|noscript)\b/i', $code)) {
return $code . "\n";
}
if ($type === 'css') {
return '<style id="' . esc_attr($id) . '">' . "\n" . $code . "\n</style>\n";
}
return '<script id="' . esc_attr($id) . '">' . "\n" . $code . "\n</script>\n";
}
}