✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ beluga.o2switch.net ​🇻​♯➤ 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 185.154.139.77 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.77
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/sc3naki1272/creditofacile.biz/wp-content/mu-plugins//snippet_leads.php
<?php
/**
 * CreditoFacile.biz — Système complet
 * - Capture de leads (REST API + admin page)
 * - Sert homepage.html sur la page d'accueil
 */

/* ── CSS GLOBAL — header bleu sur tout le site ───────────── */
add_action('wp_head', function() { ?>
<style id="cf-global-header-css">
/* Header bleu CreditoFacile — Elementor Pro template ET fallback Hello theme */
header.elementor-location-header,
.elementor-location-header,
.elementor-element-51f743de,
header#site-header,
.site-header,
header.site-header {
  background: #0a3d8f !important;
  background-color: #0a3d8f !important;
  border-bottom: none !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.2) !important;
}
/* Liens nav Hello Elementor natif */
.site-header a,
header#site-header a,
.site-navigation a,
.main-navigation a {
  color: #fff !important;
  font-weight: 600 !important;
}
.site-header .site-title a,
.site-header .site-title {
  color: #fff !important;
  font-size: 1.3rem !important;
  font-weight: 800 !important;
}
.elementor-element-51f743de .elementor-background-overlay {
  background: transparent !important;
  opacity: 0 !important;
}
/* Logo CreditoFacile — fond bleu intégré, pas de filtre */
header.elementor-location-header img.cf-logo-injected {
  max-height: 56px;
  width: auto;
  border-radius: 8px;
  filter: none !important;
}
/* Logo Elementor original : masquer si on a injecté le notre */
header.elementor-location-header img:not(.cf-logo-injected) {
  max-height: 52px;
  width: auto;
}
/* Liens navigation blancs */
header.elementor-location-header a,
header.elementor-location-header .elementor-nav-menu a,
header.elementor-location-header .elementor-item,
header.elementor-location-header .elementor-sub-item {
  color: #fff !important;
  font-weight: 600 !important;
}
header.elementor-location-header .elementor-item:hover,
header.elementor-location-header .elementor-item.elementor-item-active {
  color: #ffd54f !important;
  border-bottom-color: #ffd54f !important;
}
/* Hamburger mobile blanc */
header.elementor-location-header .elementor-menu-toggle i,
header.elementor-location-header .elementor-menu-toggle svg {
  color: #fff !important;
  fill: #fff !important;
}
/* ── SECTION H1 (2652c42a) — reset hero overlay ── */
.elementor-31083 .elementor-element-2652c42a {
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
  padding: 24px 0 16px !important;
  min-height: 0 !important;
}
.elementor-31083 .elementor-element-2652c42a > .elementor-background-overlay {
  display: none !important;
}
.elementor-31083 .elementor-element-2652c42a .elementor-container {
  min-height: 0 !important;
}
/* ── Annuler le margin-top négatif sur la colonne contenu ── */
.elementor-31083 .elementor-element-14024083 > .elementor-element-populated {
  margin-top: 0 !important;
  margin: 0 !important;
}
/* ── Section contenu — pas de z-index overlay ── */
.elementor-31083 .elementor-element-25464662 {
  z-index: auto !important;
  margin-top: 0 !important;
}
/* ── H1 : texte noir simple ── */
.elementor-31083 h1.elementor-heading-title,
.elementor-31083 .elementor-element-8ccd06d .elementor-heading-title {
  background: none !important;
  color: #1a1a2e !important;
  font-family: 'Segoe UI', Arial, sans-serif !important;
  font-size: 1.8rem !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}
/* ── Nom auteur visible ── */
.elementor-31083 .elementor-element-0171e6b .elementor-author-box__name {
  font-size: 14px !important;
  line-height: 1.4 !important;
  color: #1a1a2e !important;
  display: block !important;
}
/* ── Image featured ── */
.elementor-31083 .elementor-element-78dc8bd2 img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
  border-radius: 8px;
}
@media(max-width:767px) {
  .elementor-31083 h1.elementor-heading-title,
  .elementor-31083 .elementor-element-8ccd06d .elementor-heading-title {
    font-size: 1.3rem !important;
  }
  .elementor-31083 .elementor-element-2652c42a {
    padding: 16px 10px 10px !important;
  }
}
/* Supprimer le gap entre header et contenu sur articles/pages */
body.single .elementor-section-wrap > .elementor-top-section:first-child,
body.single main > .elementor-section:first-child,
body.single .entry-content,
body.single article > .entry-content,
body.page:not(.page-template-elementor_canvas) main > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
body.single .site-main,
body.single main#main,
body.single .site-content,
body.page:not(.page-template-elementor_canvas) .site-main {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* ── MASQUER H3 injectés par plugins analytics (Site Kit, Rank Math)
   avant le H1 — invisibles visuellement mais nuisibles au SEO ── */
#wpadminbar h3,
.googlesitekit-wp-adminbar h3,
.rank-math-adminbar h3,
[class*="sitekit"] h3 {
  display: none !important;
}

/* ── MASQUER L'ANCIEN FOOTER GRIS (Elementor / Hello theme) */
footer.elementor-location-footer,
.elementor-location-footer,
footer.elementor-section,
.site-footer,
footer#colophon,
#colophon,
.wp-site-blocks > footer {
  display: none !important;
}

/* ── FOOTER BAR CUSTOM ───────────────────────────────────── */
#cf-footer-bar {
  background: #061e5e;
  color: rgba(255,255,255,.75);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: .85rem;
  padding: 14px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
#cf-footer-bar a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  transition: color .15s;
  margin-right: 18px;
}
#cf-footer-bar a:hover { color: #ffd54f; }
.cf-footer-lang {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cf-footer-lang a {
  margin: 0;
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.cf-footer-lang a:hover,
.cf-footer-lang a.active { background: #0a3d8f; border-color: #0a3d8f; color: #fff; }
@media(max-width:600px){
  #cf-footer-bar { flex-direction: column; text-align: center; }
  #cf-footer-bar a { margin: 0 8px; }
}
/* ── LOGO MOBILE ─────────────────────────────────────────── */
/* Masquer l'image originale WP avant injection JS (évite le flash 500×500) */
header.elementor-location-header img:not(.cf-logo-injected) {
  opacity: 0;
  max-height: 52px;
  width: auto;
}
header.elementor-location-header img.cf-logo-injected {
  opacity: 1 !important;
}
@media (max-width: 767px) {
  /* Logo adapté mobile */
  header.elementor-location-header img,
  header.elementor-location-header img.cf-logo-injected {
    max-width: 170px !important;
    height: 36px !important;
    max-height: 36px !important;
    width: auto !important;
  }
  /* Colonne logo → pleine largeur */
  header.elementor-location-header .elementor-element-71e74c40,
  header.elementor-location-header [data-element_type="column"]:has([data-widget_type="theme-site-logo.default"]) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }
  /* Masquer colonne nav ENTIÈRE (lisérets noirs = colonne vide résiduelle) */
  header.elementor-location-header .elementor-element-1059432,
  header.elementor-location-header [data-element_type="column"]:has([data-widget_type="nav-menu.default"]) {
    display: none !important;
  }
}

/* ── HAMBURGER MOBILE CUSTOM ─────────────────────────────── */
@media (max-width: 767px) {
  /* Masquer TOUT le menu Elementor natif + son toggle sur mobile */
  header.elementor-location-header .elementor-nav-menu--main,
  header.elementor-location-header .elementor-nav-menu__container,
  header.elementor-location-header .elementor-menu-toggle,
  header.elementor-location-header .elementor-menu-toggle__icon--open,
  header.elementor-location-header .elementor-menu-toggle__icon--close,
  header.elementor-location-header .eicon-menu-bar,
  header.elementor-location-header .eicon-close {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}
/* Bouton hamburger custom */
#cf-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 8px 14px;
  margin-left: auto;
}
#cf-hamburger span {
  display: block; width: 26px; height: 3px;
  background: #fff; border-radius: 3px; transition: all .25s;
}
#cf-hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#cf-hamburger.open span:nth-child(2) { opacity: 0; }
#cf-hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
@media (max-width: 767px) { #cf-hamburger { display: flex; } }

/* Overlay mobile menu */
#cf-mobile-menu {
  display: none; position: fixed; inset: 0;
  background: #0a3d8f; z-index: 999999;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 0;
}
#cf-mobile-menu.open { display: flex; }
#cf-mobile-menu a {
  color: #fff; font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1.4rem; font-weight: 700; padding: 20px 40px;
  text-decoration: none; text-align: center; width: 100%;
  border-bottom: 1px solid rgba(255,255,255,.12);
  transition: background .15s;
}
#cf-mobile-menu a:hover { background: rgba(255,255,255,.08); }
#cf-mobile-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none; color: #fff;
  font-size: 2rem; cursor: pointer; line-height: 1; padding: 8px;
}

