Plugin Directory

Changeset 3727621


Ignore:
Timestamp:
10/04/2026 04:42:48 PM (7 weeks ago)
Author:
novexthemes
Message:

0.0.5

Location:
novex-demo-importer/trunk
Files:
36 added
3 edited

Legend:

Unmodified
Added
Removed
  • novex-demo-importer/trunk/assets/css/admin.css

    r3562394 r3727621  
    1 :root{--novex-bg:#000424;--novex-accent:#d251f0;--novex-strong:#6d39f2;--novex-text:#ffffff;--novex-muted:#686973;--novex-border:rgba(104,105,115,0.25)}
    2 *{box-sizing:border-box}
     1/* ============================================================
     2   Novex Demo Importer — admin UI
     3   Design system mirrored from novexthemes.com
     4   ============================================================ */
    35
    4 /* ── Wrapper ── */
    5 .novex-di-wrapper{background:#ffffff;border:1px solid rgba(104,105,115,0.2);border-radius:12px;box-shadow:0 8px 30px rgba(0,4,36,0.1);max-width:1100px;padding:0;margin-top:20px;overflow:hidden;color:#000424}
     6/* ── 1. Tokens ── */
     7:root{
     8        --novex-ink:#0B1220;
     9        --novex-slate:#5A6579;
     10        --novex-slate-light:#8C97A8;
     11        --novex-line:#E7ECF5;
     12        --novex-line-soft:#F0F4FA;
     13        --novex-cloud:#F7F9FC;
     14        --novex-wash:#EDF3FF;
     15        --novex-blue:#2F6BFF;
     16        --novex-blue-deep:#1D4FD8;
     17        --novex-blue-tint:#DCE8FF;
     18        --novex-mint:#12B981;
     19        --novex-mint-deep:#0E9C6D;
     20        --novex-red:#D92D20;
     21        --novex-white:#fff;
    622
    7 /* ── Header (dark bar) ── */
    8 .novex-di-header{display:flex;justify-content:space-between;align-items:center;padding:18px 22px;background:#000424;border-bottom:none}
    9 .novex-di-brand{display:flex;align-items:center;gap:12px}
    10 .novex-di-logo-circle{width:48px;height:48px;border-radius:50%;background:#ffffff;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 8px 20px rgba(0,0,0,0.22);flex-shrink:0}
    11 .novex-di-logo-circle img{width:30px;height:30px;display:block;object-fit:contain}
    12 .novex-di-header h1 {color: #ffffff;font-weight: 600;}
    13 /* ── Tabs ── */
    14 .novex-di-tabs{display:flex;gap:10px;flex-wrap:wrap;padding:14px 16px;background:#ffffff;}
    15 .novex-di-tab{flex:1 1 0;text-align:center;padding:12px 10px;border-radius:10px;border:1px solid rgba(104,105,115,0.22);cursor:pointer;font-weight:700;color:var(--novex-muted);background:#f7f7fb;transition:all .2s ease}
    16 .novex-di-tab:hover,.novex-di-tab:focus{border-color:var(--novex-accent);color:#000424;background:#f3eaff}
    17 .novex-di-tab.active{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%);color:#fff;border-color:transparent;box-shadow:0 8px 16px rgba(210,81,240,0.3)}
    18 .novex-di-tab.completed{color:var(--novex-strong);border-color:rgba(109,57,242,0.35);background:#f0eaff}
    19 .novex-di-tab.disabled{cursor:not-allowed;opacity:.55}
     23        --novex-r-sm:8px;
     24        --novex-r-md:12px;
     25        --novex-r-lg:16px;
    2026
    21 /* ── Panels ── */
    22 .novex-di-panels{padding:0 20px 20px;background:#ffffff}
    23 .novex-di-panel{display:none;border:1px solid rgba(104,105,115,0.18);border-radius:12px;padding:20px;background:#ffffff;color:#000424}
     27        --novex-shadow-card:0 1px 2px rgba(11,18,32,.05);
     28        --novex-shadow-hover:0 12px 32px rgba(24,54,120,.13);
     29        --novex-shadow-float:0 24px 64px rgba(24,54,120,.14),0 2px 8px rgba(11,18,32,.05);
     30        --novex-shadow-blue:0 16px 40px rgba(47,107,255,.28);
     31
     32        --novex-display:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
     33        --novex-body:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
     34        --novex-mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
     35
     36        /* Legacy aliases kept so older selectors resolve. */
     37        --novex-bg:#0B1220;
     38        --novex-accent:#2F6BFF;
     39        --novex-strong:#1D4FD8;
     40        --novex-text:#ffffff;
     41        --novex-muted:#5A6579;
     42        --novex-border:#E7ECF5;
     43}
     44.novex-di-page *{box-sizing:border-box}
     45.novex-di-page{font-family:var(--novex-body);color:var(--novex-ink);-webkit-font-smoothing:antialiased}
     46.novex-di-page h1,.novex-di-page h2,.novex-di-page h3{font-family:var(--novex-display);letter-spacing:-.02em;color:var(--novex-ink)}
     47.novex-di-page :focus-visible{outline:2px solid var(--novex-blue);outline-offset:2px;border-radius:4px}
     48
     49/* ── 2. Wrapper ── */
     50.novex-di-wrapper{background:var(--novex-white);border:1px solid var(--novex-line);border-radius:var(--novex-r-lg);box-shadow:var(--novex-shadow-card);max-width:1100px;padding:0;margin-top:20px;overflow:hidden;color:var(--novex-ink)}
     51
     52/* ── 3. Header (light wash, mirrors the site hero) ── */
     53.novex-di-header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:22px 24px;border-bottom:1px solid var(--novex-line);background:
     54        radial-gradient(520px 260px at 8% -30%,#DCE8FF 0%,rgba(220,232,255,0) 62%),
     55        radial-gradient(420px 220px at 92% -10%,#E2ECFF 0%,rgba(226,236,255,0) 58%),
     56        linear-gradient(180deg,#F5F9FF 0%,#FFFFFF 100%)}
     57.novex-di-brand{display:flex;align-items:center;gap:14px}
     58.novex-di-logo-circle{display:inline-flex;align-items:center;gap:14px;width:auto;height:auto;padding:0;background:none;border:0;border-radius:0;box-shadow:none;flex-shrink:0}
     59.novex-di-logo-circle img{width:auto;height:28px;max-width:100%;display:block;object-fit:contain}
     60.novex-di-logo-circle::after{content:'';width:1px;height:26px;background:var(--novex-line);flex-shrink:0}
     61.novex-di-header h1{color:var(--novex-ink);font-weight:800;font-size:21px;line-height:1.25}
     62
     63/* ── 4. Stepper tabs ── */
     64.novex-di-tabs{display:flex;gap:10px;flex-wrap:wrap;padding:18px 24px 4px;background:var(--novex-white)}
     65.novex-di-tab{flex:1 1 0;text-align:center;padding:11px 14px;border-radius:999px;border:1px solid var(--novex-line);cursor:pointer;font-family:var(--novex-body);font-weight:600;font-size:13.5px;color:var(--novex-slate);background:var(--novex-white);box-shadow:var(--novex-shadow-card);transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease,transform .15s ease}
     66.novex-di-tab:hover,.novex-di-tab:focus{border-color:#C9D5EA;color:var(--novex-ink)}
     67.novex-di-tab.active{background:var(--novex-blue);color:#fff;border-color:transparent;box-shadow:var(--novex-shadow-blue)}
     68.novex-di-tab.completed{background:rgba(18,185,129,.09);color:var(--novex-mint-deep);border-color:rgba(18,185,129,.28);box-shadow:none}
     69.novex-di-tab.disabled{cursor:not-allowed;opacity:.55;box-shadow:none}
     70.novex-di-tab.disabled:hover{border-color:var(--novex-line);color:var(--novex-slate)}
     71
     72/* ── 5. Panels ── */
     73.novex-di-panels{padding:16px 24px 24px;background:var(--novex-white)}
     74.novex-di-panel{display:none;border:1px solid var(--novex-line);border-radius:var(--novex-r-md);padding:24px;background:var(--novex-white);color:var(--novex-ink)}
    2475.novex-di-panel.active{display:block}
    25 .novex-di-panel h2{margin-top:0;color:#000424}
     76.novex-di-panel h2{margin:0 0 6px;font-size:18px;font-weight:800}
     77.novex-di-panel p{color:var(--novex-slate);font-size:14px;line-height:1.6;margin:0 0 16px}
     78.novex-di-panel label{font-size:13px;color:var(--novex-ink)}
     79.novex-di-panel label strong{display:inline-block;margin-bottom:6px;font-weight:600}
     80.novex-di-panel input[type=text]{display:block;width:100%;max-width:420px;padding:10px 14px;border:1px solid var(--novex-line);border-radius:var(--novex-r-sm);background:var(--novex-cloud);color:var(--novex-ink);font-family:var(--novex-body);font-size:14px;box-shadow:none;transition:border-color .15s ease,background .15s ease}
     81.novex-di-panel input[type=text]:focus{border-color:var(--novex-blue);background:var(--novex-white);box-shadow:0 0 0 3px rgba(47,107,255,.14);outline:none}
     82.novex-di-panel input[type=checkbox]{margin-right:6px}
    2683
    27 /* ── Messages ── */
    28 .novex-di-message{margin-top:10px;font-weight:600}
    29 .novex-di-message.success{color:#0a7a3f}
    30 .novex-di-message.error{color:#c92c2c}
     84/* ── 6. Messages ── */
     85.novex-di-message{margin-top:12px;font-size:13px;font-weight:500;color:var(--novex-slate)}
     86.novex-di-message:empty{margin-top:0}
     87.novex-di-message.success{color:var(--novex-mint-deep);font-weight:600}
     88.novex-di-message.error{color:var(--novex-red);font-weight:600}
    3189
    32 /* ── Action buttons ── */
    33 .novex-di-actions{margin-top:16px;display:flex;gap:10px;flex-wrap:wrap;align-items:center}
    34 .novex-di-actions .button{border-radius:8px;padding:10px 16px;font-weight:700}
    35 .novex-di-actions .button-primary{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%);border-color:transparent;box-shadow:0 4px 12px rgba(210,81,240,0.3);color:#fff;text-transform:uppercase;letter-spacing:.3px}
    36 .novex-di-actions .button-secondary{background:#fff;border-color:rgba(104,105,115,0.3);color:var(--novex-strong);font-weight:700}
    37 .novex-di-actions .novex-next{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%);border-color:transparent;color:#fff;text-transform:uppercase;letter-spacing:.3px;box-shadow:0 4px 12px rgba(109,57,242,0.3)}
    38 .novex-di-actions .button-primary:hover,.novex-di-actions .button-primary:focus{background:linear-gradient(90deg,#6d39f2 0%,#d251f0 100%);border-color:transparent;color:#fff;box-shadow:0 6px 18px rgba(210,81,240,0.45)}
    39 .novex-di-actions .button-secondary:hover,.novex-di-actions .button-secondary:focus{background:#fff;border-color:var(--novex-strong);color:var(--novex-strong)}
    40 .novex-di-actions .novex-next:hover,.novex-di-actions .novex-next:focus{background:linear-gradient(90deg,#6d39f2 0%,#d251f0 100%);border-color:transparent;color:#fff;box-shadow:0 6px 18px rgba(109,57,242,0.45)}
    41 .novex-di-actions .button:disabled{opacity:.55;cursor:not-allowed}
     90/* ── 7. Buttons ── */
     91.novex-di-actions{margin-top:18px;display:flex;gap:10px;flex-wrap:wrap;align-items:center}
     92.novex-di-actions .button,.novex-modal .button,.novex-compare-actions .button,.novex-next-wrap .novex-next{display:inline-flex;align-items:center;justify-content:center;gap:7px;font-family:var(--novex-body);font-weight:600;font-size:13.5px;line-height:1.4;height:auto;padding:10px 18px;border-radius:var(--novex-r-sm);border:1px solid transparent;text-decoration:none;text-transform:none;letter-spacing:0;transition:background .15s ease,border-color .15s ease,color .15s ease,transform .15s ease,box-shadow .15s ease}
     93.novex-di-actions .button-primary,.novex-di-actions .novex-next{background:var(--novex-blue);border-color:transparent;color:#fff;box-shadow:var(--novex-shadow-card)}
     94.novex-di-actions .button-primary:hover,.novex-di-actions .button-primary:focus,.novex-di-actions .novex-next:hover,.novex-di-actions .novex-next:focus{background:var(--novex-blue-deep);border-color:transparent;color:#fff;transform:translateY(-1px);box-shadow:var(--novex-shadow-blue)}
     95.novex-di-actions .button-secondary{background:var(--novex-white);border-color:var(--novex-line);color:var(--novex-ink);box-shadow:var(--novex-shadow-card)}
     96.novex-di-actions .button-secondary:hover,.novex-di-actions .button-secondary:focus{background:var(--novex-white);border-color:#C9D5EA;color:var(--novex-ink);transform:translateY(-1px)}
     97.novex-di-actions .button:disabled,.novex-di-actions .button[disabled]{opacity:.6;pointer-events:none;transform:none;box-shadow:none}
    4298
    43 /* ── Plugin table ── */
    44 .novex-di-table{border-collapse:separate !important;border-spacing:0 !important;width:100%;border-radius:10px;overflow:hidden;border:1px solid rgba(104,105,115,0.2) !important;margin-bottom:0}
    45 .novex-di-table thead tr{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%) !important}
    46 .novex-di-table thead th{color:#fff !important;font-weight:700;padding:13px 16px !important;border:none !important;text-transform:uppercase;font-size:11px;letter-spacing:.6px}
    47 .novex-di-table tbody tr{background:#ffffff !important;transition:background .15s ease}
    48 .novex-di-table tbody tr:nth-child(even){background:#f9f7ff !important}
    49 .novex-di-table tbody tr:hover{background:#f0eaff !important}
    50 .novex-di-table tbody td{padding:12px 16px !important;border:none !important;border-top:1px solid rgba(104,105,115,0.1) !important;color:#000424;vertical-align:middle}
    51 .novex-di-table .status{font-weight:700}
    52 .novex-plugin-status{display:inline-flex;align-items:center;padding:4px 14px;border-radius:100px;font-size:12px;font-weight:700;background:rgba(109,57,242,0.1);color:var(--novex-strong);letter-spacing:.2px}
     99/* ── 8. Plugin table ── */
     100.novex-di-table{border-collapse:separate !important;border-spacing:0 !important;width:100%;border-radius:var(--novex-r-md);overflow:hidden;border:1px solid var(--novex-line) !important;box-shadow:none;margin-bottom:0;background:var(--novex-white)}
     101.novex-di-table thead tr{background:var(--novex-cloud) !important}
     102.novex-di-table thead th{color:var(--novex-slate-light) !important;font-family:var(--novex-mono);font-weight:500;padding:12px 16px !important;border:none !important;border-bottom:1px solid var(--novex-line) !important;text-transform:uppercase;font-size:11px;letter-spacing:.08em}
     103.novex-di-table tbody tr{background:var(--novex-white) !important;transition:background .15s ease}
     104.novex-di-table tbody tr:nth-child(even){background:var(--novex-white) !important}
     105.novex-di-table tbody tr:hover{background:var(--novex-line-soft) !important}
     106.novex-di-table tbody td{padding:13px 16px !important;border:none !important;border-top:1px solid var(--novex-line) !important;color:var(--novex-ink);font-size:13.5px;vertical-align:middle}
     107.novex-di-table tbody tr:first-child td{border-top:none !important}
     108.novex-di-table .status{font-weight:500}
     109.novex-plugin-status{display:inline-flex;align-items:center;padding:4px 12px;border-radius:999px;font-family:var(--novex-mono);font-size:11px;font-weight:500;letter-spacing:.04em;text-transform:uppercase;background:var(--novex-blue-tint);color:var(--novex-blue-deep)}
    53110
    54 /* ── Next button (standalone wrap) ── */
     111/* ── 9. Next button (standalone wrap) ── */
    55112.novex-next-wrap{display:flex;justify-content:flex-end;margin-top:20px}
    56 .novex-next-wrap .novex-next{padding:9px 32px;border-radius:10px;font-size:14px;display:inline-flex;align-items:center;gap:8px;min-height:44px;transition:transform .15s ease,box-shadow .15s ease;background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%);border-color:transparent;color:#fff;font-weight:700;box-shadow:0 4px 16px rgba(210,81,240,0.35)}
    57 .novex-next-wrap .novex-next::after{content:'';display:inline-block;width:14px;height:14px;background:url('../img/angle-right-solid-full.svg') no-repeat center/contain;filter:brightness(0) invert(1)}
    58 .novex-next-wrap .novex-next:hover:not(:disabled),.novex-next-wrap .novex-next:focus:not(:disabled){background:linear-gradient(90deg,#6d39f2 0%,#d251f0 100%) !important;transform:translateY(-2px);box-shadow:0 10px 28px rgba(210,81,240,0.5) !important;border-color:transparent !important;color:#fff !important}
     113.novex-next-wrap .novex-next{padding:11px 26px;font-size:14px;min-height:0;background:var(--novex-blue);border-color:transparent;color:#fff;box-shadow:var(--novex-shadow-card)}
     114.novex-next-wrap .novex-next::after{content:'';display:inline-block;width:12px;height:12px;background:url('../img/angle-right-solid-full.svg') no-repeat center/contain;filter:brightness(0) invert(1)}
     115.novex-next-wrap .novex-next:hover:not(:disabled),.novex-next-wrap .novex-next:focus:not(:disabled){background:var(--novex-blue-deep) !important;border-color:transparent !important;color:#fff !important;transform:translateY(-2px);box-shadow:var(--novex-shadow-blue) !important}
     116.novex-next-wrap .novex-next:disabled,.novex-next-wrap .novex-next[disabled]{opacity:.6;pointer-events:none;box-shadow:none}
    59117
    60 /* ── Modal ── */
    61 .novex-modal-backdrop{position:fixed;inset:0;background:rgba(0,4,36,0.55);display:none;align-items:center;justify-content:center;padding:16px;z-index:9999}
    62 .novex-modal{background:#fff;max-width:420px;width:100%;border-radius:12px;padding:20px;box-shadow:0 16px 40px rgba(0,4,36,0.18);border:1px solid rgba(104,105,115,0.18)}
    63 .novex-modal h3{margin-top:0;color:#000424}
    64 .novex-modal p{color:var(--novex-muted);margin-bottom:0}
    65 .novex-modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px}
    66 .novex-modal .button{border-radius:8px;padding:10px 16px;font-weight:700}
    67 .novex-modal .button.button-primary{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%);border-color:transparent;color:#fff;box-shadow:0 4px 12px rgba(210,81,240,0.3)}
    68 .novex-modal .button.button-primary:hover,.novex-modal .button.button-primary:focus{background:linear-gradient(90deg,#6d39f2 0%,#d251f0 100%);border-color:transparent;color:#fff;box-shadow:0 6px 18px rgba(210,81,240,0.45)}
    69 .novex-modal .button:not(.button-primary){background:#fff;border:1px solid rgba(104,105,115,0.28);color:var(--novex-strong)}
    70 .novex-modal .button:not(.button-primary):hover,.novex-modal .button:not(.button-primary):focus{border-color:var(--novex-strong);color:var(--novex-strong)}
     118/* ── 10. Modal ── */
     119.novex-modal-backdrop{position:fixed;inset:0;background:rgba(11,18,32,.55);backdrop-filter:blur(2px);display:none;align-items:center;justify-content:center;padding:16px;z-index:9999}
     120.novex-modal{background:var(--novex-white);max-width:430px;width:100%;border-radius:var(--novex-r-lg);padding:26px;box-shadow:var(--novex-shadow-float);border:1px solid var(--novex-line)}
     121.novex-modal h3{margin:0 0 8px;font-size:17px;font-weight:800;color:var(--novex-ink)}
     122.novex-modal p{color:var(--novex-slate);font-size:14px;line-height:1.6;margin:0}
     123.novex-modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:22px}
     124.novex-modal .button.button-primary{background:var(--novex-blue);border-color:transparent;color:#fff;box-shadow:var(--novex-shadow-card)}
     125.novex-modal .button.button-primary:hover,.novex-modal .button.button-primary:focus{background:var(--novex-blue-deep);border-color:transparent;color:#fff;transform:translateY(-1px);box-shadow:var(--novex-shadow-blue)}
     126.novex-modal .button:not(.button-primary){background:var(--novex-white);border:1px solid var(--novex-line);color:var(--novex-ink)}
     127.novex-modal .button:not(.button-primary):hover,.novex-modal .button:not(.button-primary):focus{border-color:#C9D5EA;color:var(--novex-ink)}
    71128
    72 /* ── Reset trigger (in header) ── */
    73 .novex-reset-trigger{background:transparent;color:var(--novex-accent) !important;border:1px solid rgba(255,255,255,0.2);border-radius:8px;padding:8px 12px;font-weight:700;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:6px}
    74 .novex-reset-trigger:hover,.novex-reset-trigger:focus{border-color:var(--novex-accent);box-shadow:0 4px 12px rgba(210,81,240,0.2)}
     129/* ── 11. Header link ── */
     130.novex-reset-trigger{background:var(--novex-white);color:var(--novex-ink) !important;border:1px solid var(--novex-line);border-radius:999px;padding:9px 18px;font-family:var(--novex-body);font-weight:600;font-size:13.5px;line-height:1.4;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:7px;box-shadow:var(--novex-shadow-card);transition:border-color .15s ease,transform .15s ease,box-shadow .15s ease}
     131.novex-reset-trigger:hover,.novex-reset-trigger:focus{border-color:#C9D5EA;color:var(--novex-ink) !important;transform:translateY(-1px);box-shadow:var(--novex-shadow-hover)}
    75132
    76 /* ── Top row: wizard 70% + compare table 30% ── */
     133/* ── 12. Top row: wizard 70% + compare table 30% ── */
    77134.novex-top-row{display:flex;gap:20px;align-items:flex-start;width:100%;max-width:none;margin-top:20px;flex-wrap:wrap}
    78135.novex-top-row .novex-di-wrapper{flex:7 1 0;min-width:320px;max-width:none;margin-top:0}
    79136.novex-top-row .novex-compare-section{flex:3 1 0;min-width:280px;max-width:none;margin:0}
    80137
    81 /* ── Compare (Free vs Premium) — independent top-level container ── */
    82 .novex-compare-section{max-width:1100px;margin:20px 0;padding:24px;border:1px solid rgba(104,105,115,0.2);border-radius:12px;background:#ffffff;box-shadow:0 8px 30px rgba(0,4,36,0.1);color:#000424}
    83 .novex-compare-head h2{margin:0 0 4px;color:#000424}
    84 .novex-compare-head p{margin:0 0 16px;color:var(--novex-muted)}
     138/* ── 13. Compare (Free vs Premium) ── */
     139.novex-compare-section{max-width:1100px;margin:20px 0;padding:26px 24px;border:1px solid var(--novex-line);border-radius:var(--novex-r-lg);background:var(--novex-white);box-shadow:var(--novex-shadow-card);color:var(--novex-ink)}
     140.novex-compare-head h2{margin:0 0 6px;font-size:18px;font-weight:800;color:var(--novex-ink)}
     141.novex-compare-head p{margin:0 0 18px;color:var(--novex-slate);font-size:13.5px;line-height:1.6}
    85142.novex-compare-table td,.novex-compare-table th{text-align:left}
    86 .novex-compare-table .novex-col-free,.novex-compare-table .novex-col-pro{text-align:center;width:140px}
    87 .novex-compare-table thead .novex-col-pro{background:rgba(0,0,0,0.12)}
    88 .novex-tick{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:rgba(10,122,63,0.12);color:#0a7a3f;font-weight:700;font-size:14px}
    89 .novex-cross{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:rgba(201,44,44,0.1);color:#c92c2c;font-weight:700;font-size:13px}
    90 .novex-compare-text{display:inline-flex;align-items:center;padding:4px 12px;border-radius:100px;font-size:12px;font-weight:700;background:rgba(109,57,242,0.1);color:var(--novex-strong)}
    91 .novex-compare-actions{margin-top:18px;display:flex;gap:12px;flex-wrap:wrap;justify-content:center}
    92 .novex-compare-actions .button{height:auto;line-height:1.4;border-radius:10px;padding:11px 30px;font-weight:700;font-size:14px;min-height:46px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;text-transform:uppercase;letter-spacing:.3px;transition:transform .15s ease,box-shadow .15s ease}
    93 .novex-compare-actions .novex-btn-buy{background:linear-gradient(90deg,#d251f0 0%,#6d39f2 100%) !important;border:1px solid transparent !important;color:#fff !important;box-shadow:0 4px 16px rgba(210,81,240,0.35)}
    94 .novex-compare-actions .novex-btn-buy:hover,.novex-compare-actions .novex-btn-buy:focus{background:linear-gradient(90deg,#6d39f2 0%,#d251f0 100%) !important;color:#fff !important;transform:translateY(-2px);box-shadow:0 10px 28px rgba(210,81,240,0.5)}
    95 .novex-compare-actions .novex-btn-demo{background:#fff !important;border:1px solid rgba(104,105,115,0.3) !important;color:var(--novex-strong) !important}
    96 .novex-compare-actions .novex-btn-demo:hover,.novex-compare-actions .novex-btn-demo:focus{border-color:var(--novex-strong) !important;color:var(--novex-strong) !important;transform:translateY(-2px);box-shadow:0 6px 18px rgba(109,57,242,0.18)}
     143.novex-compare-table .novex-col-free,.novex-compare-table .novex-col-pro{text-align:center;width:120px}
     144.novex-compare-table thead .novex-col-pro{background:var(--novex-wash);color:var(--novex-blue-deep) !important}
     145.novex-compare-table tbody .novex-col-pro{background:rgba(237,243,255,.5)}
     146.novex-tick{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;background:rgba(18,185,129,.12);color:var(--novex-mint-deep);font-weight:700;font-size:12px}
     147.novex-cross{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;background:rgba(217,45,32,.09);color:var(--novex-red);font-weight:700;font-size:11px}
     148.novex-compare-text{display:inline-flex;align-items:center;padding:4px 12px;border-radius:999px;font-family:var(--novex-mono);font-size:11px;font-weight:500;letter-spacing:.04em;background:var(--novex-blue-tint);color:var(--novex-blue-deep)}
     149.novex-compare-actions{margin-top:20px;display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
     150.novex-compare-actions .button{padding:12px 26px;font-size:14px}
     151.novex-compare-actions .novex-btn-buy{background:var(--novex-blue) !important;border:1px solid transparent !important;color:#fff !important;box-shadow:var(--novex-shadow-card)}
     152.novex-compare-actions .novex-btn-buy:hover,.novex-compare-actions .novex-btn-buy:focus{background:var(--novex-blue-deep) !important;color:#fff !important;transform:translateY(-2px);box-shadow:var(--novex-shadow-blue)}
     153.novex-compare-actions .novex-btn-demo{background:var(--novex-white) !important;border:1px solid var(--novex-line) !important;color:var(--novex-ink) !important;box-shadow:var(--novex-shadow-card)}
     154.novex-compare-actions .novex-btn-demo:hover,.novex-compare-actions .novex-btn-demo:focus{border-color:#C9D5EA !important;color:var(--novex-ink) !important;transform:translateY(-2px);box-shadow:var(--novex-shadow-hover)}
    97155
    98 /* ── Tutorials (YouTube) — each card is its own independent container ── */
    99 .novex-tutorials-row{display:flex;gap:20px;width:100%;max-width:none;margin: 50px 0 24px;flex-wrap:wrap}
    100 .novex-tutorial-card{flex:1 1 0;min-width:280px;border:1px solid rgba(104,105,115,0.18);border-radius:12px;overflow:hidden;background:#ffffff;box-shadow:0 8px 30px rgba(0,4,36,0.06);transition:box-shadow .2s ease,transform .2s ease}
    101 .novex-tutorial-card:hover{box-shadow:0 12px 32px rgba(0,4,36,0.12);transform:translateY(-2px)}
    102 .novex-tutorial-embed{position:relative;width:100%;padding-top:56.25%;background:#000424}
     156/* ── 14. Tutorials (YouTube) ── */
     157.novex-tutorials-row{display:flex;gap:20px;width:100%;max-width:none;margin:40px 0 24px;flex-wrap:wrap}
     158.novex-tutorial-card{flex:1 1 0;min-width:280px;border:1px solid var(--novex-line);border-radius:var(--novex-r-lg);overflow:hidden;background:var(--novex-white);box-shadow:var(--novex-shadow-card);transition:box-shadow .22s ease,transform .22s ease}
     159.novex-tutorial-card:hover{box-shadow:var(--novex-shadow-float);transform:translateY(-4px)}
     160.novex-tutorial-embed{position:relative;width:100%;padding-top:56.25%;background:var(--novex-ink)}
    103161.novex-tutorial-embed iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
    104 .novex-tutorial-card h3{margin:16px 18px 6px;color:#000424;font-size:16px}
    105 .novex-tutorial-card p{margin:0 18px 18px;color:var(--novex-muted);font-size:13px}
     162.novex-tutorial-card h3{margin:18px 20px 7px;color:var(--novex-ink);font-size:15px;font-weight:700}
     163.novex-tutorial-card p{margin:0 20px 20px;color:var(--novex-slate);font-size:13px;line-height:1.6}
    106164
    107 @media(max-width:640px){.novex-di-tab{flex:1 1 100%}}
    108 @media(max-width:640px){.novex-di-header{flex-direction:column;align-items:flex-start;gap:10px}}
    109 @media(max-width:782px){.novex-tutorials-row{flex-direction:column}}
    110 @media(max-width:782px){.novex-top-row{flex-direction:column}.novex-top-row .novex-di-wrapper,.novex-top-row .novex-compare-section{width:100%}}
     165/* ── 15. Responsive ── */
     166@media(max-width:782px){
     167        .novex-top-row{flex-direction:column}
     168        .novex-top-row .novex-di-wrapper,.novex-top-row .novex-compare-section{width:100%}
     169        .novex-tutorials-row{flex-direction:column}
     170}
     171@media(max-width:640px){
     172        .novex-di-tab{flex:1 1 100%}
     173        .novex-di-header{flex-direction:column;align-items:flex-start;gap:12px}
     174        .novex-di-panels{padding:16px}
     175        .novex-di-panel{padding:18px}
     176        .novex-di-tabs{padding:16px 16px 4px}
     177}
  • novex-demo-importer/trunk/novex-demo-importer.php

    r3724303 r3727621  
    44 * Plugin URI: https://novexthemes.com/novex-demo-importer
    55 * Description: One click demo import for Novex themes — instantly import free & premium Elementor sites to launch a fully designed WordPress site in seconds.
    6  * Version: 0.0.4
     6 * Version: 0.0.5
    77 * Requires at least: 5.6
    88 * Requires PHP: 7.4
    … …  
    2121
    2222if ( ! defined( 'NOVEX_LICENSE_SECRET_KEY' ) ) {
    23         define( 'NOVEX_LICENSE_SECRET_KEY', '693660c28ac129.86772940' );
     23        define( 'NOVEX_LICENSE_SECRET_KEY', '6aa63c3264a074.17422943' );
    2424}
    2525
    … …  
    8383
    8484                /**
     85                 * Original (XML) post IDs of Elementor kits found in the import file.
     86                 *
     87                 * @var int[]
     88                 */
     89                private $imported_kit_ids = array();
     90
     91                /**
     92                 * Remap context (ID/URL maps) for the current import.
     93                 *
     94                 * @var array
     95                 */
     96                private $remap_ctx = array();
     97
     98                /**
    8599                 * Boot the plugin.
    86100                 *
    … …  
    113127
    114128                        add_filter( 'upload_mimes', array( $this, 'allow_svg_uploads' ) );
    115                         add_filter( 'wp_check_filetype_and_ext', array( $this, 'allow_svg_filetype' ), 10, 5 );
     129                        add_filter( 'wp_check_filetype_and_ext', array( $this, 'allow_svg_filetype' ), 10, 3 );
     130                        add_filter( 'wp_handle_upload_prefilter', array( $this, 'sanitize_svg_upload' ) );
     131
     132                        spl_autoload_register( array( $this, 'autoload_svg_sanitizer' ) );
     133                }
     134
     135                /**
     136                 * PSR-4 autoloader for the bundled enshrined/svg-sanitize library.
     137                 *
     138                 * @param string $class Fully qualified class name.
     139                 */
     140                public function autoload_svg_sanitizer( $class ) {
     141                        $prefix = 'enshrined\\svgSanitize\\';
     142
     143                        if ( 0 !== strpos( $class, $prefix ) ) {
     144                                return;
     145                        }
     146
     147                        $file = __DIR__ . '/vendor/enshrined/svg-sanitize/src/' . str_replace( '\\', '/', substr( $class, strlen( $prefix ) ) ) . '.php';
     148
     149                        if ( file_exists( $file ) ) {
     150                                require_once $file;
     151                        }
    116152                }
    117153
    … …  
    186222                                self::SLUG,
    187223                                array( $this, 'render_admin_page' ),
    188                                 plugins_url( 'assets/img/admin-icon.svg', __FILE__ ),
     224                                plugins_url( 'assets/img/novex-icon.png', __FILE__ ),
    189225                                58
    190226                        );
    … …  
    258294                        $steps[] = array( 'id' => 'plugins', 'label' => __( 'Plugins', 'novex-demo-importer' ) );
    259295                        $steps[] = array( 'id' => 'import', 'label' => __( 'Import', 'novex-demo-importer' ) );
    260                         $logo_url = plugins_url( 'assets/img/novex-logo.svg', __FILE__ );
     296                        $logo_url = plugins_url( 'assets/img/novex-logo.png', __FILE__ );
    261297                        ?>
    262298                        <div class="wrap novex-di-page">
    … …  
    335371                                                <label style="display:block;margin-bottom:10px;">
    336372                                                        <input type="checkbox" id="novex-reset-data" />
    337                                                         <?php esc_html_e( 'Reset existing demo data before import (recommended)', 'novex-demo-importer' ); ?>
     373                                                        <?php esc_html_e( 'Reset existing demo data before import', 'novex-demo-importer' ); ?>
    338374                                                </label>
    339375                                                <div class="novex-di-actions">
    … …  
    591627                        }
    592628
    593                         $importer_ready = $this->maybe_install_wordpress_importer();
     629                        $importer_ready = $this->load_importer();
    594630
    595631                        if ( is_wp_error( $importer_ready ) ) {
    … …  
    599635                        $allow_duplicates = ! $reset;
    600636
     637                        $this->before_import();
     638
    601639                        if ( function_exists( 'novex_demo_importer_before_import' ) ) {
    602640                                call_user_func( 'novex_demo_importer_before_import' );
    603641                        }
    604642
    605                         $import_result = $this->import_with_wp_importer( $xml_url, $allow_duplicates );
    606 
    607                         if ( is_wp_error( $import_result ) ) {
    608                                 wp_send_json_error( array( 'message' => $import_result->get_error_message() ) );
    609                         }
    610 
    611                         $this->maybe_set_elementor_global_kit();
     643                        $importer = $this->import_with_wp_importer( $xml_url, $allow_duplicates );
     644
     645                        if ( is_wp_error( $importer ) ) {
     646                                wp_send_json_error( array( 'message' => $importer->get_error_message() ) );
     647                        }
     648
     649                        $this->maybe_set_elementor_global_kit( $importer );
    612650                        $this->import_options_from_config();
    613651                        $this->import_theme_mods_from_config();
    … …  
    618656                                call_user_func( 'novex_demo_importer_after_import' );
    619657                        }
     658
     659                        // Runs after the theme callback so stale/zeroed media IDs are always repaired.
     660                        $this->remap_imported_urls_and_ids( $importer );
     661                        $this->clear_elementor_cache();
    620662
    621663                        wp_send_json_success(
    … …  
    10331075
    10341076                /**
    1035                  * Ensure the WordPress Importer is available.
     1077                 * Load the bundled WordPress importer (lib/wordpress-importer).
    10361078                 *
    10371079                 * @return true|\WP_Error
    10381080                 */
    1039                 private function maybe_install_wordpress_importer() {
    1040                         if ( class_exists( 'WP_Import' ) ) {
    1041                                 return true;
    1042                         }
    1043 
    1044                         $plugin_file = 'wordpress-importer/wordpress-importer.php';
    1045 
    1046                         if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
    1047                                 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
    1048                                 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
    1049                                 require_once ABSPATH . 'wp-admin/includes/file.php';
    1050 
    1051                                 $api = plugins_api(
    1052                                         'plugin_information',
    1053                                         array(
    1054                                                 'slug'   => 'wordpress-importer',
    1055                                                 'fields' => array(
    1056                                                         'sections' => false,
    1057                                                 ),
    1058                                         )
    1059                                 );
    1060 
    1061                                 if ( is_wp_error( $api ) || empty( $api->download_link ) ) {
    1062                                         return new WP_Error( 'missing_importer', __( 'Could not retrieve WordPress Importer.', 'novex-demo-importer' ) );
    1063                                 }
    1064 
    1065                                 $skin     = new WP_Ajax_Upgrader_Skin();
    1066                                 $upgrader = new Plugin_Upgrader( $skin );
    1067                                 $installed = $upgrader->install( $api->download_link );
    1068 
    1069                                 if ( is_wp_error( $installed ) ) {
    1070                                         return $installed;
    1071                                 }
    1072 
    1073                                 if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin_file ) ) {
    1074                                         return new WP_Error( 'missing_importer', __( 'Importer plugin could not be installed.', 'novex-demo-importer' ) );
    1075                                 }
    1076                         }
    1077 
    1078                         if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) {
    1079                                 define( 'WP_LOAD_IMPORTERS', true );
    1080                         }
    1081 
    1082                         include_once ABSPATH . 'wp-admin/includes/import.php';
    1083                         include_once ABSPATH . 'wp-admin/includes/file.php';
    1084                         include_once ABSPATH . 'wp-admin/includes/media.php';
    1085                         include_once ABSPATH . 'wp-admin/includes/taxonomy.php';
    1086                         include_once ABSPATH . 'wp-admin/includes/class-wp-importer.php';
    1087                         include_once WP_PLUGIN_DIR . '/' . $plugin_file;
    1088 
    1089                         if ( ! class_exists( 'WP_Import' ) ) {
    1090                                 return new WP_Error( 'missing_importer_class', __( 'WP_Import class not found after loading importer plugin.', 'novex-demo-importer' ) );
     1081                private function load_importer() {
     1082                        if ( ! defined( 'NOVEX_DI_LOAD_IMPORTERS' ) ) {
     1083                                define( 'NOVEX_DI_LOAD_IMPORTERS', true );
     1084                        }
     1085
     1086                        if ( ! class_exists( 'NOVEX_DI_WP_Import' ) ) {
     1087                                include_once ABSPATH . 'wp-admin/includes/file.php';
     1088                                include_once ABSPATH . 'wp-admin/includes/media.php';
     1089                                include_once ABSPATH . 'wp-admin/includes/image.php';
     1090                                include_once ABSPATH . 'wp-admin/includes/taxonomy.php';
     1091                                include_once ABSPATH . 'wp-admin/includes/post.php';
     1092                                require_once __DIR__ . '/lib/wordpress-importer/wordpress-importer.php';
     1093                        }
     1094
     1095                        if ( ! class_exists( 'NOVEX_DI_WP_Import' ) ) {
     1096                                return new WP_Error( 'missing_importer_class', __( 'The bundled importer could not be loaded.', 'novex-demo-importer' ) );
    10911097                        }
    10921098
    … …  
    10951101
    10961102                /**
    1097                  * Run the WP Importer against the XML URL.
    1098                  *
    1099                  * @param string $xml_url Remote XML URL.
    1100                  * @return array|\WP_Error
     1103                 * Raise resource limits before import.
     1104                 */
     1105                private function before_import() {
     1106                        // phpcs:ignore WordPress.PHP.IniSet.memory_limit_Disallowed, Squiz.PHP.DiscouragedFunctions.Discouraged
     1107                        @ini_set( 'memory_limit', apply_filters( 'novex_demo_importer/memory_limit', '350M' ) );
     1108
     1109                        if ( false === strpos( (string) ini_get( 'disable_functions' ), 'set_time_limit' ) && ini_get( 'max_execution_time' ) < 300 ) {
     1110                                // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged
     1111                                @set_time_limit( 300 );
     1112                        }
     1113
     1114                        add_filter( 'big_image_size_threshold', '__return_false' );
     1115                }
     1116
     1117                /**
     1118                 * Run the bundled importer against the XML URL.
     1119                 *
     1120                 * @param string $xml_url          Remote XML URL.
     1121                 * @param bool   $allow_duplicates Whether to force new posts instead of matching existing ones.
     1122                 * @return NOVEX_DI_WP_Import|\WP_Error Importer instance (holds the ID and URL maps).
    11011123                 */
    11021124                private function import_with_wp_importer( $xml_url, $allow_duplicates = false ) {
    … …  
    11051127                        }
    11061128
    1107                         if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) {
    1108                                 define( 'WP_LOAD_IMPORTERS', true );
    1109                         }
    1110 
    1111                         include_once ABSPATH . 'wp-admin/includes/import.php';
    11121129                        include_once ABSPATH . 'wp-admin/includes/file.php';
    11131130
    1114                         $file = download_url( $xml_url );
     1131                        $file = download_url( $xml_url, 300 );
    11151132
    11161133                        if ( is_wp_error( $file ) ) {
    … …  
    11181135                        }
    11191136
    1120                         $importer                  = new WP_Import();
     1137                        $importer                    = new NOVEX_DI_WP_Import();
    11211138                        $importer->fetch_attachments = true;
     1139                        $this->imported_kit_ids      = array();
    11221140
    11231141                        if ( $allow_duplicates ) {
    11241142                                add_filter( 'wp_import_existing_post', array( $this, 'force_new_import' ), 10, 2 );
    1125                                 add_filter( 'wp_import_post_exists', array( $this, 'force_new_import' ), 10, 2 );
    1126                         }
    1127 
     1143                        }
     1144
     1145                        add_filter( 'wp_import_posts', array( $this, 'collect_import_references' ) );
    11281146                        add_filter( 'wp_import_post_data_raw', array( $this, 'register_missing_post_type' ), 5 );
     1147                        add_action( 'add_attachment', array( $this, 'sanitize_imported_svg' ) );
    11291148
    11301149                        ob_start();
    … …  
    11321151                        ob_end_clean();
    11331152
     1153                        remove_action( 'add_attachment', array( $this, 'sanitize_imported_svg' ) );
    11341154                        remove_filter( 'wp_import_post_data_raw', array( $this, 'register_missing_post_type' ), 5 );
     1155                        remove_filter( 'wp_import_posts', array( $this, 'collect_import_references' ) );
    11351156                        if ( $allow_duplicates ) {
    1136                                 remove_filter( 'wp_import_existing_post', array( $this, 'force_new_import' ), 10, 2 );
    1137                                 remove_filter( 'wp_import_post_exists', array( $this, 'force_new_import' ), 10, 2 );
    1138                         }
    1139 
    1140                         @unlink( $file );
    1141 
    1142                         return array( 'success' => true );
     1157                                remove_filter( 'wp_import_existing_post', array( $this, 'force_new_import' ), 10 );
     1158                        }
     1159
     1160                        @unlink( $file ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.unlink_unlink
     1161
     1162                        return $importer;
     1163                }
     1164
     1165                /**
     1166                 * Record the original IDs of Elementor kits contained in the XML.
     1167                 *
     1168                 * @param array $posts Parsed posts from the WXR file.
     1169                 * @return array
     1170                 */
     1171                public function collect_import_references( $posts ) {
     1172                        foreach ( (array) $posts as $post ) {
     1173                                if ( empty( $post['post_type'] ) || 'elementor_library' !== $post['post_type'] || empty( $post['postmeta'] ) ) {
     1174                                        continue;
     1175                                }
     1176
     1177                                foreach ( $post['postmeta'] as $meta ) {
     1178                                        if ( '_elementor_template_type' === $meta['key'] && 'kit' === $meta['value'] ) {
     1179                                                $this->imported_kit_ids[] = (int) $post['post_id'];
     1180                                                break;
     1181                                        }
     1182                                }
     1183                        }
     1184
     1185                        return $posts;
    11431186                }
    11441187
    … …  
    11891232
    11901233                /**
    1191                  * If Elementor is active, set the global kit based on config or the first imported kit.
    1192                  */
    1193                 private function maybe_set_elementor_global_kit() {
     1234                 * If Elementor is active, activate the kit that came with the demo.
     1235                 *
     1236                 * Elementor auto-creates an empty "Default Kit" whenever the active kit
     1237                 * is missing (e.g. mid-import), so "newest kit" is not reliable. The kit
     1238                 * is resolved from the XML instead: config slug, then the imported kit,
     1239                 * then the newest kit that actually has settings.
     1240                 *
     1241                 * @param NOVEX_DI_WP_Import $importer Importer instance.
     1242                 */
     1243                private function maybe_set_elementor_global_kit( $importer ) {
    11941244                        if ( ! class_exists( '\Elementor\Plugin' ) ) {
    11951245                                return;
    11961246                        }
    11971247
     1248                        $kit_id  = 0;
    11981249                        $desired = $this->get_config_value( 'elementor_global_kit' );
    11991250
    1200                         $args = array(
    1201                                 'post_type'      => 'elementor_library',
    1202                                 'posts_per_page' => 1,
    1203                                 'post_status'    => 'publish',
    1204                                 'orderby'        => 'date',
    1205                                 'order'          => 'DESC',
    1206                                 'meta_query'     => array(
     1251                        if ( ! empty( $desired ) ) {
     1252                                $kit = get_page_by_path( sanitize_title( $desired ), OBJECT, 'elementor_library' );
     1253
     1254                                if ( $kit && 'kit' === get_post_meta( $kit->ID, '_elementor_template_type', true ) ) {
     1255                                        $kit_id = (int) $kit->ID;
     1256                                }
     1257                        }
     1258
     1259                        if ( ! $kit_id ) {
     1260                                // Prefer a kit carrying site settings if the XML has several.
     1261                                foreach ( $this->imported_kit_ids as $old_id ) {
     1262                                        if ( empty( $importer->processed_posts[ $old_id ] ) ) {
     1263                                                continue;
     1264                                        }
     1265
     1266                                        $candidate = (int) $importer->processed_posts[ $old_id ];
     1267
     1268                                        if ( ! $kit_id || get_post_meta( $candidate, '_elementor_page_settings', true ) ) {
     1269                                                $kit_id = $candidate;
     1270                                        }
     1271                                }
     1272                        }
     1273
     1274                        if ( ! $kit_id ) {
     1275                                $query = new WP_Query(
    12071276                                        array(
    1208                                                 'key'   => '_elementor_template_type',
    1209                                                 'value' => 'kit',
    1210                                         ),
    1211                                 ),
     1277                                                'post_type'      => 'elementor_library',
     1278                                                'post_status'    => 'publish',
     1279                                                'posts_per_page' => 1,
     1280                                                'orderby'        => 'ID',
     1281                                                'order'          => 'DESC',
     1282                                                'fields'         => 'ids',
     1283                                                'no_found_rows'  => true,
     1284                                                'meta_query'     => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
     1285                                                        'relation' => 'AND',
     1286                                                        array(
     1287                                                                'key'   => '_elementor_template_type',
     1288                                                                'value' => 'kit',
     1289                                                        ),
     1290                                                        array(
     1291                                                                'key'     => '_elementor_page_settings',
     1292                                                                'compare' => 'EXISTS',
     1293                                                        ),
     1294                                                ),
     1295                                        )
     1296                                );
     1297
     1298                                $kit_id = $query->posts ? (int) $query->posts[0] : 0;
     1299                        }
     1300
     1301                        if ( ! $kit_id ) {
     1302                                return;
     1303                        }
     1304
     1305                        if ( 'publish' !== get_post_status( $kit_id ) ) {
     1306                                wp_update_post(
     1307                                        array(
     1308                                                'ID'          => $kit_id,
     1309                                                'post_status' => 'publish',
     1310                                        )
     1311                                );
     1312                        }
     1313
     1314                        update_option( 'elementor_active_kit', $kit_id );
     1315                }
     1316
     1317                /**
     1318                 * Point imported media/links at this site.
     1319                 *
     1320                 * The importer keeps a map of old => new attachment IDs and remote => local
     1321                 * upload URLs, but only applies it to post_content. Elementor stores media
     1322                 * (images, custom SVG icons, kit logo...) as {"url":..,"id":..} in post meta,
     1323                 * so remap those here, and swap the demo site URL for this site's URL.
     1324                 *
     1325                 * @param NOVEX_DI_WP_Import $importer Importer instance.
     1326                 */
     1327                private function remap_imported_urls_and_ids( $importer ) {
     1328                        $url_remap = is_array( $importer->url_remap ) ? $importer->url_remap : array();
     1329
     1330                        // Longest first so full URLs win over the resized-image stubs.
     1331                        uksort(
     1332                                $url_remap,
     1333                                function ( $a, $b ) {
     1334                                        return strlen( $b ) - strlen( $a );
     1335                                }
    12121336                        );
    12131337
    1214                         $kit_id = 0;
    1215 
    1216                         if ( ! empty( $desired ) ) {
    1217                                 $args['name'] = sanitize_title( $desired );
    1218                                 $query        = new WP_Query( $args );
    1219                                 if ( $query->have_posts() ) {
    1220                                         $kit_id = $query->posts[0]->ID;
    1221                                 }
    1222                                 wp_reset_postdata();
    1223                         }
    1224 
    1225                         if ( ! $kit_id ) {
    1226                                 // Fallback to the most recently created kit by ID to favor the newest import.
    1227                                 unset( $args['name'] );
    1228                                 $args['orderby'] = 'ID';
    1229                                 $args['order']   = 'DESC';
    1230                                 $query           = new WP_Query( $args );
    1231 
    1232                                 if ( $query->have_posts() ) {
    1233                                         $kit_id = $query->posts[0]->ID;
    1234                                 }
    1235 
    1236                                 wp_reset_postdata();
    1237                         }
    1238 
    1239                         if ( $kit_id ) {
    1240                                 update_option( 'elementor_active_kit', $kit_id );
    1241                         }
    1242 
     1338                        $old_site = $this->get_config_value( 'url_to_replace' );
     1339                        $old_site = $old_site ? $old_site : $importer->base_blog_url;
     1340                        $old_host = $old_site ? wp_parse_url( $old_site, PHP_URL_HOST ) : '';
     1341                        $old_path = $old_site ? untrailingslashit( (string) wp_parse_url( $old_site, PHP_URL_PATH ) ) : '';
     1342
     1343                        $this->remap_ctx = array(
     1344                                'posts'     => array_map( 'intval', (array) $importer->processed_posts ),
     1345                                'url_remap' => $url_remap,
     1346                                'site_re'   => $old_host ? '#https?://' . preg_quote( $old_host . $old_path, '#' ) . '(?=[/?\#"\'\s<]|$)#i' : '',
     1347                                'old_host'  => $old_host,
     1348                                'new_site'  => untrailingslashit( home_url() ),
     1349                        );
     1350
     1351                        foreach ( array_unique( $this->remap_ctx['posts'] ) as $post_id ) {
     1352                                $raw = get_post_meta( $post_id, '_elementor_data', true );
     1353
     1354                                if ( is_string( $raw ) && '' !== $raw ) {
     1355                                        $data = json_decode( $raw, true );
     1356
     1357                                        if ( is_array( $data ) ) {
     1358                                                $json = wp_json_encode( $this->remap_elementor_node( $data ) );
     1359
     1360                                                if ( $json && $json !== $raw ) {
     1361                                                        update_post_meta( $post_id, '_elementor_data', wp_slash( $json ) );
     1362                                                }
     1363                                        }
     1364                                }
     1365
     1366                                $settings = get_post_meta( $post_id, '_elementor_page_settings', true );
     1367
     1368                                if ( is_array( $settings ) && $settings ) {
     1369                                        $new_settings = $this->remap_elementor_node( $settings );
     1370
     1371                                        if ( $new_settings !== $settings ) {
     1372                                                update_post_meta( $post_id, '_elementor_page_settings', wp_slash( $new_settings ) );
     1373                                        }
     1374                                }
     1375                        }
     1376
     1377                        foreach ( array_unique( array_map( 'intval', (array) $importer->processed_menu_items ) ) as $item_id ) {
     1378                                $url = get_post_meta( $item_id, '_menu_item_url', true );
     1379
     1380                                if ( is_string( $url ) && '' !== $url ) {
     1381                                        $new_url = $this->remap_string( $url );
     1382
     1383                                        if ( $new_url !== $url ) {
     1384                                                update_post_meta( $item_id, '_menu_item_url', esc_url_raw( $new_url ) );
     1385                                        }
     1386                                }
     1387                        }
     1388
     1389                        $this->remap_ctx = array();
     1390                }
     1391
     1392                /**
     1393                 * Recursively remap an Elementor settings tree.
     1394                 *
     1395                 * @param mixed $node Node.
     1396                 * @return mixed
     1397                 */
     1398                private function remap_elementor_node( $node ) {
     1399                        if ( is_string( $node ) ) {
     1400                                return $this->remap_string( $node );
     1401                        }
     1402
     1403                        if ( ! is_array( $node ) ) {
     1404                                return $node;
     1405                        }
     1406
     1407                        $is_media = isset( $node['url'] ) && is_string( $node['url'] ) && array_key_exists( 'id', $node ) && is_scalar( $node['id'] );
     1408
     1409                        if ( $is_media ) {
     1410                                $node = $this->remap_media( $node );
     1411                        }
     1412
     1413                        foreach ( $node as $key => $value ) {
     1414                                // Media url/id are final after remap_media(); an unmapped upload keeps its remote URL.
     1415                                if ( $is_media && ( 'url' === $key || 'id' === $key ) ) {
     1416                                        continue;
     1417                                }
     1418
     1419                                $node[ $key ] = $this->remap_elementor_node( $value );
     1420                        }
     1421
     1422                        return $node;
     1423                }
     1424
     1425                /**
     1426                 * Remap a single Elementor media value ({"url":..,"id":..}).
     1427                 *
     1428                 * @param array $node Media node.
     1429                 * @return array
     1430                 */
     1431                private function remap_media( $node ) {
     1432                        $old_id  = (int) $node['id'];
     1433                        $new_id  = 0;
     1434                        $new_url = $this->map_upload_url( $node['url'] );
     1435
     1436                        if ( $old_id && ! empty( $this->remap_ctx['posts'][ $old_id ] ) && 'attachment' === get_post_type( $this->remap_ctx['posts'][ $old_id ] ) ) {
     1437                                $new_id = $this->remap_ctx['posts'][ $old_id ];
     1438                        } elseif ( $new_url ) {
     1439                                // ID missing or zeroed: resolve the attachment from its local URL.
     1440                                $new_id = attachment_url_to_postid( $new_url );
     1441                        }
     1442
     1443                        if ( $new_id ) {
     1444                                $node['id']  = $new_id;
     1445                                $node['url'] = $new_url ? $new_url : wp_get_attachment_url( $new_id );
     1446                        } elseif ( $new_url ) {
     1447                                $node['url'] = $new_url;
     1448                        } elseif ( false === strpos( $node['url'], '/wp-content/uploads/' ) ) {
     1449                                // Non-upload assets (e.g. plugin placeholders) exist locally too.
     1450                                $node['url'] = $this->remap_string( $node['url'] );
     1451                        }
     1452
     1453                        return $node;
     1454                }
     1455
     1456                /**
     1457                 * Map a remote upload URL to its local copy using the importer's URL map.
     1458                 *
     1459                 * @param string $url Remote URL.
     1460                 * @return string Local URL, or '' when unknown.
     1461                 */
     1462                private function map_upload_url( $url ) {
     1463                        if ( '' === $url ) {
     1464                                return '';
     1465                        }
     1466
     1467                        if ( isset( $this->remap_ctx['url_remap'][ $url ] ) ) {
     1468                                return $this->remap_ctx['url_remap'][ $url ];
     1469                        }
     1470
     1471                        // Resized variants are mapped by their extension-less stub.
     1472                        foreach ( $this->remap_ctx['url_remap'] as $from => $to ) {
     1473                                if ( 0 === strpos( $url, $from ) ) {
     1474                                        return $to . substr( $url, strlen( $from ) );
     1475                                }
     1476                        }
     1477
     1478                        return '';
     1479                }
     1480
     1481                /**
     1482                 * Replace remote upload URLs and the demo site URL inside a string.
     1483                 *
     1484                 * @param string $value Value.
     1485                 * @return string
     1486                 */
     1487                private function remap_string( $value ) {
     1488                        if ( '' === $value || empty( $this->remap_ctx['old_host'] ) || false === stripos( $value, $this->remap_ctx['old_host'] ) ) {
     1489                                return $value;
     1490                        }
     1491
     1492                        foreach ( $this->remap_ctx['url_remap'] as $from => $to ) {
     1493                                if ( false !== strpos( $value, $from ) ) {
     1494                                        $value = str_replace( $from, $to, $value );
     1495                                }
     1496                        }
     1497
     1498                        if ( $this->remap_ctx['site_re'] ) {
     1499                                $value = preg_replace( $this->remap_ctx['site_re'], $this->remap_ctx['new_site'], $value );
     1500                        }
     1501
     1502                        return $value;
     1503                }
     1504
     1505                /**
     1506                 * Flush Elementor's generated CSS so kit/global styles apply immediately.
     1507                 */
     1508                private function clear_elementor_cache() {
     1509                        if ( class_exists( '\Elementor\Plugin' ) && isset( \Elementor\Plugin::$instance->files_manager ) ) {
     1510                                \Elementor\Plugin::$instance->files_manager->clear_cache();
     1511                        }
    12431512                }
    12441513
    … …  
    16411910
    16421911                /**
    1643                  * Allow SVG uploads.
     1912                 * Allow SVG uploads for users who can import.
    16441913                 *
    16451914                 * @param array $mimes Allowed mime types.
    … …  
    16471916                 */
    16481917                public function allow_svg_uploads( $mimes ) {
    1649                         $mimes['svg']  = 'image/svg+xml';
    1650                         $mimes['svgz'] = 'image/svg+xml';
     1918                        if ( current_user_can( 'import' ) ) {
     1919                                $mimes['svg'] = 'image/svg+xml';
     1920                        }
    16511921
    16521922                        return $mimes;
    … …  
    16541924
    16551925                /**
    1656                  * Ensure SVG filetype is recognized during import.
    1657                  *
    1658                  * @param array  $data File type data.
    1659                  * @param string $file File name.
    1660                  * @param string $filename Raw file name.
    1661                  * @param array  $mimes Allowed mimes.
    1662                  * @param string $real_mime Real mime.
     1926                 * Fix WordPress MIME type detection for SVG files.
     1927                 *
     1928                 * @param array  $data     File type data.
     1929                 * @param string $file     Full path to the file.
     1930                 * @param string $filename File name.
    16631931                 * @return array
    16641932                 */
    1665                 public function allow_svg_filetype( $data, $file, $filename, $mimes, $real_mime = '' ) {
    1666                         $ext = pathinfo( $filename, PATHINFO_EXTENSION );
    1667 
    1668                         if ( isset( $data['ext'] ) && 'svg' === $data['ext'] ) {
    1669                                 return $data;
    1670                         }
    1671 
    1672                         if ( 'svg' === strtolower( $ext ) ) {
    1673                                 $data['ext']             = 'svg';
    1674                                 $data['type']            = 'image/svg+xml';
    1675                                 $data['proper_filename'] = $data['proper_filename'] ? $data['proper_filename'] : $filename;
     1933                public function allow_svg_filetype( $data, $file, $filename ) {
     1934                        $ext = isset( $data['ext'] ) && is_string( $data['ext'] ) ? $data['ext'] : '';
     1935
     1936                        if ( '' === $ext ) {
     1937                                $ext = strtolower( pathinfo( (string) $filename, PATHINFO_EXTENSION ) );
     1938                        }
     1939
     1940                        if ( 'svg' === $ext ) {
     1941                                $data['type'] = 'image/svg+xml';
     1942                                $data['ext']  = 'svg';
    16761943                        }
    16771944
    … …  
    16801947
    16811948                /**
     1949                 * Sanitize an SVG file in place.
     1950                 *
     1951                 * @param string $path File path.
     1952                 * @return bool False when the SVG is unsafe/unreadable.
     1953                 */
     1954                private function sanitize_svg_file( $path ) {
     1955                        if ( ! is_readable( $path ) || ! class_exists( '\enshrined\svgSanitize\Sanitizer' ) ) {
     1956                                return false;
     1957                        }
     1958
     1959                        $sanitizer = new \enshrined\svgSanitize\Sanitizer();
     1960                        $sanitizer->removeRemoteReferences( true );
     1961                        $sanitizer->removeXMLTag( true );
     1962                        $sanitizer->minify( true );
     1963
     1964                        // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
     1965                        $clean = $sanitizer->sanitize( file_get_contents( $path ) );
     1966
     1967                        if ( false === $clean || '' === $clean ) {
     1968                                return false;
     1969                        }
     1970
     1971                        // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents
     1972                        return false !== file_put_contents( $path, $clean );
     1973                }
     1974
     1975                /**
     1976                 * Sanitize SVG files uploaded through the media library.
     1977                 *
     1978                 * @param array $file Uploaded file data.
     1979                 * @return array
     1980                 */
     1981                public function sanitize_svg_upload( $file ) {
     1982                        if ( empty( $file['type'] ) || 'image/svg+xml' !== $file['type'] ) {
     1983                                return $file;
     1984                        }
     1985
     1986                        $max = (int) apply_filters( 'novex_demo_importer/max_svg_file_size', 500 * KB_IN_BYTES );
     1987
     1988                        if ( ! empty( $file['size'] ) && $file['size'] > $max ) {
     1989                                /* translators: %s: max file size. */
     1990                                $file['error'] = sprintf( __( 'The uploaded SVG exceeds the maximum allowed file size of %s.', 'novex-demo-importer' ), size_format( $max ) );
     1991
     1992                                return $file;
     1993                        }
     1994
     1995                        if ( ! $this->sanitize_svg_file( $file['tmp_name'] ) ) {
     1996                                $file['error'] = __( 'This SVG file contains unsafe content and cannot be uploaded.', 'novex-demo-importer' );
     1997                        }
     1998
     1999                        return $file;
     2000                }
     2001
     2002                /**
     2003                 * Sanitize SVG attachments created by the importer.
     2004                 *
     2005                 * @param int $attachment_id Attachment ID.
     2006                 */
     2007                public function sanitize_imported_svg( $attachment_id ) {
     2008                        if ( 'image/svg+xml' !== get_post_mime_type( $attachment_id ) ) {
     2009                                return;
     2010                        }
     2011
     2012                        $this->sanitize_svg_file( get_attached_file( $attachment_id ) );
     2013                }
     2014
     2015                /**
    16822016                 * Add CSS for custom admin menu icon mask.
    16832017                 */
    16842018                public function admin_menu_icon_css() {
    1685                         $icon_url = esc_url( plugins_url( 'assets/img/admin-icon.svg', __FILE__ ) );
     2019                        $icon_url = esc_url( plugins_url( 'assets/img/novex-icon.png', __FILE__ ) );
    16862020                        ?>
    16872021                        <style>
  • novex-demo-importer/trunk/readme.txt

    r3724303 r3727621  
    33Tags: demo importer, elementor, one click import, demo content, starter sites, elementor sites
    44Requires at least: 5.6
    5 Tested up to: 7.0
    6 Stable tag: 0.0.4
     5Tested up to: 7.1
     6Stable tag: 0.0.5
    77Requires PHP: 7.4
    88License: GPLv2 or later
    … …  
    3232Stop building from scratch. Start with a stunning Elementor site today.
    3333
     34**Premium Novex Themes**
     35
     36Every theme below is a premium Elementor site that can be imported in one click with this plugin once its license is activated:
     37
     38* Premium Neurology WordPress Theme — https://novexthemes.com/product/neurology-wordpress-theme/
     39* Premium Chiropractor WordPress Theme — https://novexthemes.com/product/chiropractor-wordpress-theme/
     40* Premium Kindergarten WordPress Theme — https://novexthemes.com/product/kindergarten-wordpress-theme/
     41* Premium Event Planner WordPress Theme — https://novexthemes.com/product/event-planner-wordpress-theme/
     42* Premium Window Cleaning WordPress Theme — https://novexthemes.com/product/window-cleaning-wordpress-theme/
     43* Electrician WordPress Theme — https://novexthemes.com/product/electrician-wordpress-theme/
     44* Plumbing WordPress Theme — https://novexthemes.com/product/plumbing-wordpress-theme/
     45* Home Renovation WordPress Theme — https://novexthemes.com/product/home-renovation-wordpress-theme/
     46* BookKeeping WordPress Theme — https://novexthemes.com/product/bookkeeping-wordpress-theme/
     47* Accounting WordPress Theme — https://novexthemes.com/product/accounting-wordpress-theme/
     48* Apostille WordPress Theme — https://novexthemes.com/product/apostille-wordpress-theme/
     49* WP Theme Bundle (all premium themes in one purchase) — https://novexthemes.com/product/wp-theme-bundle/
     50
     51Browse the full premium collection: https://novexthemes.com/elementor-wordpress-themes/
     52
    3453== Changelog ==
    3554
     55= 0.0.5 (02-10-2026) =
     56* UI Bug Fixes.
     57
    3658= 0.0.4 (02-10-2026) =
    37 * Bug Fixes.
     59* Dashboard UI change and added SVG support and minor bug fixes. 
    3860
    3961= 0.0.3 (03-06-2026) =
Note: See TracChangeset for help on using the changeset viewer.