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:
FrankZamora
2025-11-17 13:48:24 -06:00
parent b782ebceee
commit de5fff4f5c
149 changed files with 3187 additions and 9554 deletions

View File

@@ -5,7 +5,7 @@
* Funciones para mostrar botones de compartir en redes sociales
* en posts individuales. Utiliza URLs nativas sin dependencias de JavaScript.
*
* @package Apus_Theme
* @package ROI_Theme
* @since 1.0.0
*/
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* @param int $post_id ID del post (opcional, usa el post actual si no se proporciona)
* @return string HTML de los botones de compartir
*/
function apus_get_social_share_buttons( $post_id = 0 ) {
function roi_get_social_share_buttons( $post_id = 0 ) {
// Si no se proporciona post_id, usar el post actual
if ( ! $post_id ) {
$post_id = get_the_ID();
@@ -45,7 +45,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
$email_url = 'mailto:?subject=' . $post_title_encoded . '&body=' . $post_url_encoded;
// Obtener texto de compartir desde las opciones del tema
$share_text = apus_get_option( 'apus_share_text', __( 'Compartir:', 'apus-theme' ) );
$share_text = roi_get_option( 'roi_share_text', __( 'Compartir:', 'roi-theme' ) );
// Construir el HTML
ob_start();
@@ -57,7 +57,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
<!-- Facebook -->
<a href="<?php echo esc_url( $facebook_url ); ?>"
class="btn btn-outline-primary btn-sm"
aria-label="<?php esc_attr_e( 'Compartir en Facebook', 'apus-theme' ); ?>"
aria-label="<?php esc_attr_e( 'Compartir en Facebook', 'roi-theme' ); ?>"
target="_blank"
rel="noopener noreferrer">
<i class="bi bi-facebook"></i>
@@ -66,7 +66,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
<!-- X (Twitter) -->
<a href="<?php echo esc_url( $twitter_url ); ?>"
class="btn btn-outline-dark btn-sm"
aria-label="<?php esc_attr_e( 'Compartir en X', 'apus-theme' ); ?>"
aria-label="<?php esc_attr_e( 'Compartir en X', 'roi-theme' ); ?>"
target="_blank"
rel="noopener noreferrer">
<i class="bi bi-twitter-x"></i>
@@ -75,7 +75,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
<!-- LinkedIn -->
<a href="<?php echo esc_url( $linkedin_url ); ?>"
class="btn btn-outline-info btn-sm"
aria-label="<?php esc_attr_e( 'Compartir en LinkedIn', 'apus-theme' ); ?>"
aria-label="<?php esc_attr_e( 'Compartir en LinkedIn', 'roi-theme' ); ?>"
target="_blank"
rel="noopener noreferrer">
<i class="bi bi-linkedin"></i>
@@ -84,7 +84,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
<!-- WhatsApp -->
<a href="<?php echo esc_url( $whatsapp_url ); ?>"
class="btn btn-outline-success btn-sm"
aria-label="<?php esc_attr_e( 'Compartir en WhatsApp', 'apus-theme' ); ?>"
aria-label="<?php esc_attr_e( 'Compartir en WhatsApp', 'roi-theme' ); ?>"
target="_blank"
rel="noopener noreferrer">
<i class="bi bi-whatsapp"></i>
@@ -93,7 +93,7 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
<!-- Email -->
<a href="<?php echo esc_url( $email_url ); ?>"
class="btn btn-outline-secondary btn-sm"
aria-label="<?php esc_attr_e( 'Compartir por Email', 'apus-theme' ); ?>">
aria-label="<?php esc_attr_e( 'Compartir por Email', 'roi-theme' ); ?>">
<i class="bi bi-envelope"></i>
</a>
</div>
@@ -110,18 +110,18 @@ function apus_get_social_share_buttons( $post_id = 0 ) {
*
* @param int $post_id ID del post (opcional)
*/
function apus_display_social_share( $post_id = 0 ) {
function roi_display_social_share( $post_id = 0 ) {
// Solo mostrar en posts individuales
if ( ! is_single() ) {
return;
}
// Verificar si los botones de compartir están habilitados
$enable_share = apus_get_option( 'apus_enable_share_buttons', '1' );
$enable_share = roi_get_option( 'roi_enable_share_buttons', '1' );
if ( $enable_share !== '1' ) {
return;
}
// Mostrar los botones
echo apus_get_social_share_buttons( $post_id );
echo roi_get_social_share_buttons( $post_id );
}