/* ── CHARTE GRAPHIQUE — Articles & Pages ─────────────────
   Ciblage large : couvre Elementor Pro template (post-content),
   Text Editor widget, et Hello Elementor natif (entry-content)
   ─────────────────────────────────────────────────────── */

/* Couleur texte — override Elementor inline color:white/white */
body.single .elementor-widget-theme-post-content .elementor-widget-container,
body.single .elementor-widget-text-editor .elementor-widget-container,
body.single .elementor-post__content,
body.single .entry-content,
body.page  .elementor-widget-theme-post-content .elementor-widget-container,
body.page  .elementor-widget-text-editor .elementor-widget-container,
body.page  .elementor-post__content,
body.page  .entry-content {
  color: #1a1a2e !important;
}

/* Paragraphes & listes */
body.single .elementor-widget-theme-post-content p,
body.single .elementor-widget-text-editor p,
body.single .elementor-post__content p,
body.single .entry-content p,
body.page  .elementor-widget-theme-post-content p,
body.page  .elementor-widget-text-editor p,
body.page  .elementor-post__content p,
body.page  .entry-content p {
  color: #1a1a2e !important;
  font-size: 1rem !important;
  line-height: 1.8 !important;
}
body.single .elementor-widget-theme-post-content li,
body.single .elementor-widget-text-editor li,
body.single .entry-content li,
body.page  .elementor-widget-theme-post-content li,
body.page  .elementor-widget-text-editor li,
body.page  .entry-content li {
  color: #1a1a2e !important;
  font-size: 1rem !important;
  line-height: 1.7 !important;
}

/* Titres H2/H3/H4 — bleu brand */
body.single .elementor-widget-theme-post-content h2,
body.single .elementor-widget-text-editor h2,
body.single .entry-content h2,
body.page  .elementor-widget-theme-post-content h2,
body.page  .elementor-widget-text-editor h2,
body.page  .entry-content h2 {
  color: #0a3d8f !important; font-size: 1.6rem !important;
  font-weight: 700 !important; margin-top: 1.6em !important; margin-bottom: .4em !important;
}
body.single .elementor-widget-theme-post-content h3,
body.single .elementor-widget-text-editor h3,
body.single .entry-content h3,
body.page  .elementor-widget-theme-post-content h3,
body.page  .elementor-widget-text-editor h3,
body.page  .entry-content h3 {
  color: #0a3d8f !important; font-size: 1.3rem !important;
  font-weight: 700 !important; margin-top: 1.4em !important; margin-bottom: .4em !important;
}
body.single .elementor-widget-theme-post-content h4,
body.single .elementor-widget-text-editor h4,
body.single .entry-content h4,
body.page  .elementor-widget-theme-post-content h4,
body.page  .elementor-widget-text-editor h4,
body.page  .entry-content h4 {
  color: #0a3d8f !important; font-size: 1.1rem !important;
  font-weight: 700 !important;
}

