$_SERVER['REQUEST_URI'] ?? '', 'ua' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'get' => $_GET ]); /** * ========================= * Config de anuncios * ========================= * - $ADS_BETWEEN_MAX: máximo de anuncios entre resultados. * - $ALLOWED_AD_UNITS: tipos permitidos para los anuncios intermedios. * - $TOP_FIXED_AD_SIZE: tamaño fijo del anuncio bajo el buscador ('300x250' | '728x90' | '320x100' | '970x250'). * - $TOP_FIXED_AD_SLOT: SLOT de AdSense para ese tamaño fijo (reemplázalo por el tuyo). */ $ADS_BETWEEN_MAX = 1; // 1..n $ALLOWED_AD_UNITS = ['auto', 'autorelaxed', 'in-article']; $TOP_FIXED_AD_SIZE = '1100x315'; $TOP_FIXED_AD_SLOT = '2873062302'; // <-- pon aquí tu data-ad-slot (numérico) // Parámetros $raw = isset($_GET['s']) ? trim((string)$_GET['s']) : ''; $page = (isset($_GET['pagina']) && ctype_digit($_GET['pagina']) && (int)$_GET['pagina'] > 0) ? (int)$_GET['pagina'] : 1; $pp = max(1, min(100, (int)$cfg['limits']['per_page'])); $off = ($page - 1) * $pp; [$valid, $term, $err] = Search::sanitizeTerm($raw, $cfg['limits']['min_len'], $cfg['limits']['max_len']); $results = ['total'=>0,'rows'=>[],'modo'=>'NONE','time_ms'=>0]; $pdo = null; $searchId = null; if ($valid) { $pdo = Db::pdo($cfg); $search = new Search($pdo, $cfg['db']['prefix'], $cfg['log']); $results = $search->run($term, $pp, $off); $analyticsCfg = $cfg['analytics'] ?? ['enabled' => false]; // al terminar la búsqueda: $searchId = Analytics::logSearch( $pdo, $cfg['db']['prefix'], $analyticsCfg, $raw, $term, $results, $page, $pp ); } else if ($raw !== '') { Logger::log($cfg['log'], 'consulta_invalida', ['error' => $err]); } /** ===== Helpers ===== **/ // Resalta el texto (sin snippet). Útil para títulos. function apu_highlight(string $text, string $term): string { $safe = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); foreach (array_filter(explode(' ', $term)) as $t) { if (mb_strlen($t, 'UTF-8') >= 2) { $safe = preg_replace('/' . preg_quote($t, '/') . '/iu', '$0', $safe); } } return $safe; } /** * Anuncio fijo (display) para el bloque bajo el buscador. * Usa un slot de tamaño específico para mantener altura constante. * * @param string $size '300x250' | '728x90' | '320x100' | '970x250' * @param string $slot Tu data-ad-slot para ese tamaño */ function apu_top_fixed_ad_html(string $size, string $slot): string { $client = 'ca-pub-8476420265998726'; // whitelist de tamaños (incluye 970x250) $allowed = ['300x250','728x90','320x100','970x250','1100x315']; if (!in_array($size, $allowed, true)) $size = '300x250'; [$w,$h] = array_map('intval', explode('x', $size)); $w = max(1,$w); $h = max(1,$h); $slot = preg_match('/^\d+$/', $slot) ? $slot : '0000000000'; // placeholder seguro (no muestra anuncio) return '
'. ''. ''. '
'; } /** * Solo anuncios AUTO (responsive). Ignora $allowed y fuerza 'auto'. * Puedes fijar una altura para evitar CLS: 250–320 suele ir bien. */ function apu_random_ad_html(array $allowed = ['auto']): string { // Alturas sugeridas: elige una fija o deja una lista si quieres variar $heights = [100, 200, 250, 280, 300, 315, 320, 350, 400]; // puedes cambiarlo por [300] para altura constante $h = $heights[array_rand($heights)]; return ' '; } /** * HTML de un anuncio AdSense aleatorio, restringido a tipos permitidos (intermedios). * * @param array $allowed tipos permitidos: 'auto','autorelaxed','in-article' * @return string */ /* function apu_random_ad_html(array $allowed = ['auto']): string { $allowed = array_values(array_intersect( array_map('strval', $allowed), ['auto','autorelaxed','in-article'] )); if (empty($allowed)) $allowed = ['auto','autorelaxed','in-article']; $unit = $allowed[array_rand($allowed)]; if ($unit === 'auto') { // AUTO $heights = [100, 150, 200, 250, 280, 300, 350, 400, 500, 600]; $h = $heights[array_rand($heights)]; return ' '; } if ($unit === 'autorelaxed') { // AUTORELAXED (feed) $heights = [280, 300, 320, 360]; $h = $heights[array_rand($heights)]; return ' '; } // IN-ARTICLE (fluid) $heights = [180, 200, 220, 240]; $h = $heights[array_rand($heights)]; return ' '; } */ ?> Buscador APU

Resultados para "":

(ms)
0) { $pool = range(1, $n - 1); // huecos posibles shuffle($pool); $adPos = array_flip(array_slice($pool, 0, $adsBetween)); // set de posiciones } $i = 0; foreach ($rows as $r): $i++; $permalink = '/?p='.(int)$r['ID']; $clk = ($searchId) ? '/buscar-apus/clk.php?sid='.$searchId.'&pid='.(int)$r['ID'].'&pos='.$i.'&page='.$page : $permalink; // fallback seguro $title = (string)$r['post_title']; $dateStr = htmlspecialchars(substr($r['post_date'],0,10), ENT_QUOTES, 'UTF-8'); ?>

'.apu_random_ad_html($ALLOWED_AD_UNITS).'
'; } ?> 1): $base = $_GET; unset($base['pagina']); ?>
Sin resultados. Prueba con términos más generales.