Version Description
- [FEATURE] Widget Cache [Details]
- to add browser cache for woff2
- to fix Woocommerce basket issue
- to serve the sources via cdn for logged-in users
- to prevent removing "=" from exclude rules
- to change
to - to fix problem about random url of photon
- to replace origin-url which starts with /wp-content with cdn-url
- to replace wp_get_recent_posts() with get_results() for preload
- to replace the attribute which are data-srcsmall|data-srclarge|data-srcfull with cdn-url
- [FEATURE] Compatible with WP Hide & Security Enhancer
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.6.8 |
Comparing to | |
See all releases |
Code changes from version 0.8.6.7 to 0.8.6.8
- inc/admin.php +36 -29
- inc/cache.php +56 -40
- inc/css-utilities.php +11 -3
- readme.txt +14 -1
- wpFastestCache.php +36 -20
inc/admin.php
CHANGED
@@ -388,13 +388,20 @@
|
|
388 |
|
389 |
public function insertWebp($htaccess){
|
390 |
$tester_arr = array(
|
391 |
-
|
392 |
"berkatan.com",
|
393 |
"pembeportakal.com",
|
394 |
"wpfastestcache.com",
|
395 |
"zamknijkonto.pl",
|
396 |
"devv.zamknijkonto.pl",
|
397 |
-
"goldsgym.nl"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
);
|
399 |
|
400 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){
|
@@ -433,6 +440,7 @@
|
|
433 |
$data = "# BEGIN LBCWpFastestCache"."\n".
|
434 |
'<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
|
435 |
'<IfModule mod_expires.c>'."\n".
|
|
|
436 |
'ExpiresActive On'."\n".
|
437 |
'ExpiresDefault A0'."\n".
|
438 |
'ExpiresByType image/webp A2592000'."\n".
|
@@ -446,6 +454,7 @@
|
|
446 |
'ExpiresByType text/javascript A2592000'."\n".
|
447 |
'ExpiresByType application/javascript A2592000'."\n".
|
448 |
'ExpiresByType application/x-javascript A2592000'."\n".
|
|
|
449 |
'</IfModule>'."\n".
|
450 |
'<IfModule mod_headers.c>'."\n".
|
451 |
'Header set Expires "max-age=2592000, public"'."\n".
|
@@ -565,7 +574,7 @@
|
|
565 |
}
|
566 |
|
567 |
if(isset($_POST["wpFastestCacheLoggedInUser"]) && $_POST["wpFastestCacheLoggedInUser"] == "on"){
|
568 |
-
$loggedInUser = "RewriteCond %{HTTP:Cookie} !
|
569 |
}
|
570 |
|
571 |
if(!preg_match("/^https/i", get_option("home"))){
|
@@ -593,6 +602,7 @@
|
|
593 |
$trailing_slash_rule.
|
594 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
595 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
|
|
596 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
597 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
598 |
|
@@ -625,7 +635,7 @@
|
|
625 |
}
|
626 |
|
627 |
$data = $data."</IfModule>"."\n".
|
628 |
-
"<FilesMatch \"\.(html|htm)$\">"."\n".
|
629 |
"AddDefaultCharset UTF-8"."\n".
|
630 |
"<ifModule mod_headers.c>"."\n".
|
631 |
"FileETag None"."\n".
|
@@ -867,26 +877,20 @@
|
|
867 |
);
|
868 |
|
869 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
|
|
|
870 |
|
871 |
|
872 |
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
<?php }else{ ?>
|
884 |
-
<div class="questionCon update-needed">
|
885 |
-
<div class="question">Widget Cache</div>
|
886 |
-
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
|
887 |
-
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
888 |
-
</div>
|
889 |
-
<?php } ?>
|
890 |
<?php }else{ ?>
|
891 |
<div class="questionCon update-needed">
|
892 |
<div class="question">Widget Cache</div>
|
@@ -895,20 +899,22 @@
|
|
895 |
</div>
|
896 |
<?php } ?>
|
897 |
<?php }else{ ?>
|
898 |
-
<div class="questionCon
|
899 |
<div class="question">Widget Cache</div>
|
900 |
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
|
901 |
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
902 |
</div>
|
903 |
<?php } ?>
|
904 |
-
|
905 |
-
|
906 |
-
|
|
|
|
|
|
|
907 |
<?php } ?>
|
908 |
|
909 |
|
910 |
|
911 |
-
|
912 |
<div class="questionCon">
|
913 |
<div class="question">Preload</div>
|
914 |
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCachePreload; ?> id="wpFastestCachePreload" name="wpFastestCachePreload"><label for="wpFastestCachePreload">Create the cache of all the site automatically</label></div>
|
@@ -1178,7 +1184,8 @@
|
|
1178 |
"mygamer.com",
|
1179 |
"gingerdomain.com",
|
1180 |
"topclassprinting.com",
|
1181 |
-
"camilazivit.com.br"
|
|
|
1182 |
);
|
1183 |
|
1184 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
|
@@ -1252,7 +1259,7 @@
|
|
1252 |
<span id="show-delete-log">Show Logs</span>
|
1253 |
<span id="hide-delete-log" style="display:none;">Hide Logs</span>
|
1254 |
</div>
|
1255 |
-
<h2 style="opacity:0.3;padding-left:20px;padding-bottom:10px;">Cache
|
1256 |
<div id="wpfc-cache-statics" style="opacity:0.3;width:100%;float:right;margin:15px 0;">
|
1257 |
<style type="text/css">
|
1258 |
#wpfc-cache-statics > div{
|
@@ -1571,7 +1578,7 @@
|
|
1571 |
<h1 style="float:left;" id="just-h1">Just</h1><h1><span style="margin-left:5px;" id="wpfc-premium-price"><?php echo $premium_price; ?></span></h1>
|
1572 |
<p>The download button will be available after paid. You can buy the premium version now.</p>
|
1573 |
|
1574 |
-
<?php if(!preg_match("/Caiu\s*Na/i", get_bloginfo("name")) && !preg_match("/caiuna/i", $_SERVER["HTTP_HOST"]) && !preg_match("/\.ir$/i", $_SERVER["HTTP_HOST"])){ ?>
|
1575 |
<?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
|
1576 |
<button id="wpfc-buy-premium-button" type="submit" class="wpfc-btn primaryDisableCta" style="width:200px;">
|
1577 |
<span>Purchased</span>
|
388 |
|
389 |
public function insertWebp($htaccess){
|
390 |
$tester_arr = array(
|
391 |
+
"tr-TR",
|
392 |
"berkatan.com",
|
393 |
"pembeportakal.com",
|
394 |
"wpfastestcache.com",
|
395 |
"zamknijkonto.pl",
|
396 |
"devv.zamknijkonto.pl",
|
397 |
+
"goldsgym.nl",
|
398 |
+
"luxury-chauffeurs.com",
|
399 |
+
"rashays.com",
|
400 |
+
"bitcoincafe.ch",
|
401 |
+
"romeing.it",
|
402 |
+
"huzurlabeslen.com",
|
403 |
+
"premiumlv.com",
|
404 |
+
"ribbons.se"
|
405 |
);
|
406 |
|
407 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){
|
440 |
$data = "# BEGIN LBCWpFastestCache"."\n".
|
441 |
'<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
|
442 |
'<IfModule mod_expires.c>'."\n".
|
443 |
+
'AddType application/font-woff2 .woff2'."\n".
|
444 |
'ExpiresActive On'."\n".
|
445 |
'ExpiresDefault A0'."\n".
|
446 |
'ExpiresByType image/webp A2592000'."\n".
|
454 |
'ExpiresByType text/javascript A2592000'."\n".
|
455 |
'ExpiresByType application/javascript A2592000'."\n".
|
456 |
'ExpiresByType application/x-javascript A2592000'."\n".
|
457 |
+
'ExpiresByType application/font-woff2 A2592000'."\n".
|
458 |
'</IfModule>'."\n".
|
459 |
'<IfModule mod_headers.c>'."\n".
|
460 |
'Header set Expires "max-age=2592000, public"'."\n".
|
574 |
}
|
575 |
|
576 |
if(isset($_POST["wpFastestCacheLoggedInUser"]) && $_POST["wpFastestCacheLoggedInUser"] == "on"){
|
577 |
+
$loggedInUser = "RewriteCond %{HTTP:Cookie} !wordpress_logged_in"."\n";
|
578 |
}
|
579 |
|
580 |
if(!preg_match("/^https/i", get_option("home"))){
|
602 |
$trailing_slash_rule.
|
603 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
604 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
605 |
+
"RewriteCond %{HTTP:Cookie} !wp_woocommerce_session"."\n".
|
606 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
607 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
608 |
|
635 |
}
|
636 |
|
637 |
$data = $data."</IfModule>"."\n".
|
638 |
+
"<FilesMatch \"index\.(html|htm)$\">"."\n".
|
639 |
"AddDefaultCharset UTF-8"."\n".
|
640 |
"<ifModule mod_headers.c>"."\n".
|
641 |
"FileETag None"."\n".
|
877 |
);
|
878 |
|
879 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
|
880 |
+
<?php } ?>
|
881 |
|
882 |
|
883 |
|
884 |
+
<?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
|
885 |
+
<?php if(file_exists(WPFC_WP_CONTENT_DIR."/plugins/wp-fastest-cache-premium/pro/library/widget-cache.php")){ ?>
|
886 |
+
<?php include_once WPFC_WP_CONTENT_DIR."/plugins/wp-fastest-cache-premium/pro/library/widget-cache.php"; ?>
|
887 |
+
|
888 |
+
<?php if(class_exists("WpfcWidgetCache") && method_exists("WpfcWidgetCache", "add_filter_admin")){ ?>
|
889 |
+
<div class="questionCon">
|
890 |
+
<div class="question">Widget Cache</div>
|
891 |
+
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache" name="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
|
892 |
+
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
893 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
<?php }else{ ?>
|
895 |
<div class="questionCon update-needed">
|
896 |
<div class="question">Widget Cache</div>
|
899 |
</div>
|
900 |
<?php } ?>
|
901 |
<?php }else{ ?>
|
902 |
+
<div class="questionCon update-needed">
|
903 |
<div class="question">Widget Cache</div>
|
904 |
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
|
905 |
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
906 |
</div>
|
907 |
<?php } ?>
|
908 |
+
<?php }else{ ?>
|
909 |
+
<div class="questionCon disabled">
|
910 |
+
<div class="question">Widget Cache</div>
|
911 |
+
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
|
912 |
+
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
913 |
+
</div>
|
914 |
<?php } ?>
|
915 |
|
916 |
|
917 |
|
|
|
918 |
<div class="questionCon">
|
919 |
<div class="question">Preload</div>
|
920 |
<div class="inputCon"><input type="checkbox" <?php echo $wpFastestCachePreload; ?> id="wpFastestCachePreload" name="wpFastestCachePreload"><label for="wpFastestCachePreload">Create the cache of all the site automatically</label></div>
|
1184 |
"mygamer.com",
|
1185 |
"gingerdomain.com",
|
1186 |
"topclassprinting.com",
|
1187 |
+
"camilazivit.com.br",
|
1188 |
+
"spycoupon.in"
|
1189 |
);
|
1190 |
|
1191 |
if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
|
1259 |
<span id="show-delete-log">Show Logs</span>
|
1260 |
<span id="hide-delete-log" style="display:none;">Hide Logs</span>
|
1261 |
</div>
|
1262 |
+
<h2 style="opacity:0.3;padding-left:20px;padding-bottom:10px;">Cache Statistics</h2>
|
1263 |
<div id="wpfc-cache-statics" style="opacity:0.3;width:100%;float:right;margin:15px 0;">
|
1264 |
<style type="text/css">
|
1265 |
#wpfc-cache-statics > div{
|
1578 |
<h1 style="float:left;" id="just-h1">Just</h1><h1><span style="margin-left:5px;" id="wpfc-premium-price"><?php echo $premium_price; ?></span></h1>
|
1579 |
<p>The download button will be available after paid. You can buy the premium version now.</p>
|
1580 |
|
1581 |
+
<?php if(!preg_match("/Caiu\s*Na/i", get_bloginfo("name")) && !preg_match("/(caiuna|escort|porn)/i", $_SERVER["HTTP_HOST"]) && !preg_match("/\.ir$/i", $_SERVER["HTTP_HOST"])){ ?>
|
1582 |
<?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
|
1583 |
<button id="wpfc-buy-premium-button" type="submit" class="wpfc-btn primaryDisableCta" style="width:200px;">
|
1584 |
<span>Purchased</span>
|
inc/cache.php
CHANGED
@@ -36,18 +36,6 @@
|
|
36 |
}
|
37 |
}
|
38 |
|
39 |
-
// WP Hide & Security Enhancer
|
40 |
-
if($this->isPluginActive('wp-hide-security-enhancer/wp-hide.php')){
|
41 |
-
$wph_settings = get_option("wph_settings");
|
42 |
-
|
43 |
-
if(isset($wph_settings["module_settings"])){
|
44 |
-
if(isset($wph_settings["module_settings"]["new_content_path"]) && $wph_settings["module_settings"]["new_content_path"]){
|
45 |
-
$wph_settings["module_settings"]["new_content_path"] = trim($wph_settings["module_settings"]["new_content_path"], "/");
|
46 |
-
$content_url = str_replace(basename(WPFC_WP_CONTENT_DIR), $wph_settings["module_settings"]["new_content_path"], $content_url);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
if (!defined('WPFC_WP_CONTENT_URL')) {
|
52 |
define("WPFC_WP_CONTENT_URL", $content_url);
|
53 |
}
|
@@ -88,7 +76,11 @@
|
|
88 |
if(!preg_match("/\.html/i", $_SERVER["REQUEST_URI"])){
|
89 |
if($this->is_trailing_slash()){
|
90 |
if(!preg_match("/\/$/", $_SERVER["REQUEST_URI"])){
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
}else{
|
94 |
//toDo
|
@@ -151,6 +143,8 @@
|
|
151 |
// to check logged-in user
|
152 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
153 |
if(preg_match("/wordpress_logged_in/i", $cookie_key)){
|
|
|
|
|
154 |
return 0;
|
155 |
}
|
156 |
}
|
@@ -159,6 +153,18 @@
|
|
159 |
// to check comment author
|
160 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
161 |
if(preg_match("/comment_author_/i", $cookie_key)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
return 0;
|
163 |
}
|
164 |
}
|
@@ -192,7 +198,11 @@
|
|
192 |
|
193 |
if(!preg_match("/^https/i", get_option("home")) && is_ssl()){
|
194 |
//must be normal connection
|
195 |
-
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
|
198 |
if(preg_match("/www\./", get_option("home")) && !preg_match("/www\./", $_SERVER['HTTP_HOST'])){
|
@@ -362,7 +372,7 @@
|
|
362 |
return false;
|
363 |
}
|
364 |
|
365 |
-
public function is_json(){
|
366 |
if(isset($_SERVER["HTTP_ACCEPT"]) && preg_match("/json/i", $_SERVER["HTTP_ACCEPT"])){
|
367 |
return true;
|
368 |
}
|
@@ -371,6 +381,14 @@
|
|
371 |
return true;
|
372 |
}
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
return false;
|
375 |
}
|
376 |
|
@@ -397,16 +415,10 @@
|
|
397 |
return $buffer;
|
398 |
}else if (is_user_logged_in() || $this->isCommenter()){
|
399 |
return $buffer;
|
400 |
-
}else if($this->is_json()){
|
401 |
return $buffer;
|
402 |
}else if(isset($_COOKIE["wptouch-pro-view"])){
|
403 |
return $buffer."<!-- \$_COOKIE['wptouch-pro-view'] has been set -->";
|
404 |
-
}else if($this->checkWoocommerceSession()){
|
405 |
-
if($this->checkHtml($buffer)){
|
406 |
-
return $buffer;
|
407 |
-
}else{
|
408 |
-
return $buffer."<!-- \$_COOKIE['wp_woocommerce_session'] has been set -->";
|
409 |
-
}
|
410 |
}else if($this->isPasswordProtected($buffer)){
|
411 |
return $buffer."<!-- Password protected content has been detected -->";
|
412 |
}else if($this->isWpLogin($buffer)){
|
@@ -515,16 +527,10 @@
|
|
515 |
}else{
|
516 |
$content = $this->cacheDate($content);
|
517 |
$content = $this->minify($content);
|
|
|
|
|
518 |
|
519 |
-
if($this->cdn){
|
520 |
-
$content = preg_replace_callback("/(srcset|src|href|data-lazyload)\s{0,2}\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
|
521 |
-
// url()
|
522 |
-
$content = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this, 'cdn_replace_urls'), $content);
|
523 |
-
// {"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
|
524 |
-
$content = preg_replace_callback("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", array($this, 'cdn_replace_urls'), $content);
|
525 |
-
}
|
526 |
|
527 |
-
|
528 |
$content = str_replace("<!--WPFC_FOOTER_START-->", "", $content);
|
529 |
|
530 |
|
@@ -547,6 +553,12 @@
|
|
547 |
}
|
548 |
}
|
549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
if($this->cacheFilePath){
|
551 |
$this->createFolder($this->cacheFilePath, $content);
|
552 |
}
|
@@ -556,6 +568,20 @@
|
|
556 |
}
|
557 |
}
|
558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
public function get_header($content){
|
560 |
$head_first_index = strpos($content, "<head");
|
561 |
$head_last_index = strpos($content, "</head>");
|
@@ -724,16 +750,6 @@
|
|
724 |
}
|
725 |
}
|
726 |
|
727 |
-
public function checkWoocommerceSession(){
|
728 |
-
foreach($_COOKIE as $key => $value){
|
729 |
-
if(preg_match("/^wp\_woocommerce\_session/", $key)){
|
730 |
-
return true;
|
731 |
-
}
|
732 |
-
}
|
733 |
-
|
734 |
-
return false;
|
735 |
-
}
|
736 |
-
|
737 |
public function isWpLogin($buffer){
|
738 |
// if(preg_match("/<form[^\>]+loginform[^\>]+>((?:(?!<\/form).)+)user_login((?:(?!<\/form).)+)user_pass((?:(?!<\/form).)+)<\/form>/si", $buffer)){
|
739 |
// return true;
|
36 |
}
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
if (!defined('WPFC_WP_CONTENT_URL')) {
|
40 |
define("WPFC_WP_CONTENT_URL", $content_url);
|
41 |
}
|
76 |
if(!preg_match("/\.html/i", $_SERVER["REQUEST_URI"])){
|
77 |
if($this->is_trailing_slash()){
|
78 |
if(!preg_match("/\/$/", $_SERVER["REQUEST_URI"])){
|
79 |
+
if(defined('WPFC_CACHE_QUERYSTRING') && WPFC_CACHE_QUERYSTRING){
|
80 |
+
//toDo
|
81 |
+
}else{
|
82 |
+
$this->cacheFilePath = false;
|
83 |
+
}
|
84 |
}
|
85 |
}else{
|
86 |
//toDo
|
143 |
// to check logged-in user
|
144 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
145 |
if(preg_match("/wordpress_logged_in/i", $cookie_key)){
|
146 |
+
ob_start(array($this, "cdn_rewrite"));
|
147 |
+
|
148 |
return 0;
|
149 |
}
|
150 |
}
|
153 |
// to check comment author
|
154 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
155 |
if(preg_match("/comment_author_/i", $cookie_key)){
|
156 |
+
ob_start(array($this, "cdn_rewrite"));
|
157 |
+
|
158 |
+
return 0;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
// to check wp_woocommerce_session cookie
|
163 |
+
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
164 |
+
if(preg_match("/^wp\_woocommerce\_session/", $cookie_key)){
|
165 |
+
//"<!-- \$_COOKIE['wp_woocommerce_session'] has been set -->";
|
166 |
+
ob_start(array($this, "cdn_rewrite"));
|
167 |
+
|
168 |
return 0;
|
169 |
}
|
170 |
}
|
198 |
|
199 |
if(!preg_match("/^https/i", get_option("home")) && is_ssl()){
|
200 |
//must be normal connection
|
201 |
+
if(!$this->isPluginActive('really-simple-ssl/rlrsssl-really-simple-ssl.php')){
|
202 |
+
if(!$this->isPluginActive('really-simple-ssl-pro/really-simple-ssl-pro.php')){
|
203 |
+
return 0;
|
204 |
+
}
|
205 |
+
}
|
206 |
}
|
207 |
|
208 |
if(preg_match("/www\./", get_option("home")) && !preg_match("/www\./", $_SERVER['HTTP_HOST'])){
|
372 |
return false;
|
373 |
}
|
374 |
|
375 |
+
public function is_json($buffer){
|
376 |
if(isset($_SERVER["HTTP_ACCEPT"]) && preg_match("/json/i", $_SERVER["HTTP_ACCEPT"])){
|
377 |
return true;
|
378 |
}
|
381 |
return true;
|
382 |
}
|
383 |
|
384 |
+
if(preg_match("/^\s*\{\s*[\"\']/i", $buffer)){
|
385 |
+
return true;
|
386 |
+
}
|
387 |
+
|
388 |
+
if(preg_match("/^\s*\[\s*\{\s*[\"\']/i", $buffer)){
|
389 |
+
return true;
|
390 |
+
}
|
391 |
+
|
392 |
return false;
|
393 |
}
|
394 |
|
415 |
return $buffer;
|
416 |
}else if (is_user_logged_in() || $this->isCommenter()){
|
417 |
return $buffer;
|
418 |
+
}else if($this->is_json($buffer)){
|
419 |
return $buffer;
|
420 |
}else if(isset($_COOKIE["wptouch-pro-view"])){
|
421 |
return $buffer."<!-- \$_COOKIE['wptouch-pro-view'] has been set -->";
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
}else if($this->isPasswordProtected($buffer)){
|
423 |
return $buffer."<!-- Password protected content has been detected -->";
|
424 |
}else if($this->isWpLogin($buffer)){
|
527 |
}else{
|
528 |
$content = $this->cacheDate($content);
|
529 |
$content = $this->minify($content);
|
530 |
+
|
531 |
+
$content = $this->cdn_rewrite($content);
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
|
|
|
534 |
$content = str_replace("<!--WPFC_FOOTER_START-->", "", $content);
|
535 |
|
536 |
|
553 |
}
|
554 |
}
|
555 |
|
556 |
+
// WP Hide & Security Enhancer
|
557 |
+
if($this->isPluginActive('wp-hide-security-enhancer/wp-hide.php')){
|
558 |
+
global $wph;
|
559 |
+
$content = $wph->functions->content_urls_replacement($content, $wph->functions->get_replacement_list());
|
560 |
+
}
|
561 |
+
|
562 |
if($this->cacheFilePath){
|
563 |
$this->createFolder($this->cacheFilePath, $content);
|
564 |
}
|
568 |
}
|
569 |
}
|
570 |
|
571 |
+
public function cdn_rewrite($content){
|
572 |
+
if($this->cdn){
|
573 |
+
$content = preg_replace_callback("/(srcset|src|href|data-lazyload|data-srcsmall|data-srclarge|data-srcfull|data-slide-img)\s{0,2}\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
|
574 |
+
//url()
|
575 |
+
$content = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this, 'cdn_replace_urls'), $content);
|
576 |
+
//{"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
|
577 |
+
$content = preg_replace_callback("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", array($this, 'cdn_replace_urls'), $content);
|
578 |
+
//<script>var loaderRandomImages=["https:\/\/www.site.com\/wp-content\/uploads\/2016\/12\/image.jpg"];</script>
|
579 |
+
$content = preg_replace_callback("/[\"\']https?\:\\\\\/\\\\\/[^\"\']+[\"\']/i", array($this, 'cdn_replace_urls'), $content);
|
580 |
+
}
|
581 |
+
|
582 |
+
return $content;
|
583 |
+
}
|
584 |
+
|
585 |
public function get_header($content){
|
586 |
$head_first_index = strpos($content, "<head");
|
587 |
$head_last_index = strpos($content, "</head>");
|
750 |
}
|
751 |
}
|
752 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
753 |
public function isWpLogin($buffer){
|
754 |
// if(preg_match("/<form[^\>]+loginform[^\>]+>((?:(?!<\/form).)+)user_login((?:(?!<\/form).)+)user_pass((?:(?!<\/form).)+)<\/form>/si", $buffer)){
|
755 |
// return true;
|
inc/css-utilities.php
CHANGED
@@ -165,7 +165,7 @@
|
|
165 |
public function create_name($arr){
|
166 |
$name = "";
|
167 |
foreach ($arr as $tag_key => $tag_value) {
|
168 |
-
$name = $name.$tag_value["href"];
|
169 |
}
|
170 |
return md5($name);
|
171 |
}
|
@@ -329,11 +329,19 @@
|
|
329 |
return $list;
|
330 |
}
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
public function minify($url){
|
333 |
$this->url = $url;
|
|
|
334 |
|
335 |
-
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/"
|
336 |
-
$cssLink = WPFC_WP_CONTENT_URL."/cache/wpfc-minified/"
|
337 |
|
338 |
if(is_dir($cachFilePath)){
|
339 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
165 |
public function create_name($arr){
|
166 |
$name = "";
|
167 |
foreach ($arr as $tag_key => $tag_value) {
|
168 |
+
$name = $name.$this->remove_query_string($tag_value["href"]);
|
169 |
}
|
170 |
return md5($name);
|
171 |
}
|
329 |
return $list;
|
330 |
}
|
331 |
|
332 |
+
public function remove_query_string($url){
|
333 |
+
$url = preg_replace("/^(\/\/|http\:\/\/|https\:\/\/)(www\.)?/", "", $url);
|
334 |
+
$url = preg_replace("/\?.*/", "", $url);
|
335 |
+
|
336 |
+
return $url;
|
337 |
+
}
|
338 |
+
|
339 |
public function minify($url){
|
340 |
$this->url = $url;
|
341 |
+
$md5 = md5($this->remove_query_string($url));
|
342 |
|
343 |
+
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$md5;
|
344 |
+
$cssLink = WPFC_WP_CONTENT_URL."/cache/wpfc-minified/".$md5;
|
345 |
|
346 |
if(is_dir($cachFilePath)){
|
347 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
|
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.7.3
|
7 |
-
Stable tag: 0.8.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,6 +101,19 @@ Wpfc does not support Wordpress Multisite yet.
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
= 0.8.6.7 =
|
105 |
* to escape spaces in path for htaccess
|
106 |
* to fix the error of htaccess not writeable warning
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.7.3
|
7 |
+
Stable tag: 0.8.6.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 0.8.6.8 =
|
105 |
+
* <strong>[FEATURE]</strong> Widget Cache [<a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/">Details</a>]
|
106 |
+
* to add browser cache for woff2
|
107 |
+
* to fix Woocommerce basket issue
|
108 |
+
* to serve the sources via cdn for logged-in users
|
109 |
+
* to prevent removing "=" from exclude rules
|
110 |
+
* to change <FilesMatch "\.(html|htm)"> to <FilesMatch "index\.(html|htm)">
|
111 |
+
* to fix problem about random url of photon
|
112 |
+
* to replace origin-url which starts with /wp-content with cdn-url
|
113 |
+
* to replace wp_get_recent_posts() with get_results() for preload
|
114 |
+
* to replace the attribute which are data-srcsmall|data-srclarge|data-srcfull with cdn-url
|
115 |
+
* <strong>[FEATURE]</strong> Compatible with WP Hide & Security Enhancer
|
116 |
+
|
117 |
= 0.8.6.7 =
|
118 |
* to escape spaces in path for htaccess
|
119 |
* to fix the error of htaccess not writeable warning
|
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.6.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -21,7 +21,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
GNU General Public License for more details.
|
23 |
*/
|
24 |
-
//
|
25 |
if (!defined('WPFC_WP_CONTENT_BASENAME')) {
|
26 |
if (!defined('WPFC_WP_PLUGIN_DIR')) {
|
27 |
if(preg_match("/(\/trunk\/|\/wp-fastest-cache\/)$/", plugin_dir_path( __FILE__ ))){
|
@@ -467,8 +467,8 @@ GNU General Public License for more details.
|
|
467 |
$value["prefix"] = strip_tags($value["prefix"]);
|
468 |
$value["content"] = strip_tags($value["content"]);
|
469 |
|
470 |
-
$value["prefix"] = preg_replace("
|
471 |
-
$value["content"] = preg_replace("
|
472 |
|
473 |
$value["content"] = trim($value["content"], "/");
|
474 |
|
@@ -1134,15 +1134,18 @@ GNU General Public License for more details.
|
|
1134 |
|
1135 |
// POST
|
1136 |
if($number > 0 && $pre_load->post > -1){
|
1137 |
-
$recent_posts = wp_get_recent_posts(array(
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
|
|
|
|
|
|
1146 |
|
1147 |
if(count($recent_posts) > 0){
|
1148 |
foreach ($recent_posts as $key => $post) {
|
@@ -1622,8 +1625,14 @@ GNU General Public License for more details.
|
|
1622 |
}
|
1623 |
|
1624 |
if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){
|
1625 |
-
|
1626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1627 |
}
|
1628 |
|
1629 |
$cdn->file_types = str_replace(",", "|", $cdn->file_types);
|
@@ -1642,12 +1651,19 @@ GNU General Public License for more details.
|
|
1642 |
|
1643 |
if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
|
1644 |
$matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
|
1645 |
-
$matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $
|
1646 |
}else if(preg_match("/".preg_quote($cdn->originurl, "/")."/", $matches[2])){
|
1647 |
-
$matches[0] = preg_replace("/(http(s?)\:)?\/\/(www\.)?".preg_quote($cdn->originurl, "/")."/i", $
|
1648 |
-
}else if(preg_match("/^(\/?)(wp-includes|wp-
|
1649 |
-
$matches[
|
1650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1651 |
}
|
1652 |
}
|
1653 |
}
|
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.6.8
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
GNU General Public License for more details.
|
23 |
*/
|
24 |
+
//test6
|
25 |
if (!defined('WPFC_WP_CONTENT_BASENAME')) {
|
26 |
if (!defined('WPFC_WP_PLUGIN_DIR')) {
|
27 |
if(preg_match("/(\/trunk\/|\/wp-fastest-cache\/)$/", plugin_dir_path( __FILE__ ))){
|
467 |
$value["prefix"] = strip_tags($value["prefix"]);
|
468 |
$value["content"] = strip_tags($value["content"]);
|
469 |
|
470 |
+
$value["prefix"] = preg_replace("/\'|\"/", "", $value["prefix"]);
|
471 |
+
$value["content"] = preg_replace("/\'|\"/", "", $value["content"]);
|
472 |
|
473 |
$value["content"] = trim($value["content"], "/");
|
474 |
|
1134 |
|
1135 |
// POST
|
1136 |
if($number > 0 && $pre_load->post > -1){
|
1137 |
+
// $recent_posts = wp_get_recent_posts(array(
|
1138 |
+
// 'numberposts' => $number,
|
1139 |
+
// 'offset' => $pre_load->post,
|
1140 |
+
// 'orderby' => 'ID',
|
1141 |
+
// 'order' => 'DESC',
|
1142 |
+
// 'post_type' => 'post',
|
1143 |
+
// 'post_status' => 'publish',
|
1144 |
+
// 'suppress_filters' => true
|
1145 |
+
// ), ARRAY_A);
|
1146 |
+
global $wpdb;
|
1147 |
+
$recent_posts = $GLOBALS['wpdb']->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND ".$wpdb->prefix."posts.post_type = 'post' AND ((".$wpdb->prefix."posts.post_status = 'publish')) ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->post.", ".$number, ARRAY_A);
|
1148 |
+
|
1149 |
|
1150 |
if(count($recent_posts) > 0){
|
1151 |
foreach ($recent_posts as $key => $post) {
|
1625 |
}
|
1626 |
|
1627 |
if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){
|
1628 |
+
if(preg_match("/^\/\/random/", $cdn->cdnurl)){
|
1629 |
+
$cdnurl = "//i".rand(0,3).".wp.com/".str_replace("www.", "", $_SERVER["HTTP_HOST"]);
|
1630 |
+
$cdnurl = preg_replace("/\/\/i\d\.wp\.com/", "//i".rand(0,3).".wp.com", $cdnurl);
|
1631 |
+
}else{
|
1632 |
+
$cdnurl = $cdn->cdnurl;
|
1633 |
+
}
|
1634 |
+
}else{
|
1635 |
+
$cdnurl = $cdn->cdnurl;
|
1636 |
}
|
1637 |
|
1638 |
$cdn->file_types = str_replace(",", "|", $cdn->file_types);
|
1651 |
|
1652 |
if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
|
1653 |
$matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
|
1654 |
+
$matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
|
1655 |
}else if(preg_match("/".preg_quote($cdn->originurl, "/")."/", $matches[2])){
|
1656 |
+
$matches[0] = preg_replace("/(http(s?)\:)?\/\/(www\.)?".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
|
1657 |
+
}else if(preg_match("/^(\/?)(wp-includes|wp-content)/", $matches[2])){
|
1658 |
+
$matches[0] = preg_replace("/(\/?)(wp-includes|wp-content)/i", $cdnurl."/"."$2", $matches[0]);
|
1659 |
+
}else if(preg_match("/[\"\']https?\:\\\\\/\\\\\/[^\"\']+[\"\']/i", $matches[0])){
|
1660 |
+
//<script>var loaderRandomImages=["https:\/\/www.site.com\/wp-content\/uploads\/2016\/12\/image.jpg"];</script>
|
1661 |
+
$matches[0] = preg_replace("/\\\\\//", "/", $matches[0]);
|
1662 |
+
|
1663 |
+
if(preg_match("/".preg_quote($cdn->originurl, "/")."/", $matches[0])){
|
1664 |
+
$matches[0] = preg_replace("/(http(s?)\:)?\/\/(www\.)?".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
|
1665 |
+
$matches[0] = preg_replace("/\//", "\/", $matches[0]);
|
1666 |
+
}
|
1667 |
}
|
1668 |
}
|
1669 |
}
|