/* Liens — orange brand */
body.single .elementor-widget-theme-post-content a,
body.single .elementor-widget-text-editor a,
body.single .entry-content a,
body.page  .elementor-widget-theme-post-content a,
body.page  .elementor-widget-text-editor a,
body.page  .entry-content a {
  color: #e65100 !important;
  text-decoration: underline !important;
}
body.single .elementor-widget-theme-post-content a:hover,
body.single .elementor-widget-text-editor a:hover,
body.single .entry-content a:hover,
body.page  .elementor-widget-theme-post-content a:hover,
body.page  .elementor-widget-text-editor a:hover,
body.page  .entry-content a:hover { color: #bf360c !important; }

/* Strong — bleu */
body.single .elementor-widget-theme-post-content strong,
body.single .elementor-widget-text-editor strong,
body.single .entry-content strong,
body.page  .elementor-widget-theme-post-content strong,
body.page  .elementor-widget-text-editor strong,
body.page  .entry-content strong { color: #0a3d8f !important; }

/* Fond blanc sections articles (pas homepage) */
body.single .elementor-top-section,
body.page  .elementor-top-section { background-color: #fff !important; }

/* ── SIMULATEUR — restaurer couleurs (ID > class, override charte) ─ */
#cf-sim-wrap .cf-sim-header,
#cf-sim-wrap .cf-sim-header h2,
#cf-sim-wrap .cf-sim-header p { color: #fff !important; }
#cf-sim-wrap .cf-form-col label { color: #2a3a5c !important; }
#cf-sim-wrap .cf-mensualite .montant { color: #0a3d8f !important; }
#cf-sim-wrap .cf-mensualite .label,
#cf-sim-wrap .cf-mensualite .mois { color: #778 !important; }
#cf-sim-wrap .cf-detail-item .lbl { color: #778 !important; }
#cf-sim-wrap .cf-detail-item .val { color: #1a1a2e !important; }
#cf-sim-wrap .cf-cta-title { color: #0a3d8f !important; }
#cf-sim-wrap .cf-btn-submit,
#cf-sim-wrap .cf-btn-submit * { color: #fff !important; text-decoration: none !important; }
#cf-sim-wrap a { text-decoration: none !important; }
#cf-sim-wrap p { font-size: inherit !important; line-height: inherit !important; }

/* ── FILET DE SÉCURITÉ — Hello Elementor natif (sans template Elementor Pro) ─ */
body.single article p, body.single article li, body.single article td,
body.single main p,    body.single main li,
body.single .site-content p, body.single .site-content li,
body.page  article p,  body.page  article li,
body.page  main p,     body.page  main li,
body.page  .site-content p, body.page  .site-content li {
  color: #1a1a2e !important;
  font-size: 1rem !important;
  line-height: 1.8 !important;
}
body.single article h2, body.single main h2, body.single .site-content h2,
body.page  article h2, body.page  main h2,  body.page  .site-content h2 {
  color: #0a3d8f !important; font-size: 1.6rem !important; font-weight: 700 !important;
}
body.single article h3, body.single main h3, body.single .site-content h3,
body.page  article h3, body.page  main h3,  body.page  .site-content h3 {
  color: #0a3d8f !important; font-size: 1.3rem !important; font-weight: 700 !important;
}
body.single article a, body.single main a:not([class*="nav"]):not([class*="menu"]):not([class*="footer"]):not([class*="cf-"]),
body.page  article a, body.page  main a:not([class*="nav"]):not([class*="menu"]):not([class*="footer"]):not([class*="cf-"]) {
  color: #e65100 !important;
}
</style>
<script>
(function() {
  var logoUrl = '<?php echo esc_js(home_url('/creditofacile-logo.svg')); ?>';

  /* Cible Elementor Pro template OU Hello Elementor natif — fallback sur <header> */
  function getHeader() {
    return document.querySelector('header.elementor-location-header')
        || document.querySelector('.elementor-location-header')
        || document.querySelector('header#site-header')
        || document.querySelector('.site-header')
        || document.querySelector('header');
  }

  function injectLogo() {
    var header = getHeader();
    if (!header) return;
    var existing = header.querySelector('img');
    if (!existing) return;
    if (existing.classList.contains('cf-logo-injected')) return;
    existing.src = logoUrl;
    existing.alt = 'CreditoFacile';
    existing.removeAttribute('srcset');
    existing.removeAttribute('sizes');
    existing.removeAttribute('width');
    existing.removeAttribute('height');
    existing.style.cssText = 'width:auto;height:48px;max-height:48px;border-radius:0;display:block';
    existing.classList.add('cf-logo-injected');
  }
  /* ── HAMBURGER MOBILE ── */
  function buildHamburger() {
    if (window.innerWidth >= 768) return;
    var header = getHeader();
    if (!header || document.getElementById('cf-hamburger')) return;

    // Collecter les liens : Elementor Pro nav OU Hello Elementor natif
    var links = [];
    var selectors = '.elementor-nav-menu a, .site-navigation a, .main-navigation a, .nav-menu a';
    header.querySelectorAll(selectors).forEach(function(a) {
      var txt = a.textContent.trim();
      if (txt) links.push({href: a.href, text: txt});
    });

    // Bouton hamburger
    var btn = document.createElement('button');
    btn.id = 'cf-hamburger';
    btn.setAttribute('aria-label', 'Menu');
    btn.innerHTML = '<span></span><span></span><span></span>';
    header.appendChild(btn);

    // Overlay menu
    var overlay = document.createElement('div');
    overlay.id = 'cf-mobile-menu';
    var close = document.createElement('button');
    close.id = 'cf-mobile-close';
    close.innerHTML = '&#10005;';
    overlay.appendChild(close);

    links.forEach(function(l) {
      var a = document.createElement('a');
      a.href = l.href; a.textContent = l.text;
      overlay.appendChild(a);
    });
    document.body.appendChild(overlay);

    btn.addEventListener('click', function() {
      btn.classList.toggle('open');
      overlay.classList.toggle('open');
      document.body.style.overflow = overlay.classList.contains('open') ? 'hidden' : '';
    });
    close.addEventListener('click', function() {
      btn.classList.remove('open');
      overlay.classList.remove('open');
      document.body.style.overflow = '';
    });
  }

  /* Force le fond bleu du header — override Elementor Customize + inline styles */
  function forceHeaderBlue() {
    var header = getHeader();
    if (!header) return;
    header.style.setProperty('background', '#0a3d8f', 'important');
    header.style.setProperty('background-color', '#0a3d8f', 'important');
    header.style.setProperty('border-bottom', 'none', 'important');
    header.style.setProperty('box-shadow', '0 2px 12px rgba(0,0,0,.2)', 'important');
    /* Liens nav blancs */
    header.querySelectorAll('a').forEach(function(a) {
      a.style.setProperty('color', '#fff', 'important');
    });
    /* Site title */
    var title = header.querySelector('.site-title, .site-title a');
    if (title) {
      title.style.setProperty('color', '#fff', 'important');
      title.style.setProperty('font-weight', '800', 'important');
    }
  }

  function init() {
    forceHeaderBlue();
    injectLogo();
    buildHamburger();
    /* Elementor applique ses styles après DOMContentLoaded — relancer après load */
    window.addEventListener('load', forceHeaderBlue);
    setTimeout(forceHeaderBlue, 600);
    setTimeout(forceHeaderBlue, 1500);
  }

  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
  } else {
    init();
  }
})();
</script>
<?php }, 1);

