Version Description
- refactoring of delete_cache_of_term()
- [FEATURE] exclude archives
- to delete cache of pagination after new post
- to add do_action() for deleteCache()
- to shorten the url of the minified and combined sources
- to fix excluding googleanalytics problem
- to create cache for mobile user-agents when mobile option is disabled
- [FEATURE] Compatible with WeePie Cookie Allow
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.7.9 |
Comparing to | |
See all releases |
Code changes from version 0.8.7.8 to 0.8.7.9
- inc/admin.php +18 -11
- inc/cache.php +47 -16
- inc/css-utilities.php +4 -21
- inc/js-utilities.php +9 -5
- readme.txt +11 -1
- templates/exclude.php +9 -4
- templates/newpost.php +1 -0
- wpFastestCache.php +36 -13
inc/admin.php
CHANGED
@@ -9,8 +9,6 @@
|
|
9 |
|
10 |
public function __construct(){
|
11 |
$this->options = $this->getOptions();
|
12 |
-
|
13 |
-
$this->set_content_url();
|
14 |
|
15 |
//to call like that because on WP Multisite current_user_can() cannot get the user
|
16 |
add_action('admin_init', array($this, "optionsPageRequest"));
|
@@ -594,6 +592,7 @@
|
|
594 |
$loggedInUser = "";
|
595 |
$ifIsNotSecure = "";
|
596 |
$trailing_slash_rule = "";
|
|
|
597 |
|
598 |
if(isset($_POST["wpFastestCacheMobile"]) && $_POST["wpFastestCacheMobile"] == "on"){
|
599 |
$mobile = "RewriteCond %{HTTP_USER_AGENT} !^.*(".$this->getMobileUserAgents().").*$ [NC]"."\n";
|
@@ -607,6 +606,11 @@
|
|
607 |
$ifIsNotSecure = "RewriteCond %{HTTPS} !=on";
|
608 |
}
|
609 |
|
|
|
|
|
|
|
|
|
|
|
610 |
if($this->is_trailing_slash()){
|
611 |
$trailing_slash_rule = "RewriteCond %{REQUEST_URI} \/$"."\n";
|
612 |
}else{
|
@@ -629,6 +633,7 @@
|
|
629 |
"RewriteCond %{REQUEST_URI} !(\/){2}$"."\n".
|
630 |
$trailing_slash_rule.
|
631 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
|
|
632 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
633 |
"RewriteCond %{HTTP:Cookie} !wp_woocommerce_session"."\n".
|
634 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
@@ -1198,15 +1203,15 @@
|
|
1198 |
|
1199 |
$tester_arr = array(
|
1200 |
// "de-DE",
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
// "fr-FR",
|
1211 |
// "fr-BE",
|
1212 |
// "fr-CA",
|
@@ -1217,6 +1222,7 @@
|
|
1217 |
"pt-PT",
|
1218 |
"pt-BR",
|
1219 |
"tr-TR",
|
|
|
1220 |
"nicheadvice.co.uk",
|
1221 |
"addkenmerken.net",
|
1222 |
"animefantastica.com",
|
@@ -1734,6 +1740,7 @@
|
|
1734 |
<option value="homepage">Home Page</option>
|
1735 |
<option value="category">Categories</option>
|
1736 |
<option value="tag">Tags</option>
|
|
|
1737 |
<option value="post">Posts</option>
|
1738 |
<option value="page">Pages</option>
|
1739 |
<option value="attachment">Attachments</option>
|
9 |
|
10 |
public function __construct(){
|
11 |
$this->options = $this->getOptions();
|
|
|
|
|
12 |
|
13 |
//to call like that because on WP Multisite current_user_can() cannot get the user
|
14 |
add_action('admin_init', array($this, "optionsPageRequest"));
|
592 |
$loggedInUser = "";
|
593 |
$ifIsNotSecure = "";
|
594 |
$trailing_slash_rule = "";
|
595 |
+
$consent_cookie = "";
|
596 |
|
597 |
if(isset($_POST["wpFastestCacheMobile"]) && $_POST["wpFastestCacheMobile"] == "on"){
|
598 |
$mobile = "RewriteCond %{HTTP_USER_AGENT} !^.*(".$this->getMobileUserAgents().").*$ [NC]"."\n";
|
606 |
$ifIsNotSecure = "RewriteCond %{HTTPS} !=on";
|
607 |
}
|
608 |
|
609 |
+
// WeePie Cookie Allow: to serve cache if the cookie named wpca_consent is set
|
610 |
+
if($this->isPluginActive('wp-cookie-allow/wp-cookie-allow.php')){
|
611 |
+
$consent_cookie = "RewriteCond %{HTTP:Cookie} wpca_consent=1"."\n";
|
612 |
+
}
|
613 |
+
|
614 |
if($this->is_trailing_slash()){
|
615 |
$trailing_slash_rule = "RewriteCond %{REQUEST_URI} \/$"."\n";
|
616 |
}else{
|
633 |
"RewriteCond %{REQUEST_URI} !(\/){2}$"."\n".
|
634 |
$trailing_slash_rule.
|
635 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
636 |
+
$consent_cookie.
|
637 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
638 |
"RewriteCond %{HTTP:Cookie} !wp_woocommerce_session"."\n".
|
639 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
1203 |
|
1204 |
$tester_arr = array(
|
1205 |
// "de-DE",
|
1206 |
+
"es_CL",
|
1207 |
+
"es_AR",
|
1208 |
+
"es_GT",
|
1209 |
+
"es_PE",
|
1210 |
+
"es_VE",
|
1211 |
+
"es_CO",
|
1212 |
+
"es_MX",
|
1213 |
+
"es_ES",
|
1214 |
+
"es-ES",
|
1215 |
// "fr-FR",
|
1216 |
// "fr-BE",
|
1217 |
// "fr-CA",
|
1222 |
"pt-PT",
|
1223 |
"pt-BR",
|
1224 |
"tr-TR",
|
1225 |
+
"rebootyourpc.gr",
|
1226 |
"nicheadvice.co.uk",
|
1227 |
"addkenmerken.net",
|
1228 |
"animefantastica.com",
|
1740 |
<option value="homepage">Home Page</option>
|
1741 |
<option value="category">Categories</option>
|
1742 |
<option value="tag">Tags</option>
|
1743 |
+
<option value="archive">Archives</option>
|
1744 |
<option value="post">Posts</option>
|
1745 |
<option value="page">Pages</option>
|
1746 |
<option value="attachment">Attachments</option>
|
inc/cache.php
CHANGED
@@ -29,8 +29,6 @@
|
|
29 |
|
30 |
$this->set_exclude_rules();
|
31 |
|
32 |
-
$this->set_content_url();
|
33 |
-
|
34 |
if(isset($this->options->wpFastestCacheDisableEmojis) && $this->options->wpFastestCacheDisableEmojis){
|
35 |
add_action('init', array($this, 'disable_emojis'));
|
36 |
}
|
@@ -67,6 +65,8 @@
|
|
67 |
echo "<!--WPFC_PAGE_TYPE_page-->";
|
68 |
}else if(is_attachment()){
|
69 |
echo "<!--WPFC_PAGE_TYPE_attachment-->";
|
|
|
|
|
70 |
}
|
71 |
}
|
72 |
|
@@ -234,6 +234,20 @@
|
|
234 |
}
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
if(isset($_COOKIE) && isset($_COOKIE['safirmobilswitcher'])){
|
238 |
ob_start(array($this, "cdn_rewrite"));
|
239 |
|
@@ -282,11 +296,11 @@
|
|
282 |
}
|
283 |
}
|
284 |
|
285 |
-
if(preg_match("/www\./", get_option("home")) && !preg_match("/www\./", $_SERVER['HTTP_HOST'])){
|
286 |
return 0;
|
287 |
}
|
288 |
|
289 |
-
if(!preg_match("/www\./", get_option("home")) && preg_match("/www\./", $_SERVER['HTTP_HOST'])){
|
290 |
return 0;
|
291 |
}
|
292 |
|
@@ -347,6 +361,8 @@
|
|
347 |
$create_cache = false;
|
348 |
}
|
349 |
}
|
|
|
|
|
350 |
}else{
|
351 |
$create_cache = false;
|
352 |
}
|
@@ -441,7 +457,11 @@
|
|
441 |
$value->content = trim($value->content);
|
442 |
$value->content = trim($value->content, "/");
|
443 |
|
444 |
-
if(
|
|
|
|
|
|
|
|
|
445 |
if(preg_match('/<\!--WPFC_PAGE_TYPE_'.$value->prefix.'-->/i', $buffer)){
|
446 |
return true;
|
447 |
}
|
@@ -460,10 +480,6 @@
|
|
460 |
return true;
|
461 |
}
|
462 |
}
|
463 |
-
}else if($value->prefix == "googleanalytics"){
|
464 |
-
if(preg_match("/utm_(source|medium|campaign|content|term)/i", $request_url)){
|
465 |
-
return true;
|
466 |
-
}
|
467 |
}else if($value->type == "useragent"){
|
468 |
if(preg_match("/".preg_quote($value->content, "/")."/i", $_SERVER['HTTP_USER_AGENT'])){
|
469 |
return true;
|
@@ -759,7 +775,7 @@
|
|
759 |
}
|
760 |
|
761 |
public function cacheDate($buffer){
|
762 |
-
if($this->isMobile() && class_exists("WpFcMobileCache")){
|
763 |
$comment = "<!-- Mobile: WP Fastest Cache file was created in ".$this->creationTime()." seconds, on ".date("d-m-y G:i:s", current_time('timestamp'))." -->";
|
764 |
}else{
|
765 |
$comment = "<!-- WP Fastest Cache file was created in ".$this->creationTime()." seconds, on ".date("d-m-y G:i:s", current_time('timestamp'))." -->";
|
@@ -794,8 +810,21 @@
|
|
794 |
return false;
|
795 |
}
|
796 |
|
797 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
$create = false;
|
|
|
799 |
$update_db_statistic = true;
|
800 |
|
801 |
if($buffer && strlen($buffer) > 100 && $extension == "html"){
|
@@ -806,16 +835,18 @@
|
|
806 |
}
|
807 |
|
808 |
if($this->preload_user_agent){
|
809 |
-
if(file_exists($cachFilePath."/"
|
810 |
$update_db_statistic = false;
|
811 |
-
@unlink($cachFilePath."/"
|
812 |
}
|
813 |
}
|
814 |
}
|
815 |
|
816 |
if(($extension == "css" || $extension == "js") && $buffer && strlen($buffer) > 5){
|
817 |
$create = true;
|
|
|
818 |
$buffer = trim($buffer);
|
|
|
819 |
if($extension == "js"){
|
820 |
if(substr($buffer, -1) != ";"){
|
821 |
$buffer .= ";";
|
@@ -829,7 +860,7 @@
|
|
829 |
if(is_writable($this->getWpContentDir()) || ((is_dir($this->getWpContentDir()."/cache")) && (is_writable($this->getWpContentDir()."/cache")))){
|
830 |
if (@mkdir($cachFilePath, 0755, true)){
|
831 |
|
832 |
-
file_put_contents($cachFilePath."/".$
|
833 |
|
834 |
if(class_exists("WpFastestCacheStatics")){
|
835 |
if($update_db_statistic && !preg_match("/After\sCache\sTimeout/i", $_SERVER['HTTP_USER_AGENT'])){
|
@@ -858,11 +889,11 @@
|
|
858 |
|
859 |
}
|
860 |
}else{
|
861 |
-
if(file_exists($cachFilePath."/".$
|
862 |
|
863 |
}else{
|
864 |
|
865 |
-
file_put_contents($cachFilePath."/".$
|
866 |
|
867 |
if(class_exists("WpFastestCacheStatics")){
|
868 |
if($update_db_statistic && !preg_match("/After\sCache\sTimeout/i", $_SERVER['HTTP_USER_AGENT'])){
|
29 |
|
30 |
$this->set_exclude_rules();
|
31 |
|
|
|
|
|
32 |
if(isset($this->options->wpFastestCacheDisableEmojis) && $this->options->wpFastestCacheDisableEmojis){
|
33 |
add_action('init', array($this, 'disable_emojis'));
|
34 |
}
|
65 |
echo "<!--WPFC_PAGE_TYPE_page-->";
|
66 |
}else if(is_attachment()){
|
67 |
echo "<!--WPFC_PAGE_TYPE_attachment-->";
|
68 |
+
}else if(is_archive()){
|
69 |
+
echo "<!--WPFC_PAGE_TYPE_archive-->";
|
70 |
}
|
71 |
}
|
72 |
|
234 |
}
|
235 |
}
|
236 |
|
237 |
+
// WeePie Cookie Allow: to create cache if the cookie named wpca_consent is set
|
238 |
+
if($this->isPluginActive('wp-cookie-allow/wp-cookie-allow.php')){
|
239 |
+
$wpca_settings_general = get_option('wpca_settings_general', array());
|
240 |
+
$wpca_enabled = (isset($wpca_settings_general['general_plugin_status']) && $wpca_settings_general['general_plugin_status'] == '1');
|
241 |
+
|
242 |
+
if($wpca_enabled){
|
243 |
+
if(!isset($_COOKIE["wpca_consent"]) || (isset($_COOKIE["wpca_consent"]) && $_COOKIE["wpca_consent"] == 0)){
|
244 |
+
ob_start(array($this, "cdn_rewrite"));
|
245 |
+
|
246 |
+
return 0;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
if(isset($_COOKIE) && isset($_COOKIE['safirmobilswitcher'])){
|
252 |
ob_start(array($this, "cdn_rewrite"));
|
253 |
|
296 |
}
|
297 |
}
|
298 |
|
299 |
+
if(preg_match("/www\./i", get_option("home")) && !preg_match("/www\./i", $_SERVER['HTTP_HOST'])){
|
300 |
return 0;
|
301 |
}
|
302 |
|
303 |
+
if(!preg_match("/www\./i", get_option("home")) && preg_match("/www\./i", $_SERVER['HTTP_HOST'])){
|
304 |
return 0;
|
305 |
}
|
306 |
|
361 |
$create_cache = false;
|
362 |
}
|
363 |
}
|
364 |
+
}else if(!isset($this->options->wpFastestCacheMobile) && !isset($this->options->wpFastestCacheMobileTheme)){
|
365 |
+
$create_cache = true;
|
366 |
}else{
|
367 |
$create_cache = false;
|
368 |
}
|
457 |
$value->content = trim($value->content);
|
458 |
$value->content = trim($value->content, "/");
|
459 |
|
460 |
+
if($value->prefix == "googleanalytics"){
|
461 |
+
if(preg_match("/utm_(source|medium|campaign|content|term)/i", $request_url)){
|
462 |
+
return true;
|
463 |
+
}
|
464 |
+
}else if(preg_match("/^(homepage|category|tag|post|page|archive|attachment)$/", $value->prefix)){
|
465 |
if(preg_match('/<\!--WPFC_PAGE_TYPE_'.$value->prefix.'-->/i', $buffer)){
|
466 |
return true;
|
467 |
}
|
480 |
return true;
|
481 |
}
|
482 |
}
|
|
|
|
|
|
|
|
|
483 |
}else if($value->type == "useragent"){
|
484 |
if(preg_match("/".preg_quote($value->content, "/")."/i", $_SERVER['HTTP_USER_AGENT'])){
|
485 |
return true;
|
775 |
}
|
776 |
|
777 |
public function cacheDate($buffer){
|
778 |
+
if($this->isMobile() && class_exists("WpFcMobileCache") && isset($this->options->wpFastestCacheMobile) && isset($this->options->wpFastestCacheMobileTheme)){
|
779 |
$comment = "<!-- Mobile: WP Fastest Cache file was created in ".$this->creationTime()." seconds, on ".date("d-m-y G:i:s", current_time('timestamp'))." -->";
|
780 |
}else{
|
781 |
$comment = "<!-- WP Fastest Cache file was created in ".$this->creationTime()." seconds, on ".date("d-m-y G:i:s", current_time('timestamp'))." -->";
|
810 |
return false;
|
811 |
}
|
812 |
|
813 |
+
public function create_name($list){
|
814 |
+
$arr = is_array($list) ? $list : array(array("href" => $list));
|
815 |
+
$name = "";
|
816 |
+
|
817 |
+
foreach ($arr as $tag_key => $tag_value){
|
818 |
+
$tmp = preg_replace("/\?.*/", "", $tag_value["href"]); //to remove version number
|
819 |
+
$name = $name.$tmp;
|
820 |
+
}
|
821 |
+
|
822 |
+
return base_convert(crc32($name), 20, 36);
|
823 |
+
}
|
824 |
+
|
825 |
+
public function createFolder($cachFilePath, $buffer, $extension = "html", $prefix = false){
|
826 |
$create = false;
|
827 |
+
$file_name = "index.";
|
828 |
$update_db_statistic = true;
|
829 |
|
830 |
if($buffer && strlen($buffer) > 100 && $extension == "html"){
|
835 |
}
|
836 |
|
837 |
if($this->preload_user_agent){
|
838 |
+
if(file_exists($cachFilePath."/"."index.".$extension)){
|
839 |
$update_db_statistic = false;
|
840 |
+
@unlink($cachFilePath."/"."index.".$extension);
|
841 |
}
|
842 |
}
|
843 |
}
|
844 |
|
845 |
if(($extension == "css" || $extension == "js") && $buffer && strlen($buffer) > 5){
|
846 |
$create = true;
|
847 |
+
$file_name = base_convert(substr(time(), -6), 20, 36).".";
|
848 |
$buffer = trim($buffer);
|
849 |
+
|
850 |
if($extension == "js"){
|
851 |
if(substr($buffer, -1) != ";"){
|
852 |
$buffer .= ";";
|
860 |
if(is_writable($this->getWpContentDir()) || ((is_dir($this->getWpContentDir()."/cache")) && (is_writable($this->getWpContentDir()."/cache")))){
|
861 |
if (@mkdir($cachFilePath, 0755, true)){
|
862 |
|
863 |
+
file_put_contents($cachFilePath."/".$file_name.$extension, $buffer);
|
864 |
|
865 |
if(class_exists("WpFastestCacheStatics")){
|
866 |
if($update_db_statistic && !preg_match("/After\sCache\sTimeout/i", $_SERVER['HTTP_USER_AGENT'])){
|
889 |
|
890 |
}
|
891 |
}else{
|
892 |
+
if(file_exists($cachFilePath."/".$file_name.$extension)){
|
893 |
|
894 |
}else{
|
895 |
|
896 |
+
file_put_contents($cachFilePath."/".$file_name.$extension, $buffer);
|
897 |
|
898 |
if(class_exists("WpFastestCacheStatics")){
|
899 |
if($update_db_statistic && !preg_match("/After\sCache\sTimeout/i", $_SERVER['HTTP_USER_AGENT'])){
|
inc/css-utilities.php
CHANGED
@@ -91,7 +91,7 @@
|
|
91 |
if(count($group_value) > 0){
|
92 |
|
93 |
$combined_css = "";
|
94 |
-
$combined_name = $this->create_name($group_value);
|
95 |
$combined_link = "";
|
96 |
|
97 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$combined_name;
|
@@ -116,7 +116,7 @@
|
|
116 |
}
|
117 |
|
118 |
|
119 |
-
$this->wpfc->createFolder($cachFilePath, $combined_css, "css"
|
120 |
|
121 |
if(is_dir($cachFilePath)){
|
122 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
@@ -162,14 +162,6 @@
|
|
162 |
return $combined_css;
|
163 |
}
|
164 |
|
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 |
-
}
|
172 |
-
|
173 |
public function minifyCss(){
|
174 |
$data = $this->html;
|
175 |
|
@@ -337,16 +329,9 @@
|
|
337 |
return $list;
|
338 |
}
|
339 |
|
340 |
-
public function remove_query_string($url){
|
341 |
-
$url = preg_replace("/^(\/\/|http\:\/\/|https\:\/\/)(www\.)?/", "", $url);
|
342 |
-
$url = preg_replace("/\?.*/", "", $url);
|
343 |
-
|
344 |
-
return $url;
|
345 |
-
}
|
346 |
-
|
347 |
public function minify($url){
|
348 |
$this->url = $url;
|
349 |
-
$md5 =
|
350 |
|
351 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$md5;
|
352 |
$cssLink = WPFC_WP_CONTENT_URL."/cache/wpfc-minified/".$md5;
|
@@ -386,13 +371,11 @@
|
|
386 |
}
|
387 |
|
388 |
if(!is_dir($cachFilePath)){
|
389 |
-
$prefix = time();
|
390 |
-
|
391 |
if($this->wpfc->cdn){
|
392 |
$cssContent = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this->wpfc, 'cdn_replace_urls'), $cssContent);
|
393 |
}
|
394 |
|
395 |
-
$this->wpfc->createFolder($cachFilePath, $cssContent, "css"
|
396 |
}
|
397 |
|
398 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
91 |
if(count($group_value) > 0){
|
92 |
|
93 |
$combined_css = "";
|
94 |
+
$combined_name = $this->wpfc->create_name($group_value);
|
95 |
$combined_link = "";
|
96 |
|
97 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$combined_name;
|
116 |
}
|
117 |
|
118 |
|
119 |
+
$this->wpfc->createFolder($cachFilePath, $combined_css, "css");
|
120 |
|
121 |
if(is_dir($cachFilePath)){
|
122 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
162 |
return $combined_css;
|
163 |
}
|
164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
public function minifyCss(){
|
166 |
$data = $this->html;
|
167 |
|
329 |
return $list;
|
330 |
}
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
public function minify($url){
|
333 |
$this->url = $url;
|
334 |
+
$md5 = $this->wpfc->create_name($url);
|
335 |
|
336 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$md5;
|
337 |
$cssLink = WPFC_WP_CONTENT_URL."/cache/wpfc-minified/".$md5;
|
371 |
}
|
372 |
|
373 |
if(!is_dir($cachFilePath)){
|
|
|
|
|
374 |
if($this->wpfc->cdn){
|
375 |
$cssContent = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this->wpfc, 'cdn_replace_urls'), $cssContent);
|
376 |
}
|
377 |
|
378 |
+
$this->wpfc->createFolder($cachFilePath, $cssContent, "css");
|
379 |
}
|
380 |
|
381 |
if($cssFiles = @scandir($cachFilePath, 1)){
|
inc/js-utilities.php
CHANGED
@@ -53,8 +53,7 @@
|
|
53 |
|
54 |
if($minifiedJs){
|
55 |
if(!is_dir($minifiedJs["cachFilePath"])){
|
56 |
-
$
|
57 |
-
$this->wpfc->createFolder($minifiedJs["cachFilePath"], $minifiedJs["jsContent"], "js", $prefix, true);
|
58 |
}
|
59 |
|
60 |
if($jsFiles = @scandir($minifiedJs["cachFilePath"], 1)){
|
@@ -165,8 +164,10 @@
|
|
165 |
public function minify($url){
|
166 |
$this->url = $url;
|
167 |
|
168 |
-
$
|
169 |
-
|
|
|
|
|
170 |
|
171 |
if(is_dir($cachFilePath)){
|
172 |
return array("cachFilePath" => $cachFilePath, "jsContent" => "", "url" => $jsLink);
|
@@ -220,10 +221,13 @@
|
|
220 |
|
221 |
public function mergeJs($js_content, $value, $last = false){
|
222 |
$name = md5($js_content);
|
|
|
|
|
|
|
223 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$name;
|
224 |
|
225 |
if(!is_dir($cachFilePath)){
|
226 |
-
$this->wpfc->createFolder($cachFilePath, $js_content, "js"
|
227 |
}
|
228 |
|
229 |
if($jsFiles = @scandir($cachFilePath, 1)){
|
53 |
|
54 |
if($minifiedJs){
|
55 |
if(!is_dir($minifiedJs["cachFilePath"])){
|
56 |
+
$this->wpfc->createFolder($minifiedJs["cachFilePath"], $minifiedJs["jsContent"], "js");
|
|
|
57 |
}
|
58 |
|
59 |
if($jsFiles = @scandir($minifiedJs["cachFilePath"], 1)){
|
164 |
public function minify($url){
|
165 |
$this->url = $url;
|
166 |
|
167 |
+
$md5 = $this->wpfc->create_name($url);
|
168 |
+
|
169 |
+
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$md5;
|
170 |
+
$jsLink = WPFC_WP_CONTENT_URL."/cache/wpfc-minified/".$md5;
|
171 |
|
172 |
if(is_dir($cachFilePath)){
|
173 |
return array("cachFilePath" => $cachFilePath, "jsContent" => "", "url" => $jsLink);
|
221 |
|
222 |
public function mergeJs($js_content, $value, $last = false){
|
223 |
$name = md5($js_content);
|
224 |
+
|
225 |
+
$name = base_convert(crc32($name), 20, 36);
|
226 |
+
|
227 |
$cachFilePath = WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$name;
|
228 |
|
229 |
if(!is_dir($cachFilePath)){
|
230 |
+
$this->wpfc->createFolder($cachFilePath, $js_content, "js");
|
231 |
}
|
232 |
|
233 |
if($jsFiles = @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.9
|
7 |
-
Stable tag: 0.8.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -102,6 +102,16 @@ Wpfc does not support Wordpress Multisite yet.
|
|
102 |
|
103 |
== Changelog ==
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
= 0.8.7.8 =
|
106 |
* to check <title> for 404 if the header return 200
|
107 |
* to clear all the cache if the visibility is converted to private
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 0.8.7.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
102 |
|
103 |
== Changelog ==
|
104 |
|
105 |
+
= 0.8.7.9 =
|
106 |
+
* refactoring of delete_cache_of_term()
|
107 |
+
* <strong>[FEATURE]</strong> exclude archives
|
108 |
+
* to delete cache of pagination after new post
|
109 |
+
* to add do_action() for deleteCache()
|
110 |
+
* to shorten the url of the minified and combined sources
|
111 |
+
* to fix excluding googleanalytics problem
|
112 |
+
* to create cache for mobile user-agents when mobile option is disabled
|
113 |
+
* <strong>[FEATURE]</strong> Compatible with WeePie Cookie Allow
|
114 |
+
|
115 |
= 0.8.7.8 =
|
116 |
* to check <title> for 404 if the header return 200
|
117 |
* to clear all the cache if the visibility is converted to private
|
templates/exclude.php
CHANGED
@@ -95,6 +95,9 @@
|
|
95 |
<option value="tag">Tags</option>
|
96 |
<option value="post">Posts</option>
|
97 |
<option value="page">Pages</option>
|
|
|
|
|
|
|
98 |
<option value="attachment">Attachments</option>
|
99 |
<option value="startwith">Starts With</option>
|
100 |
<option value="contain">Contains</option>
|
@@ -180,7 +183,7 @@
|
|
180 |
var clone_modal_id = "wpfc-modal-exclude-" + new Date().getTime();
|
181 |
|
182 |
clone_modal.find("select").change(function(e){
|
183 |
-
if(jQuery(this).val().match(/^(homepage|category|tag|post|page|attachment|googleanalytics)$/)){
|
184 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
185 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
186 |
}else{
|
@@ -189,7 +192,7 @@
|
|
189 |
}
|
190 |
});
|
191 |
|
192 |
-
if(e.prefix.match(/^(homepage|category|tag|post|page|attachment|googleanalytics)$/)){
|
193 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
194 |
}
|
195 |
|
@@ -275,6 +278,8 @@
|
|
275 |
title = "Home Page";
|
276 |
}else if(prefix == "tag"){
|
277 |
title = "Tags";
|
|
|
|
|
278 |
}else if(prefix == "category"){
|
279 |
title = "Categories";
|
280 |
}else if(prefix == "post"){
|
@@ -305,7 +310,7 @@
|
|
305 |
}
|
306 |
|
307 |
if(type == "page" || type == "css" || type == "js"){
|
308 |
-
if(prefix.match(/^(homepage|category|tag|post|page|attachment|googleanalytics)$/)){
|
309 |
if(prefix == "homepage"){
|
310 |
return "The " + b_start + "homepage" + b_end + " has been excluded";
|
311 |
}else{
|
@@ -369,7 +374,7 @@
|
|
369 |
|
370 |
|
371 |
clone_modal.find("select").change(function(){
|
372 |
-
if(jQuery(this).val().match(/^(homepage|category|tag|post|page|attachment|googleanalytics)$/)){
|
373 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
374 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
375 |
}else{
|
95 |
<option value="tag">Tags</option>
|
96 |
<option value="post">Posts</option>
|
97 |
<option value="page">Pages</option>
|
98 |
+
|
99 |
+
<option value="archive">Archives</option>
|
100 |
+
|
101 |
<option value="attachment">Attachments</option>
|
102 |
<option value="startwith">Starts With</option>
|
103 |
<option value="contain">Contains</option>
|
183 |
var clone_modal_id = "wpfc-modal-exclude-" + new Date().getTime();
|
184 |
|
185 |
clone_modal.find("select").change(function(e){
|
186 |
+
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
187 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
188 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
189 |
}else{
|
192 |
}
|
193 |
});
|
194 |
|
195 |
+
if(e.prefix.match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
196 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
197 |
}
|
198 |
|
278 |
title = "Home Page";
|
279 |
}else if(prefix == "tag"){
|
280 |
title = "Tags";
|
281 |
+
}else if(prefix == "archive"){
|
282 |
+
title = "Archives";
|
283 |
}else if(prefix == "category"){
|
284 |
title = "Categories";
|
285 |
}else if(prefix == "post"){
|
310 |
}
|
311 |
|
312 |
if(type == "page" || type == "css" || type == "js"){
|
313 |
+
if(prefix.match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
314 |
if(prefix == "homepage"){
|
315 |
return "The " + b_start + "homepage" + b_end + " has been excluded";
|
316 |
}else{
|
374 |
|
375 |
|
376 |
clone_modal.find("select").change(function(){
|
377 |
+
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
378 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
379 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
380 |
}else{
|
templates/newpost.php
CHANGED
@@ -55,6 +55,7 @@
|
|
55 |
<label for="wpFastestCacheNewPost_type_homepage">Clear Cache of Homepage</label><br>
|
56 |
<label style="margin-left:24px;" for="wpFastestCacheNewPost_type_homepage">Clear Cache of Post Categories</label><br>
|
57 |
<label style="margin-left:24px;" for="wpFastestCacheNewPost_type_homepage">Clear Cache of Post Tags</label><br>
|
|
|
58 |
</div>
|
59 |
|
60 |
|
55 |
<label for="wpFastestCacheNewPost_type_homepage">Clear Cache of Homepage</label><br>
|
56 |
<label style="margin-left:24px;" for="wpFastestCacheNewPost_type_homepage">Clear Cache of Post Categories</label><br>
|
57 |
<label style="margin-left:24px;" for="wpFastestCacheNewPost_type_homepage">Clear Cache of Post Tags</label><br>
|
58 |
+
<label style="margin-left:24px;" for="wpFastestCacheNewPost_type_homepage">Clear Cache of Pagination</label><br>
|
59 |
</div>
|
60 |
|
61 |
|
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.7.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -85,8 +85,11 @@ GNU General Public License for more details.
|
|
85 |
private $systemMessage = "";
|
86 |
private $options = array();
|
87 |
public $noscript = "";
|
|
|
88 |
|
89 |
public function __construct(){
|
|
|
|
|
90 |
$optimize_image_ajax_requests = array("wpfc_revert_image_ajax_request",
|
91 |
"wpfc_statics_ajax_request",
|
92 |
"wpfc_optimize_image_ajax_request",
|
@@ -263,6 +266,8 @@ GNU General Public License for more details.
|
|
263 |
if (!defined('WPFC_WP_CONTENT_URL')) {
|
264 |
define("WPFC_WP_CONTENT_URL", $content_url);
|
265 |
}
|
|
|
|
|
266 |
}
|
267 |
|
268 |
public function clear_cache_on_kksr_rate($id){
|
@@ -1016,22 +1021,25 @@ GNU General Public License for more details.
|
|
1016 |
return false;
|
1017 |
}
|
1018 |
|
1019 |
-
if(preg_match("/cat|tag/", $term->taxonomy)){
|
1020 |
-
$url = get_term_link($term->term_id, $term->taxonomy);
|
1021 |
|
1022 |
-
|
1023 |
-
$path = preg_replace("/https?\:\/\/[^\/]+/i", "", $url);
|
1024 |
-
$path = trim($path, "/");
|
1025 |
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
|
|
|
|
|
|
1034 |
}
|
|
|
|
|
|
|
1035 |
}
|
1036 |
|
1037 |
public function deleteHomePageCache($log = true){
|
@@ -1044,6 +1052,10 @@ GNU General Public License for more details.
|
|
1044 |
if($site_url_path){
|
1045 |
@unlink($this->getWpContentDir()."/cache/all/".$site_url_path."/index.html");
|
1046 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$site_url_path."/index.html");
|
|
|
|
|
|
|
|
|
1047 |
}
|
1048 |
}
|
1049 |
|
@@ -1053,12 +1065,21 @@ GNU General Public License for more details.
|
|
1053 |
if($home_url_path){
|
1054 |
@unlink($this->getWpContentDir()."/cache/all/".$home_url_path."/index.html");
|
1055 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$home_url_path."/index.html");
|
|
|
|
|
|
|
|
|
1056 |
}
|
1057 |
}
|
1058 |
|
1059 |
@unlink($this->getWpContentDir()."/cache/all/index.html");
|
1060 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
|
1061 |
|
|
|
|
|
|
|
|
|
|
|
1062 |
if($log){
|
1063 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|
1064 |
include_once $this->get_premium_path("logs.php");
|
@@ -1129,6 +1150,8 @@ GNU General Public License for more details.
|
|
1129 |
}
|
1130 |
|
1131 |
if($created_tmpWpfc && $cache_deleted && $minifed_deleted){
|
|
|
|
|
1132 |
$this->systemMessage = array("All cache files have been deleted","success");
|
1133 |
|
1134 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|
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.7.9
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
85 |
private $systemMessage = "";
|
86 |
private $options = array();
|
87 |
public $noscript = "";
|
88 |
+
public $content_url = "";
|
89 |
|
90 |
public function __construct(){
|
91 |
+
$this->set_content_url();
|
92 |
+
|
93 |
$optimize_image_ajax_requests = array("wpfc_revert_image_ajax_request",
|
94 |
"wpfc_statics_ajax_request",
|
95 |
"wpfc_optimize_image_ajax_request",
|
266 |
if (!defined('WPFC_WP_CONTENT_URL')) {
|
267 |
define("WPFC_WP_CONTENT_URL", $content_url);
|
268 |
}
|
269 |
+
|
270 |
+
$this->content_url = $content_url;
|
271 |
}
|
272 |
|
273 |
public function clear_cache_on_kksr_rate($id){
|
1021 |
return false;
|
1022 |
}
|
1023 |
|
1024 |
+
//if(preg_match("/cat|tag|store|listing/", $term->taxonomy)){}
|
|
|
1025 |
|
1026 |
+
$url = get_term_link($term->term_id, $term->taxonomy);
|
|
|
|
|
1027 |
|
1028 |
+
if(preg_match("/^http/", $url)){
|
1029 |
+
$path = preg_replace("/https?\:\/\/[^\/]+/i", "", $url);
|
1030 |
+
$path = trim($path, "/");
|
1031 |
|
1032 |
+
// to remove the cache of tag/cat
|
1033 |
+
@unlink($this->getWpContentDir()."/cache/all/".$path."/index.html");
|
1034 |
+
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/index.html");
|
1035 |
+
|
1036 |
+
// to remove the cache of the pages
|
1037 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$path."/page");
|
1038 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/page");
|
1039 |
}
|
1040 |
+
|
1041 |
+
|
1042 |
+
|
1043 |
}
|
1044 |
|
1045 |
public function deleteHomePageCache($log = true){
|
1052 |
if($site_url_path){
|
1053 |
@unlink($this->getWpContentDir()."/cache/all/".$site_url_path."/index.html");
|
1054 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$site_url_path."/index.html");
|
1055 |
+
|
1056 |
+
//to clear pagination of homepage cache
|
1057 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$site_url_path."/page");
|
1058 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$site_url_path."/page");
|
1059 |
}
|
1060 |
}
|
1061 |
|
1065 |
if($home_url_path){
|
1066 |
@unlink($this->getWpContentDir()."/cache/all/".$home_url_path."/index.html");
|
1067 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$home_url_path."/index.html");
|
1068 |
+
|
1069 |
+
//to clear pagination of homepage cache
|
1070 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$home_url_path."/page");
|
1071 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$home_url_path."/page");
|
1072 |
}
|
1073 |
}
|
1074 |
|
1075 |
@unlink($this->getWpContentDir()."/cache/all/index.html");
|
1076 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
|
1077 |
|
1078 |
+
//to clear pagination of homepage cache
|
1079 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/page");
|
1080 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/page");
|
1081 |
+
|
1082 |
+
|
1083 |
if($log){
|
1084 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|
1085 |
include_once $this->get_premium_path("logs.php");
|
1150 |
}
|
1151 |
|
1152 |
if($created_tmpWpfc && $cache_deleted && $minifed_deleted){
|
1153 |
+
do_action('wpfc_delete_cache');
|
1154 |
+
|
1155 |
$this->systemMessage = array("All cache files have been deleted","success");
|
1156 |
|
1157 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|