Fase 1: Estructura Base y DI Container - Clean Architecture
COMPLETADO: Fase 1 de la migración a Clean Architecture + POO ## Estructura de Carpetas - ✓ Estructura completa de 4 capas (Domain, Application, Infrastructure, Presentation) - ✓ Carpetas de Use Cases (SaveComponent, GetComponent, DeleteComponent, SyncSchema) - ✓ Estructura de tests (Unit, Integration, E2E) - ✓ Carpetas de schemas y templates ## Composer y Autoloading - ✓ PSR-4 autoloading configurado para ROITheme namespace - ✓ Autoloader optimizado regenerado ## DI Container - ✓ DIContainer implementado con patrón Singleton - ✓ Métodos set(), get(), has() para gestión de servicios - ✓ Getters específicos para ComponentRepository, ValidationService, CacheService - ✓ Placeholders que serán implementados en Fase 5 - ✓ Prevención de clonación y deserialización ## Interfaces - ✓ ComponentRepositoryInterface (Domain) - ✓ ValidationServiceInterface (Application) - ✓ CacheServiceInterface (Application) - ✓ Component entity placeholder (Domain) ## Bootstrap - ✓ functions.php actualizado con carga de Composer autoloader - ✓ Inicialización del DIContainer - ✓ Helper function roi_container() disponible globalmente ## Tests - ✓ 10 tests unitarios para DIContainer (100% cobertura) - ✓ Total: 13 tests unitarios, 28 assertions - ✓ Suite de tests pasando correctamente ## Validación - ✓ Script de validación automatizado (48/48 checks pasados) - ✓ 100% de validaciones exitosas La arquitectura base está lista para la Fase 2. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Delays the loading of AdSense scripts until user interaction or timeout
|
||||
* to improve initial page load performance.
|
||||
*
|
||||
* @package Apus_Theme
|
||||
* @package ROI_Theme
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
@@ -20,23 +20,23 @@ if (!defined('ABSPATH')) {
|
||||
* Esta función inicia el output buffering y reemplaza los scripts de AdSense
|
||||
* con versiones retrasadas cuando se renderiza la página.
|
||||
*/
|
||||
function apus_delay_adsense_scripts() {
|
||||
function roi_delay_adsense_scripts() {
|
||||
// Solo ejecutar en frontend
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Verificar si el retardo de AdSense está habilitado en las opciones del tema
|
||||
$delay_enabled = apus_get_option('apus_adsense_delay_enabled', '1');
|
||||
$delay_enabled = roi_get_option('roi_adsense_delay_enabled', '1');
|
||||
|
||||
if ($delay_enabled !== '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Iniciar output buffering
|
||||
ob_start('apus_replace_adsense_scripts');
|
||||
ob_start('roi_replace_adsense_scripts');
|
||||
}
|
||||
add_action('template_redirect', 'apus_delay_adsense_scripts', 1);
|
||||
add_action('template_redirect', 'roi_delay_adsense_scripts', 1);
|
||||
|
||||
/**
|
||||
* Reemplaza scripts de AdSense con versiones retrasadas
|
||||
@@ -47,7 +47,7 @@ add_action('template_redirect', 'apus_delay_adsense_scripts', 1);
|
||||
* @param string $html El contenido HTML a procesar
|
||||
* @return string HTML modificado con scripts de AdSense retrasados
|
||||
*/
|
||||
function apus_replace_adsense_scripts($html) {
|
||||
function roi_replace_adsense_scripts($html) {
|
||||
// Solo procesar si hay contenido real de AdSense
|
||||
if (strpos($html, 'pagead2.googlesyndication.com') === false &&
|
||||
strpos($html, 'adsbygoogle.js') === false) {
|
||||
@@ -93,7 +93,7 @@ function apus_replace_adsense_scripts($html) {
|
||||
|
||||
// Agregar comentario para indicar que se procesó (solo en modo debug)
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
$html = str_replace('</body>', '<!-- Scripts de AdSense retrasados por Apus Theme --></body>', $html);
|
||||
$html = str_replace('</body>', '<!-- Scripts de AdSense retrasados por ROI Theme --></body>', $html);
|
||||
}
|
||||
|
||||
return $html;
|
||||
@@ -105,8 +105,8 @@ function apus_replace_adsense_scripts($html) {
|
||||
* Esto agrega un pequeño script inline que marca AdSense como listo para cargar
|
||||
* después de que adsense-loader.js ha sido enqueued.
|
||||
*/
|
||||
function apus_add_adsense_init_script() {
|
||||
$delay_enabled = apus_get_option('apus_adsense_delay_enabled', '1');
|
||||
function roi_add_adsense_init_script() {
|
||||
$delay_enabled = roi_get_option('roi_adsense_delay_enabled', '1');
|
||||
|
||||
if ($delay_enabled !== '1' || is_admin()) {
|
||||
return;
|
||||
@@ -115,17 +115,17 @@ function apus_add_adsense_init_script() {
|
||||
?>
|
||||
<script>
|
||||
// Inicializar flag de retardo de AdSense
|
||||
window.apusAdsenseDelayed = true;
|
||||
window.roiAdsenseDelayed = true;
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action('wp_head', 'apus_add_adsense_init_script', 1);
|
||||
add_action('wp_head', 'roi_add_adsense_init_script', 1);
|
||||
|
||||
/**
|
||||
* INSTRUCCIONES DE USO:
|
||||
*
|
||||
* Para activar el retardo de carga de AdSense:
|
||||
* 1. Ir al panel de opciones del tema (Dashboard > Apus Theme Options)
|
||||
* 1. Ir al panel de opciones del tema (Dashboard > ROI Theme Options)
|
||||
* 2. En la sección "Performance", activar la opción "Delay AdSense Loading"
|
||||
* 3. Guardar cambios
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user