backup: estado antes de limpieza de defaults
This commit is contained in:
136
admin/includes/sanitizers/class-navbar-sanitizer.php
Normal file
136
admin/includes/sanitizers/class-navbar-sanitizer.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Navbar Sanitizer
|
||||
*
|
||||
* Sanitiza configuraciones del componente Navbar
|
||||
*
|
||||
* @package Apus_Theme
|
||||
* @subpackage Admin_Panel\Sanitizers
|
||||
* @since 2.1.0
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class APUS_Navbar_Sanitizer
|
||||
*
|
||||
* Sanitiza todas las configuraciones del componente Navbar
|
||||
*/
|
||||
class APUS_Navbar_Sanitizer {
|
||||
|
||||
/**
|
||||
* Obtiene los valores por defecto del Navbar
|
||||
*
|
||||
* @return array Valores por defecto
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function get_defaults() {
|
||||
return array(
|
||||
'enabled' => true,
|
||||
'show_on_mobile' => true,
|
||||
'show_on_desktop' => true,
|
||||
'position' => 'sticky',
|
||||
'responsive_breakpoint' => 'lg',
|
||||
'enable_box_shadow' => true,
|
||||
'enable_underline_effect' => true,
|
||||
'enable_hover_background' => true,
|
||||
|
||||
'lets_talk_button' => array(
|
||||
'enabled' => true,
|
||||
'text' => "Let's Talk",
|
||||
'icon_class' => 'bi bi-lightning-charge-fill',
|
||||
'show_icon' => true,
|
||||
'position' => 'right'
|
||||
),
|
||||
|
||||
'dropdown' => array(
|
||||
'enable_hover_desktop' => true,
|
||||
'max_height' => 70,
|
||||
'border_radius' => 8,
|
||||
'item_padding_vertical' => 0.5,
|
||||
'item_padding_horizontal' => 1.25
|
||||
),
|
||||
|
||||
'custom_styles' => array(
|
||||
'background_color' => '#1e3a5f',
|
||||
'text_color' => '#ffffff',
|
||||
'link_hover_color' => '#FF8600',
|
||||
'link_hover_bg_color' => '#FF8600',
|
||||
'dropdown_bg_color' => '#ffffff',
|
||||
'dropdown_item_color' => '#4A5568',
|
||||
'dropdown_item_hover_color' => '#FF8600',
|
||||
'font_size' => 'normal',
|
||||
'font_weight' => '500',
|
||||
'box_shadow_intensity' => 'normal',
|
||||
'border_radius' => 4,
|
||||
'padding_vertical' => 0.75,
|
||||
'link_padding_vertical' => 0.5,
|
||||
'link_padding_horizontal' => 0.65,
|
||||
'z_index' => 1030,
|
||||
'transition_speed' => 'normal'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitiza los datos del Navbar
|
||||
*
|
||||
* @param array $data Datos sin sanitizar del Navbar
|
||||
* @return array Datos sanitizados
|
||||
*/
|
||||
public function sanitize($data) {
|
||||
return array_merge(
|
||||
// Booleanos principales
|
||||
APUS_Sanitizer_Helper::sanitize_booleans($data, array(
|
||||
'enabled', 'show_on_mobile', 'show_on_desktop',
|
||||
'enable_box_shadow', 'enable_underline_effect', 'enable_hover_background'
|
||||
)),
|
||||
|
||||
// Enums principales
|
||||
APUS_Sanitizer_Helper::sanitize_enums($data, array(
|
||||
'position' => array('allowed' => array('sticky', 'static', 'fixed'), 'default' => 'sticky'),
|
||||
'responsive_breakpoint' => array('allowed' => array('sm', 'md', 'lg', 'xl', 'xxl'), 'default' => 'lg')
|
||||
)),
|
||||
|
||||
// Let's Talk Button anidado
|
||||
array('lets_talk_button' => APUS_Sanitizer_Helper::sanitize_nested_group($data, 'lets_talk_button', array(
|
||||
'enabled' => array('type' => 'bool'),
|
||||
'text' => array('type' => 'text', 'default' => ''),
|
||||
'icon_class' => array('type' => 'text', 'default' => ''),
|
||||
'show_icon' => array('type' => 'bool'),
|
||||
'position' => array('type' => 'enum', 'allowed' => array('left', 'center', 'right'), 'default' => 'right')
|
||||
))),
|
||||
|
||||
// Dropdown anidado
|
||||
array('dropdown' => APUS_Sanitizer_Helper::sanitize_nested_group($data, 'dropdown', array(
|
||||
'enable_hover_desktop' => array('type' => 'bool'),
|
||||
'max_height' => array('type' => 'int', 'default' => 70),
|
||||
'border_radius' => array('type' => 'int', 'default' => 8),
|
||||
'item_padding_vertical' => array('type' => 'float', 'default' => 0.5),
|
||||
'item_padding_horizontal' => array('type' => 'float', 'default' => 1.25)
|
||||
))),
|
||||
|
||||
// Custom styles anidado
|
||||
array('custom_styles' => APUS_Sanitizer_Helper::sanitize_nested_group($data, 'custom_styles', array(
|
||||
'background_color' => array('type' => 'color', 'default' => ''),
|
||||
'text_color' => array('type' => 'color', 'default' => ''),
|
||||
'link_hover_color' => array('type' => 'color', 'default' => ''),
|
||||
'link_hover_bg_color' => array('type' => 'color', 'default' => ''),
|
||||
'dropdown_bg_color' => array('type' => 'color', 'default' => ''),
|
||||
'dropdown_item_color' => array('type' => 'color', 'default' => ''),
|
||||
'dropdown_item_hover_color' => array('type' => 'color', 'default' => ''),
|
||||
'font_size' => array('type' => 'enum', 'allowed' => array('small', 'normal', 'large'), 'default' => 'normal'),
|
||||
'font_weight' => array('type' => 'enum', 'allowed' => array('400', '500', '600', '700'), 'default' => '500'),
|
||||
'box_shadow_intensity' => array('type' => 'enum', 'allowed' => array('none', 'light', 'normal', 'strong'), 'default' => 'normal'),
|
||||
'border_radius' => array('type' => 'int', 'default' => 4),
|
||||
'padding_vertical' => array('type' => 'float', 'default' => 0.75),
|
||||
'link_padding_vertical' => array('type' => 'float', 'default' => 0.5),
|
||||
'link_padding_horizontal' => array('type' => 'float', 'default' => 0.65),
|
||||
'z_index' => array('type' => 'int', 'default' => 1030),
|
||||
'transition_speed' => array('type' => 'enum', 'allowed' => array('fast', 'normal', 'slow'), 'default' => 'normal')
|
||||
)))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user