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') ? AKSRT_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 '\n"; } return '\n"; } }