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:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* CRUD de configuraciones por componentes
|
||||
*
|
||||
* @package Apus_Theme
|
||||
* @package ROI_Theme
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
@@ -12,16 +12,16 @@ if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class APUS_Settings_Manager {
|
||||
class ROI_Settings_Manager {
|
||||
|
||||
const OPTION_NAME = 'apus_theme_settings';
|
||||
const OPTION_NAME = 'roi_theme_settings';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action('wp_ajax_apus_get_settings', array($this, 'ajax_get_settings'));
|
||||
add_action('wp_ajax_apus_save_settings', array($this, 'ajax_save_settings'));
|
||||
add_action('wp_ajax_roi_get_settings', array($this, 'ajax_get_settings'));
|
||||
add_action('wp_ajax_roi_save_settings', array($this, 'ajax_save_settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ class APUS_Settings_Manager {
|
||||
*/
|
||||
public function save_settings($data) {
|
||||
// Validar
|
||||
$validator = new APUS_Validator();
|
||||
$validator = new ROI_Validator();
|
||||
$validation = $validator->validate($data);
|
||||
|
||||
if (!$validation['valid']) {
|
||||
@@ -54,7 +54,7 @@ class APUS_Settings_Manager {
|
||||
$sanitized = $this->sanitize_settings($data);
|
||||
|
||||
// Agregar metadata
|
||||
$sanitized['version'] = APUS_ADMIN_PANEL_VERSION;
|
||||
$sanitized['version'] = ROI_ADMIN_PANEL_VERSION;
|
||||
$sanitized['updated_at'] = current_time('mysql');
|
||||
|
||||
// Guardar
|
||||
@@ -68,14 +68,14 @@ class APUS_Settings_Manager {
|
||||
|
||||
/**
|
||||
* Valores por defecto
|
||||
* Lee los defaults desde la tabla wp_apus_theme_components_defaults
|
||||
* Lee los defaults desde la tabla wp_roi_theme_components_defaults
|
||||
*/
|
||||
public function get_defaults() {
|
||||
$db_manager = new APUS_DB_Manager();
|
||||
$db_manager = new ROI_DB_Manager();
|
||||
$component_names = $db_manager->list_components('defaults');
|
||||
|
||||
$defaults = array(
|
||||
'version' => APUS_ADMIN_PANEL_VERSION,
|
||||
'version' => ROI_ADMIN_PANEL_VERSION,
|
||||
'components' => array()
|
||||
);
|
||||
|
||||
@@ -106,7 +106,7 @@ class APUS_Settings_Manager {
|
||||
*/
|
||||
public function ajax_get_settings() {
|
||||
// Verificar nonce usando check_ajax_referer (método recomendado para AJAX)
|
||||
check_ajax_referer('apus_admin_nonce', 'nonce');
|
||||
check_ajax_referer('roi_admin_nonce', 'nonce');
|
||||
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error('Permisos insuficientes');
|
||||
@@ -121,7 +121,7 @@ class APUS_Settings_Manager {
|
||||
*/
|
||||
public function ajax_save_settings() {
|
||||
// Verificar nonce usando check_ajax_referer (método recomendado para AJAX)
|
||||
check_ajax_referer('apus_admin_nonce', 'nonce');
|
||||
check_ajax_referer('roi_admin_nonce', 'nonce');
|
||||
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error('Permisos insuficientes');
|
||||
@@ -153,4 +153,4 @@ class APUS_Settings_Manager {
|
||||
}
|
||||
|
||||
// Instanciar clase
|
||||
new APUS_Settings_Manager();
|
||||
new ROI_Settings_Manager();
|
||||
|
||||
Reference in New Issue
Block a user