/* ── HEADER BLEU — injecté en footer priorité 9999 (après tout Elementor) ── */
add_action('wp_footer', function() { ?>
<style id="cf-header-force">
/* Header wrapper — bleu */
header.elementor-location-header { background:#0a3d8f!important; background-color:#0a3d8f!important; }
/* Sections/colonnes internes — transparentes pour laisser passer le bleu */
header.elementor-location-header .elementor-section,
header.elementor-location-header .elementor-container,
header.elementor-location-header .elementor-column,
header.elementor-location-header .elementor-widget-wrap,
header.elementor-location-header .e-con,
header.elementor-location-header .e-con-inner { background:transparent!important; background-color:transparent!important; }
/* Liens blancs */
header.elementor-location-header a { color:#fff!important; }
</style>
<script>
(function cfhdr(){
  function paint(){
    var h = document.querySelector('header.elementor-location-header')
         || document.querySelector('header#site-header');
    if(!h) return;
    /* Header wrapper → bleu */
    h.style.setProperty('background','#0a3d8f','important');
    h.style.setProperty('background-color','#0a3d8f','important');
    h.style.setProperty('border-bottom','none','important');
    /* Sections/colonnes internes → transparentes */
    h.querySelectorAll('.elementor-section,.elementor-container,.elementor-column,.elementor-widget-wrap,.e-con,.e-con-inner').forEach(function(el){
      el.style.setProperty('background','transparent','important');
      el.style.setProperty('background-color','transparent','important');
    });
    /* Liens blancs */
    h.querySelectorAll('a').forEach(function(a){
      a.style.setProperty('color','#fff','important');
    });
  }
  paint();
  window.addEventListener('load', paint);
  setTimeout(paint, 300);
  setTimeout(paint, 1000);
})();
</script>
<?php }, 9999);

/* ── FOOTER BAR — mentions légales + contact + langue ─────── */
add_action('wp_footer', function() {
    $lang = substr(get_locale(), 0, 2); // 'it' ou 'fr'
    $it = $lang !== 'fr';
    $home = home_url('/');
    $current_url = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    ?>
    <div id="cf-footer-bar">
        <div>
            <a href="<?= esc_url($home . 'mentions-legales/') ?>"><?= $it ? 'Note legali' : 'Mentions légales' ?></a>
            <a href="<?= esc_url($home . 'contatti/') ?>"><?= $it ? 'Contatti' : 'Contact' ?></a>
            <a href="<?= esc_url($home . 'privacy-policy/') ?>">Privacy</a>
            <span>&copy; <?= date('Y') ?> CreditoFacile.biz</span>
        </div>
        <div class="cf-footer-lang">
            <?php
            if (function_exists('pll_the_languages')) {
                pll_the_languages(['show_flags' => 0, 'show_names' => 1, 'display_names_as' => 'name', 'hide_current' => 0, 'echo' => 1]);
            } else { ?>
                <a href="<?= esc_url($home . 'it/') ?>" class="<?= !$it ? '' : 'active' ?>">IT</a>
                <a href="<?= esc_url($home . 'fr/') ?>" class="<?= $it ? '' : 'active' ?>">FR</a>
            <?php } ?>
        </div>
    </div>
    <?php
}, 20);

/* ── PAGES HTML STATIQUES — homepage + pages produits ─────── */
add_action('template_redirect', function() {
    // Mapping URL → fichier HTML
    $path = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');

    // Homepage
    if (is_front_page() || $path === '') {
        $file = ABSPATH . 'homepage.html';
        if (!file_exists($file)) return;
        get_header(); readfile($file); get_footer(); exit;
    }

    // Pages produits + statiques
    $pages = [
        'mutui'                 => 'mutuo.html',
        'prestiti'              => 'prestito.html',
        'prestito-personale'    => 'prestito.html',
        'cessione-del-quinto'   => 'cessione.html',
        'cessione'              => 'cessione.html',
        'consolidamento-debiti' => 'consolidamento.html',
        'consolidamento'        => 'consolidamento.html',
        'contatti'              => 'contatti.html',
        'contact'               => 'contatti.html',
        'note-legali'           => 'note-legali.html',
        'mentions-legales'      => 'note-legali.html',
        'mentions-légales'      => 'note-legali.html',
    ];

    if (array_key_exists($path, $pages)) {
        $file = ABSPATH . $pages[$path];
        if (!file_exists($file)) return;
        status_header(200);
        get_header(); readfile($file); get_footer(); exit;
    }
}, 1);

defined('ABSPATH') || exit;

/* ── CONFIG ──────────────────────────────────────────────── */
define('CF_LEAD_VERSION', '1.0');
define('CF_LEAD_SECRET',  'CFLeads2026secure'); // Token URL-safe

/* ── TABLE MySQL ─────────────────────────────────────────── */
register_activation_hook(__FILE__, 'cf_create_leads_table');
add_action('init', 'cf_maybe_create_leads_table');

function cf_maybe_create_leads_table() {
    if (get_option('cf_leads_table_version') !== CF_LEAD_VERSION) {
        cf_create_leads_table();
    }
}

function cf_create_leads_table() {
    global $wpdb;
    $table = $wpdb->prefix . 'cf_leads';
    $charset = $wpdb->get_charset_collate();

    $sql = "CREATE TABLE IF NOT EXISTS {$table} (
        id          INT AUTO_INCREMENT PRIMARY KEY,
        nome        VARCHAR(200) DEFAULT '',
        email       VARCHAR(255) NOT NULL,
        tel         VARCHAR(50)  DEFAULT '',
        pays        VARCHAR(10)  DEFAULT 'IT',
        reddito     VARCHAR(50)  DEFAULT '',
        type_credit VARCHAR(50)  DEFAULT '',
        montant     VARCHAR(30)  DEFAULT '',
        duree       VARCHAR(10)  DEFAULT '',
        taux        VARCHAR(10)  DEFAULT '',
        mensualite  VARCHAR(30)  DEFAULT '',
        ip          VARCHAR(45)  DEFAULT '',
        lang        VARCHAR(10)  DEFAULT '',
        created_at  DATETIME     DEFAULT NOW(),
        traite      TINYINT(1)   DEFAULT 0,
        notes       TEXT         DEFAULT '',
        INDEX idx_email (email),
        INDEX idx_pays  (pays),
        INDEX idx_type  (type_credit),
        INDEX idx_date  (created_at)
    ) {$charset};";

    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    dbDelta($sql);
    update_option('cf_leads_table_version', CF_LEAD_VERSION);
}

/* ── REST API ─────────────────────────────────────────────── */
add_action('rest_api_init', 'cf_register_rest_routes');

function cf_register_rest_routes() {
    // Recevoir un lead (public, depuis le simulateur)
    register_rest_route('creditofacile/v1', '/lead', [
        'methods'             => 'POST',
        'callback'            => 'cf_rest_receive_lead',
        'permission_callback' => '__return_true',
    ]);

    // Exporter les leads (protégé)
    register_rest_route('creditofacile/v1', '/leads', [
        'methods'             => 'GET',
        'callback'            => 'cf_rest_get_leads',
        'permission_callback' => 'cf_check_token',
    ]);
}

function cf_rest_receive_lead(WP_REST_Request $req) {
    global $wpdb;

    $email = sanitize_email($req->get_param('email'));
    if (!$email || !is_email($email)) {
        return new WP_REST_Response(['ok' => false, 'msg' => 'Email invalide'], 400);
    }

    $table = $wpdb->prefix . 'cf_leads';
    $wpdb->insert($table, [
        'nome'        => sanitize_text_field($req->get_param('nome')        ?? ''),
        'email'       => $email,
        'tel'         => sanitize_text_field($req->get_param('tel')         ?? ''),
        'pays'        => sanitize_text_field($req->get_param('pays')        ?? 'IT'),
        'reddito'     => sanitize_text_field($req->get_param('reddito')     ?? ''),
        'type_credit' => sanitize_text_field($req->get_param('type_credit') ?? ''),
        'montant'     => sanitize_text_field($req->get_param('montant')     ?? ''),
        'duree'       => sanitize_text_field($req->get_param('duree')       ?? ''),
        'taux'        => sanitize_text_field($req->get_param('taux')        ?? ''),
        'mensualite'  => sanitize_text_field($req->get_param('mensualite')  ?? ''),
        'ip'          => $_SERVER['REMOTE_ADDR'] ?? '',
        'lang'        => sanitize_text_field($req->get_param('lang')        ?? ''),
    ]);

    // Notif email
    cf_send_lead_notification([
        'nome'        => $req->get_param('nome')        ?? '',
        'email'       => $email,
        'tel'         => $req->get_param('tel')         ?? '',
        'pays'        => $req->get_param('pays')        ?? 'IT',
        'reddito'     => $req->get_param('reddito')     ?? '',
        'type_credit' => $req->get_param('type_credit') ?? '',
        'montant'     => $req->get_param('montant')     ?? '',
        'duree'       => $req->get_param('duree')       ?? '',
        'taux'        => $req->get_param('taux')        ?? '',
        'mensualite'  => $req->get_param('mensualite')  ?? '',
    ]);

    return new WP_REST_Response(['ok' => true, 'msg' => 'Lead enregistré'], 200);
}

function cf_check_token(WP_REST_Request $req) {
    // Admin connecte = acces direct
    if (current_user_can('manage_options')) return true;
    // Token via query param ou header
    $token = sanitize_text_field(
        $req->get_param('token')
        ?? $req->get_header('X-CF-Token')
        ?? ($_SERVER['HTTP_X_CF_TOKEN'] ?? '')
    );
    return ($token !== '' && $token === CF_LEAD_SECRET);
}

function cf_rest_get_leads(WP_REST_Request $req) {
    global $wpdb;
    $table = $wpdb->prefix . 'cf_leads';
    $pays  = sanitize_text_field($req->get_param('pays') ?? '');
    $type  = sanitize_text_field($req->get_param('type') ?? '');
    $limit = intval($req->get_param('limit') ?? 500);

    $where = [];
    if ($pays) $where[] = $wpdb->prepare("pays = %s", $pays);
    if ($type) $where[] = $wpdb->prepare("type_credit = %s", $type);
    $sql = "SELECT * FROM {$table}";
    if ($where) $sql .= " WHERE " . implode(' AND ', $where);
    $sql .= " ORDER BY created_at DESC LIMIT {$limit}";

    return new WP_REST_Response($wpdb->get_results($sql), 200);
}

/* ── ADMIN PAGE ──────────────────────────────────────────── */
add_action('admin_menu', 'cf_add_admin_menu');

function cf_add_admin_menu() {
    add_menu_page(
        'Leads CreditoFacile',
        'Leads CF',
        'manage_options',
        'cf-leads',
        'cf_admin_page',
        'dashicons-businessman',
        25
    );
}

function cf_admin_page() {
    global $wpdb;
    $table = $wpdb->prefix . 'cf_leads';

    // Action : marquer traité
    if (isset($_POST['cf_mark_done']) && isset($_POST['lead_id'])) {
        $wpdb->update($table, ['traite' => 1], ['id' => intval($_POST['lead_id'])]);
    }

    // Stats
    $total    = (int)$wpdb->get_var("SELECT COUNT(*) FROM {$table}");
    $non_trt  = (int)$wpdb->get_var("SELECT COUNT(*) FROM {$table} WHERE traite = 0");
    $by_type  = $wpdb->get_results("SELECT type_credit, COUNT(*) as n FROM {$table} GROUP BY type_credit ORDER BY n DESC");
    $by_pays  = $wpdb->get_results("SELECT pays, COUNT(*) as n FROM {$table} GROUP BY pays ORDER BY n DESC");

    // Filtres
    $filtre_pays = sanitize_text_field($_GET['pays'] ?? '');
    $filtre_type = sanitize_text_field($_GET['type'] ?? '');
    $where = "WHERE 1=1";
    if ($filtre_pays) $where .= $wpdb->prepare(" AND pays = %s", $filtre_pays);
    if ($filtre_type) $where .= $wpdb->prepare(" AND type_credit = %s", $filtre_type);

    $leads = $wpdb->get_results("SELECT * FROM {$table} {$where} ORDER BY created_at DESC LIMIT 200");

    ?>
    <div class="wrap">
    <h1>Leads CreditoFacile.biz</h1>

    <div style="display:flex;gap:20px;margin:16px 0;flex-wrap:wrap">
      <div style="background:#0a3d8f;color:#fff;padding:16px 24px;border-radius:10px;text-align:center">
        <div style="font-size:2rem;font-weight:800"><?= $total ?></div>
        <div style="font-size:.85rem;opacity:.85">Total leads</div>
      </div>
      <div style="background:#e65100;color:#fff;padding:16px 24px;border-radius:10px;text-align:center">
        <div style="font-size:2rem;font-weight:800"><?= $non_trt ?></div>
        <div style="font-size:.85rem;opacity:.85">Non traités</div>
      </div>
      <?php foreach ($by_pays as $bp): ?>
      <div style="background:#1565c0;color:#fff;padding:16px 24px;border-radius:10px;text-align:center">
        <div style="font-size:2rem;font-weight:800"><?= $bp->n ?></div>
        <div style="font-size:.85rem;opacity:.85"><?= esc_html($bp->pays) ?></div>
      </div>
      <?php endforeach; ?>
    </div>

    <!-- Export CSV -->
    <p>
      <a href="<?= admin_url('admin-post.php?action=cf_export_csv') ?>"
         style="background:#2e7d32;color:#fff;padding:8px 18px;border-radius:6px;text-decoration:none;font-weight:600">
        Exporter CSV
      </a>
    </p>

    <!-- Filtres -->
    <form method="GET" style="margin:12px 0;display:flex;gap:12px;align-items:center;flex-wrap:wrap">
      <input type="hidden" name="page" value="cf-leads">
      <select name="pays" style="padding:6px 10px;border-radius:6px;border:1px solid #ccc">
        <option value="">Tous les pays</option>
        <?php foreach ($by_pays as $bp): ?>
          <option value="<?= esc_attr($bp->pays) ?>" <?= selected($filtre_pays, $bp->pays, false) ?>>
            <?= esc_html($bp->pays) ?> (<?= $bp->n ?>)
          </option>
        <?php endforeach; ?>
      </select>
      <select name="type" style="padding:6px 10px;border-radius:6px;border:1px solid #ccc">
        <option value="">Tous les types</option>
        <?php foreach ($by_type as $bt): ?>
          <option value="<?= esc_attr($bt->type_credit) ?>" <?= selected($filtre_type, $bt->type_credit, false) ?>>
            <?= esc_html($bt->type_credit) ?> (<?= $bt->n ?>)
          </option>
        <?php endforeach; ?>
      </select>
      <button type="submit" style="padding:7px 16px;background:#0a3d8f;color:#fff;border:none;border-radius:6px;cursor:pointer">Filtrer</button>
    </form>

    <!-- Tableau -->
    <table class="widefat striped" style="margin-top:8px">
      <thead>
        <tr>
          <th>#</th><th>Date</th><th>Nom</th><th>Email</th><th>Tél</th>
          <th>Pays</th><th>Type</th><th>Montant</th><th>Mensualité</th>
          <th>Revenu</th><th>Traité</th>
        </tr>
      </thead>
      <tbody>
      <?php if (empty($leads)): ?>
        <tr><td colspan="11" style="text-align:center;padding:20px;color:#888">Aucun lead pour le moment.</td></tr>
      <?php else: ?>
        <?php foreach ($leads as $l): ?>
        <tr style="<?= $l->traite ? 'opacity:.5' : '' ?>">
          <td><?= $l->id ?></td>
          <td style="white-space:nowrap"><?= esc_html(substr($l->created_at, 0, 16)) ?></td>
          <td><?= esc_html($l->nome) ?></td>
          <td><a href="mailto:<?= esc_attr($l->email) ?>"><?= esc_html($l->email) ?></a></td>
          <td><?= esc_html($l->tel) ?></td>
          <td><strong><?= esc_html($l->pays) ?></strong></td>
          <td><?= esc_html($l->type_credit) ?></td>
          <td><?= esc_html($l->montant) ?>€</td>
          <td><?= esc_html($l->mensualite) ?></td>
          <td><?= esc_html($l->reddito) ?></td>
          <td>
            <?php if (!$l->traite): ?>
            <form method="POST" style="margin:0">
              <input type="hidden" name="lead_id" value="<?= $l->id ?>">
              <button name="cf_mark_done" value="1"
                style="padding:3px 10px;background:#2e7d32;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:.8rem">
                Traité
              </button>
            </form>
            <?php else: echo '✅'; endif; ?>
          </td>
        </tr>
        <?php endforeach; ?>
      <?php endif; ?>
      </tbody>
    </table>
    </div>
    <?php
}

/* ── EXPORT CSV ──────────────────────────────────────────── */
add_action('admin_post_cf_export_csv', 'cf_export_csv');

function cf_export_csv() {
    if (!current_user_can('manage_options')) wp_die('Accès refusé');
    global $wpdb;
    $table = $wpdb->prefix . 'cf_leads';
    $leads = $wpdb->get_results("SELECT * FROM {$table} ORDER BY created_at DESC", ARRAY_A);

    header('Content-Type: text/csv; charset=utf-8');
    header('Content-Disposition: attachment; filename="cf_leads_' . date('Ymd') . '.csv"');
    $out = fopen('php://output', 'w');
    fputcsv($out, ['ID','Date','Nom','Email','Tel','Pays','Type','Montant','Duree','Taux','Mensualite','Revenu','IP','Traite']);
    foreach ($leads as $l) {
        fputcsv($out, [
            $l['id'], $l['created_at'], $l['nome'], $l['email'], $l['tel'],
            $l['pays'], $l['type_credit'], $l['montant'], $l['duree'],
            $l['taux'], $l['mensualite'], $l['reddito'], $l['ip'], $l['traite']
        ]);
    }
    fclose($out);
    exit;
}

/* ── AJAX wp-admin (fallback pour le simulateur) ─────────── */
add_action('wp_ajax_cf_submit_lead',        'cf_ajax_submit_lead');
add_action('wp_ajax_nopriv_cf_submit_lead', 'cf_ajax_submit_lead');

function cf_ajax_submit_lead() {
    global $wpdb;

    $email = sanitize_email($_POST['email'] ?? '');
    if (!$email || !is_email($email)) {
        wp_send_json(['ok' => false, 'msg' => 'Email invalide'], 400);
    }

    $table = $wpdb->prefix . 'cf_leads';
    $wpdb->insert($table, [
        'nome'        => sanitize_text_field($_POST['nome']        ?? ''),
        'email'       => $email,
        'tel'         => sanitize_text_field($_POST['tel']         ?? ''),
        'pays'        => sanitize_text_field($_POST['pays']        ?? 'IT'),
        'reddito'     => sanitize_text_field($_POST['reddito']     ?? ''),
        'type_credit' => sanitize_text_field($_POST['type_credit'] ?? ''),
        'montant'     => sanitize_text_field($_POST['montant']     ?? ''),
        'duree'       => sanitize_text_field($_POST['duree']       ?? ''),
        'taux'        => sanitize_text_field($_POST['taux']        ?? ''),
        'mensualite'  => sanitize_text_field($_POST['mensualite']  ?? ''),
        'ip'          => $_SERVER['REMOTE_ADDR'] ?? '',
        'lang'        => sanitize_text_field($_POST['lang']        ?? ''),
    ]);

    // Notif email
    cf_send_lead_notification([
        'nome'        => sanitize_text_field($_POST['nome']        ?? ''),
        'email'       => $email,
        'tel'         => sanitize_text_field($_POST['tel']         ?? ''),
        'pays'        => sanitize_text_field($_POST['pays']        ?? 'IT'),
        'reddito'     => sanitize_text_field($_POST['reddito']     ?? ''),
        'type_credit' => sanitize_text_field($_POST['type_credit'] ?? ''),
        'montant'     => sanitize_text_field($_POST['montant']     ?? ''),
        'duree'       => sanitize_text_field($_POST['duree']       ?? ''),
        'taux'        => sanitize_text_field($_POST['taux']        ?? ''),
        'mensualite'  => sanitize_text_field($_POST['mensualite']  ?? ''),
    ]);

    wp_send_json(['ok' => true]);
}

/* ── NOTIFICATION EMAIL LEAD ─────────────────────────────── */
function cf_send_lead_notification(array $d): void {
    $to      = 'jean-thierry@rank-up.io';
    $type    = $d['type_credit'] ?: 'N/A';
    $pays    = $d['pays']        ?: 'IT';
    $nom     = $d['nome']        ?: '(non renseigné)';
    $montant = $d['montant'] ? $d['montant'] . ' €' : 'N/A';
    $mensua  = $d['mensualite'] ? $d['mensualite'] . ' €/mois' : 'N/A';
    $duree   = $d['duree'] ? $d['duree'] . ' mois' : 'N/A';
    $taux    = $d['taux'] ? $d['taux'] . ' %' : 'N/A';
    $revenu  = $d['reddito'] ?: 'N/A';

    $subject = "[CreditoFacile] Nouveau lead — {$type} {$montant} ({$pays})";

    $body = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body style="font-family:Arial,sans-serif;background:#f0f4fb;margin:0;padding:20px">';
    $body .= '<div style="max-width:560px;margin:0 auto;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,.1)">';
    $body .= '<div style="background:#0a3d8f;padding:20px 28px">';
    $body .= '<h2 style="color:#fff;margin:0;font-size:1.1rem">Nouveau lead CreditoFacile.biz</h2>';
    $body .= '<p style="color:rgba(255,255,255,.75);margin:4px 0 0;font-size:.85rem">' . esc_html(date('d/m/Y H:i')) . '</p>';
    $body .= '</div>';
    $body .= '<div style="padding:24px 28px">';

    // Badge type crédit
    $body .= '<div style="background:#e8f0fe;border-left:4px solid #0a3d8f;padding:10px 16px;border-radius:0 8px 8px 0;margin-bottom:20px">';
    $body .= '<strong style="color:#0a3d8f;font-size:1rem">' . esc_html(strtoupper($type)) . '</strong>';
    $body .= ' &nbsp;|&nbsp; <strong style="color:#e65100">' . esc_html($montant) . '</strong>';
    $body .= ' &nbsp;|&nbsp; ' . esc_html($pays);
    $body .= '</div>';

    $rows = [
        ['Nom',         $nom],
        ['Email',       '<a href="mailto:' . esc_attr($d['email']) . '" style="color:#0a3d8f">' . esc_html($d['email']) . '</a>'],
        ['Téléphone',   $d['tel'] ?: 'N/A'],
        ['Montant',     $montant],
        ['Durée',       $duree],
        ['Taux',        $taux],
        ['Mensualité',  $mensua],
        ['Revenu',      $revenu],
    ];

    $body .= '<table style="width:100%;border-collapse:collapse;font-size:.9rem">';
    foreach ($rows as [$label, $val]) {
        $body .= '<tr>';
        $body .= '<td style="padding:8px 12px;color:#6b7a99;width:40%;border-bottom:1px solid #eef">' . esc_html($label) . '</td>';
        $body .= '<td style="padding:8px 12px;font-weight:600;border-bottom:1px solid #eef">' . $val . '</td>';
        $body .= '</tr>';
    }
    $body .= '</table>';

    $admin_url = admin_url('admin.php?page=cf-leads');
    $body .= '<div style="margin-top:24px;text-align:center">';
    $body .= '<a href="' . esc_url($admin_url) . '" style="background:#0a3d8f;color:#fff;padding:12px 28px;border-radius:6px;text-decoration:none;font-weight:700;font-size:.9rem">Voir dans l\'admin</a>';
    $body .= '</div>';

    $body .= '</div></div></body></html>';

    add_filter('wp_mail_content_type', fn() => 'text/html');
    wp_mail($to, $subject, $body, ['From: CreditoFacile.biz <noreply@creditofacile.biz>']);
    remove_all_filters('wp_mail_content_type');
}

/* ── FORMULAIRE CONTACT (AJAX) ───────────────────────────── */
add_action('wp_ajax_cf_contact_message',        'cf_handle_contact');
add_action('wp_ajax_nopriv_cf_contact_message', 'cf_handle_contact');

function cf_handle_contact() {
    $nome     = sanitize_text_field($_POST['nome']      ?? '');
    $email    = sanitize_email($_POST['email']          ?? '');
    $oggetto  = sanitize_text_field($_POST['oggetto']   ?? '');
    $messaggio= sanitize_textarea_field($_POST['messaggio'] ?? '');

    if (!$email || !is_email($email)) {
        wp_send_json(['ok' => false], 400);
    }

    $subject = "[CreditoFacile] Contatto: {$oggetto} — {$nome}";
    $body  = '<div style="font-family:Arial,sans-serif;max-width:560px">';
    $body .= '<div style="background:#0a3d8f;padding:20px;border-radius:12px 12px 0 0">';
    $body .= '<h2 style="color:#fff;margin:0">Nuovo messaggio di contatto</h2></div>';
    $body .= '<div style="padding:24px;background:#fff;border:1px solid #e0e7f0;border-radius:0 0 12px 12px">';
    $body .= '<p><strong>Nome:</strong> ' . esc_html($nome) . '</p>';
    $body .= '<p><strong>Email:</strong> <a href="mailto:' . esc_attr($email) . '">' . esc_html($email) . '</a></p>';
    $body .= '<p><strong>Oggetto:</strong> ' . esc_html($oggetto) . '</p>';
    $body .= '<p><strong>Messaggio:</strong></p>';
    $body .= '<p style="background:#f5f7fa;padding:14px;border-radius:8px">' . nl2br(esc_html($messaggio)) . '</p>';
    $body .= '</div></div>';

    add_filter('wp_mail_content_type', fn() => 'text/html');
    wp_mail('jean-thierry@rank-up.io', $subject, $body, ['From: CreditoFacile.biz <noreply@creditofacile.biz>']);
    remove_all_filters('wp_mail_content_type');

    wp_send_json(['ok' => true]);
}

/* ── Forcer l'avatar local de Luca sur tous les users ── */
add_filter('pre_get_avatar_data', function($args, $id_or_email) {
    $avatar_url = 'https://www.creditofacile.biz/wp-content/uploads/2025/11/cropped-LUCAS-MORETTI.jpg';
    $args['url'] = $avatar_url;
    return $args;
}, 99, 2);

/* ── Convertir le H4 auteur en SPAN (author-box Elementor) ── */
add_action('wp_footer', function() {
    if (!is_singular()) return;
    ?>
    <script>
    document.querySelectorAll('.elementor-author-box__name').forEach(function(el) {
        if (el.tagName === 'H4') {
            var span = document.createElement('span');
            span.className = el.className;
            span.innerHTML = el.innerHTML;
            el.parentNode.replaceChild(span, el);
        }
    });
    </script>
    <?php
});

/* ── INJECTION CTA dans tous les articles WP (Otomatic) ──── */

add_filter('the_content', 'cf_inject_article_cta');

function cf_inject_article_cta($content) {
    // is_singular() couvre posts ET pages (Otomatic crée des pages)
    if (!is_singular() || is_front_page()) return $content;

    $home = home_url('/');
    $lang = substr(get_locale(), 0, 2);
    $fr   = ($lang === 'fr');

    $sim_title = $fr ? 'Calculez votre Mensualité'          : 'Calcola la tua Rata';
    $sim_body  = $fr ? 'Simulation gratuite en 30 secondes, sans engagement.'
                     : 'Simulazione gratuita in 30 secondi, senza impegno.';
    $sim_cta   = $fr ? 'Simuler mon Crédit →'              : 'Simula il mio Credito →';
    $hp_cta    = $fr ? '← Retour à l\'Accueil'             : '← Torna all\'Accueil';

    $cta = '
<div style="margin:40px 0;background:linear-gradient(135deg,#061e5e,#0a3d8f);border-radius:16px;padding:28px 32px;color:#fff;text-align:center;font-family:Segoe UI,Arial,sans-serif">
  <p style="font-size:1.05rem;font-weight:800;margin:0 0 8px">' . esc_html($sim_title) . '</p>
  <p style="font-size:.9rem;opacity:.82;margin:0 0 20px">' . esc_html($sim_body) . '</p>
  <div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap">
    <a href="' . esc_url($home) . '#simulatore" style="background:linear-gradient(135deg,#e65100,#f57c00);color:#fff;border-radius:50px;padding:12px 28px;font-size:.95rem;font-weight:700;text-decoration:none;display:inline-block;box-shadow:0 6px 20px rgba(230,81,0,.4)">'
        . esc_html($sim_cta) . '</a>
    <a href="' . esc_url($home) . '" style="background:rgba(255,255,255,.12);border:1.5px solid rgba(255,255,255,.3);color:#fff;border-radius:50px;padding:12px 28px;font-size:.9rem;font-weight:600;text-decoration:none;display:inline-block">'
        . esc_html($hp_cta) . '</a>
  </div>
</div>';

    return $content . $cta;
}

/* ── ENQUEUE NONCE pour le simulateur ────────────────────── */
add_action('wp_enqueue_scripts', 'cf_enqueue_ajax');

function cf_enqueue_ajax() {
    wp_add_inline_script('jquery', '
        var cf_ajax = {
            url: "' . admin_url('admin-ajax.php') . '",
            nonce: "' . wp_create_nonce('cf_lead_nonce') . '"
        };
    ');
}

/* ── SHORTCODE [cf_simulateur] ─────────────────────────────────
   Lit simulator.html depuis la racine du site.
   Usage Elementor : widget Shortcode → [cf_simulateur]
   ─────────────────────────────────────────────────────────── */
add_action('init', function() {
    add_shortcode('cf_simulateur', 'cf_render_simulator');
});

function cf_render_simulator() {
    $file = ABSPATH . 'simulator.html';
    if (!file_exists($file)) return '<!-- simulator.html introuvable -->';
    return file_get_contents($file);
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
15 Aug 2026 4.25 AM
sc3naki1272 / sc3naki1272
0755
block-patterns
--
30 Mar 2026 7.31 AM
sc3naki1272 / sc3naki1272
0755
cf-basic-auth.php
0.796 KB
20 Mar 2026 7.30 AM
sc3naki1272 / sc3naki1272
0644
snippet_leads.php
48.799 KB
20 Mar 2026 8.45 AM
sc3naki1272 / sc3naki1272
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF