WP Fastest Cache - Version 0.9.3

Version Description

  • to prevent removing "/" for exclude rules
  • [FEATURE] to add "pause" feature for cdn [Details]
  • to add wpfc_clear_all_site_cache() for clearing cache of all sites [Details]
  • to add spinner for the buttons on the cdn wizard
  • refactroing of excluding "There has been a critical error on this website" page
Download this release

Release Info

Developer emrevona
Plugin Icon 128x128 WP Fastest Cache
Version 0.9.3
Comparing to
See all releases

Code changes from version 0.9.2 to 0.9.3

css/dialog.css CHANGED
@@ -153,9 +153,7 @@ button:focus {outline:0;}
153
  opacity: 0.25;
154
  }
155
 
156
- .buttons-blood {
157
- background-color: red;
158
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAABaCAIAAAAU4rCTAAACEElEQVQ4EQXBMQElSwFFwTrzerGABGI8YAULJFjAExkuyJHwd/dNX6r63z/+TgKF/vvXPwMAzoCBRudONhpiZ7uTjLbZ2bANEs6FWZhL596BAexcbACxc+/AiLHzbjEy4NytWQLj3M0Yaca5FyPDpvPugsHSzr0EI3Odd9cCwM47mcES594pm7hw7t1iE+D8vlcZJnS+s3tRXLPz+70AI5zvexWzmHbeOyZstM53WAOsnXcXjZA5G3YnsXHuhtgGnM/zAAD641//1KOUovP7P/8GAJw7DMRwdu+KwVadd7OBgZ27CwKzzvdiLIF77l4LjNF5343aRrLz3WyINeu898KIsZ33vTQD4vy+y6UR47z3xdQGOd87w8Bwvu+FTcGc73vBlMH5fa8tQOy872UEhvN931Exmp2f7wsY2Zw/fn1VYBvOz++LGJp1fn6/CAycX9/LZBM4v96vESPm/P5eBrFwvvfd0gBzvu+4CjacH08EKPS3PwEw4vzlsGYxygkt2Sp2niJWDTofaSCwc54wYuQ5nyeQYXROCAp0Tg8ymcd2fjwxHmHW+fHJTEhyPlIMxM6TshWLdT5PRsYTOR9kqlnsPE9GmaLORxqEtPNUWrMnW53PY7R6GDoPEBI6T8UgNOehECyP83kiZnmG82iowOo8gZHp4VTGM6tG52GplpachxVC2Klilmbp/Pg8AID/A42AjXF48qy/AAAAAElFTkSuQmCC') !important;
159
  background-repeat: repeat-x;
160
  border: 1px solid #333 !important;
161
  color: #fff;
@@ -164,6 +162,18 @@ button:focus {outline:0;}
164
  font-weight: bold;
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  .wpfc-green-button {
168
  font-weight: bold;
169
  padding:6px 18px;
153
  opacity: 0.25;
154
  }
155
 
156
+ .buttons-blood, .buttons-orange, .buttons-start{
 
 
157
  background-repeat: repeat-x;
158
  border: 1px solid #333 !important;
159
  color: #fff;
162
  font-weight: bold;
163
  }
164
 
165
+ .buttons-blood {
166
+ background-image:url("../images/button-back-blood.png") !important;
167
+ }
168
+
169
+ .buttons-orange {
170
+ background-image:url("../images/button-back-fire.png") !important;
171
+ }
172
+
173
+ .buttons-start {
174
+ background-image:url("../images/button-back-green.png") !important;
175
+ }
176
+
177
  .wpfc-green-button {
178
  font-weight: bold;
179
  padding:6px 18px;
css/style.css CHANGED
@@ -424,13 +424,18 @@ span.deleteicon span.cleared {
424
  width: 45px;
425
  }
426
  .int-item .meta.isConnected{
427
- background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAACA0lEQVQ4EaVUy23bQBCd4SdAbipB7oC+BVEOVAURO5BLSAWxKohdgZ0KyFRgArEN36wS7A50C2BKmLy30lJriZRiZw7a3bczT2/nQ5UD9lJ+zkQ0V9GBdzOxxUpW1cfi4clju6vuAjyDbBqpfjeRYdf9BqvFdJYWt/WuzytSK/PBUl+uoG6y69h3BsF1bOk3LeqF94n8Zk3Y3LyFkLF4zXSpjNtaS4qLEjBy+C7Lml+jHz7SPZ85VFU8+z/NdMwcO6UsyjvoFmZ2KioXbaya44nYNna4ym1MsJknlp58KO7najII8PxP+WkIpZoH4NEtqw3CMavNtEHQNAxKJc2SdWPjKjAGmumzbJ7TXqEvk+L2nOe+OmA4srb6dPQGwp9I+DmaewyM/bdQiwqH4dBHiCtnnaRQWDI3rCRzt7TVaVL8rhjRlF/yY52ScJZdX63/xP8OEo1LDITLHUCqpcKMf+idulakcw6lVnddAsvCSSEhFN4AD6u9FxpLXDuRTTV6JMmeBwAWrbHVDMrpc5AQAqt0cl+4nKIIsy5CYmyZfyOkc3TJGEfKIlARgR47ohBRmCwWlvGOlBt+vrDMuX+rUVD69Y7xzlpSToiblMOKfdx2hcJkcne2BVwdwuN6z17cTFO+f+sRq5hD/2SPcoXyfuMAxBLlKtHQe7EPXdsEX3p/59e/YUe3GmOE5VkAAAAASUVORK5CYII=") no-repeat scroll 0 0;
428
- height: 21px;
429
- width: 21px;
430
  position: relative;
431
- top: -8px;
432
- left: 312px;
433
  }
 
 
 
 
 
434
  .int-item .meta.success{
435
  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAADb0lEQVQ4Ea2VS0iUURTH7+v7dAwnLMhWjURRm4IeOtEmS4VQ6GFNUYFG+UCooDYlBAktCqIXRVEUvaggqVQoNzallGiboKIWvSha5MLSMZ2Z7746Z9JptLEHdQbmu9+95/+7595z7v0oSWOFDUTkFqwKTPQ7Qa7oIkN4kFIzw1r2mhHdrYXt6o/I7p7HTe8fNBA1FkHHdmxoXpHrnzhhCyV2D+PUT+xYD3gHldYmYik5MNAXvXB9ZUtPqlcqlFa1rZgjfFlHBeXLrDbEpgMOqykoKWdEWR1W0aGd54pbnsFQQpGEbutcOcdY3yXhOPNU7KcVpQYyqi0yBVFSPmE0WnlycTOCCcO/iraiyVq5J/4WiNuAAaAO9chBHi9sKBRT8qbucFyxVXsa+/7YDCGSc8q1hFQKkUeJ+yU770UXCxQEApzZPVb9YgPTTGOs7pADg8VK6lbmMIJ6anl9oKAywLL8Q0EmqN+mTfMYGiYHNsxa0zlg1KbzZS0dWulTylNR3EgOnAQPZggSWEfSQMgEeCRTODyC/ZBto02n9syGq0tvfaxuK893MsRexxE+a2ClwEEes8RZlArEtpbqHQaOZZMweHKYSEr5SA9GKs6WNH6oC4cWOBnuKeGKoFY/okIeA+pMFFL4WQNxKHLwq+eVgeMRjBb7OUQoY/FL8Z6va8+Wtr6pvR9aDrPcgOQsVPHRyUUeM5S8QqilFjNIldFPr5Tcfhnvj++HU3NG+DiRnursj3i7L667+6nmQflSSukx7rLpWo4GIgd5jBLZhS+4XAuHG4I6VNu+rvTi6qY+1RfdFx2M74qrWDUexar20DLGxEnhOrMMlFE6Qx6texjaSIm4OpIsyikxnuqF81d5uqTxDgmFOGls1FXhNaWCu4eFw2ablD0cBcbKIGoTG4pkdRtlI7h3aFZDvTl8MnHFlZpwqAz7ajrWz3eFOO644wNRr4GDPJ4zM2cgZ1q2FS4rSpRFggwJYsQH1Vy8IJ9FBaX13BFz8eSMZ1iGkOWGt4+utSbCwzM7wZ1008nMXJJ6meDszMWqgASMt2SYBS8VGYu1D3qf11wuvtcLu0AINrjwtuNtgw4jhqcMCv23QNShHjmoTUCxAdfWcy86tNmTMoxLSRY+DqYxHEc/9Ecd6kfcvmdn5A2e//vmT6L/9Rv1DasAwJ2jW2dLAAAAAElFTkSuQmCC') no-repeat scroll 0 0;
436
  height: 21px;
424
  width: 45px;
425
  }
426
  .int-item .meta.isConnected{
427
+ background: url("../images/check.png") no-repeat scroll 0 0;
428
+ height: 24px;
429
+ width: 24px;
430
  position: relative;
431
+ top: -10px;
432
+ left: 311px;
433
  }
434
+
435
+ .int-item .meta.isConnected.pause{
436
+ background: url("../images/pause.png") no-repeat scroll 0 0;
437
+ }
438
+
439
  .int-item .meta.success{
440
  background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAADb0lEQVQ4Ea2VS0iUURTH7+v7dAwnLMhWjURRm4IeOtEmS4VQ6GFNUYFG+UCooDYlBAktCqIXRVEUvaggqVQoNzallGiboKIWvSha5MLSMZ2Z7746Z9JptLEHdQbmu9+95/+7595z7v0oSWOFDUTkFqwKTPQ7Qa7oIkN4kFIzw1r2mhHdrYXt6o/I7p7HTe8fNBA1FkHHdmxoXpHrnzhhCyV2D+PUT+xYD3gHldYmYik5MNAXvXB9ZUtPqlcqlFa1rZgjfFlHBeXLrDbEpgMOqykoKWdEWR1W0aGd54pbnsFQQpGEbutcOcdY3yXhOPNU7KcVpQYyqi0yBVFSPmE0WnlycTOCCcO/iraiyVq5J/4WiNuAAaAO9chBHi9sKBRT8qbucFyxVXsa+/7YDCGSc8q1hFQKkUeJ+yU770UXCxQEApzZPVb9YgPTTGOs7pADg8VK6lbmMIJ6anl9oKAywLL8Q0EmqN+mTfMYGiYHNsxa0zlg1KbzZS0dWulTylNR3EgOnAQPZggSWEfSQMgEeCRTODyC/ZBto02n9syGq0tvfaxuK893MsRexxE+a2ClwEEes8RZlArEtpbqHQaOZZMweHKYSEr5SA9GKs6WNH6oC4cWOBnuKeGKoFY/okIeA+pMFFL4WQNxKHLwq+eVgeMRjBb7OUQoY/FL8Z6va8+Wtr6pvR9aDrPcgOQsVPHRyUUeM5S8QqilFjNIldFPr5Tcfhnvj++HU3NG+DiRnursj3i7L667+6nmQflSSukx7rLpWo4GIgd5jBLZhS+4XAuHG4I6VNu+rvTi6qY+1RfdFx2M74qrWDUexar20DLGxEnhOrMMlFE6Qx6texjaSIm4OpIsyikxnuqF81d5uqTxDgmFOGls1FXhNaWCu4eFw2ablD0cBcbKIGoTG4pkdRtlI7h3aFZDvTl8MnHFlZpwqAz7ajrWz3eFOO644wNRr4GDPJ4zM2cgZ1q2FS4rSpRFggwJYsQH1Vy8IJ9FBaX13BFz8eSMZ1iGkOWGt4+utSbCwzM7wZ1008nMXJJ6meDszMWqgASMt2SYBS8VGYu1D3qf11wuvtcLu0AINrjwtuNtgw4jhqcMCv23QNShHjmoTUCxAdfWcy86tNmTMoxLSRY+DqYxHEc/9Ecd6kfcvmdn5A2e//vmT6L/9Rv1DasAwJ2jW2dLAAAAAElFTkSuQmCC') no-repeat scroll 0 0;
441
  height: 21px;
images/button-back-blood.png ADDED
Binary file
images/button-back-fire.png ADDED
Binary file
images/check.png ADDED
Binary file
images/pause.png ADDED
Binary file
inc/admin.php CHANGED
@@ -1979,7 +1979,12 @@
1979
  if($cdn_value->id == "amazonaws" || $cdn_value->id == "keycdn" || $cdn_value->id == "cdn77"){
1980
  $cdn_value->id = "other";
1981
  }
1982
- ?>jQuery("div[wpfc-cdn-name='<?php echo $cdn_value->id;?>']").find("div.meta").addClass("isConnected");<?php
 
 
 
 
 
1983
  }
1984
  }
1985
  ?>
1979
  if($cdn_value->id == "amazonaws" || $cdn_value->id == "keycdn" || $cdn_value->id == "cdn77"){
1980
  $cdn_value->id = "other";
1981
  }
1982
+
1983
+ if(isset($cdn_value->status) && $cdn_value->status == "pause"){
1984
+ ?>jQuery("div[wpfc-cdn-name='<?php echo $cdn_value->id;?>']").find("div.meta").addClass("isConnected pause");<?php
1985
+ }else{
1986
+ ?>jQuery("div[wpfc-cdn-name='<?php echo $cdn_value->id;?>']").find("div.meta").addClass("isConnected");<?php
1987
+ }
1988
  }
