'Nueva',
'in_progress' => 'En proceso',
'responded' => 'Respondida',
'closed' => 'Cerrada',
);
public function __construct() {
add_action('admin_menu', array($this, 'menu'));
add_action('admin_enqueue_scripts', array($this, 'assets'));
add_action('admin_post_' . NET360RECLAMACIONES_PUBLIC_PREFIX . '_' . 'update_claim', array($this, 'update_claim'));
add_action('admin_post_' . NET360RECLAMACIONES_PUBLIC_PREFIX . '_' . 'reply_claim', array($this, 'reply_claim'));
add_action('admin_post_' . NET360RECLAMACIONES_PUBLIC_PREFIX . '_' . 'export', array($this, 'export'));
add_action('admin_post_' . NET360RECLAMACIONES_PUBLIC_PREFIX . '_' . 'print_claim', array($this, 'print_claim'));
}
public function menu() {
add_menu_page('360 Reclamaciones', '360 Reclamaciones', 'manage_options', NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', array($this, 'dashboard'), 'dashicons-feedback', 30);
add_submenu_page(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', 'Escritorio', 'Escritorio', 'manage_options', NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', array($this, 'dashboard'));
add_submenu_page(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', 'Reclamaciones', 'Reclamaciones', 'manage_options', NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones', array($this, 'claims'));
add_submenu_page(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', 'Exportar', 'Exportar', 'manage_options', NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'export', array($this, 'export_page'));
add_submenu_page(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'dashboard', 'Configuración', 'Configuración', 'manage_options', NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'settings', array($this, 'settings'));
}
public function assets($hook) {
if (strpos($hook, NET360RECLAMACIONES_PUBLIC_SLUG . '-' . '') === false) {
return;
}
wp_enqueue_style(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'admin', NET360RECLAMACIONES_URL . 'assets/css/admin.css', array(), NET360RECLAMACIONES_VERSION);
wp_enqueue_script(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'admin', NET360RECLAMACIONES_URL . 'assets/js/admin.js', array(), NET360RECLAMACIONES_VERSION, true);
}
private function header($eyebrow, $title, $description = '', $actions = '') {
$logo = NET360RECLAMACIONES_URL . 'assets/images/360-reclamaciones-logo.png';
echo '
';
echo '
';
echo '
';
echo '
' . esc_html($eyebrow) . '
';
echo '
' . esc_html($title) . ' ';
echo '
' . esc_html($description) . '
';
echo '
' . wp_kses_post($actions) . '
';
echo '
v' . esc_html(NET360RECLAMACIONES_VERSION) . ' ';
echo '
';
}
private function footer() {
echo '
';
}
private function url($page, $args = array()) {
return add_query_arg(array_merge(array('page' => $page), $args), admin_url('admin.php'));
}
private function table() {
return NET360RECLAMACIONES_Database::table();
}
public function dashboard() {
global $wpdb;
$table = $this->table();
$counts = array_fill_keys(array_keys($this->statuses), 0);
$results = $wpdb->get_results($wpdb->prepare('SELECT status, COUNT(*) AS c FROM %i GROUP BY status', $table), ARRAY_A);
foreach ($results as $row) {
$status = sanitize_key($row['status']);
if (isset($counts[$status])) {
$counts[$status] = (int) $row['c'];
}
}
$total = array_sum($counts);
$pending = $counts['new'] + $counts['in_progress'];
$today = (int) $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM %i WHERE DATE(created_at) = %s', $table, current_time('Y-m-d')));
$recent = $wpdb->get_results($wpdb->prepare('SELECT id, claim_code, full_name, claim_type, status, created_at FROM %i ORDER BY created_at DESC LIMIT %d', $table, 6));
$this->header(
'GESTIÓN DE RECLAMACIONES',
'360 Reclamaciones',
'Gestiona, responde y controla todas las reclamaciones desde un solo lugar.',
' Ver reclamaciones Configuración '
);
echo '';
$this->stat_card('dashicons-clipboard', $total, 'Total', 'Reclamaciones registradas', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones'), 'Gestionar ›');
$this->stat_card('dashicons-clock', $pending, 'Pendientes', 'Nuevas y en proceso', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones', array('status' => 'new')), 'Revisar ›');
$this->stat_card('dashicons-chart-line', $today, 'Hoy', 'Registros recibidos hoy', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones'), 'Ver todas ›');
echo '
';
echo 'ACCESOS RÁPIDOS Centro de control Todo lo que necesitas para gestionar tu Libro de Reclamaciones.
';
$quick = array(
array('dashicons-list-view', 'Ver reclamaciones', 'Consulta, filtra y gestiona los registros.', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones')),
array('dashicons-download', 'Exportar registros', 'Descarga todas las reclamaciones.', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'export')),
array('dashicons-admin-generic', 'Configuración', 'Ajusta datos, correos y apariencia.', $this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'settings')),
);
foreach ($quick as $item) {
echo '
' . esc_html($item[1]) . ' ' . esc_html($item[2]) . '
';
}
echo '
';
$this->footer();
}
private function stat_card($icon, $number, $label, $description, $url, $action) {
echo '' . (int) $number . ' ' . esc_html($label) . ' ' . esc_html($description) . '
' . esc_html($action) . ' ';
}
public function claims() {
global $wpdb;
$table = $this->table();
if (isset($_GET['claim'])) {
$this->detail(absint(wp_unslash($_GET['claim'])));
return;
}
$search = isset($_GET['s']) ? sanitize_text_field(wp_unslash($_GET['s'])) : '';
$status = isset($_GET['status']) ? sanitize_key(wp_unslash($_GET['status'])) : '';
$type = isset($_GET['claim_type']) ? sanitize_text_field(wp_unslash($_GET['claim_type'])) : '';
$paged = isset($_GET['paged']) ? max(1, absint(wp_unslash($_GET['paged']))) : 1;
$per_page = 20;
$like = '%' . $wpdb->esc_like($search) . '%';
$valid_status = isset($this->statuses[$status]) ? $status : '';
$valid_type = in_array($type, array('Queja', 'Reclamo'), true) ? $type : '';
$total = (int) $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM %i WHERE (%s = '' OR claim_code LIKE %s OR full_name LIKE %s OR email LIKE %s OR document_number LIKE %s) AND (%s = '' OR status = %s) AND (%s = '' OR claim_type = %s)",
$table, $search, $like, $like, $like, $like, $valid_status, $valid_status, $valid_type, $valid_type
)
);
$offset = ($paged - 1) * $per_page;
$rows = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM %i WHERE (%s = '' OR claim_code LIKE %s OR full_name LIKE %s OR email LIKE %s OR document_number LIKE %s) AND (%s = '' OR status = %s) AND (%s = '' OR claim_type = %s) ORDER BY created_at DESC LIMIT %d OFFSET %d",
$table, $search, $like, $like, $like, $like, $valid_status, $valid_status, $valid_type, $valid_type, $per_page, $offset
)
);
$this->header('GESTIÓN DE RECLAMACIONES', 'Reclamaciones', 'Busca, filtra y administra todos los registros.', 'Exportar ');
echo '';
echo '
Código Fecha Consumidor Tipo Estado Acción ';
if (empty($rows)) {
echo 'No hay reclamaciones. ';
} else {
foreach ($rows as $row) {
$status_label = isset($this->statuses[$row->status]) ? $this->statuses[$row->status] : $row->status;
echo '' . esc_html($row->claim_code) . ' ' . esc_html(mysql2date(get_option('date_format'), $row->created_at)) . ' ' . esc_html($row->full_name) . '' . esc_html($row->email) . ' ' . esc_html($row->claim_type) . ' ' . esc_html($status_label) . ' Ver ';
}
}
echo '
';
if ($total > $per_page) {
$pagination = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $paged, 'total' => (int) ceil($total / $per_page)));
if ($pagination) {
echo '
' . wp_kses_post($pagination) . '
';
}
}
echo '
';
$this->footer();
}
private function detail($id) {
global $wpdb;
$table = $this->table();
$record = $wpdb->get_row($wpdb->prepare('SELECT * FROM %i WHERE id = %d', $table, $id));
if (!$record) {
echo '
Reclamación no encontrada ';
return;
}
$this->header('DETALLE DE RECLAMACIÓN', 'Reclamación', 'Información y gestión del registro.');
$print_url = wp_nonce_url(admin_url('admin-post.php?action=' . rawurlencode(NET360RECLAMACIONES_PUBLIC_PREFIX . '_print_claim') . '&claim_id=' . (int) $record->id), NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'print_claim_' . (int) $record->id);
echo '← Volver | Imprimir constancia
' . esc_html($record->claim_code) . ' ';
$this->box('Consumidor reclamante', array(
array('Nombre', $record->full_name),
array('Documento', $record->document_type . ' ' . $record->document_number),
array('Correo', $record->email),
array('Teléfono', $record->phone),
array('Domicilio', $record->address),
array('Menor de edad', $record->is_minor ? 'Sí' : 'No'),
));
if ($record->is_minor) {
$this->box('Padre, madre o tutor', array(array('Nombre', $record->guardian_name), array('Documento', $record->guardian_document_type . ' ' . $record->guardian_document_number)));
}
$this->box('Bien contratado', array(
array('Tipo', $record->goods_type),
array('Descripción', $record->goods_description),
array('Monto', $record->claim_amount_enabled ? $record->currency . ' ' . $record->amount : 'No solicitado'),
));
$this->box('Reclamación y pedido', array(array('Tipo', $record->claim_type), array('Reclamación', $record->claim_description), array('Pedido', $record->request_description)));
$this->history($record->id);
echo '
';
echo '
';
echo '
Responder al cliente ';
wp_nonce_field(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'reply_claim_' . (int) $record->id);
echo 'Para: ' . esc_html($record->email) . '
Enviar respuesta ';
$this->footer();
}
private function box($title, $rows) {
echo '' . esc_html($title) . ' ';
foreach ($rows as $row) {
echo '' . esc_html($row[0]) . ' ' . nl2br(esc_html((string) $row[1])) . ' ';
}
echo '
';
}
private function history($id) {
$rows = NET360RECLAMACIONES_History::all($id);
echo 'Historial ';
if (empty($rows)) {
echo '
Sin movimientos registrados.
';
} else {
echo '
';
foreach ($rows as $row) {
echo '' . esc_html(mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $row->created_at)) . ' — ' . esc_html($row->message) . ( ! empty($row->display_name) ? ' (' . esc_html($row->display_name) . ')' : '' ) . ' ';
}
echo ' ';
}
echo '
';
}
public function update_claim() {
if (!current_user_can('manage_options')) { wp_die('No autorizado.'); }
$id = isset($_POST['claim_id']) ? absint(wp_unslash($_POST['claim_id'])) : 0;
check_admin_referer(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'update_claim_' . $id);
$status = isset($_POST['status']) ? sanitize_key(wp_unslash($_POST['status'])) : '';
if (!isset($this->statuses[$status])) { $status = 'new'; }
$notes = isset($_POST['admin_notes']) ? sanitize_textarea_field(wp_unslash($_POST['admin_notes'])) : '';
global $wpdb;
$table = $this->table();
$old = $wpdb->get_row($wpdb->prepare('SELECT status, admin_notes FROM %i WHERE id = %d', $table, $id));
$wpdb->update($table, array('status' => $status, 'admin_notes' => $notes, 'updated_at' => current_time('mysql')), array('id' => $id), array('%s', '%s', '%s'), array('%d'));
if ($old && $old->status !== $status) { NET360RECLAMACIONES_History::add($id, 'status', 'Estado cambiado a: ' . $this->statuses[$status]); }
if ($old && $old->admin_notes !== $notes) { NET360RECLAMACIONES_History::add($id, 'notes', 'Notas internas actualizadas.'); }
wp_safe_redirect($this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones', array('claim' => $id, 'updated' => 1)));
exit;
}
public function reply_claim() {
if (!current_user_can('manage_options')) { wp_die('No autorizado.'); }
$id = isset($_POST['claim_id']) ? absint(wp_unslash($_POST['claim_id'])) : 0;
check_admin_referer(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'reply_claim_' . $id);
global $wpdb;
$table = $this->table();
$record = $wpdb->get_row($wpdb->prepare('SELECT * FROM %i WHERE id = %d', $table, $id));
if (!$record) { wp_die('No encontrada.'); }
$subject = isset($_POST['subject']) ? sanitize_text_field(wp_unslash($_POST['subject'])) : '';
$message = isset($_POST['message']) ? sanitize_textarea_field(wp_unslash($_POST['message'])) : '';
$settings = get_option(NET360RECLAMACIONES_PUBLIC_PREFIX . '_settings', array());
$headers = array('Content-Type: text/plain; charset=UTF-8');
$from_email = !empty($settings['from_email']) ? sanitize_email($settings['from_email']) : '';
$from_name = !empty($settings['from_name']) ? sanitize_text_field($settings['from_name']) : get_bloginfo('name');
if ($from_email && is_email($from_email)) { $headers[] = 'From: ' . $from_name . ' <' . $from_email . '>'; }
if ($message && wp_mail(sanitize_email($record->email), $subject, $message, $headers)) {
NET360RECLAMACIONES_History::add($id, 'reply', 'Respuesta enviada al cliente: ' . $subject);
if (in_array($record->status, array('new', 'in_progress'), true)) {
$wpdb->update($table, array('status' => 'responded', 'updated_at' => current_time('mysql')), array('id' => $id), array('%s', '%s'), array('%d'));
}
wp_safe_redirect($this->url(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . 'reclamaciones', array('claim' => $id, 'replied' => 1)));
exit;
}
wp_die('No se pudo enviar el correo.');
}
public function print_claim() {
if (!current_user_can('manage_options')) { wp_die('No autorizado.'); }
$id = isset($_GET['claim_id']) ? absint(wp_unslash($_GET['claim_id'])) : 0;
check_admin_referer(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'print_claim_' . $id);
global $wpdb;
$record = $wpdb->get_row($wpdb->prepare('SELECT * FROM %i WHERE id = %d', $this->table(), $id));
if (!$record) { wp_die('No encontrada.'); }
$date = mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $record->created_at);
wp_enqueue_style('net360reclamaciones-print', NET360RECLAMACIONES_URL . 'assets/css/print.css', array(), NET360RECLAMACIONES_VERSION);
wp_enqueue_script('net360reclamaciones-print', NET360RECLAMACIONES_URL . 'assets/js/print.js', array(), NET360RECLAMACIONES_VERSION, true);
?>claim_code); ?> Imprimir Constancia de reclamación Código: claim_code); ?>Fecha:
Consumidor Nombre full_name); ?> Documento document_type . ' ' . $record->document_number); ?> Correo email); ?>
Bien contratado Tipo goods_type); ?> Descripción goods_description)); ?>
Reclamación Tipo claim_type); ?> Detalle claim_description)); ?> Pedido request_description)); ?>
header('EXPORTACIÓN', 'Exportar reclamaciones', 'Descarga tus registros en formato Excel XLSX.');
echo ' ';
wp_nonce_field(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'export');
echo 'Formato: Excel (.xlsx) Descargar XLSX
';
$this->footer();
}
private function xlsx_cell($value, $row, $col, $style = 0, $type = 'inlineStr') {
$value = (string) $value;
if ('n' === $type) { return '' . esc_html($value) . ' '; }
$value = htmlspecialchars($value, ENT_XML1 | ENT_COMPAT, 'UTF-8');
return '' . $value . ' ';
}
private function xlsx_col($index) {
$name = '';
while ($index > 0) {
--$index;
$name = chr(65 + ($index % 26)) . $name;
$index = intdiv($index, 26);
}
return $name;
}
private function generate_xlsx($rows) {
if (!class_exists('ZipArchive')) { wp_die('La extensión ZIP de PHP es necesaria para generar archivos XLSX.'); }
$tmp = wp_tempnam('360-reclamaciones.xlsx');
if (!$tmp) { wp_die('No se pudo crear el archivo temporal de exportación.'); }
wp_delete_file($tmp);
$zip = new ZipArchive();
if (true !== $zip->open($tmp, ZipArchive::CREATE)) { wp_die('No se pudo crear el archivo XLSX.'); }
$headers = array(
'id' => 'ID', 'claim_code' => 'Código de reclamación', 'created_at' => 'Fecha de registro', 'updated_at' => 'Última actualización', 'status' => 'Estado',
'full_name' => 'Nombre completo', 'is_minor' => 'Menor de edad', 'guardian_name' => 'Padre, madre o tutor', 'guardian_document_type' => 'Tipo doc. tutor', 'guardian_document_number' => 'N.º documento tutor',
'document_type' => 'Tipo de documento', 'document_number' => 'N.º de documento', 'email' => 'Correo electrónico', 'phone' => 'Teléfono', 'address' => 'Domicilio',
'goods_type' => 'Tipo de bien contratado', 'goods_description' => 'Descripción del producto o servicio', 'claim_amount_enabled' => 'Reclama monto', 'currency' => 'Moneda', 'amount' => 'Monto reclamado',
'claim_type' => 'Tipo de reclamación', 'claim_description' => 'Descripción de la reclamación', 'request_description' => 'Pedido del consumidor', 'admin_notes' => 'Notas internas',
);
$status_labels = array('new' => 'Nueva', 'in_progress' => 'En proceso', 'responded' => 'Respondida', 'closed' => 'Cerrada');
$data = array();
foreach ($rows as $row) {
$row = (array) $row;
$data[] = array(
'id' => $row['id'] ?? '', 'claim_code' => $row['claim_code'] ?? '',
'created_at' => !empty($row['created_at']) ? mysql2date('d/m/Y H:i', $row['created_at']) : '',
'updated_at' => !empty($row['updated_at']) ? mysql2date('d/m/Y H:i', $row['updated_at']) : '',
'status' => $status_labels[$row['status'] ?? ''] ?? ($row['status'] ?? ''), 'full_name' => $row['full_name'] ?? '',
'is_minor' => !empty($row['is_minor']) ? 'Sí' : 'No', 'guardian_name' => $row['guardian_name'] ?? '', 'guardian_document_type' => $row['guardian_document_type'] ?? '',
'guardian_document_number' => $row['guardian_document_number'] ?? '', 'document_type' => $row['document_type'] ?? '', 'document_number' => $row['document_number'] ?? '',
'email' => $row['email'] ?? '', 'phone' => $row['phone'] ?? '', 'address' => $row['address'] ?? '', 'goods_type' => $row['goods_type'] ?? '',
'goods_description' => $row['goods_description'] ?? '', 'claim_amount_enabled' => !empty($row['claim_amount_enabled']) ? 'Sí' : 'No', 'currency' => $row['currency'] ?? '',
'amount' => $row['amount'] ?? '', 'claim_type' => $row['claim_type'] ?? '', 'claim_description' => $row['claim_description'] ?? '',
'request_description' => $row['request_description'] ?? '', 'admin_notes' => $row['admin_notes'] ?? '',
);
}
if (empty($data)) { $data = array(array_fill_keys(array_keys($headers), '')); }
$last_col = $this->xlsx_col(count($headers));
$sheet = '';
$sheet .= '';
$widths = array(8,20,19,20,16,28,14,28,18,20,18,20,18,30,18,36,22,50,15,12,18,18,55,55,45);
foreach ($widths as $i => $width) { $column = $this->xlsx_col($i + 1); $sheet .= ' '; }
$sheet .= ' ';
$cells = ''; $index = 1;
foreach ($headers as $header) { $cells .= $this->xlsx_cell($header, 1, $this->xlsx_col($index++), 1); }
$sheet .= '' . $cells . '
';
$row_number = 2;
foreach ($data as $row) {
$cells = ''; $index = 1;
foreach ($headers as $key => $header) {
$value = $row[$key] ?? ''; $style = 2; $type = 'inlineStr';
if ('amount' === $key && '' !== $value) { $style = 3; $type = 'n'; $value = (float) $value; }
$cells .= $this->xlsx_cell($value, $row_number, $this->xlsx_col($index++), $style, $type);
}
$sheet .= '' . $cells . '
';
++$row_number;
}
$last_data_row = $row_number - 1;
$sheet .= ' ';
$content = ' ';
$rels = ' ';
$workbook = ' ';
$wrels = ' ';
$styles = ' ';
$core = '360 Reclamaciones NET360 ';
$app = '360 Reclamaciones ';
$files = array('[Content_Types].xml' => $content, '_rels/.rels' => $rels, 'xl/workbook.xml' => $workbook, 'xl/_rels/workbook.xml.rels' => $wrels, 'xl/worksheets/sheet1.xml' => $sheet, 'xl/styles.xml' => $styles, 'docProps/core.xml' => $core, 'docProps/app.xml' => $app);
foreach ($files as $name => $file_data) { $zip->addFromString($name, $file_data); }
$zip->close();
return $tmp;
}
public function export() {
if (!current_user_can('manage_options')) { wp_die('No autorizado.'); }
check_admin_referer(NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'export');
global $wpdb;
$rows = $wpdb->get_results($wpdb->prepare('SELECT * FROM %i ORDER BY created_at DESC', $this->table()), ARRAY_A);
$file = $this->generate_xlsx($rows);
nocache_headers();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$filename = sanitize_file_name(NET360RECLAMACIONES_PUBLIC_SLUG . '-' . '' . wp_date('Y-m-d') . '.xlsx');
header('Content-Disposition: attachment; filename="' . $filename . '"');
require_once ABSPATH . 'wp-admin/includes/file.php';
$filesystem = new WP_Filesystem_Direct(null);
$content = $filesystem->get_contents($file);
wp_delete_file($file);
if (false === $content) { wp_die('No se pudo leer el archivo XLSX generado.'); }
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- XLSX is binary content and must not be HTML-escaped.
echo $content;
exit;
}
public function settings() {
if (isset($_POST[NET360RECLAMACIONES_PUBLIC_SLUG . '_' . 'save'])) {
check_admin_referer(NET360RECLAMACIONES_PUBLIC_PREFIX . '_settings');
$settings = get_option(NET360RECLAMACIONES_PUBLIC_PREFIX . '_settings', array());
$text_fields = array('responsible_name', 'privacy_responsible', 'privacy_purpose', 'privacy_rights', 'privacy_retention', 'privacy_transfer', 'privacy_more_url', 'legal_notice', 'admin_email', 'admin_cc', 'admin_bcc', 'from_name', 'from_email', 'admin_subject', 'customer_subject', 'customer_message');
foreach ($text_fields as $key) {
$value = filter_input(INPUT_POST, $key, FILTER_UNSAFE_RAW);
$value = is_string($value) ? wp_unslash($value) : '';
if (in_array($key, array('admin_email', 'from_email'), true)) {
$settings[$key] = sanitize_email($value);
} elseif ('privacy_more_url' === $key) {
$settings[$key] = esc_url_raw($value);
} else {
$settings[$key] = sanitize_textarea_field($value);
}
}
$settings['primary_color'] = sanitize_hex_color(isset($_POST['primary_color']) ? wp_unslash($_POST['primary_color']) : '') ?: '#2f6fd3';
$settings['card_radius'] = min(50, max(0, isset($_POST['card_radius']) ? absint(wp_unslash($_POST['card_radius'])) : 20));
update_option(NET360RECLAMACIONES_PUBLIC_PREFIX . '_settings', $settings);
echo '';
}
$settings = wp_parse_args(get_option(NET360RECLAMACIONES_PUBLIC_PREFIX . '_settings', array()), array());
$this->header('CONFIGURACIÓN', 'Configuración', 'Personaliza los datos, apariencia, privacidad y notificaciones.');
?>
General y apariencia
Privacidad y textos legales
Correos
Guardar cambios
Shortcode: [net360reclamaciones]
footer();
}
}