HEX
Server: nginx/1.24.0
System: Linux 0c1023d6c65e 6.8.0-137-generic #137-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 17 20:28:23 UTC 2026 x86_64
User: root (0)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/mu-plugins/ethnic-cookie-policy-page.php
<?php
/**
 * Plugin Name: Ethnic Cookie Policy Page
 * Description: Creates and renders a plain text Cookie Policy page.
 * Version: 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! function_exists( 'ethnic_cookie_policy_page_get_target_page' ) ) {
	function ethnic_cookie_policy_page_get_target_page() {
		return get_page_by_path( 'cookie-policy' );
	}
}

if ( ! function_exists( 'ethnic_cookie_policy_page_ensure_page' ) ) {
	function ethnic_cookie_policy_page_ensure_page() {
		$page = ethnic_cookie_policy_page_get_target_page();

		if ( $page instanceof WP_Post ) {
			return;
		}

		$page_id = wp_insert_post(
			array(
				'post_title'     => 'Cookie Policy',
				'post_name'      => 'cookie-policy',
				'post_status'    => 'publish',
				'post_type'      => 'page',
				'post_content'   => '',
				'post_parent'    => 0,
				'comment_status' => 'closed',
			)
		);

		if ( $page_id && ! is_wp_error( $page_id ) ) {
			update_post_meta( $page_id, '_wp_page_template', 'default' );
		}
	}

	add_action( 'init', 'ethnic_cookie_policy_page_ensure_page', 5 );
}

if ( ! function_exists( 'ethnic_cookie_policy_page_request_matches' ) ) {
	function ethnic_cookie_policy_page_request_matches() {
		if ( is_admin() ) {
			return false;
		}

		$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_unslash( $_SERVER['REQUEST_URI'] ) : '';
		$request_uri = wp_parse_url( $request_uri, PHP_URL_PATH );
		$request_uri = is_string( $request_uri ) ? untrailingslashit( $request_uri ) : '';

		$target_path = wp_parse_url( home_url( '/cookie-policy/' ), PHP_URL_PATH );
		$target_path = is_string( $target_path ) ? untrailingslashit( $target_path ) : '/cookie-policy';

		return '' !== $request_uri && $request_uri === $target_path;
	}
}

if ( ! function_exists( 'ethnic_cookie_policy_page_is_target' ) ) {
	function ethnic_cookie_policy_page_is_target() {
		if ( ethnic_cookie_policy_page_request_matches() ) {
			return true;
		}

		if ( is_admin() ) {
			return false;
		}

		$page = ethnic_cookie_policy_page_get_target_page();

		if ( ! ( $page instanceof WP_Post ) ) {
			return false;
		}

		return (int) get_queried_object_id() === (int) $page->ID || is_page( (int) $page->ID );
	}
}

if ( ! function_exists( 'ethnic_cookie_policy_page_body_class' ) ) {
	function ethnic_cookie_policy_page_body_class( $classes ) {
		if ( ethnic_cookie_policy_page_is_target() ) {
			$classes[] = 'ethnic-cookie-policy-active';
		}

		return $classes;
	}

	add_filter( 'body_class', 'ethnic_cookie_policy_page_body_class' );
}

if ( ! function_exists( 'ethnic_cookie_policy_page_data' ) ) {
	function ethnic_cookie_policy_page_data() {
		static $data = null;

		if ( null !== $data ) {
			return $data;
		}

		$data = array(
			'meta_title'       => 'Cookie Policy | Ethnic Infotech',
			'meta_description' => 'Read our Cookie Policy to understand how we use cookies, analytics tools, tracking technologies, consent options, and browser controls on this website.',
			'contact_url'      => 'https://ethnicinfotech.com/contact-us/',
		);

		return $data;
	}
}

if ( ! function_exists( 'ethnic_cookie_policy_page_render_content' ) ) {
	function ethnic_cookie_policy_page_render_content() {
		$data        = ethnic_cookie_policy_page_data();
		$contact_url = isset( $data['contact_url'] ) ? (string) $data['contact_url'] : home_url( '/contact-us/' );

		ob_start();
		?>
		<div class="ethnic-cookie-policy">
			<div class="ethnic-cookie-policy__inner">
				<h1>Cookie Policy</h1>
				<p><strong>Effective Date:</strong> 16th May 2026</p>
				<p>This Cookie Policy explains how the website may use cookies and similar tracking technologies in connection with website functionality, analytics, performance monitoring, and related operational use of the site.</p>

				<h2>1. What Are Cookies</h2>
				<p>Cookies are small text files that may be placed on a user&rsquo;s device when visiting a website. Cookies can help websites function properly, remember preferences, understand usage patterns, and support performance improvements.</p>
				<p>Similar technologies may also be used for analytics, session handling, measurement, or other operational purposes depending on how the website is configured.</p>

				<h2>2. How We Use Cookies</h2>
				<p>Cookies may be used on the website to support core website functionality, understand traffic and user behavior, improve usability, and review general content performance.</p>
				<p>Where relevant, cookies may also support login or session-related handling, security review, and smoother interaction with website features.</p>

				<h2>3. Types of Cookies We May Use</h2>
				<h3>Essential Cookies</h3>
				<p>These cookies may support basic website operation, security controls, session management, and other functionality required for the website to work properly.</p>

				<h3>Analytics Cookies</h3>
				<p>These cookies may help us understand how visitors use the website, which pages are viewed, how users move through the site, and where improvements may be useful. This includes analytics tools such as Google Analytics.</p>

				<h3>Preference Cookies</h3>
				<p>These cookies may remember settings, interface choices, or similar preferences where that functionality is available on the website.</p>

				<h3>Marketing or Advertising Cookies</h3>
				<p>If applicable, the website may use advertising-related or marketing-related tracking tools, tags, or pixels in general terms to help measure campaign performance, understand engagement, or review website interactions connected to outreach activity. The exact tools and configuration may vary over time.</p>

				<h2>4. Google Analytics and Tracking Tools</h2>
				<p>The website uses Google Analytics. Google Analytics helps us understand visitor behavior, traffic patterns, page usage, and general website performance.</p>
				<p>Analytics information is used to improve the website, review how content performs, and support a better user experience. Analytics data is generally used in aggregated or operational ways rather than for individual marketing decisions unless separately configured.</p>

				<h2>5. Third-Party Cookies</h2>
				<p>Some cookies or similar tracking technologies may be placed by third-party services used on the website. These may relate to analytics, embedded tools, scheduling tools, media, forms, file handling, or other integrations.</p>
				<p>Third-party services operate under their own policies, practices, and terms. The company does not control all aspects of third-party cookie behavior once those services are used on the website.</p>

				<h2>6. Consent and Cookie Preferences</h2>
				<p>Where required, users may be shown a cookie notice, consent mechanism, or related preference tool. Depending on the final website configuration, users may be able to accept, reject, or manage certain cookie preferences.</p>
				<p>Cookie consent tools, banners, and settings may be updated later based on final implementation, website features, and applicable legal requirements.</p>

				<h2>7. Managing Cookies</h2>
				<p>Users can usually manage, restrict, or disable cookies through their browser settings. Many browsers allow users to review stored cookies, block certain cookies, or clear cookies entirely.</p>
				<p>Disabling some cookies may affect website functionality, performance, or overall user experience. Where a cookie banner or consent tool is available, users may also be able to manage certain preferences through that mechanism.</p>

				<h2>8. Changes to This Cookie Policy</h2>
				<p>The company may update this Cookie Policy from time to time. Updated versions may be posted on the website with a revised effective date.</p>

				<h2>9. Contact Us</h2>
				<p>If you have questions about this Cookie Policy or cookie-related practices on the website, please contact us using the details below:</p>
				<p><strong>Company Name:</strong> Ethnic Infotech Pvt. Ltd.</p>
				<p><strong>Privacy/Contact Email:</strong> info@ethnicinfotech.com</p>
				<p><strong>Contact Page:</strong> <a href="<?php echo esc_url( $contact_url ); ?>"><?php echo esc_html( $contact_url ); ?></a></p>
			</div>
		</div>
		<?php

		return (string) ob_get_clean();
	}
}

if ( ! function_exists( 'ethnic_cookie_policy_page_filter_content' ) ) {
	function ethnic_cookie_policy_page_filter_content( $content ) {
		if ( ! ethnic_cookie_policy_page_is_target() || ! in_the_loop() || ! is_main_query() ) {
			return $content;
		}

		return ethnic_cookie_policy_page_render_content();
	}

	add_filter( 'the_content', 'ethnic_cookie_policy_page_filter_content', 20 );
}

if ( ! function_exists( 'ethnic_cookie_policy_page_render_template_fallback' ) ) {
	function ethnic_cookie_policy_page_render_template_fallback() {
		if ( ! ethnic_cookie_policy_page_request_matches() ) {
			return;
		}

		if ( ! is_404() ) {
			return;
		}

		$page = ethnic_cookie_policy_page_get_target_page();

		if ( ! ( $page instanceof WP_Post ) ) {
			ethnic_cookie_policy_page_ensure_page();
			$page = ethnic_cookie_policy_page_get_target_page();
		}

		global $wp_query, $post;

		if ( $page instanceof WP_Post ) {
			$post = $page;
			setup_postdata( $post );
		}

		if ( $wp_query instanceof WP_Query ) {
			$wp_query->is_404            = false;
			$wp_query->is_page           = true;
			$wp_query->is_singular       = true;
			$wp_query->is_home           = false;
			$wp_query->is_archive        = false;
			$wp_query->queried_object    = $page instanceof WP_Post ? $page : null;
			$wp_query->queried_object_id = $page instanceof WP_Post ? (int) $page->ID : 0;
			$wp_query->post              = $page instanceof WP_Post ? $page : null;
			$wp_query->posts             = $page instanceof WP_Post ? array( $page ) : array();
			$wp_query->post_count        = $page instanceof WP_Post ? 1 : 0;
			$wp_query->found_posts       = $page instanceof WP_Post ? 1 : 0;
			$wp_query->max_num_pages     = 1;
		}

		status_header( 200 );

		get_header();
		echo ethnic_cookie_policy_page_render_content(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		get_footer();
		exit;
	}

	add_action( 'template_redirect', 'ethnic_cookie_policy_page_render_template_fallback', 1 );
}

if ( ! function_exists( 'ethnic_cookie_policy_page_document_title' ) ) {
	function ethnic_cookie_policy_page_document_title( $title ) {
		if ( ! ethnic_cookie_policy_page_is_target() ) {
			return $title;
		}

		$data         = ethnic_cookie_policy_page_data();
		$custom_title = isset( $data['meta_title'] ) ? trim( (string) $data['meta_title'] ) : '';

		if ( '' !== $custom_title ) {
			return $custom_title;
		}

		return $title;
	}

	add_filter( 'pre_get_document_title', 'ethnic_cookie_policy_page_document_title' );
}

if ( ! function_exists( 'ethnic_cookie_policy_page_head' ) ) {
	function ethnic_cookie_policy_page_head() {
		if ( ! ethnic_cookie_policy_page_is_target() ) {
			return;
		}

		$data = ethnic_cookie_policy_page_data();
		$meta = isset( $data['meta_description'] ) ? trim( (string) $data['meta_description'] ) : '';

		if ( '' !== $meta ) {
			echo '<meta name="description" content="' . esc_attr( $meta ) . '">' . "\n";
		}
		?>
		<style id="ethnic-cookie-policy-page">
			body.ethnic-cookie-policy-active #page-title.page-title-block.custom-page-title {
				display: none !important;
			}

			body.ethnic-cookie-policy-active #main,
			body.ethnic-cookie-policy-active .block-content,
			body.ethnic-cookie-policy-active .fullwidth-content {
				background: transparent !important;
			}

			.ethnic-cookie-policy {
				max-width: 880px;
				margin: 0 auto;
				padding: 48px 20px 72px;
				color: #18212c;
			}

			.ethnic-cookie-policy__inner {
				max-width: 100%;
			}

			.ethnic-cookie-policy h1,
			.ethnic-cookie-policy h2,
			.ethnic-cookie-policy h3 {
				margin: 0;
				color: #18212c;
			}

			.ethnic-cookie-policy h1 {
				font-size: clamp(34px, 4vw, 48px);
				line-height: 1.08;
				letter-spacing: -0.04em;
				margin-bottom: 18px;
			}

			.ethnic-cookie-policy h2 {
				font-size: clamp(24px, 2.4vw, 30px);
				line-height: 1.2;
				letter-spacing: -0.03em;
				margin-top: 40px;
				margin-bottom: 16px;
			}

			.ethnic-cookie-policy h3 {
				font-size: 18px;
				line-height: 1.35;
				margin-top: 22px;
				margin-bottom: 10px;
			}

			.ethnic-cookie-policy p,
			.ethnic-cookie-policy li {
				font-size: 16px;
				line-height: 1.8;
				color: #425066;
			}

			.ethnic-cookie-policy p {
				margin: 0 0 16px;
			}

			.ethnic-cookie-policy ul {
				margin: 0 0 18px 20px;
				padding: 0;
			}

			.ethnic-cookie-policy li {
				margin: 0 0 8px;
			}

			.ethnic-cookie-policy a {
				color: #2f6bff;
				text-decoration: underline;
			}

			.ethnic-cookie-policy strong {
				color: #18212c;
			}

			@media (max-width: 767px) {
				.ethnic-cookie-policy {
					padding: 36px 18px 56px;
				}

				.ethnic-cookie-policy h2 {
					margin-top: 32px;
				}
			}
		</style>
		<?php
	}

	add_action( 'wp_head', 'ethnic_cookie_policy_page_head', 20 );
}