1989
  }
1990
  ?>
inc/cache.php CHANGED
@@ -531,7 +531,8 @@
531
 
532
  public function exclude_page($buffer = false){
533
  $preg_match_rule = "";
534
- $request_url = urldecode(trim($_SERVER["REQUEST_URI"], "/"));
 
535
 
536
  if($this->exclude_rules){
537
 
@@ -544,18 +545,24 @@
544
  }
545
  }else if(isset($value->prefix) && $value->prefix && ($value->type == "page")){
546
  $value->content = trim($value->content);
547
- $value->content = trim($value->content, "/");
548
 
549
  if($buffer && preg_match("/^(homepage|category|tag|post|page|archive|attachment)$/", $value->prefix)){
550
  if(preg_match('/<\!--WPFC_PAGE_TYPE_'.$value->prefix.'-->/i', $buffer)){
551
  return true;
552
  }
553
  }else if($value->prefix == "exact"){
 
 
 
554
  if(strtolower($value->content) == strtolower($request_url)){
555
  return true;
556
  }
557
  }else{
558
  if($value->prefix == "startwith"){
 
 
 
559
  $preg_match_rule = "^".preg_quote($value->content, "/");
560
  }else if($value->prefix == "contain"){
561
  $preg_match_rule = preg_quote($value->content, "/");
@@ -654,7 +661,8 @@
654
  return true;
655
  }
656
 
657
- if(preg_match("/<body id\=\"error-page\">\s*<p>[^\>]+<\/p>\s*<\/body>/i", $buffer)){
 
658
  return true;
659
  }
660
  }
531
 
532
  public function exclude_page($buffer = false){
533
  $preg_match_rule = "";
534
+ //$request_url = urldecode(trim($_SERVER["REQUEST_URI"], "/"));
535
+ $request_url = urldecode($_SERVER["REQUEST_URI"]);
536
 
537
  if($this->exclude_rules){
538
 
545
  }
546
  }else if(isset($value->prefix) && $value->prefix && ($value->type == "page")){
547
  $value->content = trim($value->content);
548
+ //$value->content = trim($value->content, "/");
549
 
550
  if($buffer && preg_match("/^(homepage|category|tag|post|page|archive|attachment)$/", $value->prefix)){
551
  if(preg_match('/<\!--WPFC_PAGE_TYPE_'.$value->prefix.'-->/i', $buffer)){
552
  return true;
553
  }
554
  }else if($value->prefix == "exact"){
555
+ $request_url = trim($request_url, "/");
556
+ $value->content = trim($value->content, "/");
557
+
558
  if(strtolower($value->content) == strtolower($request_url)){
559
  return true;
560
  }
561
  }else{
562
  if($value->prefix == "startwith"){
563
+ $request_url = ltrim($request_url, "/");
564
+ $value->content = ltrim($value->content, "/");
565
+
566
  $preg_match_rule = "^".preg_quote($value->content, "/");
567
  }else if($value->prefix == "contain"){
568
  $preg_match_rule = preg_quote($value->content, "/");
661
  return true;
662
  }
663
 
664
+ //to exclude "There has been a critical error on this website" page
665
+ if(preg_match("/<body\sid\=\"error-page\">\s*<div\sclass\=\"wp-die-message\">/i", $buffer)){
666
  return true;
667
  }
668
  }
inc/cdn.php CHANGED
@@ -412,6 +412,78 @@
412
  }
413
  }
