FASE 1 COMPLETADA: Limpieza de defaults hardcodeados
Eliminados todos los componentes incorrectos y defaults duplicados preparando el sistema para la implementación correcta con tabla de BD. ARCHIVOS ELIMINADOS (11 archivos): - admin/assets/js/component-navbar.js - admin/assets/css/component-navbar.css - admin/components/component-top-bar.php - admin/components/component-navbar.php - admin/components/component-hero-section.php - admin/components/component-lets-talk-button.php - admin/includes/sanitizers/class-topbar-sanitizer.php - admin/includes/sanitizers/class-navbar-sanitizer.php - admin/includes/sanitizers/class-herosection-sanitizer.php - admin/includes/sanitizers/class-letstalkbutton-sanitizer.php - template-parts/navbar-configurable.php ARCHIVOS MODIFICADOS (6 archivos): - admin/includes/class-admin-menu.php: Eliminados enqueues de componentes - admin/includes/class-settings-manager.php: Limpiados get_defaults() y sanitize_settings() - admin/includes/class-validator.php: Eliminado validate_top_bar() - admin/pages/main.php: Reducido de 521 a 37 líneas (93%) - admin/assets/js/admin-app.js: Reducido de 431 a 219 líneas (49%) - header.php: Eliminado código de Top Bar (92 líneas) BASE DE DATOS: - Eliminada opción 'apus_theme_settings' de wp_options RESUMEN: - 11 archivos eliminados - 6 archivos limpiados - 1 opción de BD eliminada - Todos los defaults hardcodeados eliminados - Sistema preparado para FASE 2 (crear tabla de defaults) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,74 +68,27 @@ class APUS_Settings_Manager {
|
||||
|
||||
/**
|
||||
* Valores por defecto
|
||||
* NOTA: Aquí se agregan los defaults de cada componente
|
||||
* NOTA: Los defaults se cargarán desde la tabla wp_apus_theme_components_defaults
|
||||
*/
|
||||
public function get_defaults() {
|
||||
return array(
|
||||
'version' => APUS_ADMIN_PANEL_VERSION,
|
||||
'components' => array(
|
||||
'top_bar' => array(
|
||||
'enabled' => true,
|
||||
'show_on_mobile' => true,
|
||||
'show_on_desktop' => true,
|
||||
'icon_class' => 'bi bi-megaphone-fill',
|
||||
'show_icon' => true,
|
||||
'highlight_text' => 'Nuevo:',
|
||||
'message_text' => 'Accede a más de 200,000 Análisis de Precios Unitarios actualizados para 2025.',
|
||||
'link_text' => 'Ver Catálogo',
|
||||
'link_url' => '/catalogo',
|
||||
'link_target' => '_self',
|
||||
'show_link' => true,
|
||||
'custom_styles' => array(
|
||||
// Valores extraídos de componente-top-bar.css
|
||||
'background_color' => '#0E2337', // var(--color-navy-dark)
|
||||
'text_color' => '#ffffff',
|
||||
'highlight_color' => '#FF8600', // var(--color-orange-primary)
|
||||
'link_hover_color' => '#FF8600', // var(--color-orange-primary)
|
||||
'font_size' => 'normal' // 0.9rem del CSS
|
||||
)
|
||||
)
|
||||
// Navbar - Pendiente
|
||||
// Hero - Pendiente
|
||||
// Footer - Pendiente
|
||||
// Los componentes se agregarán aquí cuando se ejecute el algoritmo
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizar configuraciones
|
||||
* NOTA: Aquí se agrega sanitización de cada componente
|
||||
* NOTA: Los sanitizers de componentes se ejecutarán aquí cuando se implementen
|
||||
*/
|
||||
public function sanitize_settings($data) {
|
||||
$sanitized = array(
|
||||
'components' => array()
|
||||
);
|
||||
|
||||
// Sanitizar Top Bar
|
||||
if (isset($data['components']['top_bar'])) {
|
||||
$top_bar = $data['components']['top_bar'];
|
||||
|
||||
$sanitized['components']['top_bar'] = array(
|
||||
'enabled' => !empty($top_bar['enabled']),
|
||||
'show_on_mobile' => !empty($top_bar['show_on_mobile']),
|
||||
'show_on_desktop' => !empty($top_bar['show_on_desktop']),
|
||||
'icon_class' => sanitize_text_field($top_bar['icon_class'] ?? ''),
|
||||
'show_icon' => !empty($top_bar['show_icon']),
|
||||
'highlight_text' => sanitize_text_field($top_bar['highlight_text'] ?? ''),
|
||||
'message_text' => sanitize_text_field($top_bar['message_text'] ?? ''),
|
||||
'link_text' => sanitize_text_field($top_bar['link_text'] ?? ''),
|
||||
'link_url' => esc_url_raw($top_bar['link_url'] ?? ''),
|
||||
'link_target' => in_array($top_bar['link_target'] ?? '', array('_self', '_blank')) ? $top_bar['link_target'] : '_self',
|
||||
'show_link' => !empty($top_bar['show_link']),
|
||||
'custom_styles' => array(
|
||||
'background_color' => sanitize_hex_color($top_bar['custom_styles']['background_color'] ?? ''),
|
||||
'text_color' => sanitize_hex_color($top_bar['custom_styles']['text_color'] ?? ''),
|
||||
'highlight_color' => sanitize_hex_color($top_bar['custom_styles']['highlight_color'] ?? ''),
|
||||
'link_hover_color' => sanitize_hex_color($top_bar['custom_styles']['link_hover_color'] ?? ''),
|
||||
'font_size' => in_array($top_bar['custom_styles']['font_size'] ?? '', array('small', 'normal', 'large')) ? $top_bar['custom_styles']['font_size'] : 'normal'
|
||||
)
|
||||
);
|
||||
}
|
||||
// Los componentes se sanitizarán aquí cuando se ejecute el algoritmo
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user