Version Description
- to create cache for xml sources
- to create cache for json sources [Details]
- to clear cache after Maintenance Mode activation/deactivation on Elementor plugin
- refactoring of clearing cache hook system
- refactoring of cache time-out time list
- to disable cache when "The site is experiencing technical difficulties." error occurs
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.9.7 |
Comparing to | |
See all releases |
Code changes from version 0.8.9.6 to 0.8.9.7
- inc/admin.php +17 -2
- inc/cache.php +107 -37
- inc/css-utilities.php +12 -12
- inc/js-utilities.php +13 -13
- readme.txt +9 -1
- templates/timeout.php +5 -0
- wpFastestCache.php +37 -12
inc/admin.php
CHANGED
@@ -487,10 +487,18 @@
|
|
487 |
if($webp){
|
488 |
$basename = "$1.webp";
|
489 |
|
490 |
-
|
491 |
-
|
|
|
|
|
|
|
492 |
if(preg_match("/https?\:\/\/[^\/]+\/(.+)/", site_url(), $siteurl_base_name)){
|
493 |
if(preg_match("/https?\:\/\/[^\/]+\/(.+)/", home_url(), $homeurl_base_name)){
|
|
|
|
|
|
|
|
|
|
|
494 |
$homeurl_base_name[1] = trim($homeurl_base_name[1], "/");
|
495 |
$siteurl_base_name[1] = trim($siteurl_base_name[1], "/");
|
496 |
|
@@ -499,6 +507,13 @@
|
|
499 |
$basename = $homeurl_base_name[1]."/".$basename;
|
500 |
}
|
501 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
}
|
503 |
}
|
504 |
|
487 |
if($webp){
|
488 |
$basename = "$1.webp";
|
489 |
|
490 |
+
/*
|
491 |
+
This part for sub-directory installation
|
492 |
+
WordPress Address (URL): site_url()
|
493 |
+
Site Address (URL): home_url()
|
494 |
+
*/
|
495 |
if(preg_match("/https?\:\/\/[^\/]+\/(.+)/", site_url(), $siteurl_base_name)){
|
496 |
if(preg_match("/https?\:\/\/[^\/]+\/(.+)/", home_url(), $homeurl_base_name)){
|
497 |
+
/*
|
498 |
+
site_url() return http://example.com/sub-directory
|
499 |
+
home_url() returns http://example.com/sub-directory
|
500 |
+
*/
|
501 |
+
|
502 |
$homeurl_base_name[1] = trim($homeurl_base_name[1], "/");
|
503 |
$siteurl_base_name[1] = trim($siteurl_base_name[1], "/");
|
504 |
|
507 |
$basename = $homeurl_base_name[1]."/".$basename;
|
508 |
}
|
509 |
}
|
510 |
+
}else{
|
511 |
+
/*
|
512 |
+
site_url() return http://example.com/sub-directory
|
513 |
+
home_url() returns http://example.com/
|
514 |
+
*/
|
515 |
+
$siteurl_base_name[1] = trim($siteurl_base_name[1], "/");
|
516 |
+
$basename = $siteurl_base_name[1]."/".$basename;
|
517 |
}
|
518 |
}
|
519 |
|
inc/cache.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
public $exclude_rules = false;
|
10 |
public $preload_user_agent = false;
|
11 |
public $current_page_type = false;
|
|
|
12 |
|
13 |
public function __construct(){
|
14 |
//to fix: PHP Notice: Undefined index: HTTP_USER_AGENT
|
@@ -344,14 +345,30 @@
|
|
344 |
|
345 |
|
346 |
//to show cache version via php if htaccess rewrite rule does not work
|
347 |
-
if(!$this->preload_user_agent && $this->cacheFilePath && @file_exists($this->cacheFilePath."index.html")){
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
if(defined('WPFC_REMOVE_VIA_FOOTER_COMMENT') && WPFC_REMOVE_VIA_FOOTER_COMMENT){
|
350 |
-
|
351 |
-
}else{
|
352 |
-
$content = $content."<!-- via php -->";
|
353 |
-
die($content);
|
354 |
}
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
}else{
|
357 |
if($this->isMobile()){
|
@@ -408,8 +425,6 @@
|
|
408 |
public function ignored($buffer){
|
409 |
$list = array(
|
410 |
"\/wp\-comments\-post\.php",
|
411 |
-
"\/sitemap\.xml",
|
412 |
-
"\/sitemap_index\.xml",
|
413 |
"\/wp\-login\.php",
|
414 |
"\/robots\.txt",
|
415 |
"\/wp\-cron\.php",
|
@@ -518,31 +533,39 @@
|
|
518 |
return false;
|
519 |
}
|
520 |
|
521 |
-
public function is_json(
|
522 |
-
|
523 |
-
return true;
|
524 |
-
}
|
525 |
|
526 |
-
if(preg_match("
|
527 |
-
|
528 |
-
}
|
529 |
|
530 |
-
if(preg_match("
|
531 |
-
|
532 |
-
}
|
533 |
|
534 |
-
if(preg_match("/^\s*\
|
535 |
-
|
536 |
-
}
|
537 |
|
538 |
-
|
|
|
|
|
|
|
|
|
539 |
}
|
540 |
|
541 |
-
public function is_xml(
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
}
|
547 |
|
548 |
public function set_current_page_type($buffer){
|
@@ -551,8 +574,43 @@
|
|
551 |
$this->current_page_type = isset($out[1]) ? $out[1] : false;
|
552 |
}
|
553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
public function callback($buffer){
|
555 |
$this->set_current_page_type($buffer);
|
|
|
556 |
|
557 |
$buffer = $this->checkShortCode($buffer);
|
558 |
|
@@ -570,21 +628,19 @@
|
|
570 |
|
571 |
$buffer = preg_replace('/<\!--WPFC_PAGE_TYPE_[a-z]+-->/i', '', $buffer);
|
572 |
|
573 |
-
if(
|
574 |
return $buffer;
|
575 |
-
}else if(
|
576 |
return $buffer;
|
577 |
}else if (is_user_logged_in() || $this->isCommenter()){
|
578 |
return $buffer;
|
579 |
-
}else if($this->is_json($buffer)){
|
580 |
-
return $buffer;
|
581 |
}else if($this->isPasswordProtected($buffer)){
|
582 |
return $buffer."<!-- Password protected content has been detected -->";
|
583 |
}else if($this->isWpLogin($buffer)){
|
584 |
return $buffer."<!-- wp-login.php -->";
|
585 |
}else if($this->hasContactForm7WithCaptcha($buffer)){
|
586 |
return $buffer."<!-- This page was not cached because ContactForm7's captcha -->";
|
587 |
-
}else if((
|
588 |
return $buffer;
|
589 |
}else if($this->ignored($buffer)){
|
590 |
return $buffer;
|
@@ -724,10 +780,20 @@
|
|
724 |
$content = $this->fix_pre_tag($content, $buffer);
|
725 |
|
726 |
if($this->cacheFilePath){
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
731 |
}
|
732 |
|
733 |
return $content."<!-- need to refresh to see cached version -->";
|
@@ -799,6 +865,10 @@
|
|
799 |
}
|
800 |
|
801 |
public function checkHtml($buffer){
|
|
|
|
|
|
|
|
|
802 |
if(preg_match('/<html[^\>]*>/si', $buffer) && preg_match('/<body[^\>]*>/si', $buffer)){
|
803 |
return false;
|
804 |
}
|
@@ -862,7 +932,7 @@
|
|
862 |
$file_name = "index.";
|
863 |
$update_db_statistic = true;
|
864 |
|
865 |
-
if($buffer && strlen($buffer) > 100 &&
|
866 |
if(!preg_match("/^\<\!\-\-\sMobile\:\sWP\sFastest\sCache/i", $buffer)){
|
867 |
if(!preg_match("/^\<\!\-\-\sWP\sFastest\sCache/i", $buffer)){
|
868 |
$create = true;
|
9 |
public $exclude_rules = false;
|
10 |
public $preload_user_agent = false;
|
11 |
public $current_page_type = false;
|
12 |
+
public $current_page_content_type = false;
|
13 |
|
14 |
public function __construct(){
|
15 |
//to fix: PHP Notice: Undefined index: HTTP_USER_AGENT
|
345 |
|
346 |
|
347 |
//to show cache version via php if htaccess rewrite rule does not work
|
348 |
+
if(!$this->preload_user_agent && $this->cacheFilePath && (@file_exists($this->cacheFilePath."index.html") || @file_exists($this->cacheFilePath."index.json") || @file_exists($this->cacheFilePath."index.xml"))){
|
349 |
+
|
350 |
+
$via_php = "";
|
351 |
+
if(@file_exists($this->cacheFilePath."index.json")){
|
352 |
+
$file_extension = "json";
|
353 |
+
|
354 |
+
header('Content-type: application/json');
|
355 |
+
}else if(@file_exists($this->cacheFilePath."index.xml")){
|
356 |
+
$file_extension = "xml";
|
357 |
+
|
358 |
+
header('Content-type: text/xml');
|
359 |
+
}else{
|
360 |
+
$file_extension = "html";
|
361 |
+
$via_php = "<!-- via php -->";
|
362 |
+
}
|
363 |
+
|
364 |
+
if($content = @file_get_contents($this->cacheFilePath."index.".$file_extension)){
|
365 |
if(defined('WPFC_REMOVE_VIA_FOOTER_COMMENT') && WPFC_REMOVE_VIA_FOOTER_COMMENT){
|
366 |
+
$via_php = "";
|
|
|
|
|
|
|
367 |
}
|
368 |
+
|
369 |
+
$content = $content.$via_php;
|
370 |
+
|
371 |
+
die($content);
|
372 |
}
|
373 |
}else{
|
374 |
if($this->isMobile()){
|
425 |
public function ignored($buffer){
|
426 |
$list = array(
|
427 |
"\/wp\-comments\-post\.php",
|
|
|
|
|
428 |
"\/wp\-login\.php",
|
429 |
"\/robots\.txt",
|
430 |
"\/wp\-cron\.php",
|
533 |
return false;
|
534 |
}
|
535 |
|
536 |
+
public function is_json(){
|
537 |
+
return $this->current_page_content_type == "json" ? true : false;
|
|
|
|
|
538 |
|
539 |
+
// if(isset($_SERVER["HTTP_ACCEPT"]) && preg_match("/json/i", $_SERVER["HTTP_ACCEPT"])){
|
540 |
+
// return true;
|
541 |
+
// }
|
542 |
|
543 |
+
// if(preg_match("/^\/wp-json/", $_SERVER["REQUEST_URI"])){
|
544 |
+
// return true;
|
545 |
+
// }
|
546 |
|
547 |
+
// if(preg_match("/^\s*\{\s*[\"\']/i", $buffer)){
|
548 |
+
// return true;
|
549 |
+
// }
|
550 |
|
551 |
+
// if(preg_match("/^\s*\[\s*\{\s*[\"\']/i", $buffer)){
|
552 |
+
// return true;
|
553 |
+
// }
|
554 |
+
|
555 |
+
// return false;
|
556 |
}
|
557 |
|
558 |
+
public function is_xml(){
|
559 |
+
return $this->current_page_content_type == "xml" ? true : false;
|
560 |
+
|
561 |
+
// if(preg_match("/^\s*\<\?xml/i", $buffer)){
|
562 |
+
// return true;
|
563 |
+
// }
|
564 |
+
// return false;
|
565 |
+
}
|
566 |
+
|
567 |
+
public function is_html(){
|
568 |
+
return $this->current_page_content_type == "html" ? true : false;
|
569 |
}
|
570 |
|
571 |
public function set_current_page_type($buffer){
|
574 |
$this->current_page_type = isset($out[1]) ? $out[1] : false;
|
575 |
}
|
576 |
|
577 |
+
public function set_current_page_content_type($buffer){
|
578 |
+
$content_type = false;
|
579 |
+
if(function_exists("headers_list")){
|
580 |
+
$headers = headers_list();
|
581 |
+
foreach($headers as $header){
|
582 |
+
if(preg_match("/Content-Type\:/i", $header)){
|
583 |
+
$content_type = preg_replace("/Content-Type\:\s(.+)/i", "$1", $header);
|
584 |
+
}
|
585 |
+
}
|
586 |
+
}
|
587 |
+
|
588 |
+
if(preg_match("/xml/i", $content_type)){
|
589 |
+
$this->current_page_content_type = "xml";
|
590 |
+
}else if(preg_match("/json/i", $content_type)){
|
591 |
+
$this->current_page_content_type = "json";
|
592 |
+
}else{
|
593 |
+
$this->current_page_content_type = "html";
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
public function last_error($buffer = false){
|
598 |
+
if(function_exists("http_response_code") && (http_response_code() === 404)){
|
599 |
+
return true;
|
600 |
+
}
|
601 |
+
|
602 |
+
if(is_404()){
|
603 |
+
return true;
|
604 |
+
}
|
605 |
+
|
606 |
+
if(preg_match("/<body id\=\"error-page\">\s*<p>[^\>]+<\/p>\s*<\/body>/i", $buffer)){
|
607 |
+
return true;
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
public function callback($buffer){
|
612 |
$this->set_current_page_type($buffer);
|
613 |
+
$this->set_current_page_content_type($buffer);
|
614 |
|
615 |
$buffer = $this->checkShortCode($buffer);
|
616 |
|
628 |
|
629 |
$buffer = preg_replace('/<\!--WPFC_PAGE_TYPE_[a-z]+-->/i', '', $buffer);
|
630 |
|
631 |
+
if($this->is_json() && (!defined('WPFC_CACHE_JSON') || (defined('WPFC_CACHE_JSON') && WPFC_CACHE_JSON !== true))){
|
632 |
return $buffer;
|
633 |
+
}else if(preg_match("/Mediapartners-Google|Google\sWireless\sTranscoder/i", $_SERVER['HTTP_USER_AGENT'])){
|
634 |
return $buffer;
|
635 |
}else if (is_user_logged_in() || $this->isCommenter()){
|
636 |
return $buffer;
|
|
|
|
|
637 |
}else if($this->isPasswordProtected($buffer)){
|
638 |
return $buffer."<!-- Password protected content has been detected -->";
|
639 |
}else if($this->isWpLogin($buffer)){
|
640 |
return $buffer."<!-- wp-login.php -->";
|
641 |
}else if($this->hasContactForm7WithCaptcha($buffer)){
|
642 |
return $buffer."<!-- This page was not cached because ContactForm7's captcha -->";
|
643 |
+
}else if($this->last_error($buffer)){
|
644 |
return $buffer;
|
645 |
}else if($this->ignored($buffer)){
|
646 |
return $buffer;
|
780 |
$content = $this->fix_pre_tag($content, $buffer);
|
781 |
|
782 |
if($this->cacheFilePath){
|
783 |
+
if($this->is_html()){
|
784 |
+
$this->createFolder($this->cacheFilePath, $content);
|
785 |
+
do_action('wpfc_is_cacheable_action');
|
786 |
+
}else if($this->is_xml()){
|
787 |
+
$this->createFolder($this->cacheFilePath, $buffer, "xml");
|
788 |
+
do_action('wpfc_is_cacheable_action');
|
789 |
+
|
790 |
+
return $buffer;
|
791 |
+
}else if($this->is_json()){
|
792 |
+
$this->createFolder($this->cacheFilePath, $buffer, "json");
|
793 |
+
do_action('wpfc_is_cacheable_action');
|
794 |
+
|
795 |
+
return $buffer;
|
796 |
+
}
|
797 |
}
|
798 |
|
799 |
return $content."<!-- need to refresh to see cached version -->";
|
865 |
}
|
866 |
|
867 |
public function checkHtml($buffer){
|
868 |
+
if(!$this->is_html()){
|
869 |
+
return false;
|
870 |
+
}
|
871 |
+
|
872 |
if(preg_match('/<html[^\>]*>/si', $buffer) && preg_match('/<body[^\>]*>/si', $buffer)){
|
873 |
return false;
|
874 |
}
|
932 |
$file_name = "index.";
|
933 |
$update_db_statistic = true;
|
934 |
|
935 |
+
if($buffer && strlen($buffer) > 100 && preg_match("/html|xml|json/i", $extension)){
|
936 |
if(!preg_match("/^\<\!\-\-\sMobile\:\sWP\sFastest\sCache/i", $buffer)){
|
937 |
if(!preg_match("/^\<\!\-\-\sWP\sFastest\sCache/i", $buffer)){
|
938 |
$create = true;
|
inc/css-utilities.php
CHANGED
@@ -4,16 +4,9 @@
|
|
4 |
private $tags = array();
|
5 |
private $except = "";
|
6 |
private $wpfc;
|
7 |
-
private $cache_wpfc_minified = "";
|
8 |
|
9 |
public function __construct($wpfc, $html){
|
10 |
-
|
11 |
-
$this->cache_wpfc_minified = "cache/".$_SERVER['HTTP_HOST']."/wpfc-minified";
|
12 |
-
}else{
|
13 |
-
$this->cache_wpfc_minified = "cache/wpfc-minified";
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
$this->wpfc = $wpfc;
|
18 |
$this->html = $html;
|
19 |
$this->set_except_tags();
|
@@ -102,8 +95,8 @@
|
|
102 |
$combined_name = $this->wpfc->create_name($group_value);
|
103 |
$combined_link = "";
|
104 |
|
105 |
-
$cachFilePath =
|
106 |
-
$cssLink =
|
107 |
|
108 |
if(is_dir($cachFilePath)){
|
109 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
@@ -341,8 +334,8 @@
|
|
341 |
$this->url = $url;
|
342 |
$md5 = $this->wpfc->create_name($url);
|
343 |
|
344 |
-
$cachFilePath =
|
345 |
-
$cssLink =
|
346 |
|
347 |
if(is_dir($cachFilePath)){
|
348 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
@@ -595,6 +588,13 @@
|
|
595 |
return false;
|
596 |
}
|
597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
public function file_get_contents_curl($url, $version = ""){
|
599 |
if($data = $this->wpfc->read_file($url)){
|
600 |
return $data;
|
4 |
private $tags = array();
|
5 |
private $except = "";
|
6 |
private $wpfc;
|
|
|
7 |
|
8 |
public function __construct($wpfc, $html){
|
9 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
$this->wpfc = $wpfc;
|
11 |
$this->html = $html;
|
12 |
$this->set_except_tags();
|
95 |
$combined_name = $this->wpfc->create_name($group_value);
|
96 |
$combined_link = "";
|
97 |
|
98 |
+
$cachFilePath = $this->wpfc->getWpContentDir("/cache/wpfc-minified")."/".$combined_name;
|
99 |
+
$cssLink = $this->convert_path_to_link($cachFilePath);
|
100 |
|
101 |
if(is_dir($cachFilePath)){
|
102 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
334 |
$this->url = $url;
|
335 |
$md5 = $this->wpfc->create_name($url);
|
336 |
|
337 |
+
$cachFilePath = $this->wpfc->getWpContentDir("/cache/wpfc-minified")."/".$md5;
|
338 |
+
$cssLink = $this->convert_path_to_link($cachFilePath);
|
339 |
|
340 |
if(is_dir($cachFilePath)){
|
341 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
588 |
return false;
|
589 |
}
|
590 |
|
591 |
+
public function convert_path_to_link($path){
|
592 |
+
preg_match("/\/cache\/.+/", $path, $out);
|
593 |
+
$prefixLink = str_replace(array("http:", "https:"), "", WPFC_WP_CONTENT_URL);
|
594 |
+
|
595 |
+
return $prefixLink.$out[0];
|
596 |
+
}
|
597 |
+
|
598 |
public function file_get_contents_curl($url, $version = ""){
|
599 |
if($data = $this->wpfc->read_file($url)){
|
600 |
return $data;
|
inc/js-utilities.php
CHANGED
@@ -6,14 +6,8 @@
|
|
6 |
private $jsLinksExcept = "";
|
7 |
private $url = "";
|
8 |
private $minify;
|
9 |
-
private $cache_wpfc_minified = "";
|
10 |
|
11 |
public function __construct($wpfc, $html, $minify = false){
|
12 |
-
if(is_multisite()){
|
13 |
-
$this->cache_wpfc_minified = "cache/".$_SERVER['HTTP_HOST']."/wpfc-minified";
|
14 |
-
}else{
|
15 |
-
$this->cache_wpfc_minified = "cache/wpfc-minified";
|
16 |
-
}
|
17 |
|
18 |
//$this->html = preg_replace("/\s+/", " ", ((string) $html));
|
19 |
$this->minify = $minify;
|
@@ -175,8 +169,9 @@
|
|
175 |
|
176 |
$md5 = $this->wpfc->create_name($url);
|
177 |
|
178 |
-
$cachFilePath =
|
179 |
-
$jsLink =
|
|
|
180 |
|
181 |
if(is_dir($cachFilePath)){
|
182 |
return array("cachFilePath" => $cachFilePath, "jsContent" => "", "url" => $jsLink);
|
@@ -233,7 +228,8 @@
|
|
233 |
|
234 |
$name = base_convert(crc32($name), 20, 36);
|
235 |
|
236 |
-
$cachFilePath =
|
|
|
237 |
|
238 |
if(!is_dir($cachFilePath)){
|
239 |
$this->wpfc->createFolder($cachFilePath, $js_content, "js");
|
@@ -241,10 +237,7 @@
|
|
241 |
|
242 |
if($jsFiles = @scandir($cachFilePath, 1)){
|
243 |
|
244 |
-
$
|
245 |
-
|
246 |
-
$prefixLink = str_replace(array("http:", "https:"), "", WPFC_WP_CONTENT_URL);
|
247 |
-
$newLink = "<script src='".$prefixLink."/".$this->cache_wpfc_minified."/".$name."/".$jsFiles[0]."' type=\"text/javascript\"></script>";
|
248 |
|
249 |
$script_tag = substr($this->html, $value["start"], ($value["end"] - $value["start"] + 1));
|
250 |
|
@@ -258,6 +251,13 @@
|
|
258 |
}
|
259 |
}
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
public function file_get_contents_curl($url) {
|
262 |
if($data = $this->wpfc->read_file($url)){
|
263 |
return $data;
|
6 |
private $jsLinksExcept = "";
|
7 |
private $url = "";
|
8 |
private $minify;
|
|
|
9 |
|
10 |
public function __construct($wpfc, $html, $minify = false){
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
//$this->html = preg_replace("/\s+/", " ", ((string) $html));
|
13 |
$this->minify = $minify;
|
169 |
|
170 |
$md5 = $this->wpfc->create_name($url);
|
171 |
|
172 |
+
$cachFilePath = $this->wpfc->getWpContentDir("/cache/wpfc-minified")."/".$md5;
|
173 |
+
$jsLink = $this->convert_path_to_link($cachFilePath);
|
174 |
+
|
175 |
|
176 |
if(is_dir($cachFilePath)){
|
177 |
return array("cachFilePath" => $cachFilePath, "jsContent" => "", "url" => $jsLink);
|
228 |
|
229 |
$name = base_convert(crc32($name), 20, 36);
|
230 |
|
231 |
+
$cachFilePath = $this->wpfc->getWpContentDir("/cache/wpfc-minified")."/".$name;
|
232 |
+
$jsLink = $this->convert_path_to_link($cachFilePath);
|
233 |
|
234 |
if(!is_dir($cachFilePath)){
|
235 |
$this->wpfc->createFolder($cachFilePath, $js_content, "js");
|
237 |
|
238 |
if($jsFiles = @scandir($cachFilePath, 1)){
|
239 |
|
240 |
+
$newLink = "<script src='".$jsLink."/".$jsFiles[0]."' type=\"text/javascript\"></script>";
|
|
|
|
|
|
|
241 |
|
242 |
$script_tag = substr($this->html, $value["start"], ($value["end"] - $value["start"] + 1));
|
243 |
|
251 |
}
|
252 |
}
|
253 |
|
254 |
+
public function convert_path_to_link($path){
|
255 |
+
preg_match("/\/cache\/.+/", $path, $out);
|
256 |
+
$prefixLink = str_replace(array("http:", "https:"), "", WPFC_WP_CONTENT_URL);
|
257 |
+
|
258 |
+
return $prefixLink.$out[0];
|
259 |
+
}
|
260 |
+
|
261 |
public function file_get_contents_curl($url) {
|
262 |
if($data = $this->wpfc->read_file($url)){
|
263 |
return $data;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
|
|
4 |
Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 0.8.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,6 +103,14 @@ Wpfc supports Wordpress Multisite [<a target="_blank" href="https://www.wpfastes
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 0.8.9.6 =
|
107 |
* to clear post's cache which contains query string if WPFC_CACHE_QUERYSTRING is defined
|
108 |
* refactoring of excluding system
|
4 |
Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 0.8.9.7
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 0.8.9.7 =
|
107 |
+
* to create cache for xml sources
|
108 |
+
* to create cache for json sources [<a target="_blank" href="https://www.wpfastestcache.com/features/how-to-cache-json/">Details</a>]
|
109 |
+
* to clear cache after Maintenance Mode activation/deactivation on Elementor plugin
|
110 |
+
* refactoring of clearing cache hook system
|
111 |
+
* refactoring of cache time-out time list
|
112 |
+
* to disable cache when "The site is experiencing technical difficulties." error occurs
|
113 |
+
|
114 |
= 0.8.9.6 =
|
115 |
* to clear post's cache which contains query string if WPFC_CACHE_QUERYSTRING is defined
|
116 |
* refactoring of excluding system
|
templates/timeout.php
CHANGED
@@ -126,8 +126,13 @@
|
|
126 |
<select name="wpfc-timeout-rule-schedule">
|
127 |
<?php
|
128 |
$schedules = wp_get_schedules();
|
|
|
129 |
$first = true;
|
130 |
foreach ($schedules as $key => $value) {
|
|
|
|
|
|
|
|
|
131 |
if($first){
|
132 |
echo "<option value=''>Choose One</option>";
|
133 |
$first = false;
|
126 |
<select name="wpfc-timeout-rule-schedule">
|
127 |
<?php
|
128 |
$schedules = wp_get_schedules();
|
129 |
+
$schedules = wp_list_sort($schedules, "interval", "ASC", true);
|
130 |
$first = true;
|
131 |
foreach ($schedules as $key => $value) {
|
132 |
+
if(!$value["wpfc"]){
|
133 |
+
continue;
|
134 |
+
}
|
135 |
+
|
136 |
if($first){
|
137 |
echo "<option value=''>Choose One</option>";
|
138 |
$first = false;
|
wpFastestCache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Fastest Cache
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
|
5 |
Description: The simplest and fastest WP Cache system
|
6 |
-
Version: 0.8.9.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -118,10 +118,18 @@ GNU General Public License for more details.
|
|
118 |
//add_action('init', array($this, "nonce_timeout"));
|
119 |
|
120 |
// to clear cache after new Woocommerce orders
|
121 |
-
add_action(
|
122 |
|
123 |
// kk Star Ratings: to clear the cache of the post after voting
|
124 |
-
add_action(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
// to clear cache after ajax request by other plugins
|
127 |
if(isset($_POST["action"])){
|
@@ -774,7 +782,7 @@ GNU General Public License for more details.
|
|
774 |
//https://wpml.org/forums/topic/wpml-language-switch-wp-fastest-cache-issue/
|
775 |
$language_negotiation_type = apply_filters('wpml_setting', false, 'language_negotiation_type');
|
776 |
if(($language_negotiation_type == 2) && $this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
|
777 |
-
$path = preg_replace("/\/cache\/(all|wpfc-mobile-cache)/", "/cache/".$_SERVER['HTTP_HOST']."/$1", $path);
|
778 |
}
|
779 |
|
780 |
if(is_multisite()){
|
@@ -871,14 +879,15 @@ GNU General Public License for more details.
|
|
871 |
|
872 |
protected function commentHooks(){
|
873 |
//it works when the status of a comment changes
|
874 |
-
|
875 |
|
876 |
//it works when a comment is saved in the database
|
877 |
-
|
878 |
}
|
879 |
|
880 |
-
public function detectNewComment($comment_id){
|
881 |
-
if(current_user_can( 'manage_options') || !get_option('comment_moderation')){
|
|
|
882 |
$this->singleDeleteCache($comment_id);
|
883 |
}
|
884 |
}
|
@@ -1437,13 +1446,13 @@ GNU General Public License for more details.
|
|
1437 |
$schedules['everyminute'] = array(
|
1438 |
'interval' => 60*1,
|
1439 |
'display' => __( 'Once Every 1 Minute' ),
|
1440 |
-
'wpfc' =>
|
1441 |
);
|
1442 |
|
1443 |
$schedules['everyfiveminute'] = array(
|
1444 |
'interval' => 60*5,
|
1445 |
'display' => __( 'Once Every 5 Minutes' ),
|
1446 |
-
'wpfc' =>
|
1447 |
);
|
1448 |
|
1449 |
$schedules['everyfifteenminute'] = array(
|
@@ -1530,9 +1539,9 @@ GNU General Public License for more details.
|
|
1530 |
'wpfc' => true
|
1531 |
);
|
1532 |
|
1533 |
-
$schedules['
|
1534 |
'interval' => 60*60*24*7,
|
1535 |
-
'display' => __( 'Once
|
1536 |
'wpfc' => true
|
1537 |
);
|
1538 |
|
@@ -1542,6 +1551,12 @@ GNU General Public License for more details.
|
|
1542 |
'wpfc' => true
|
1543 |
);
|
1544 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1545 |
$schedules['montly'] = array(
|
1546 |
'interval' => 60*60*24*30,
|
1547 |
'display' => __( 'Once a Month' ),
|
@@ -1789,6 +1804,16 @@ GNU General Public License for more details.
|
|
1789 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
1790 |
require_once "inc/cli.php";
|
1791 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1792 |
|
1793 |
$GLOBALS["wp_fastest_cache"] = new WpFastestCache();
|
1794 |
?>
|
3 |
Plugin Name: WP Fastest Cache
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
|
5 |
Description: The simplest and fastest WP Cache system
|
6 |
+
Version: 0.8.9.7
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
118 |
//add_action('init', array($this, "nonce_timeout"));
|
119 |
|
120 |
// to clear cache after new Woocommerce orders
|
121 |
+
add_action('woocommerce_checkout_order_processed', array($this, 'clear_cache_after_woocommerce_checkout_order_processed'), 1, 1);
|
122 |
|
123 |
// kk Star Ratings: to clear the cache of the post after voting
|
124 |
+
add_action('kksr_rate', array($this, 'clear_cache_on_kksr_rate'));
|
125 |
+
|
126 |
+
// Elementor: to clear cache after Maintenance Mode activation/deactivation
|
127 |
+
add_action('elementor/maintenance_mode/mode_changed', array($this, 'deleteCache'));
|
128 |
+
|
129 |
+
// clearing cache hooks
|
130 |
+
add_action("wpfc_clear_all_cache", array($this, 'deleteCache'), 10, 1);
|
131 |
+
add_action("wpfc_clear_post_cache_by_id", array($this, 'singleDeleteCache'), 10, 2);
|
132 |
+
|
133 |
|
134 |
// to clear cache after ajax request by other plugins
|
135 |
if(isset($_POST["action"])){
|
782 |
//https://wpml.org/forums/topic/wpml-language-switch-wp-fastest-cache-issue/
|
783 |
$language_negotiation_type = apply_filters('wpml_setting', false, 'language_negotiation_type');
|
784 |
if(($language_negotiation_type == 2) && $this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
|
785 |
+
$path = preg_replace("/\/cache\/(all|wpfc-minified|wpfc-widget-cache|wpfc-mobile-cache)/", "/cache/".$_SERVER['HTTP_HOST']."/$1", $path);
|
786 |
}
|
787 |
|
788 |
if(is_multisite()){
|
879 |
|
880 |
protected function commentHooks(){
|
881 |
//it works when the status of a comment changes
|
882 |
+
add_action('wp_set_comment_status', array($this, 'singleDeleteCache'), 10, 1);
|
883 |
|
884 |
//it works when a comment is saved in the database
|
885 |
+
add_action('comment_post', array($this, 'detectNewComment'), 10, 2);
|
886 |
}
|
887 |
|
888 |
+
public function detectNewComment($comment_id, $comment_approved){
|
889 |
+
// if(current_user_can( 'manage_options') || !get_option('comment_moderation')){
|
890 |
+
if($comment_approved === 1){
|
891 |
$this->singleDeleteCache($comment_id);
|
892 |
}
|
893 |
}
|
1446 |
$schedules['everyminute'] = array(
|
1447 |
'interval' => 60*1,
|
1448 |
'display' => __( 'Once Every 1 Minute' ),
|
1449 |
+
'wpfc' => true
|
1450 |
);
|
1451 |
|
1452 |
$schedules['everyfiveminute'] = array(
|
1453 |
'interval' => 60*5,
|
1454 |
'display' => __( 'Once Every 5 Minutes' ),
|
1455 |
+
'wpfc' => true
|
1456 |
);
|
1457 |
|
1458 |
$schedules['everyfifteenminute'] = array(
|
1539 |
'wpfc' => true
|
1540 |
);
|
1541 |
|
1542 |
+
$schedules['everysevendays'] = array(
|
1543 |
'interval' => 60*60*24*7,
|
1544 |
+
'display' => __( 'Once Every 7 Days' ),
|
1545 |
'wpfc' => true
|
1546 |
);
|
1547 |
|
1551 |
'wpfc' => true
|
1552 |
);
|
1553 |
|
1554 |
+
$schedules['everyfifteendays'] = array(
|
1555 |
+
'interval' => 60*60*24*15,
|
1556 |
+
'display' => __( 'Once Every 15 Days' ),
|
1557 |
+
'wpfc' => true
|
1558 |
+
);
|
1559 |
+
|
1560 |
$schedules['montly'] = array(
|
1561 |
'interval' => 60*60*24*30,
|
1562 |
'display' => __( 'Once a Month' ),
|
1804 |
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
1805 |
require_once "inc/cli.php";
|
1806 |
}
|
1807 |
+
|
1808 |
+
function wpfc_clear_all_cache($minified = false){
|
1809 |
+
do_action("wpfc_clear_all_cache", $minified);
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
function wpfc_clear_post_cache_by_id($post_id = false){
|
1813 |
+
if($post_id){
|
1814 |
+
do_action("wpfc_clear_post_cache_by_id", false, $post_id);
|
1815 |
+
}
|
1816 |
+
}
|
1817 |
|
1818 |
$GLOBALS["wp_fastest_cache"] = new WpFastestCache();
|
1819 |
?>
|