414
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  public static function remove_cdn_integration(){
416
  if(current_user_can('manage_options')){
417
  $cdn_values = get_option("WpFastestCacheCDN");
412
  }
413
  }
414
 
415
+ public static function start_cdn_integration(){
416
+ if(current_user_can('manage_options')){
417
+ $cdn_values = get_option("WpFastestCacheCDN");
418
+
419
+ if($cdn_values){
420
+ $std_obj = json_decode($cdn_values);
421
+ $cdn_values_arr = array();
422
+
423
+ if(is_array($std_obj)){
424
+ $cdn_values_arr = $std_obj;
425
+ }else{
426
+ array_push($cdn_values_arr, $std_obj);
427
+ }
428
+
429
+ foreach ($cdn_values_arr as $cdn_key => $cdn_value) {
430
+ if($cdn_value->id == "amazonaws" || $cdn_value->id == "keycdn" || $cdn_value->id == "cdn77"){
431
+ $cdn_value->id = "other";
432
+ }
433
+
434
+ if($cdn_value->id == $_POST["id"]){
435
+ unset($cdn_value->status);
436
+ }
437
+ }
438
+
439
+ $cdn_values_arr = array_values($cdn_values_arr);
440
+
441
+ update_option("WpFastestCacheCDN", json_encode($cdn_values_arr));
442
+ }
443
+
444
+ echo json_encode(array("success" => true));
445
+ exit;
446
+ }else{
447
+ wp_die("Must be admin");
448
+ }
449
+ }
450
+
451
+ public static function pause_cdn_integration(){
452
+ if(current_user_can('manage_options')){
453
+ $cdn_values = get_option("WpFastestCacheCDN");
454
+
455
+ if($cdn_values){
456
+ $std_obj = json_decode($cdn_values);
457
+ $cdn_values_arr = array();
458
+
459
+ if(is_array($std_obj)){
460
+ $cdn_values_arr = $std_obj;
461
+ }else{
462
+ array_push($cdn_values_arr, $std_obj);
463
+ }
464
+
465
+ foreach ($cdn_values_arr as $cdn_key => $cdn_value) {
466
+ if($cdn_value->id == "amazonaws" || $cdn_value->id == "keycdn" || $cdn_value->id == "cdn77"){
467
+ $cdn_value->id = "other";
468
+ }
469
+
470
+ if($cdn_value->id == $_POST["id"]){
471
+ $cdn_value->status = "pause";
472
+ }
473
+ }
474
+
475
+ $cdn_values_arr = array_values($cdn_values_arr);
476
+
477
+ update_option("WpFastestCacheCDN", json_encode($cdn_values_arr));
478
+ }
479
+
480
+ echo json_encode(array("success" => true));
481
+ exit;
482
+ }else{
483
+ wp_die("Must be admin");
484
+ }
485
+ }
486
+
487
  public static function remove_cdn_integration(){
488
  if(current_user_can('manage_options')){
489
  $cdn_values = get_option("WpFastestCacheCDN");
js/cdn/cdn.js CHANGED
@@ -3,6 +3,7 @@ var WpfcCDN = {
3
  id : "",
4
  template_url : "",
5
  content : "",
 
6
  init: function(obj){
7
  this.set_params(obj);
8
  this.open_wizard();
@@ -130,14 +131,71 @@ var WpfcCDN = {
130
  Wpfc_Dialog.remove();
131
  }else if(action == "remove"){
132
  self.remove_integration();
 
 
 
 
133
  }
134
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  },
136
  remove_integration: function(){
137
  var self = this;
138
  var modal = jQuery("#wpfc-modal-" + self.id);
139
 
140
- modal.find(".wpfc-dialog-buttons[action='remove']").attr("disabled", true);
141
 
142
  jQuery.ajax({
143
  type: 'POST',
@@ -153,14 +211,13 @@ var WpfcCDN = {
153
  });
154
 
155
 
156
-
157
- modal.find(".wpfc-dialog-buttons[action='remove']").attr("disabled", false);
158
  jQuery("div.tab7 div[wpfc-cdn-name='" + self.id + "']").find("div.meta").removeClass("isConnected");
159
  Wpfc_Dialog.remove();
160
  console.log(res);
161
  },
162
  error: function(e) {
163
- modal.find(".wpfc-dialog-buttons[action='remove']").attr("disabled", false);
164
  alert("unknown error");
165
  }
166
  });
@@ -173,7 +230,7 @@ var WpfcCDN = {
173
  self.values = {};
174
  self.values.id = self.id;
175
 
176
- modal.find(".wpfc-dialog-buttons[action='finish']").attr("disabled", true);
177
 
178
  if(modal.find("input#cdn-url").length == 1){
179
  self.values.cdnurl = modal.find("input#cdn-url").val();
@@ -195,18 +252,59 @@ var WpfcCDN = {
195
  data : {"action": "wpfc_save_cdn_integration", "values" : self.values, "file_types" : self.values.file_types, "keywords" : self.values.keywords, "excludekeywords" : self.values.excludekeywords},
196
  success: function(res){
197
  jQuery("div[wpfc-cdn-name='" + self.id + "']").find("div.meta").addClass("isConnected");
198
- jQuery(".wpfc-dialog-buttons[action='finish']").attr("disabled", false);
 
 
199
  self.show_page("next");
200
  console.log(res);
201
  },
202
  error: function(e) {
203
- modal.find(".wpfc-dialog-buttons[action='finish']").attr("disabled", false);
204
  alert("unknown error");
205
  }
206
  });
207
 
208
 
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  },
211
  check_url_exist: function(){
212
  var self = this;
@@ -283,6 +381,12 @@ var WpfcCDN = {
283
  jQuery(self.values).each(function(i, e){
284
  if(e.id == self.id){
285
  self.show_button("remove");
 
 
 
 
 
 
286
  }
287
  });
288
 
3
  id : "",
4
  template_url : "",
5
  content : "",
6
+ interval : false,
7
  init: function(obj){
8
  this.set_params(obj);
9
  this.open_wizard();
131
  Wpfc_Dialog.remove();
132
  }else if(action == "remove"){
133
  self.remove_integration();
134
+ }else if(action == "pause"){
135
+ self.pause_integration();
136
+ }else if(action == "start"){
137
+ self.start_integration();
138
  }
139
  });
140
+ },
141
+ start_integration: function(){
142
+ var self = this;
143
+ var modal = jQuery("#wpfc-modal-" + self.id);
144
+
145
+ self.disable_button("start");
146
+
147
+ jQuery.ajax({
148
+ type: 'POST',
149
+ dataType: "json",
150
+ url: ajaxurl,
151
+ data : {"action": "wpfc_start_cdn_integration", "id" : self.id},
152
+ success: function(res){
153
+ self.show_button("pause");
154
+ self.enable_button("pause");
155
+ self.hide_button("start");
156
+
157
+ jQuery("div[wpfc-cdn-name='" + self.id + "']").find("div.meta").removeClass("pause");
158
+
159
+ },
160
+ error: function(e) {
161
+ self.enable_button("start");
162
+ alert("unknown error");
163
+ }
164
+ });
165
+
166
+ },
167
+ pause_integration: function(){
168
+ var self = this;
169
+ var modal = jQuery("#wpfc-modal-" + self.id);
170
+
171
+ self.disable_button("pause");
172
+
173
+ jQuery.ajax({
174
+ type: 'POST',
175
+ dataType: "json",
176
+ url: ajaxurl,
177
+ data : {"action": "wpfc_pause_cdn_integration", "id" : self.id},
178
+ success: function(res){
179
+ self.show_button("start");
180
+ self.enable_button("start");
181
+ self.hide_button("pause");
182
+
183
+ jQuery("div[wpfc-cdn-name='" + self.id + "']").find("div.meta").addClass("pause");
184
+
185
+ },
186
+ error: function(e) {
187
+ self.enable_button("pause");
188
+ alert("unknown error");
189
+ }
190
+ });
191
+
192
+
193
  },
194
  remove_integration: function(){
195
  var self = this;
196
  var modal = jQuery("#wpfc-modal-" + self.id);
197
 
198
+ self.disable_button("remove");
199
 
200
  jQuery.ajax({
201
  type: 'POST',
211
  });
212
 
213
 
214
+ self.enable_button("remove");
 
215
  jQuery("div.tab7 div[wpfc-cdn-name='" + self.id + "']").find("div.meta").removeClass("isConnected");
216
  Wpfc_Dialog.remove();
217
  console.log(res);
218
  },
219
  error: function(e) {
220
+ self.enable_button("remove");
221
  alert("unknown error");
222
  }
223
  });
