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 @@
|
||||
* Este archivo desactiva completamente los comentarios en WordPress,
|
||||
* tanto en el frontend como en el área de administración.
|
||||
*
|
||||
* @package Apus_Theme
|
||||
* @package ROI_Theme
|
||||
* @since 1.0.0
|
||||
* @link https://github.com/prime-leads-app/analisisdepreciosunitarios.com/issues/4
|
||||
*/
|
||||
@@ -24,11 +24,11 @@ if (!defined('ABSPATH')) {
|
||||
* @param bool $open Si los comentarios están abiertos o no.
|
||||
* @return bool Siempre retorna false.
|
||||
*/
|
||||
function apus_disable_comments_status() {
|
||||
function roi_disable_comments_status() {
|
||||
return false;
|
||||
}
|
||||
add_filter('comments_open', 'apus_disable_comments_status', 20, 2);
|
||||
add_filter('pings_open', 'apus_disable_comments_status', 20, 2);
|
||||
add_filter('comments_open', 'roi_disable_comments_status', 20, 2);
|
||||
add_filter('pings_open', 'roi_disable_comments_status', 20, 2);
|
||||
|
||||
/**
|
||||
* Ocultar comentarios existentes
|
||||
@@ -39,10 +39,10 @@ add_filter('pings_open', 'apus_disable_comments_status', 20, 2);
|
||||
* @param array $comments Array de comentarios.
|
||||
* @return array Array vacío.
|
||||
*/
|
||||
function apus_hide_existing_comments($comments) {
|
||||
function roi_hide_existing_comments($comments) {
|
||||
return array();
|
||||
}
|
||||
add_filter('comments_array', 'apus_hide_existing_comments', 10, 2);
|
||||
add_filter('comments_array', 'roi_hide_existing_comments', 10, 2);
|
||||
|
||||
/**
|
||||
* Desactivar feeds de comentarios
|
||||
@@ -51,25 +51,25 @@ add_filter('comments_array', 'apus_hide_existing_comments', 10, 2);
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_disable_comment_feeds() {
|
||||
function roi_disable_comment_feeds() {
|
||||
// Remover enlaces de feeds de comentarios
|
||||
remove_action('wp_head', 'feed_links_extra', 3);
|
||||
|
||||
// Desactivar feeds de comentarios
|
||||
add_action('do_feed_rss2_comments', 'apus_disable_feed_comments');
|
||||
add_action('do_feed_atom_comments', 'apus_disable_feed_comments');
|
||||
add_action('do_feed_rss2_comments', 'roi_disable_feed_comments');
|
||||
add_action('do_feed_atom_comments', 'roi_disable_feed_comments');
|
||||
}
|
||||
add_action('init', 'apus_disable_comment_feeds');
|
||||
add_action('init', 'roi_disable_comment_feeds');
|
||||
|
||||
/**
|
||||
* Retornar error en feeds de comentarios
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_disable_feed_comments() {
|
||||
function roi_disable_feed_comments() {
|
||||
wp_die(
|
||||
esc_html__('Los comentarios están desactivados en este sitio.', 'apus-theme'),
|
||||
esc_html__('Comentarios no disponibles', 'apus-theme'),
|
||||
esc_html__('Los comentarios están desactivados en este sitio.', 'roi-theme'),
|
||||
esc_html__('Comentarios no disponibles', 'roi-theme'),
|
||||
array(
|
||||
'response' => 404,
|
||||
'back_link' => true,
|
||||
@@ -84,10 +84,10 @@ function apus_disable_feed_comments() {
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_disable_comment_reply_script() {
|
||||
function roi_disable_comment_reply_script() {
|
||||
wp_deregister_script('comment-reply');
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'apus_disable_comment_reply_script', 100);
|
||||
add_action('wp_enqueue_scripts', 'roi_disable_comment_reply_script', 100);
|
||||
|
||||
/**
|
||||
* Remover menú de comentarios del admin
|
||||
@@ -96,10 +96,10 @@ add_action('wp_enqueue_scripts', 'apus_disable_comment_reply_script', 100);
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_remove_comments_admin_menu() {
|
||||
function roi_remove_comments_admin_menu() {
|
||||
remove_menu_page('edit-comments.php');
|
||||
}
|
||||
add_action('admin_menu', 'apus_remove_comments_admin_menu');
|
||||
add_action('admin_menu', 'roi_remove_comments_admin_menu');
|
||||
|
||||
/**
|
||||
* Remover comentarios de la admin bar
|
||||
@@ -109,10 +109,10 @@ add_action('admin_menu', 'apus_remove_comments_admin_menu');
|
||||
* @since 1.0.0
|
||||
* @param WP_Admin_Bar $wp_admin_bar Instancia de WP_Admin_Bar.
|
||||
*/
|
||||
function apus_remove_comments_admin_bar($wp_admin_bar) {
|
||||
function roi_remove_comments_admin_bar($wp_admin_bar) {
|
||||
$wp_admin_bar->remove_menu('comments');
|
||||
}
|
||||
add_action('admin_bar_menu', 'apus_remove_comments_admin_bar', 60);
|
||||
add_action('admin_bar_menu', 'roi_remove_comments_admin_bar', 60);
|
||||
|
||||
/**
|
||||
* Remover metabox de comentarios del editor
|
||||
@@ -121,7 +121,7 @@ add_action('admin_bar_menu', 'apus_remove_comments_admin_bar', 60);
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_remove_comments_metabox() {
|
||||
function roi_remove_comments_metabox() {
|
||||
// Post types por defecto
|
||||
remove_meta_box('commentstatusdiv', 'post', 'normal');
|
||||
remove_meta_box('commentstatusdiv', 'page', 'normal');
|
||||
@@ -139,7 +139,7 @@ function apus_remove_comments_metabox() {
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('admin_init', 'apus_remove_comments_metabox');
|
||||
add_action('admin_init', 'roi_remove_comments_metabox');
|
||||
|
||||
/**
|
||||
* Ocultar columna de comentarios en listados del admin
|
||||
@@ -150,14 +150,14 @@ add_action('admin_init', 'apus_remove_comments_metabox');
|
||||
* @param array $columns Columnas actuales.
|
||||
* @return array Columnas modificadas sin comentarios.
|
||||
*/
|
||||
function apus_remove_comments_column($columns) {
|
||||
function roi_remove_comments_column($columns) {
|
||||
unset($columns['comments']);
|
||||
return $columns;
|
||||
}
|
||||
|
||||
// Aplicar a posts y páginas
|
||||
add_filter('manage_posts_columns', 'apus_remove_comments_column');
|
||||
add_filter('manage_pages_columns', 'apus_remove_comments_column');
|
||||
add_filter('manage_posts_columns', 'roi_remove_comments_column');
|
||||
add_filter('manage_pages_columns', 'roi_remove_comments_column');
|
||||
|
||||
/**
|
||||
* Desactivar widgets de comentarios
|
||||
@@ -166,10 +166,10 @@ add_filter('manage_pages_columns', 'apus_remove_comments_column');
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_disable_comments_widgets() {
|
||||
function roi_disable_comments_widgets() {
|
||||
unregister_widget('WP_Widget_Recent_Comments');
|
||||
}
|
||||
add_action('widgets_init', 'apus_disable_comments_widgets');
|
||||
add_action('widgets_init', 'roi_disable_comments_widgets');
|
||||
|
||||
/**
|
||||
* Remover estilos CSS de comentarios recientes
|
||||
@@ -178,7 +178,7 @@ add_action('widgets_init', 'apus_disable_comments_widgets');
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_remove_recent_comments_style() {
|
||||
function roi_remove_recent_comments_style() {
|
||||
global $wp_widget_factory;
|
||||
|
||||
if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
|
||||
@@ -188,7 +188,7 @@ function apus_remove_recent_comments_style() {
|
||||
));
|
||||
}
|
||||
}
|
||||
add_action('widgets_init', 'apus_remove_recent_comments_style');
|
||||
add_action('widgets_init', 'roi_remove_recent_comments_style');
|
||||
|
||||
/**
|
||||
* Redireccionar URLs de comentarios (opcional)
|
||||
@@ -198,13 +198,13 @@ add_action('widgets_init', 'apus_remove_recent_comments_style');
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_redirect_comment_urls() {
|
||||
function roi_redirect_comment_urls() {
|
||||
if (is_comment_feed()) {
|
||||
wp_safe_redirect(home_url(), 301);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
add_action('template_redirect', 'apus_redirect_comment_urls');
|
||||
add_action('template_redirect', 'roi_redirect_comment_urls');
|
||||
|
||||
/**
|
||||
* Prevenir nuevos comentarios via REST API
|
||||
@@ -215,7 +215,7 @@ add_action('template_redirect', 'apus_redirect_comment_urls');
|
||||
* @param array $endpoints Endpoints disponibles.
|
||||
* @return array Endpoints sin comentarios.
|
||||
*/
|
||||
function apus_disable_comments_rest_api($endpoints) {
|
||||
function roi_disable_comments_rest_api($endpoints) {
|
||||
if (isset($endpoints['/wp/v2/comments'])) {
|
||||
unset($endpoints['/wp/v2/comments']);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ function apus_disable_comments_rest_api($endpoints) {
|
||||
}
|
||||
return $endpoints;
|
||||
}
|
||||
add_filter('rest_endpoints', 'apus_disable_comments_rest_api');
|
||||
add_filter('rest_endpoints', 'roi_disable_comments_rest_api');
|
||||
|
||||
/**
|
||||
* Ocultar opciones de comentarios en el dashboard
|
||||
@@ -233,10 +233,10 @@ add_filter('rest_endpoints', 'apus_disable_comments_rest_api');
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function apus_remove_dashboard_comments() {
|
||||
function roi_remove_dashboard_comments() {
|
||||
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
|
||||
}
|
||||
add_action('admin_init', 'apus_remove_dashboard_comments');
|
||||
add_action('admin_init', 'roi_remove_dashboard_comments');
|
||||
|
||||
/**
|
||||
* Desactivar notificaciones de comentarios
|
||||
@@ -246,8 +246,8 @@ add_action('admin_init', 'apus_remove_dashboard_comments');
|
||||
* @since 1.0.0
|
||||
* @return bool Siempre retorna false.
|
||||
*/
|
||||
function apus_disable_comment_emails() {
|
||||
function roi_disable_comment_emails() {
|
||||
return false;
|
||||
}
|
||||
add_filter('notify_post_author', 'apus_disable_comment_emails', 10, 2);
|
||||
add_filter('notify_moderator', 'apus_disable_comment_emails', 10, 2);
|
||||
add_filter('notify_post_author', 'roi_disable_comment_emails', 10, 2);
|
||||
add_filter('notify_moderator', 'roi_disable_comment_emails', 10, 2);
|
||||
|
||||
Reference in New Issue
Block a user