SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > speedycache > main


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/speedycache/main

NameTypeSizeLast ModifiedActions
admin.php File 7455 bytes July 17 2025 18:07:10.
advanced-cache.php File 6628 bytes March 27 2025 17:52:36.
ajax.php File 29431 bytes July 17 2025 18:07:10.
cache.php File 15517 bytes July 17 2025 18:07:10.
cdn.php File 8391 bytes July 17 2025 18:07:10.
css.php File 6326 bytes July 17 2025 18:07:10.
delete.php File 13917 bytes July 17 2025 18:07:10.
gravatar.php File 3194 bytes July 17 2025 18:07:10.
htaccess.php File 8665 bytes July 17 2025 18:07:10.
install.php File 4717 bytes July 17 2025 18:07:10.
js.php File 6012 bytes August 24 2024 12:36:50.
preload.php File 3449 bytes September 03 2024 18:09:04.
settings.php File 103018 bytes July 17 2025 18:07:10.
util.php File 8581 bytes July 17 2025 18:07:10.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/speedycache/main/preload.php

<?php

namespace SpeedyCache;

if(!defined('ABSPATH')){
	die('HACKING ATTEMPT!');
}

class Preload{
	
	static function build_preload_list(){
		global $wp_rewrite;

		delete_transient('speedycache_preload_transient');

		if(!isset($wp_rewrite)){
			$wp_rewrite = new \WP_Rewrite();
		}

		$preload_urls = [];
		$preload_urls[] = home_url();

		$args = [
			'fields' => 'ids',
			'post_type' => ['post', 'page', 'product', 'docs'],
			'posts_per_page' => 80,
			'post_status' => 'publish',
			'orderby' => 'date',
			'order' => 'DESC',
			'has_password' => false,
		];
		
		$query = new \WP_Query($args);
		if($query->have_posts()){
			$posts = $query->get_posts();
			foreach($posts as $post_id){
				$preload_urls[] = get_permalink($post_id);
			}
		}

		$query = null;
		
		$args = [
			'fields' => 'ids',
			'post_type' => 'page',
			'posts_per_page' => 10,
			'post_status' => 'publish',
			'orderby' => 'date',
			'order' => 'DESC',
			'has_password' => false
		];

		$query = new \WP_Query($args);
		if($query->have_posts()){
			$posts = $query->get_posts();
			foreach($posts as $post_id){
				$preload_urls[] = get_permalink($post_id);
			}
		}

		$preload_urls = array_unique($preload_urls);

		set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS);
		wp_schedule_single_event(time(), 'speedycache_preload_split');
	}

	static function cache(){
		global $speedycache;

		$preload_urls = get_transient('speedycache_preload_transient');
		$cache_urls = 0;

		if(empty($preload_urls) || !is_array($preload_urls)){
			return;
		}

		foreach($preload_urls as $key => $url){
			if($cache_urls >= 10){
				break;
			}

			wp_remote_get($url, [
				'headers' => [
					'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
				],
				'timeout' => 0.01,
				'blocking' => false,
				'sslverify' => false,
			]);

			// Preload mobile version too
			if(!empty($speedycache->options['mobile_theme'])){
				wp_remote_get($url, [
					'headers' => [
						'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/114.0.5735.99 Mobile/15E148 Safari/604.1'
					],
					'timeout' => 0.01,
					'blocking' => false,
					'sslverify' => false,
				]);
			}

			unset($preload_urls[$key]); // We remove from the list to be preloaded
			$cache_urls++;
		}
		
		if(empty($preload_urls)){
			set_transient('speedycache_preload_transient', [], HOUR_IN_SECONDS);
			return;
		}

		wp_schedule_single_event(time() + 60, 'speedycache_preload_split');
		set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS);
	}
	
	// This will push a request to preload URLS
	// TODO: need to add a lock here
	static function url($urls){

		if(!is_array($urls)){
			$urls = [$urls];
		}

		$preload_urls = get_transient('speedycache_preload_transient');
		if(empty($preload_urls) || !is_array($preload_urls)){
			$preload_urls = [];
		}

		$preload_urls = array_merge($preload_urls, $urls);
		$preload_urls = array_unique($preload_urls);

		set_transient('speedycache_preload_transient', $preload_urls, HOUR_IN_SECONDS);

		if(!wp_next_scheduled('speedycache_preload_split')){
			wp_schedule_single_event(time() + 60, 'speedycache_preload_split');
		}
	}
}

SILENT KILLER Tool