230
  self.values = {};
231
  self.values.id = self.id;
232
 
233
+ self.disable_button("finish");
234
 
235
  if(modal.find("input#cdn-url").length == 1){
236
  self.values.cdnurl = modal.find("input#cdn-url").val();
252
  data : {"action": "wpfc_save_cdn_integration", "values" : self.values, "file_types" : self.values.file_types, "keywords" : self.values.keywords, "excludekeywords" : self.values.excludekeywords},
253
  success: function(res){
254
  jQuery("div[wpfc-cdn-name='" + self.id + "']").find("div.meta").addClass("isConnected");
255
+
256
+ self.enable_button("finish");
257
+
258
  self.show_page("next");
259
  console.log(res);
260
  },
261
  error: function(e) {
262
+ self.enable_button("finish");
263
  alert("unknown error");
264
  }
265
  });
266
 
267
 
268
 
269
+ },
270
+ enable_button: function(button_type){
271
+ clearInterval(this.interval);
272
+
273
+ let self = this;
274
+ let modal = jQuery("#wpfc-modal-" + self.id);
275
+ let button = modal.find(".wpfc-dialog-buttons[action='" + button_type + "']");
276
+
277
+ button.attr("disabled", false);
278
+ button.text(button.text().replace(/\.+$/, ""));
279
+ },
280
+ disable_button: function(button_type){
281
+ let self = this;
282
+ let modal = jQuery("#wpfc-modal-" + self.id);
283
+ let button = modal.find(".wpfc-dialog-buttons[action='" + button_type + "']");
284
+ let text = button.text();
285
+ let dot = 0;
286
+
287
+ button.attr("disabled", true);
288
+
289
+ button.text(text + ".");
290
+
291
+ self.interval = setInterval(function(){
292
+ text = button.text();
293
+ dot = text.match(/\./g);
294
+
295
+ console.log(dot);
296
+ console.log(button);
297
+
298
+ if(dot){
299
+ if(dot.length < 3){
300
+ button.text(text + ".");
301
+ }else{
302
+ button.text(text.replace(/\.+$/, ""));
303
+ }
304
+ }else{
305
+ button.text(text + ".");
306
+ }
307
+ }, 300);
308
  },
