diff --git a/Shared/Infrastructure/Hooks/CacheFirstHooksRegistrar.php b/Shared/Infrastructure/Hooks/CacheFirstHooksRegistrar.php new file mode 100644 index 00000000..08adade1 --- /dev/null +++ b/Shared/Infrastructure/Hooks/CacheFirstHooksRegistrar.php @@ -0,0 +1,82 @@ + 0) { + /** + * Hook: roi_theme_before_page_serve + * + * Permite que plugins externos evalúen condiciones antes de servir página. + * + * Uso típico: + * - Rate limiters (límite de vistas por IP) + * - Membership plugins (verificar acceso) + * - Geolocation restrictions + * + * Para bloquear acceso: + * wp_safe_redirect('/pagina-destino/', 302); + * exit; + * + * Para permitir acceso: + * return; // La página se servirá (con cache si disponible) + * + * @since 1.0.0 + * @param int $post_id ID del post/page que se va a servir + */ + do_action('roi_theme_before_page_serve', $post_id); + } + } +} diff --git a/functions.php b/functions.php index d946a389..25a9f61d 100644 --- a/functions.php +++ b/functions.php @@ -174,6 +174,12 @@ try { ); $youtubeFacadeHooksRegistrar->register(); + // === CACHE-FIRST ARCHITECTURE (Plan 1000.01) === + // Hook para plugins externos que necesitan evaluar acceso antes de servir página + // @see openspec/specs/cache-first-architecture/spec.md + $cacheFirstHooksRegistrar = new \ROITheme\Shared\Infrastructure\Hooks\CacheFirstHooksRegistrar(); + $cacheFirstHooksRegistrar->register(); + // Log en modo debug if (defined('WP_DEBUG') && WP_DEBUG) { error_log('ROI Theme: Admin Panel initialized successfully');