getSettings(); if (empty($settings)) { return; } $content = $this->renderer->renderHeadContent($settings); if (!empty($content)) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $content; } } catch (\Throwable $e) { $this->logError('Error injecting head content', $e); } } /** * Inyecta contenido en wp_footer * * Callback para el hook wp_footer. * Genera y muestra: Custom JS Footer * * @return void */ public function injectFooterContent(): void { try { $settings = $this->getSettings(); if (empty($settings)) { return; } $content = $this->renderer->renderFooterContent($settings); if (!empty($content)) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $content; } } catch (\Throwable $e) { $this->logError('Error injecting footer content', $e); } } /** * Obtiene las configuraciones del componente theme-settings * * @return array Configuraciones agrupadas o array vacio si no hay */ private function getSettings(): array { return $this->repository->getComponentSettings(self::COMPONENT_NAME); } /** * Registra errores en el log de WordPress * * @param string $message Mensaje de error * @param \Throwable $e Excepcion * @return void */ private function logError(string $message, \Throwable $e): void { if (defined('WP_DEBUG') && WP_DEBUG) { error_log(sprintf( 'ROI Theme - ThemeSettingsInjector: %s - %s in %s:%d', $message, $e->getMessage(), $e->getFile(), $e->getLine() )); } } }