309
  check_url_exist: function(){
310
  var self = this;
381
  jQuery(self.values).each(function(i, e){
382
  if(e.id == self.id){
383
  self.show_button("remove");
384
+
385
+ if(typeof e.status != "undefined" && e.status == "pause"){
386
+ self.show_button("start");
387
+ }else{
388
+ self.show_button("pause");
389
+ }
390
  }
391
  });
392
 
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.8
7
- Stable tag: 0.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,6 +125,13 @@ The free version is enough to speed up your site but in the premium version ther
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
 
128
  = 0.9.2 =
129
  * <strong>[FEATURE]</strong> to create cache after publishing new post or updating a post [<a target="_blank" href="https://www.wpfastestcache.com/features/automatic-cache/">Details</a>]
130
  * <strong>[FEATURE]</strong> Clear cache after activate/deactivate plugin [<a target="_blank" href="https://www.wpfastestcache.com/features/clear-cache-after-activate-deactivate-a-plugin/">Details</a>]
4
  Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 5.8
7
+ Stable tag: 0.9.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
125
 
126
  == Changelog ==
127
 
128
+ = 0.9.3 =
129
+ * to prevent removing "/" for exclude rules
130
+ * <strong>[FEATURE]</strong> to add "pause" feature for cdn [<a target="_blank" href="https://www.wpfastestcache.com/features/temporarily-disable-cdn/">Details</a>]
131
+ * to add wpfc_clear_all_site_cache() for clearing cache of all sites [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/delete-the-cache-by-calling-the-function/">Details</a>]
132
+ * to add spinner for the buttons on the cdn wizard
133
+ * refactroing of excluding "There has been a critical error on this website" page
134
+
135
  = 0.9.2 =
136
  * <strong>[FEATURE]</strong> to create cache after publishing new post or updating a post [<a target="_blank" href="https://www.wpfastestcache.com/features/automatic-cache/">Details</a>]
137
  * <strong>[FEATURE]</strong> Clear cache after activate/deactivate plugin [<a target="_blank" href="https://www.wpfastestcache.com/features/clear-cache-after-activate-deactivate-a-plugin/">Details</a>]
templates/buttons.html CHANGED
@@ -1,7 +1,13 @@
1
  <div class="window-buttons-wrapper" style="padding: 0px; display: inline-block; width: 100%; border-top: 1px solid rgb(255, 255, 255); background: none repeat scroll 0px 0px rgb(222, 222, 222); z-index: 999; position: relative; text-align: right; border-radius: 0px 0px 3px 3px;">
2
  <div style="padding: 12px; height: 23px;">
3
  <button class="wpfc-dialog-buttons buttons-blood" type="button" action="remove">
4
- <span>Remove integration</span>
 
 
 
 
 
 
5
  </button>
6
  <button class="wpfc-dialog-buttons" type="button" action="back">
7
  <img align="left" class="icon-left" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYFJREFUeNrEkzFLw0AUx1/SpE02C0UXF6EgLXQxxc3BSUWsm1N1qVBwkIyOrgoFwY+gW0E36SQ4OIhmMIN+ACelWi1terlcLr5rTTE2oNDBB/+85HL/X+7du0hBEMA4IcOYMTZACW9y+7eQ1DRI6Xo/K8lkGYcXsMSqeP/RbA5NAedwv1eIAr4HmsqMUjN8Jo7z9xKE2XNdc2tt2qCEgNPpAPO830sIzWgydzYLRqvFwO31xPBdzEcsTNUIgHO+jAZztzJv2HYbdD0BpcWsIbrMeQAiCymKBPULe3QFpNsdZOIDYz44LgfH49B1CBCXAvVYH5RKqcO50RX4fsOjNHN41DBLlSXDevXg6ezSiqtbkiRrBNC+OQF5MncK6SzUj8/Nme0Nw8XdV1S1KMnRvWbPD3hdHcDCo4zUAXEqD4n8elnOzPbbSK8Oiv7LY1yrYwE6Ki2UMCoroE3M+de1WuhBdVBvqHf0sTiAitK+QD8PmZhIUaK3BH08Avi3n+lTgAEAiza4dOMU/9wAAAAASUVORK5CYII="/>
1
  <div class="window-buttons-wrapper" style="padding: 0px; display: inline-block; width: 100%; border-top: 1px solid rgb(255, 255, 255); background: none repeat scroll 0px 0px rgb(222, 222, 222); z-index: 999; position: relative; text-align: right; border-radius: 0px 0px 3px 3px;">
2
  <div style="padding: 12px; height: 23px;">
3
  <button class="wpfc-dialog-buttons buttons-blood" type="button" action="remove">
4
+ <span>Remove</span>
5
+ </button>
6
+ <button class="wpfc-dialog-buttons buttons-orange" type="button" action="pause">
7
+ <span>Pause</span>
8
+ </button>
9
+ <button class="wpfc-dialog-buttons buttons-start" type="button" action="start">
10
+ <span>Start</span>
11
  </button>
12
  <button class="wpfc-dialog-buttons" type="button" action="back">
13
  <img align="left" class="icon-left" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYFJREFUeNrEkzFLw0AUx1/SpE02C0UXF6EgLXQxxc3BSUWsm1N1qVBwkIyOrgoFwY+gW0E36SQ4OIhmMIN+ACelWi1terlcLr5rTTE2oNDBB/+85HL/X+7du0hBEMA4IcOYMTZACW9y+7eQ1DRI6Xo/K8lkGYcXsMSqeP/RbA5NAedwv1eIAr4HmsqMUjN8Jo7z9xKE2XNdc2tt2qCEgNPpAPO830sIzWgydzYLRqvFwO31xPBdzEcsTNUIgHO+jAZztzJv2HYbdD0BpcWsIbrMeQAiCymKBPULe3QFpNsdZOIDYz44LgfH49B1CBCXAvVYH5RKqcO50RX4fsOjNHN41DBLlSXDevXg6ezSiqtbkiRrBNC+OQF5MncK6SzUj8/Nme0Nw8XdV1S1KMnRvWbPD3hdHcDCo4zUAXEqD4n8elnOzPbbSK8Oiv7LY1yrYwE6Ki2UMCoroE3M+de1WuhBdVBvqHf0sTiAitK+QD8PmZhIUaK3BH08Avi3n+lTgAEAiza4dOMU/9wAAAAASUVORK5CYII="/>
templates/exclude.php CHANGED
@@ -329,9 +329,9 @@
329
  var b_end = "</b>"
330
 
331
  if(prefix == "exact"){
332
- request_uri = b_start + content + b_end;
333
  }else if(prefix == "startwith"){
334
- request_uri = b_start + content + b_end + '(.*)';
335
  }else if(prefix == "contain"){
336
  request_uri = '(.*)' + b_start + content + b_end + '(.*)';
337
  }else if(prefix == "homepage"){
@@ -445,7 +445,7 @@
445
 
446
  content = self.remove_host_name(content);
447
 
448
- content = content.replace(/^\/|\/$/g, '');
449
 
450
  if(self.is_empty_values(prefix, content)){
451
  self.add_line(number + 1, {"prefix" : prefix, "content" : content, "type" : type});
@@ -546,7 +546,7 @@
546
  remove_host_name: function(content){
547
  //to replace the urls which start with http:// or www. or with Host_Name
548
  content = content.replace(new RegExp('.*' + location.hostname.replace(/www\./, "") + "\/", "gi"), "");
549
- content = content.replace(/\/$/, "");
550
 
551
  return content;
552
  },
329
  var b_end = "</b>"
330
 
331
  if(prefix == "exact"){
332
+ request_uri = b_start + content.replace(/^\//, "") + b_end;
333
  }else if(prefix == "startwith"){
334
+ request_uri = b_start + content.replace(/^\//, "") + b_end + '(.*)';
335
  }else if(prefix == "contain"){
336
  request_uri = '(.*)' + b_start + content + b_end + '(.*)';
337
  }else if(prefix == "homepage"){
445
 
446
  content = self.remove_host_name(content);
447
 
448
+ //content = content.replace(/^\/|\/$/g, '');
449
 
450
  if(self.is_empty_values(prefix, content)){
451
  self.add_line(number + 1, {"prefix" : prefix, "content" : content, "type" : type});
546
  remove_host_name: function(content){
547
  //to replace the urls which start with http:// or www. or with Host_Name
548
  content = content.replace(new RegExp('.*' + location.hostname.replace(/www\./, "") + "\/", "gi"), "");
549
+ //content = content.replace(/\/$/, "");
550
 
551
  return content;
552
  },
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.9.2
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -110,6 +110,8 @@ GNU General Public License for more details.
110
  add_action( 'wp_ajax_wpfc_save_exclude_pages', array($this, 'wpfc_save_exclude_pages_callback'));
111
  add_action( 'wp_ajax_wpfc_cdn_options', array($this, 'wpfc_cdn_options_ajax_request_callback'));
112
  add_action( 'wp_ajax_wpfc_remove_cdn_integration', array($this, 'wpfc_remove_cdn_integration_ajax_request_callback'));
 
 
113
  add_action( 'wp_ajax_wpfc_save_cdn_integration', array($this, 'wpfc_save_cdn_integration_ajax_request_callback'));
114
  add_action( 'wp_ajax_wpfc_cdn_template', array($this, 'wpfc_cdn_template_ajax_request_callback'));
115
  add_action( 'wp_ajax_wpfc_check_url', array($this, 'wpfc_check_url_ajax_request_callback'));
@@ -154,6 +156,7 @@ GNU General Public License for more details.
154
 
155
  // clearing cache hooks
156
  add_action("wpfc_clear_all_cache", array($this, 'deleteCache'), 10, 1);
 
157
  add_action("wpfc_clear_post_cache_by_id", array($this, 'singleDeleteCache'), 10, 2);
158
 
159
 
@@ -492,7 +495,7 @@ GNU General Public License for more details.
492
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["trackback_pingback"];
493
 
494
  $element = "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '%\_transient\_%' ;";
495
- $statics["transient_options"] = $wpdb->get_var( $element ) > 20 ? $wpdb->get_var( $element ) : 0;
496
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["transient_options"];
497
 
498
  die(json_encode($statics));
@@ -539,7 +542,16 @@ GNU General Public License for more details.
539
  public function wpfc_save_cdn_integration_ajax_request_callback(){
540
  include_once('inc/cdn.php');
541
  CdnWPFC::save_cdn_integration();
 
542
 
 
 
 
 
 
 
 
 
543
  }
544
 
545
  public function wpfc_remove_cdn_integration_ajax_request_callback(){
@@ -566,7 +578,7 @@ GNU General Public License for more details.
566
  $value["prefix"] = preg_replace("/\'|\"/", "", $value["prefix"]);
567
  $value["content"] = preg_replace("/\'|\"/", "", $value["content"]);
568
 
569
- $value["content"] = trim($value["content"], "/");
570
 
571
  $value["content"] = preg_replace("/(\#|\s|\(|\)|\*)/", "", $value["content"]);
572
 
@@ -1678,6 +1690,8 @@ GNU General Public License for more details.
1678
 
1679
  if($value->type == "page"){
1680
  if($value->prefix == "startwith"){
 
 
1681
  $htaccess_page_rules = $htaccess_page_rules."RewriteCond %{REQUEST_URI} !^/".$value->content." [NC]\n";
1682
  }
1683
 
@@ -1686,6 +1700,8 @@ GNU General Public License for more details.
1686
  }
1687
 
1688
  if($value->prefix == "exact"){
 
 
1689
  $htaccess_page_rules = $htaccess_page_rules."RewriteCond %{REQUEST_URI} !\/".$value->content." [NC]\n";
1690
  }
1691
  }else if($value->type == "useragent"){
@@ -1952,6 +1968,10 @@ GNU General Public License for more details.
1952
  continue;
1953
  }
1954
 
 
 
 
 
1955
  if(preg_match("/manifest\.json\.php/i", $matches[0])){
1956
  return $matches[0];
1957
  }
@@ -2142,7 +2162,11 @@ GNU General Public License for more details.
2142
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
2143
  require_once "inc/cli.php";
2144
  }
2145
-
 
 
 
 
2146
  function wpfc_clear_all_cache($minified = false){
2147
  do_action("wpfc_clear_all_cache", $minified);
2148
  }
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.9.3
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
110
  add_action( 'wp_ajax_wpfc_save_exclude_pages', array($this, 'wpfc_save_exclude_pages_callback'));
111
  add_action( 'wp_ajax_wpfc_cdn_options', array($this, 'wpfc_cdn_options_ajax_request_callback'));
112
  add_action( 'wp_ajax_wpfc_remove_cdn_integration', array($this, 'wpfc_remove_cdn_integration_ajax_request_callback'));
113
+ add_action( 'wp_ajax_wpfc_pause_cdn_integration', array($this, 'wpfc_pause_cdn_integration_ajax_request_callback'));
114
+ add_action( 'wp_ajax_wpfc_start_cdn_integration', array($this, 'wpfc_start_cdn_integration_ajax_request_callback'));
115
  add_action( 'wp_ajax_wpfc_save_cdn_integration', array($this, 'wpfc_save_cdn_integration_ajax_request_callback'));
116
  add_action( 'wp_ajax_wpfc_cdn_template', array($this, 'wpfc_cdn_template_ajax_request_callback'));
117
  add_action( 'wp_ajax_wpfc_check_url', array($this, 'wpfc_check_url_ajax_request_callback'));
156
 
157
  // clearing cache hooks
158
  add_action("wpfc_clear_all_cache", array($this, 'deleteCache'), 10, 1);
159
+ add_action("wpfc_clear_all_site_cache", array($this, 'wpfc_clear_cache_of_allsites_callback'));
160
  add_action("wpfc_clear_post_cache_by_id", array($this, 'singleDeleteCache'), 10, 2);
161
 
162
 
495
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["trackback_pingback"];
496
 
497
  $element = "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '%\_transient\_%' ;";
498
+ $statics["transient_options"] = $wpdb->get_var( $element ) > 30 ? $wpdb->get_var( $element ) : 0;
499
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["transient_options"];
500
 
501
  die(json_encode($statics));
542
  public function wpfc_save_cdn_integration_ajax_request_callback(){
543
  include_once('inc/cdn.php');
544
  CdnWPFC::save_cdn_integration();
545
+ }
546
 
547
+ public function wpfc_start_cdn_integration_ajax_request_callback(){
548
+ include_once('inc/cdn.php');
549
+ CdnWPFC::start_cdn_integration();
550
+ }
551
+
552
+ public function wpfc_pause_cdn_integration_ajax_request_callback(){
553
+ include_once('inc/cdn.php');
554
+ CdnWPFC::pause_cdn_integration();
555
  }
556
 
557
  public function wpfc_remove_cdn_integration_ajax_request_callback(){
578
  $value["prefix"] = preg_replace("/\'|\"/", "", $value["prefix"]);
579
  $value["content"] = preg_replace("/\'|\"/", "", $value["content"]);
580
 
581
+ //$value["content"] = trim($value["content"], "/");
582
 
583
  $value["content"] = preg_replace("/(\#|\s|\(|\)|\*)/", "", $value["content"]);
584
 
1690
 
1691
  if($value->type == "page"){
1692
  if($value->prefix == "startwith"){
1693
+ $value->content = ltrim($value->content, "/");
1694
+
1695
  $htaccess_page_rules = $htaccess_page_rules."RewriteCond %{REQUEST_URI} !^/".$value->content." [NC]\n";
1696
  }
1697
 
1700
  }
1701
 
1702
  if($value->prefix == "exact"){
1703
+ $value->content = trim($value->content, "/");
1704
+
1705
  $htaccess_page_rules = $htaccess_page_rules."RewriteCond %{REQUEST_URI} !\/".$value->content." [NC]\n";
1706
  }
1707
  }else if($value->type == "useragent"){
1968
  continue;
1969
  }
1970
 
1971
+ if(isset($cdn->status) && $cdn->status == "pause"){
1972
+ continue;
1973
+ }
1974
+
1975
  if(preg_match("/manifest\.json\.php/i", $matches[0])){
1976
  return $matches[0];
1977
  }
2162
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
2163
  require_once "inc/cli.php";
2164
  }
2165
+
2166
+ function wpfc_clear_all_site_cache(){
2167
+ do_action("wpfc_clear_all_cache");
2168
+ }
2169
+
2170
  function wpfc_clear_all_cache($minified = false){
2171
  do_action("wpfc_clear_all_cache", $minified);
2172
  }