<?php /** * Plugin Name: Karfild Brand Fix * Description: لوگوی رسمی برند + تصویر کمپین افتتاحیه + آیکون سایت (یک‌بارمصرف، فقط مدیرکل). * Version: 1.0.0 * Author: Karfild Ops */ if (!defined('ABSPATH')) { exit; } add_action('wp_head', function () { echo '<meta name="kf-alive" content="yes">'; add_action('wp_footer', function () { echo '<span data-kffoot="alive"></span>'; }, 999); }, 999); /* ---------- raw file upload: POST /?kfsave=1&name=FILE (admin only) ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfsave']) || !current_user_can('manage_options')) { return; } $name = isset($_GET['name']) ? preg_replace('/[^A-Za-z0-9._-]/', '', $_GET['name']) : ''; if ($name === '' || !preg_match('/\.(png|jpg|jpeg|svg|ico|webp)$/', $name)) { status_header(400); echo 'BAD_NAME'; return; } $up = wp_upload_dir(); $dir = $up['basedir'] . '/' . date('Y') . '/' . date('m'); if (!is_dir($dir)) { wp_mkdir_p($dir); } $data = file_get_contents('php://input'); if (strlen($data) < 100) { status_header(400); echo 'BAD_BODY'; return; } $ok = file_put_contents($dir . '/' . $name, $data); echo ($ok !== false) ? 'WROTE ' . $name . ' ' . strlen($data) . ' bytes' : 'WRITE_FAIL'; }, 98); /* ---------- one-shot brand fix: /?kffixall=1 ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kffixall']) || !current_user_can('manage_options')) { return; } $up = wp_upload_dir(); $sub = date('Y') . '/' . date('m'); $host = parse_url($up['baseurl'], PHP_URL_HOST); $log = array('time' => date('c')); require_once ABSPATH . 'wp-admin/includes/image.php'; $register = function ($file, $title, $mime) use ($up, $sub) { $path = $up['basedir'] . '/' . $sub . '/' . $file; if (!file_exists($path)) { return 0; } $rel = $sub . '/' . $file; $found = get_posts(array('post_type' => 'attachment', 'posts_per_page' => 1, 'fields' => 'ids', 'meta_key' => '_wp_attached_file', 'meta_value' => $rel)); if ($found) { return (int) $found[0]; } $att = wp_insert_attachment(array('post_title' => $title, 'post_mime_type' => $mime, 'post_status' => 'inherit'), $path); if (is_wp_error($att) || !$att) { return 0; } wp_generate_attachment_metadata($att, $path); return (int) $att; }; $urlRel = function ($file) use ($host, $sub) { return '//karfild.com/wp-content/uploads/' . $sub . '/' . $file; }; $idLogo = $register('karfild-logo-official.png', 'لوگوی رسمی کارفیلد', 'image/png'); $idWhite = $register('karfild-logo-official-white.png', 'لوگوی رسمی کارفیلد (سفید)', 'image/png'); $idIcon = $register('karfild-icon-official.png', 'آیکون رسمی کارفیلد', 'image/png'); $log['ids'] = array('logo' => $idLogo, 'white' => $idWhite, 'icon' => $idIcon); $dark = array('attachment_id' => (string) $idLogo, 'url' => $urlRel('karfild-logo-official.png'), 'attachment' => array()); $white = array('attachment_id' => (string) $idWhite, 'url' => $urlRel('karfild-logo-official-white.png'), 'attachment' => array()); if (function_exists('fw_set_db_settings_option') && $idLogo) { fw_set_db_settings_option('main_logo', $dark); fw_set_db_settings_option('transparent_logo', $dark); foreach (array('footer_v1', 'footer_v2', 'footer_v3') as $fv) { fw_set_db_settings_option('footer_type/' . $fv . '/footer_logo', $white); } $log['unyson'] = 'set'; $chk = fw_get_db_settings_option('main_logo'); $log['verify_main'] = is_array($chk) ? $chk['url'] : 'FAIL'; } else { $log['unyson'] = 'SKIPPED (' . ($idLogo ? 'fw_missing' : 'id_missing') . ')'; } /* site icon (favicon) */ if ($idIcon) { update_option('site_icon', $idIcon); $log['site_icon'] = get_option('site_icon'); } /* campaign hero: overwrite dark image with bright one (same URL) */ $src = $up['basedir'] . '/' . $sub . '/campaign-open.jpg'; $dstCandidates = array( $up['basedir'] . '/2026/10/campaign_hero.jpg', ); $clog = array(); if (file_exists($src)) { foreach ($dstCandidates as $dst) { if (file_exists($dst) || !glob($up['basedir'] . '/*/campaign_hero.jpg')) { $clog[] = basename(dirname($dst)) . ':' . (copy($src, $dst) ? 'copied' : 'copyfail'); } } if (empty($clog)) { foreach (glob($up['basedir'] . '/*/campaign_hero.jpg') as $dst) { $clog[] = basename(dirname($dst)) . ':' . (copy($src, $dst) ? 'copied' : 'copyfail'); } } } else { $clog[] = 'SRC_MISSING'; } $log['campaign'] = $clog; @file_put_contents($up['basedir'] . '/kf-brand-fix-log.txt', print_r($log, true)); echo '<pre>' . htmlspecialchars(print_r($log, true)) . '</pre>'; }, 97); /* ---------- probe: /?kfprobe=1 ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfprobe']) || !current_user_can('manage_options')) { return; } $out = array('time' => date('c')); if (function_exists('fw_get_db_settings_option')) { $ml = fw_get_db_settings_option('main_logo', null); $out['main_logo'] = is_array($ml) ? $ml['url'] : gettype($ml); $fl = fw_get_db_settings_option('footer_type/footer_v1/footer_logo', null); $out['footer_logo'] = is_array($fl) ? $fl['url'] : gettype($fl); } $out['site_icon'] = get_option('site_icon'); $out['has_favicon_link'] = has_site_icon() ? 'yes' : 'no'; echo '<pre>' . htmlspecialchars(print_r($out, true)) . '</pre>'; }, 96); /* ---------- admin verify user: /?kfverify=1&uid=43658 ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfverify']) || !current_user_can('manage_options')) { return; } $uid = isset($_GET['uid']) ? intval($_GET['uid']) : 0; if (!$uid || !get_userdata($uid)) { echo 'NO-USER'; return; } update_user_meta($uid, '_is_verified', 'yes'); $linked = get_user_meta($uid, '_linked_profile', true); if (!$linked) { $posts = get_posts(array('post_type' => array('freelancers','employers'), 'author' => $uid, 'numberposts' => 1, 'post_status' => 'any', 'fields' => 'ids')); $linked = $posts ? $posts[0] : 0; if ($linked) update_user_meta($uid, '_linked_profile', $linked); } if ($linked) { update_post_meta($linked, '_is_verified', 'yes'); update_post_meta($linked, 'identity_verified', 'yes'); } echo 'VERIFIED-U' . $uid . '-P' . ($linked ?: 'none'); }, 96); /* ---------- kfscan4: /?kfscan4=1&needle=X ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfscan4']) || !current_user_can('manage_options')) { return; } $needle = isset($_GET['needle']) ? wp_unslash($_GET['needle']) : 'hourly_rate'; $out = array(); $roots = array(WP_PLUGIN_DIR . '/workreap_core', get_template_directory(), get_stylesheet_directory()); foreach ($roots as $root) { if (!is_dir($root)) continue; $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS)); foreach ($it as $f) { if ($f->getSize() > 900000) continue; $ext = strtolower($f->getExtension()); if (!in_array($ext, array('php','html','htm','js','css','txt','json'), true)) continue; $code = @file_get_contents($f->getPathname()); if (!$code) continue; $p = 0; $hits = 0; while (($p = strpos($code, $needle, $p)) !== false && $hits < 5) { $out[] = array('file' => str_replace(ABSPATH,'',$f->getPathname()), 'ctx' => substr($code, max(0,$p-150), 400)); $p += strlen($needle); $hits++; } } } echo '<pre>' . htmlspecialchars(json_encode(array_slice($out, 0, 12), JSON_UNESCAPED_SLASHES)) . '</pre>'; }, 96); /* ---------- kfdb: /?kfdb=1&needle=X ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfdb']) || !current_user_can('manage_options')) { return; } global $wpdb; $needle = isset($_GET['needle']) ? wp_unslash($_GET['needle']) : 'jobourly_rate'; $out = array(); $tables = array($wpdb->posts, $wpdb->postmeta, $wpdb->options, $wpdb->terms); foreach ($tables as $tbl) { $col = ($tbl === $wpdb->options) ? 'option_value' : (($tbl === $wpdb->postmeta || $tbl === $wpdb->terms) ? ($tbl === $wpdb->terms ? 'name' : 'meta_value') : 'post_content'); $rows = $wpdb->get_results($wpdb->prepare( "SELECT ID AS rid, %i AS col FROM {$tbl} WHERE {$col} LIKE %s LIMIT 6", $col, '%' . $wpdb->esc_like($needle) . '%' )); if ($rows) { foreach ($rows as $r) { $v = $r->col; $p = strpos($v, $needle); $out[] = array('table' => $tbl, 'id' => $r->rid, 'ctx' => substr($v, max(0, $p - 120), 320)); } } } echo '<pre>' . htmlspecialchars(json_encode($out, JSON_UNESCAPED_SLASHES)) . '</pre>'; }, 96); /* ---------- kfopt: read/write whitelisted fw options (admin-only) ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfopt']) || !current_user_can('manage_options')) { return; } $allow = array('proposal_page', 'dir_proposal_page', 'login_reg_page', 'login_page', 'enable_login_register'); $key = isset($_GET['key']) ? wp_unslash($_GET['key']) : ''; if (!in_array($key, $allow, true)) { echo 'KEY-NOT-ALLOWED'; return; } if (isset($_POST['val'])) { $val = json_decode(wp_unslash($_POST['val']), true); if ($val === null) { echo 'BAD-JSON'; return; } fw_set_db_settings_option($key, $val); echo 'SET-OK'; } $cur = fw_get_db_settings_option($key, 'MISSING'); echo '<pre>' . htmlspecialchars(json_encode($cur, JSON_UNESCAPED_SLASHES)) . '</pre>'; }, 96); /* ---------- image/font upload to uploads subdir: POST /?kfimg=1&dir=2026/10&name=cat_repair.jpg (admin only) ---------- */ add_action('wp_footer', function () { if (!isset($_GET['kfimg']) || !current_user_can('manage_options')) { return; } $dir = isset($_GET['dir']) ? trim($_GET['dir'], "/") : ''; $name = isset($_GET['name']) ? $_GET['name'] : ''; $dirs_ok = ($dir !== '' && preg_match('/^[A-Za-z0-9_-]+(\/[A-Za-z0-9_-]+){0,3}$/', $dir) && strpos($dir, '..') === false); $names_ok = preg_match('/^[A-Za-z0-9._-]+\.(jpg|jpeg|png|webp|svg|woff2)$/', $name); if (!$dirs_ok || !$names_ok) { status_header(400); echo 'BAD_PATH'; return; } $up = wp_upload_dir(); $full = $up['basedir'] . '/' . $dir; if (!is_dir($full)) { wp_mkdir_p($full); } $data = file_get_contents('php://input'); if (strlen($data) < 100) { status_header(400); echo 'BAD_BODY'; return; } $ok = file_put_contents($full . '/' . $name, $data); echo ($ok !== false) ? 'WROTE ' . $name . ' ' . strlen($data) . ' bytes' : 'WRITE_FAIL'; }, 98); /* ---------- V8 professional design polish: inline CSS at wp_head (priority 99) ---------- */ add_action('wp_head', function () { echo '<style id="karfild-v8-design">' . PHP_EOL . <<<'KFCSS' /* KARFILD V8 — PROFESSIONAL DESIGN POLISH (2026-11) */ /* 1) Font fix: headings MUST be Vazirmatn (theme forces iranyekan/tahoma fallback) */ body h1, body h2, body h3, body h4, body h5, body h6, h1, h2, h3, h4, h5, h6, .elementor-heading-title, .kf-sec-title, .elementor-widget-heading .elementor-heading-title { font-family: 'Vazirmatn', Vazir, Tahoma, sans-serif !important; letter-spacing: 0 !important; } body h1 { font-weight: 900 !important; line-height: 1.45 !important; } body h2 { font-weight: 800 !important; } body h3 { font-weight: 700 !important; } body, .btn, button, input, select, textarea { font-family: 'Vazirmatn', Vazir, Tahoma, sans-serif !important; } /* 2) Broken empty elements */ a[href="#"]:empty, button:empty { display: none !important; } /* 3) Floating contact buttons: park at bottom-left, never overlap content */ .kf-fab { top: auto !important; bottom: 16px !important; left: 12px !important; display: flex !important; flex-direction: column !important; gap: 10px !important; z-index: 9990 !important; } .kf-fab a { width: 48px !important; height: 48px !important; border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important; box-shadow: 0 6px 18px rgba(2,6,23,.22) !important; border: 2px solid rgba(255,255,255,.85) !important; transition: transform .18s ease, box-shadow .18s ease !important; } .kf-fab a:hover { transform: scale(1.08) !important; box-shadow: 0 10px 26px rgba(2,6,23,.3) !important; } .kf-fab a svg { width: 22px !important; height: 22px !important; } /* 4) Hero image: professional framing */ .elementor-section img[src*="car-mechanic-toronto"] { border-radius: 22px !important; box-shadow: 0 26px 60px rgba(2,6,23,.38) !important; } /* 5) Category tiles: card look + hover */ a[data-kfimg] { display: block !important; border-radius: 18px !important; overflow: hidden !important; box-shadow: 0 6px 20px rgba(15,23,42,.10) !important; transition: transform .2s ease, box-shadow .2s ease !important; } a[data-kfimg]:hover { transform: translateY(-4px) !important; box-shadow: 0 16px 34px rgba(15,23,42,.18) !important; } a[data-kfimg] img { display: block !important; width: 100% !important; transition: transform .4s ease !important; } a[data-kfimg]:hover img { transform: scale(1.06) !important; } /* 6) Buttons: unified brand style */ .kf-camp-p1, .kf-camp-p2, .wt-btn, .wt-btntwo { border-radius: 14px !important; font-weight: 700 !important; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease !important; } .kf-camp-p1 { box-shadow: 0 10px 26px rgba(5,150,105,.38) !important; } .kf-camp-p1:hover { transform: translateY(-2px) !important; box-shadow: 0 14px 32px rgba(5,150,105,.48) !important; } /* 7) Campaign panel: premium card */ .kf-camp-panel { border-radius: 26px !important; box-shadow: 0 30px 80px rgba(2,6,23,.35) !important; } .kf-camp-panel img { border-radius: 18px !important; box-shadow: 0 18px 40px rgba(2,6,23,.35) !important; } .kf-camp-perks span { background: rgba(255,255,255,.10) !important; border: 1px solid rgba(255,255,255,.16) !important; border-radius: 999px !important; } /* 8) Global image polish */ .elementor-widget-image img, .entry-content img { border-radius: 16px; } /* 9) Forms: soft modern fields */ input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], textarea, select { border-radius: 12px !important; transition: border-color .15s ease, box-shadow .15s ease !important; } input:focus, textarea:focus, select:focus { border-color: #10b981 !important; box-shadow: 0 0 0 3px rgba(16,185,129,.14) !important; } /* 10) Accessibility focus ring */ a:focus-visible, button:focus-visible { outline: 2px solid #10b981 !important; outline-offset: 2px !important; } /* 11) Mobile refinements */ @media (max-width: 767px) { .kf-fab a { width: 44px !important; height: 44px !important; } .kf-fab { bottom: 12px !important; left: 10px !important; gap: 8px !important; } } /* END KARFILD V8 */ KFCSS . PHP_EOL . '</style>'; }, 99); /* ---------- V8.1 hero refinements: inline CSS (priority 100) ---------- */ add_action('wp_head', function () { echo '<style id="karfild-v81-design">' . PHP_EOL . <<<'KFCSS81' /* KARFILD V8.1 — hero refinements */ /* enlarge hero image into a real visual anchor */ .wt-sc-banner .wt-bannerimages { width: 100% !important; max-width: 540px !important; } .wt-sc-banner .wt-bannermanimg { width: 100% !important; max-width: 520px !important; } .wt-sc-banner .wt-bannermanimg img, .wt-sc-banner .wt-bannerimages img { width: 100% !important; max-width: 520px !important; height: auto !important; border-radius: 22px !important; box-shadow: 0 26px 60px rgba(2,6,23,.38) !important; display: block !important; } /* tighten oversized hero bottom padding */ .elementor-element-aebd306 { padding-bottom: 90px !important; } /* hero: balanced column heights */ .wt-sc-banner .row { align-items: center !important; } /* END V8.1 */ KFCSS81 . PHP_EOL . '</style>'; }, 100); /* ---------- V8 design polish via JS injector (bypasses LiteSpeed CSS merge) ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v8-js">' . <<<'KFJS81' try{(function(){if(window.__kfV8)return;window.__kfV8=1;var s=document.createElement('style');s.id='karfild-v8-design-js';s.textContent='/* KARFILD V8 — PROFESSIONAL DESIGN POLISH (2026-11) */\n/* 1) Font fix: headings MUST be Vazirmatn */\nbody h1, body h2, body h3, body h4, body h5, body h6,\nh1, h2, h3, h4, h5, h6, .elementor-heading-title, .kf-sec-title,\n.elementor-widget-heading .elementor-heading-title {\n font-family: \'Vazirmatn\', Vazir, Tahoma, sans-serif !important;\n letter-spacing: 0 !important;\n}\nbody h1 { font-weight: 900 !important; line-height: 1.45 !important; }\nbody h2 { font-weight: 800 !important; }\nbody h3 { font-weight: 700 !important; }\nbody, .btn, button, input, select, textarea { font-family: \'Vazirmatn\', Vazir, Tahoma, sans-serif !important; }\n/* 2) Broken empty elements */\na[href="#"]:empty, button:empty { display: none !important; }\n/* 3) Floating contact buttons: bottom-left, never overlap content */\n.kf-fab {\n top: auto !important;\n bottom: 16px !important;\n left: 12px !important;\n display: flex !important;\n flex-direction: column !important;\n gap: 10px !important;\n z-index: 9990 !important;\n}\n.kf-fab a {\n width: 48px !important;\n height: 48px !important;\n border-radius: 50% !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n box-shadow: 0 6px 18px rgba(2,6,23,.22) !important;\n border: 2px solid rgba(255,255,255,.85) !important;\n transition: transform .18s ease, box-shadow .18s ease !important;\n}\n.kf-fab a:hover { transform: scale(1.08) !important; box-shadow: 0 10px 26px rgba(2,6,23,.3) !important; }\n.kf-fab a svg { width: 22px !important; height: 22px !important; }\n/* 4) Hero image: professional framing + real size */\n.wt-sc-banner .wt-bannerimages { width: 100% !important; max-width: 540px !important; }\n.wt-sc-banner .wt-bannermanimg { width: 100% !important; max-width: 520px !important; }\n.wt-sc-banner .wt-bannermanimg img, .wt-sc-banner .wt-bannerimages img {\n width: 100% !important;\n max-width: 520px !important;\n height: auto !important;\n border-radius: 22px !important;\n box-shadow: 0 26px 60px rgba(2,6,23,.38) !important;\n display: block !important;\n}\n.elementor-element-aebd306 { padding-bottom: 90px !important; }\n.wt-sc-banner .row { align-items: center !important; }\n/* 5) Category tiles: card look + hover */\na[data-kfimg] {\n display: block !important;\n border-radius: 18px !important;\n overflow: hidden !important;\n box-shadow: 0 6px 20px rgba(15,23,42,.10) !important;\n transition: transform .2s ease, box-shadow .2s ease !important;\n}\na[data-kfimg]:hover { transform: translateY(-4px) !important; box-shadow: 0 16px 34px rgba(15,23,42,.18) !important; }\na[data-kfimg] img { display: block !important; width: 100% !important; transition: transform .4s ease !important; }\na[data-kfimg]:hover img { transform: scale(1.06) !important; }\n/* 6) Buttons */\n.kf-camp-p1, .kf-camp-p2, .wt-btn, .wt-btntwo {\n border-radius: 14px !important;\n font-weight: 700 !important;\n transition: transform .18s ease, box-shadow .18s ease, filter .18s ease !important;\n}\n.kf-camp-p1 { box-shadow: 0 10px 26px rgba(5,150,105,.38) !important; }\n.kf-camp-p1:hover { transform: translateY(-2px) !important; box-shadow: 0 14px 32px rgba(5,150,105,.48) !important; }\n/* 7) Campaign panel */\n.kf-camp-panel { border-radius: 26px !important; box-shadow: 0 30px 80px rgba(2,6,23,.35) !important; }\n.kf-camp-panel img { border-radius: 18px !important; box-shadow: 0 18px 40px rgba(2,6,23,.35) !important; }\n.kf-camp-perks span { background: rgba(255,255,255,.10) !important; border: 1px solid rgba(255,255,255,.16) !important; border-radius: 999px !important; }\n/* 8) Global images */\n.elementor-widget-image img, .entry-content img { border-radius: 16px; }\n/* 9) Forms */\ninput[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], textarea, select {\n border-radius: 12px !important;\n transition: border-color .15s ease, box-shadow .15s ease !important;\n}\ninput:focus, textarea:focus, select:focus {\n border-color: #10b981 !important;\n box-shadow: 0 0 0 3px rgba(16,185,129,.14) !important;\n}\n/* 10) Accessibility */\na:focus-visible, button:focus-visible { outline: 2px solid #10b981 !important; outline-offset: 2px !important; }\n/* 11) Mobile */\n@media (max-width: 767px) {\n .kf-fab a { width: 44px !important; height: 44px !important; }\n .kf-fab { bottom: 12px !important; left: 10px !important; gap: 8px !important; }\n}\n/* END KARFILD V8 */';document.head.appendChild(s);})();}catch(e){} KFJS81 . '</script>'; }, 97); /* ---------- V8.2: about-page hero/story images (client-side injection) ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v82-js">' . <<<'KFJS82' try{(function(){var p=location.pathname.replace(/\/+$/,'');if(p!=='/about-us')return;var css=document.createElement('style');css.id='karfild-v82-css';css.textContent='.kf-about-heroimg{margin:26px auto 0!important;max-width:780px;border-radius:22px;overflow:hidden;box-shadow:0 30px 70px rgba(2,6,23,.42)!important}.kf-about-heroimg img{width:100%;display:block;height:auto}.kf-about-storyimg{max-width:860px;margin:34px auto!important;border-radius:22px;overflow:hidden;box-shadow:0 24px 60px rgba(2,6,23,.16)}.kf-about-storyimg img{width:100%;display:block;height:auto}';document.head.appendChild(css);var col=document.querySelector('.wt-innerbannercontent');if(col&&!document.querySelector('.kf-about-heroimg')){var fig=document.createElement('figure');fig.className='kf-about-heroimg';fig.innerHTML='<img src=\'/wp-content/uploads/2026/11/about-main.jpg\' alt=\'تیم متخصصان کارفیلد\' loading=\'lazy\'>';col.appendChild(fig);}var h2s=[].slice.call(document.querySelectorAll('h2'));var target=h2s.find(function(e){return e.textContent.indexOf('کارفیلد چگونه کار')>-1});if(target&&!document.querySelector('.kf-about-storyimg')){var sec=target.closest('section')||target.closest('div');var fig2=document.createElement('figure');fig2.className='kf-about-storyimg';fig2.innerHTML='<img src=\'/wp-content/uploads/2026/11/about-story.jpg\' alt=\'تحویل خودرو به متخصص کارفیلد\' loading=\'lazy\'>';sec.parentNode.insertBefore(fig2,sec);}})();}catch(e){} KFJS82 . '</script>'; }, 96); /* ---------- V8.3: about images explicit width (theme collapses block width) ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v83-js">' . <<<'KFJS83' try{(function(){var s=document.createElement('style');s.id='karfild-v83-css';s.textContent='.kf-about-heroimg{width:100%!important;max-width:780px!important;margin-left:auto!important;margin-right:auto!important;}.kf-about-heroimg img{width:100%!important;max-width:100%!important;}.kf-about-storyimg{width:100%!important;max-width:860px!important;margin-left:auto!important;margin-right:auto!important;}.kf-about-storyimg img{width:100%!important;max-width:100%!important;}';document.head.appendChild(s);})();}catch(e){} KFJS83 . '</script>'; }, 95); /* ---------- V8.4: about hero image as overlap card below banner ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v84-js">' . <<<'KFJS84' try{(function(){var f=document.querySelector('.kf-about-heroimg');if(!f)return;var banner=f.closest('.wt-innerbanner')||f.closest('.wt-innerbannercontent').closest('section')||f.closest('.wt-innerbannercontent');var host=banner.nodeType===1?banner:document.body;if(host.parentNode){host.parentNode.insertBefore(f,host.nextSibling);}var css=document.createElement('style');css.id='karfild-v84-css';css.textContent='.kf-about-heroimg{margin:-72px auto 36px!important;position:relative!important;z-index:6!important;width:100%!important;max-width:820px!important;border:6px solid #fff!important;}';document.head.appendChild(css);})();}catch(e){} KFJS84 . '</script>'; }, 94); /* ---------- V8.5: about hero figure outside fixed-height banner (overlap card) ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v85-js">' . <<<'KFJS85' try{(function(){var f=document.querySelector('.kf-about-heroimg');var holder=document.querySelector('.wt-innerbannerholder');if(f&&holder&&holder.contains(f)){holder.parentNode.insertBefore(f,holder.nextSibling);}var s=document.createElement('style');s.id='karfild-v85-css';s.textContent='.kf-about-heroimg{margin:-64px auto 40px!important;width:100%!important;max-width:820px!important;position:relative!important;z-index:6!important;border:6px solid #fff!important;border-radius:22px!important;overflow:hidden!important;box-shadow:0 30px 70px rgba(2,6,23,.42)!important}.kf-about-heroimg img{width:100%!important;height:auto!important;display:block!important}';document.head.appendChild(s);})();}catch(e){} KFJS85 . '</script>'; }, 97); /* ---------- V8.6: hero H1 text normalization ---------- */ add_action('wp_footer', function () { echo '<script id="karfild-v86-js">' . <<<'KFJS86' try{(function(){var h1=document.querySelector('.wt-sc-banner h1');if(h1&&!window.__kfH1Fix){window.__kfH1Fix=1;h1.innerHTML='<span>درخواست و ارائه</span> خدمات خودرویی';}})();}catch(e){} KFJS86 . '</script>'; }, 96); /* ============================================================ * KF OPS v2 — عملیات مدیریتی امن (فقط مدیرکل + توکن) * POST /?kfrun=1 body: {"op":"...","args":{...}} header: X-KF-Op-Token * ============================================================ */ add_action('init', function () { if (!isset($_GET['kfrun'])) { return; } if (!current_user_can('manage_options')) { wp_send_json(array('ok' => false, 'error' => 'NO_AUTH'), 403); } $tok = isset($_SERVER['HTTP_X_KF_OP_TOKEN']) ? (string) $_SERVER['HTTP_X_KF_OP_TOKEN'] : ''; if (!hash_equals('kfOps2Zx7qLm4Vn9Tb2Wd8Kp5Rj3Hg06', $tok)) { wp_send_json(array('ok' => false, 'error' => 'BAD_TOKEN'), 403); } $raw = file_get_contents('php://input'); $in = json_decode($raw, true); if (!is_array($in) || !isset($in['op'])) { wp_send_json(array('ok' => false, 'error' => 'BAD_JSON'), 400); } $op = (string) $in['op']; $a = (isset($in['args']) && is_array($in['args'])) ? $in['args'] : array(); $out = array('ok' => true, 'op' => $op); switch ($op) { case 'php': ob_start(); $res = eval($a['code']); $echo = ob_get_clean(); $out['result'] = (is_string($res) || is_numeric($res) || is_bool($res) || is_null($res)) ? $res : 'NON_SCALAR:' . gettype($res); $out['echo'] = $echo; break; case 'terms_list': $tax = isset($a['taxonomy']) ? $a['taxonomy'] : 'skills'; $terms = get_terms(array('taxonomy' => $tax, 'hide_empty' => false, 'orderby' => 'id', 'order' => 'ASC')); if (is_wp_error($terms)) { $out['ok'] = false; $out['error'] = $terms->get_error_message(); break; } $rows = array(); foreach ($terms as $t) { $rows[] = array('id' => (int) $t->term_id, 'name' => $t->name, 'slug' => $t->slug, 'parent' => (int) $t->parent, 'count' => (int) $t->count); } $out['terms'] = $rows; break; case 'term_set_parent': $r = wp_update_term((int) $a['term_id'], (isset($a['taxonomy']) ? $a['taxonomy'] : 'skills'), array('parent' => (int) $a['parent_id'])); if (is_wp_error($r)) { $out['ok'] = false; $out['error'] = $r->get_error_message(); } else { $out['term'] = $r; } break; case 'term_create': $r = wp_insert_term((string) $a['name'], (string) $a['taxonomy'], array( 'slug' => isset($a['slug']) ? (string) $a['slug'] : '', 'parent' => isset($a['parent']) ? (int) $a['parent'] : 0, 'description' => isset($a['description']) ? (string) $a['description'] : '', )); if (is_wp_error($r)) { $out['ok'] = false; $out['error'] = $r->get_error_message(); } else { $out['term'] = $r; } break; case 'term_update': $r = wp_update_term((int) $a['term_id'], (string) $a['taxonomy'], (array) $a['fields']); if (is_wp_error($r)) { $out['ok'] = false; $out['error'] = $r->get_error_message(); } else { $out['term'] = $r; } break; case 'option_get': $out['value'] = get_option((string) $a['key'], null); break; case 'option_set': update_option((string) $a['key'], $a['value']); $out['value'] = get_option((string) $a['key'], null); break; case 'post_meta_get': $out['value'] = get_post_meta((int) $a['pid'], (string) $a['key'], true); break; case 'post_meta_set': update_post_meta((int) $a['pid'], (string) $a['key'], $a['value']); break; case 'user_meta_get': $out['value'] = get_user_meta((int) $a['uid'], (string) $a['key'], true); break; case 'user_meta_set': update_user_meta((int) $a['uid'], (string) $a['key'], $a['value']); break; case 'query': global $wpdb; $rows = $wpdb->get_results((string) $a['sql'], ARRAY_A); if ($rows === null) { $out['ok'] = false; $out['error'] = $wpdb->last_error ?: 'EMPTY_OR_NULL'; } $out['rows'] = is_array($rows) ? array_slice($rows, 0, 200) : array(); break; default: $out['ok'] = false; $out['error'] = 'UNKNOWN_OP'; } wp_send_json($out, 200); }, 1); اعضا | کارفیلد انجمن

تالار گفتگوی ماشین‌بازها

اعلان‌ها
پاک کردن همه

اعضای انجمن

 

 
New Member
عضویت: 1402-05-16
موضوعات: 0   نوشته‌ها: 0
 
سارا محمدی
New Member
عضویت: 1405-08-04
موضوعات: 0   نوشته‌ها: 0
 
SH Rabani
New Member
عضویت: 1405-03-10
موضوعات: 0   نوشته‌ها: 0
 
Ehsan Ghasempoor
New Member
عضویت: 1404-11-27
موضوعات: 0   نوشته‌ها: 0
 
امین امین نسب
New Member
عضویت: 1404-08-18
موضوعات: 0   نوشته‌ها: 0
 
میلاد کاظمی
New Member
عضویت: 1404-08-10
موضوعات: 0   نوشته‌ها: 0
 
عمید کرباسی
New Member
عضویت: 1404-06-09
موضوعات: 0   نوشته‌ها: 0
 
New Member
عضویت: -0001-11-30
موضوعات: 0   نوشته‌ها: 0
صفحه 32 / 32
اشتراک‌گذاری: