feat: LOPDP Ecuador — router, permalinks, política privacidad, banner, nav, index temas

This commit is contained in:
2026-06-05 15:06:52 -05:00
parent 5d575db5e3
commit 90fee1947f
16 changed files with 180 additions and 108 deletions
+7
View File
@@ -0,0 +1,7 @@
<?php
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$file = __DIR__ . '/wordpress' . $path;
if ($path !== '/' && file_exists($file) && !is_dir($file)) {
return false;
}
require_once __DIR__ . '/wordpress/index.php';
+1 -1
View File
@@ -39,4 +39,4 @@ else
fi
echo "Iniciando WordPress en http://${WP_HOST}:${WP_PORT}"
exec php -S "${WP_HOST}:${WP_PORT}" -t "$WP_DIR"
exec php -S "${WP_HOST}:${WP_PORT}" -t "$WP_DIR" "$ROOT_DIR/backend/router.php"
@@ -330,14 +330,10 @@ function pflores_get_cv_data(): array
3. LOPDP — Política de privacidad, banner y widget
────────────────────────────────────────────── */
// A) Crear página de Política de Privacidad (una sola vez)
// A) Crear / reparar página de Política de Privacidad
add_action('admin_init', 'pflores_create_privacy_page');
function pflores_create_privacy_page(): void
{
if (get_option('pflores_privacy_page_created')) {
return;
}
$content = '<h2>Responsable del tratamiento</h2>
<p>Patricia Soledad Flores Sánchez · <a href="mailto:patricflorsanchez@gmail.com">patricflorsanchez@gmail.com</a> · pflores.linkedcorp.net</p>
@@ -359,6 +355,28 @@ function pflores_create_privacy_page(): void
<h2>Última actualización</h2>
<p>Junio de 2026.</p>';
// Si ya existe, reparar si tiene contenido genérico de WordPress
$existing = get_page_by_path('politica-de-privacidad');
if ($existing) {
update_option('pflores_privacy_page_created', $existing->ID);
if (str_contains((string) $existing->post_content, 'Qui') ||
str_contains((string) $existing->post_content, 'sample') ||
trim($existing->post_content) === '') {
wp_update_post([
'ID' => $existing->ID,
'post_content' => $content,
'post_status' => 'publish',
'post_name' => 'politica-de-privacidad',
]);
}
return;
}
// Si no existe, crearla
if (get_option('pflores_privacy_page_created')) {
return;
}
$id = wp_insert_post([
'post_title' => 'Política de Privacidad',
'post_name' => 'politica-de-privacidad',
@@ -369,7 +387,14 @@ function pflores_create_privacy_page(): void
]);
if ($id && ! is_wp_error($id)) {
update_option('pflores_privacy_page_created', 1);
update_option('pflores_privacy_page_created', $id);
// Asegurar permalinks bonitos
global $wpdb;
$wpdb->update(
$wpdb->options,
['option_value' => '/%postname%/'],
['option_name' => 'permalink_structure']
);
}
}
@@ -380,6 +405,7 @@ function pflores_lopd_banner(): void
if (is_admin()) {
return;
}
$privacy_url = esc_url(home_url('/politica-de-privacidad/'));
?>
<style>
#pflores-lopd-banner {
@@ -415,22 +441,19 @@ function pflores_lopd_banner(): void
<strong>Ley Orgánica de Protección de Datos Personales del Ecuador (LOPDP)</strong>.
</p>
<div class="pflores-lopd-actions">
<a href="/politica-de-privacidad/" class="pflores-lopd-link">Política de privacidad</a>
<a href="<?php echo $privacy_url; ?>" class="pflores-lopd-link">Política de privacidad</a>
<button id="pflores-lopd-accept" type="button">Aceptar</button>
</div>
</div>
<script>
(function(){
var banner = document.getElementById('pflores-lopd-banner');
if (!banner) return;
if (!localStorage.getItem('pflores_lopd_ok')) {
banner.style.display = 'flex';
}
document.getElementById('pflores-lopd-accept')
.addEventListener('click', function(){
localStorage.setItem('pflores_lopd_ok', '1');
banner.style.display = 'none';
});
var b = document.getElementById('pflores-lopd-banner');
if (!b) return;
if (!localStorage.getItem('pflores_lopd_ok')) b.style.display = 'flex';
document.getElementById('pflores-lopd-accept').addEventListener('click', function(){
localStorage.setItem('pflores_lopd_ok', '1');
b.style.display = 'none';
});
})();
</script>
<?php
@@ -141,7 +141,7 @@ $skills = array_filter($skillsFlat);
</div>
<p style="font-size:.65rem;color:rgba(255,255,255,.25);text-align:center;margin-top:auto;padding-top:.75rem">
<a href="/politica-de-privacidad/" style="opacity:.6;text-decoration:underline;color:inherit">Política de Privacidad · LOPDP</a>
<a href="<?php echo esc_url(home_url('/politica-de-privacidad/')); ?>" style="opacity:.6;text-decoration:underline;color:inherit">Política de Privacidad · LOPDP</a>
</p>
</aside><!-- /.ax-sidebar -->
@@ -73,13 +73,14 @@ add_filter('body_class', 'apex_body_classes');
// ---------------------------------------------------------------------------
function apex_render_nav(): string
{
$base = is_front_page() ? '' : home_url('/');
$items = [
'#sobre-mi' => __('Sobre mí', 'apex'),
'#impacto' => __('Impacto', 'apex'),
'#experiencia' => __('Experiencia', 'apex'),
'#formacion' => __('Formación', 'apex'),
'#certificaciones' => __('Certificaciones', 'apex'),
'#contacto' => __('Contacto', 'apex'),
$base . '#sobre-mi' => __('Sobre mí', 'apex'),
$base . '#impacto' => __('Impacto', 'apex'),
$base . '#experiencia' => __('Experiencia', 'apex'),
$base . '#formacion' => __('Formación', 'apex'),
$base . '#certificaciones' => __('Certificaciones', 'apex'),
$base . '#contacto' => __('Contacto', 'apex'),
];
$html = '<ul class="ax-nav__list">';
@@ -1,24 +1,28 @@
<?php
declare(strict_types=1);
// Fallback template — the theme uses front-page.php for all CV content.
get_header();
?>
<div class="ax-main">
<div class="ax-content-wrap">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
</div>
</article>
<?php endwhile; ?>
<?php else : ?>
<p><?php esc_html_e('No se encontró contenido.', 'apex'); ?></p>
<?php endif; ?>
</div>
<aside class="ax-sidebar" id="ax-sidebar"></aside>
<main class="ax-main">
<div class="ax-content-wrap">
<style>
.ax-page-content h1{font-size:1.6rem;font-weight:700;color:var(--ax-text);margin-bottom:1.5rem;padding-bottom:.75rem;border-bottom:2px solid var(--ax-cyan)}
.ax-page-content h2,.ax-page-content h3{font-weight:600;color:var(--ax-text);margin:1.5rem 0 .5rem}
.ax-page-content h2{font-size:1rem}
.ax-page-content p{font-size:.9rem;color:var(--ax-muted);line-height:1.75;margin-bottom:.75rem}
.ax-page-content a{color:var(--ax-cyan)}
.ax-page-content a:hover{opacity:.75}
.ax-back{display:inline-flex;align-items:center;gap:.4rem;margin-bottom:2rem;font-size:.78rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--ax-cyan);text-decoration:none}
.ax-back:hover{opacity:.75}
.ax-back::before{content:'←'}
</style>
<div class="ax-section ax-page-content">
<a class="ax-back" href="<?php echo esc_url(home_url('/')); ?>">Volver al CV</a>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
</div>
</main>
<?php get_footer(); ?>