WP Fastest Cache - Version 1.0.7

Version Description

  • [FEATURE] Clearing Specific Pages (BETA) [Details]
  • to add last-modified header when cache is served via php
Download this release

Release Info

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

Code changes from version 1.0.6 to 1.0.7

css/dialog.css CHANGED
@@ -56,7 +56,7 @@ button:focus {outline:0;}
56
  .window-buttons-wrapper button {
57
  margin: 0 4px;
58
  }
59
- .wpfc-add-new-timeout-button, .wpfc-add-new-exclude-button, .window-buttons-wrapper button[action="next"], .window-buttons-wrapper button[action="back"], .window-buttons-wrapper button[action="close"] {
60
  background-color: gray !important;
61
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAABaCAIAAAAU4rCTAAACGUlEQVQ4EQXBQbIkRxEFQH+V0V974Bjo/neaBTJhs6Ir4+GeX79+AQDmr7/+UxChmBawGsq0qxGqoabVVolUa7ZNW8IWpnsraAGzWwogMdsl2khTm9lb2dCqSKddVZRUze6CUIXZriJJW2T2lgLA7F4AQs3uAgBm9xIAmN1SoIrZ3ZY0oqRz74XQUMy9t1ASVfN9X5pGoDr3+5UAwLz3AgDmfS8gtGTufQEAc+9VAmjN3lsIJXTuXgIA8zwHAJDfv38DAObvv/9LRWgTnqRJVJtEdXYrTVOtaqZtahWKTtuCtonW7C6AFmZ3SdKWUNNuxQqFzr2l0UWipr0lJbFbZu8WJFqYuwsAmL1LIUqYuxfChorZvQSoYvZuCQ2VmHtX2iY0jczdCwCYe5eSKCqze0u0TRDz/X5Dk7RNtPP9vtIUoZV53y9QQpnv90XSVqQ67/s/AgDzvhdKAPO+L4FUkbn3AgBm96oKEtX8+e8/AQDzj3/9M0BJMed5QgkV6cxMCS2EOeeEhkrSdj6fIUpUMTMfACDz+flJS0rSMj8zElBSnc/PH9FCQnV+fj6gGkHn8/mAEmDOOQCAOedAIFXmnAMAmHNOKJBo55wDAJhzDkqgZJ5zoJCgc55HklbSNsmccwAAc55HtIRGzHMORKpgnnOiLY8UmfNE0yeBqnmeU6IqCSZPHtp4aBLz5EECgkyeJ4CCzHkeAMD/AViclsCJwxhXAAAAAElFTkSuQmCC') !important;
62
  background-repeat: repeat-x !important;
56
  .window-buttons-wrapper button {
57
  margin: 0 4px;
58
  }
59
+ .wpfc-add-new-csp-button, .wpfc-add-new-timeout-button, .wpfc-add-new-exclude-button, .window-buttons-wrapper button[action="next"], .window-buttons-wrapper button[action="back"], .window-buttons-wrapper button[action="close"] {
60
  background-color: gray !important;
61
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAABaCAIAAAAU4rCTAAACGUlEQVQ4EQXBQbIkRxEFQH+V0V974Bjo/neaBTJhs6Ir4+GeX79+AQDmr7/+UxChmBawGsq0qxGqoabVVolUa7ZNW8IWpnsraAGzWwogMdsl2khTm9lb2dCqSKddVZRUze6CUIXZriJJW2T2lgLA7F4AQs3uAgBm9xIAmN1SoIrZ3ZY0oqRz74XQUMy9t1ASVfN9X5pGoDr3+5UAwLz3AgDmfS8gtGTufQEAc+9VAmjN3lsIJXTuXgIA8zwHAJDfv38DAObvv/9LRWgTnqRJVJtEdXYrTVOtaqZtahWKTtuCtonW7C6AFmZ3SdKWUNNuxQqFzr2l0UWipr0lJbFbZu8WJFqYuwsAmL1LIUqYuxfChorZvQSoYvZuCQ2VmHtX2iY0jczdCwCYe5eSKCqze0u0TRDz/X5Dk7RNtPP9vtIUoZV53y9QQpnv90XSVqQ67/s/AgDzvhdKAPO+L4FUkbn3AgBm96oKEtX8+e8/AQDzj3/9M0BJMed5QgkV6cxMCS2EOeeEhkrSdj6fIUpUMTMfACDz+flJS0rSMj8zElBSnc/PH9FCQnV+fj6gGkHn8/mAEmDOOQCAOedAIFXmnAMAmHNOKJBo55wDAJhzDkqgZJ5zoJCgc55HklbSNsmccwAAc55HtIRGzHMORKpgnnOiLY8UmfNE0yeBqnmeU6IqCSZPHtp4aBLz5EECgkyeJ4CCzHkeAMD/AViclsCJwxhXAAAAAElFTkSuQmCC') !important;
62
  background-repeat: repeat-x !important;
css/style.css CHANGED
@@ -381,15 +381,15 @@ span.deleteicon span.cleared {
381
  overflow-y: auto;
382
  padding: 0;
383
  }
384
- .wpfc-timeout-item, .wpfc-exclude-item, .int-item{
385
  background: url(data:image/gif;base64,R0lGODlhAQAkANUAAAAAAP/////+//38/fb19vX09fDv8Pr6+/n5+vb29/Hx8u/v8Pv8/Pn6+vLz8vv7+vj49/T08/Pz8vLy8f/+/v38/Pn4+PHw8P7+/v39/fv7+/j4+Pf39/b29vPz8/Hx8fDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACEALAAAAAABACQAAAYiwICAgsFkMpUBQ/M4IBqWDYST6BAKhYjHIZkoPp8LaGEIAgA7) repeat-x scroll center bottom transparent !important;
386
  border: 1px solid #CCCCCC !important;
387
  }
388
- .wpfc-timeout-item:hover, .wpfc-exclude-item:hover, .int-item:hover{
389
  border:1px solid #ccc;
390
  background:#f5f5f5 none repeat scroll 0 0 !important;
391
  }
392
- .int-item, .wpfc-timeout-item, .wpfc-exclude-item {
393
  border-radius: 6px;
394
  cursor: pointer;
395
  margin-bottom: 7px;
381
  overflow-y: auto;
382
  padding: 0;
383
  }
384
+ .wpfc-csp-item, .wpfc-timeout-item, .wpfc-exclude-item, .int-item{
385
  background: url(data:image/gif;base64,R0lGODlhAQAkANUAAAAAAP/////+//38/fb19vX09fDv8Pr6+/n5+vb29/Hx8u/v8Pv8/Pn6+vLz8vv7+vj49/T08/Pz8vLy8f/+/v38/Pn4+PHw8P7+/v39/fv7+/j4+Pf39/b29vPz8/Hx8fDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACEALAAAAAABACQAAAYiwICAgsFkMpUBQ/M4IBqWDYST6BAKhYjHIZkoPp8LaGEIAgA7) repeat-x scroll center bottom transparent !important;
386
  border: 1px solid #CCCCCC !important;
387
  }
388
+ .wpfc-csp-item:hover, .wpfc-timeout-item:hover, .wpfc-exclude-item:hover, .int-item:hover{
389
  border:1px solid #ccc;
390
  background:#f5f5f5 none repeat scroll 0 0 !important;
391
  }
392
+ .int-item, .wpfc-timeout-item, .wpfc-exclude-item, .wpfc-csp-item {
393
  border-radius: 6px;
394
  cursor: pointer;
395
  margin-bottom: 7px;
inc/admin.php CHANGED
@@ -1621,6 +1621,34 @@
1621
  echo "WpFcTimeout.init();";
1622
  } ?>
1623
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1624
  </div>
1625
 
1626
 
1621
  echo "WpFcTimeout.init();";
1622
  } ?>
1623
  </script>
1624
+
1625
+
1626
+ <?php if(defined("WPFC_ENABLE_CLEARING_SPECIFIC_PAGES") && WPFC_ENABLE_CLEARING_SPECIFIC_PAGES){ ?>
1627
+
1628
+ <div class="exclude_section_clear" style=" margin-left: 3%; width: 95%; margin-bottom: 12px; margin-top: 0;"><div></div></div>
1629
+
1630
+ <h2 style="padding-bottom:10px;padding-left:20px;float:left;"><?php _e("Clearing Specific Pages", "wp-fastest-cache"); ?></h2>
1631
+
1632
+ <div style="float:left;margin-top:-37px;padding-left:628px;">
1633
+ <button type="button" <?php echo $disable_wp_cron;?> class="wpfc-add-new-csp-button wpfc-dialog-buttons" style="display: inline-block;padding: 4px 10px;">
1634
+ <span><?php _e("Add New Rule", "wp-fastest-cache"); ?></span>
1635
+ </button>
1636
+ </div>
1637
+
1638
+ <div class="wpfc-csp-list" style="display: block;width:98%;float:left;">
1639
+
1640
+ </div>
1641
+
1642
+ <?php
1643
+ include(WPFC_MAIN_PATH."templates/clearing_specific_pages.php");
1644
+ ?>
1645
+
1646
+ <?php } ?>
1647
+
1648
+
1649
+
1650
+
1651
+
1652
  </div>
1653
 
1654
 
inc/cache.php CHANGED
@@ -389,6 +389,12 @@
389
  }
390
 
391
  if($content = @file_get_contents($this->cacheFilePath."index.".$file_extension)){
 
 
 
 
 
 
392
  if(defined('WPFC_REMOVE_VIA_FOOTER_COMMENT') && WPFC_REMOVE_VIA_FOOTER_COMMENT){
393
  $via_php = "";
394
  }
389
  }
390
 
391
  if($content = @file_get_contents($this->cacheFilePath."index.".$file_extension)){
392
+
393
+ if($file_extension == "html"){
394
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($this->cacheFilePath."index.".$file_extension)).' GMT', true, 200);
395
+ }
396
+
397
+
398
  if(defined('WPFC_REMOVE_VIA_FOOTER_COMMENT') && WPFC_REMOVE_VIA_FOOTER_COMMENT){
399
  $via_php = "";
400
  }
inc/clearing-specific-pages.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ClearingSpecificPagesWPFC{
3
+
4
+ public static function remove(){
5
+ if(!wp_verify_nonce($_POST["security"], 'wpfc-save-csp-ajax-nonce')){
6
+ die( 'Security check' );
7
+ }
8
+
9
+ $_POST["order"] = sanitize_text_field($_POST["order"]);
10
+
11
+ $urls = get_option("WpFastestCacheCSP");
12
+
13
+ if(!empty($urls)){
14
+ foreach ($urls as $key => $value) {
15
+ if($value->order == ($_POST["order"])){
16
+ unset($urls[$key]);
17
+ }
18
+ }
19
+ }
20
+
21
+ if(empty($urls)){
22
+ delete_option("WpFastestCacheCSP");
23
+ }else{
24
+ update_option("WpFastestCacheCSP", $urls, 1, "no");
25
+ }
26
+
27
+ wp_send_json_success();
28
+ }
29
+
30
+ public function check_url(){
31
+ $home_url = parse_url(get_option("home"), PHP_URL_HOST);
32
+ $specific_url = parse_url($_POST["url"], PHP_URL_HOST);
33
+
34
+ if($home_url == $specific_url){
35
+ return true;
36
+ }
37
+
38
+ return false;
39
+ }
40
+
41
+ public function check_wild_card(){
42
+ if(preg_match("/[^\/]\(\.\*\)/", $_POST["url"])){
43
+ return false;
44
+ }
45
+
46
+ if(substr_count($_POST["url"], "(.*)") > 1){
47
+ return false;
48
+ }
49
+
50
+ return true;
51
+ }
52
+
53
+ public static function save(){
54
+ if(!wp_verify_nonce($_POST["security"], 'wpfc-save-csp-ajax-nonce')){
55
+ die( 'Security check' );
56
+ }
57
+
58
+ if(!self::check_url()){
59
+ wp_send_json_error("The URL must start with ".parse_url(get_option("home"), PHP_URL_SCHEME)."//".parse_url(get_option("home"), PHP_URL_HOST));
60
+ }
61
+
62
+ if(!self::check_wild_card()){
63
+ wp_send_json_error("Wrong Wild Card Usage");
64
+ }
65
+
66
+ $_POST["url"] = sanitize_url($_POST["url"]);
67
+ $_POST["order"] = sanitize_text_field($_POST["order"]);
68
+
69
+ $urls = get_option("WpFastestCacheCSP");
70
+ $url = (object)array("url" => $_POST["url"], "order" => $_POST["order"]);
71
+
72
+ if(!is_array($urls)){
73
+ $urls = array();
74
+
75
+ array_push($urls, $url);
76
+
77
+ add_option("WpFastestCacheCSP", $urls, 1, "no");
78
+ }else{
79
+ $is_update = false;
80
+
81
+ foreach ($urls as $key => &$value) {
82
+ if($value->order == ($_POST["order"])){
83
+ $is_update = true;
84
+ $value->url = $_POST["url"];
85
+ }
86
+ }
87
+
88
+ if(!$is_update){
89
+ array_push($urls, $url);
90
+ }
91
+
92
+ update_option("WpFastestCacheCSP", $urls, 1, "no");
93
+ }
94
+
95
+ wp_send_json_success();
96
+ }
97
+
98
+ public static function get_list(){
99
+ if(!wp_verify_nonce($_POST["security"], 'wpfc-save-csp-ajax-nonce')){
100
+ die( 'Security check' );
101
+ }
102
+
103
+ $urls = get_option("WpFastestCacheCSP");
104
+
105
+ if(!is_array($urls)){
106
+ $urls = array();
107
+ }
108
+
109
+ wp_send_json_success($urls);
110
+
111
+ }
112
+
113
+ }
114
+ ?>
js/cdn/index.html ADDED
@@ -0,0 +1 @@
 
1
+ Silence is golden.
js/dialog_new.js CHANGED
@@ -5,9 +5,9 @@ var Wpfc_New_Dialog = {
5
  clone: "",
6
  current_page_number: 1,
7
  total_page_number: 0,
8
- interval : false,
9
  enable_button: function(button_type){
10
- clearInterval(this.interval);
11
 
12
  let self = this;
13
  let modal = jQuery("#" + self.id);
@@ -27,12 +27,15 @@ var Wpfc_New_Dialog = {
27
 
28
  button.text(text + ".");
29
 
30
- self.interval = setInterval(function(){
 
 
 
 
31
  text = button.text();
32
  dot = text.match(/\./g);
33
 
34
- console.log(dot);
35
- console.log(button);
36
 
37
  if(dot){
38
  if(dot.length < 3){
5
  clone: "",
6
  current_page_number: 1,
7
  total_page_number: 0,
8
+ interval : {},
9
  enable_button: function(button_type){
10
+ clearInterval(this.interval[this.id]);
11
 
12
  let self = this;
13
  let modal = jQuery("#" + self.id);
27
 
28
  button.text(text + ".");
29
 
30
+ self.interval[self.id] = setInterval(function(){
31
+ if(jQuery("#" + self.id).length === 0){
32
+ clearInterval(self.interval);
33
+ }
34
+
35
  text = button.text();
36
  dot = text.match(/\./g);
37
 
38
+ console.log(self.interval);
 
39
 
40
  if(dot){
41
  if(dot.length < 3){
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: emrevona
3
  Donate link: http://profiles.wordpress.org/emrevona/
4
  Tags: cache, Optimize, performance, wp-cache, core web vitals
5
  Requires at least: 3.3
6
- Tested up to: 6.0
7
- Stable tag: 1.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -131,6 +131,10 @@ WP Fastest Cache is compatible with most popular plugins such as Contact Form 7,
131
 
132
  == Changelog ==
133
 
 
 
 
 
134
  = 1.0.6 =
135
  * to serve sources via cdn for excluded pages if cdn is enabled
136
  * to fix PHP Notice: Undefined offset: -1 in js-utilities.php on line 48
3
  Donate link: http://profiles.wordpress.org/emrevona/
4
  Tags: cache, Optimize, performance, wp-cache, core web vitals
5
  Requires at least: 3.3
6
+ Tested up to: 6.1
7
+ Stable tag: 1.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
131
 
132
  == Changelog ==
133
 
134
+ = 1.0.7 =
135
+ * <strong>[FEATURE]</strong> Clearing Specific Pages (BETA) [<a target="_blank" href="https://www.wpfastestcache.com/features/clear-cache-of-specific-urls-when-updating-or-posting/">Details</a>]
136
+ * to add last-modified header when cache is served via php
137
+
138
  = 1.0.6 =
139
  * to serve sources via cdn for excluded pages if cdn is enabled
140
  * to fix PHP Notice: Undefined offset: -1 in js-utilities.php on line 48
templates/clearing_specific_pages.php ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style type="text/css">
2
+ .wpfc-csp-item:hover{
3
+ background-color: #E5E5E5;
4
+ }
5
+ .wpfc-csp-item{
6
+ float: left;
7
+ width: 330.5px;
8
+ margin-right: 7px;
9
+ margin-left: 20px;
10
+ -moz-border-radius:5px 5px 5px 5px;
11
+ -webkit-border-radius:5px 5px 5px 5px;
12
+ border-radius:5px 5px 5px 5px;
13
+ border:1px solid transparent;
14
+ cursor:pointer;
15
+ padding:9px;
16
+ outline:none !important;
17
+ list-style: outside none none;
18
+ }
19
+
20
+ .wpfc-csp-item-form-title{
21
+ max-width:380px;
22
+ font-weight:bold;
23
+ white-space:nowrap;
24
+ max-width:615px;
25
+ margin-bottom:3px;
26
+ text-overflow:ellipsis;
27
+ -o-text-overflow:ellipsis;
28
+ -moz-text-overflow:ellipsis;
29
+ -webkit-text-overflow:ellipsis;
30
+ line-height:1em;
31
+ font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;
32
+ }
33
+ .wpfc-csp-item-details{
34
+ font-size:11px;
35
+ color:#888;
36
+ display:block;
37
+ white-space:nowrap;
38
+ font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;
39
+ line-height:1.5em;
40
+ }
41
+ .wpfc-csp-item-details b {
42
+ display:inline;
43
+ margin-left: 1px;
44
+
45
+ }
46
+ .wpfc-csp-item-right{
47
+ margin-right: 0;
48
+ margin-left: 0;
49
+ }
50
+ </style>
51
+
52
+ <!-- item sample -->
53
+ <div class="wpfc-csp-item" tabindex="1" style="position: relative;display:none;">
54
+ <div class="app">
55
+ <div class="wpfc-csp-item-form-title">Specific Page - <span style="color: green;">When Updating or Posting</span></div>
56
+ <span class="wpfc-csp-item-details wpfc-csp-item-url"></span>
57
+ </div>
58
+ </div>
59
+ <!-- samples end -->
60
+
61
+
62
+ <div template-id="wpfc-modal-csp" style="display:none; top: 10.5px; left: 226px; position: absolute; padding: 6px; height: auto; width: 560px; z-index: 10001;">
63
+ <div style="height: 100%; width: 100%; background: none repeat scroll 0% 0% rgb(0, 0, 0); position: absolute; top: 0px; left: 0px; z-index: -1; opacity: 0.5; border-radius: 8px;">
64
+ </div>
65
+ <div style="z-index: 600; border-radius: 3px;">
66
+ <div style="font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:12px;background: none repeat scroll 0px 0px rgb(255, 161, 0); z-index: 1000; position: relative; padding: 2px; border-bottom: 1px solid rgb(194, 122, 0); height: 35px; border-radius: 3px 3px 0px 0px;">
67
+ <table width="100%" height="100%">
68
+ <tbody>
69
+ <tr>
70
+ <td valign="middle" style="vertical-align: middle; font-weight: bold; color: rgb(255, 255, 255); text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.5); padding-left: 10px; font-size: 13px; cursor: move;">Clearing Specific Pages Settings</td>
71
+ <td width="20" align="center" style="vertical-align: middle;"></td>
72
+ <td width="20" align="center" style="vertical-align: middle; font-family: Arial,Helvetica,sans-serif; color: rgb(170, 170, 170); cursor: default;">
73
+ <div title="Close Window" class="close-wiz"></div>
74
+ </td>
75
+ </tr>
76
+ </tbody>
77
+ </table>
78
+ </div>
79
+ <div class="window-content-wrapper" style="padding: 8px;">
80
+ <div style="z-index: 1000; height: auto; position: relative; display: inline-block; width: 100%;" class="window-content">
81
+
82
+
83
+ <div id="wpfc-wizard-csp" class="wpfc-cdn-pages-container">
84
+ <div wpfc-cdn-page="1" class="wiz-cont">
85
+
86
+ <h1>Enter a Url</h1>
87
+ <p>Please enter a url which you want cleared from cache whenever a post is created or updated.</p>
88
+ <div class="wiz-input-cont">
89
+ <input placeholder="<?php echo get_site_url('', 'sample-page'); ?>" type="text" name="url" class="api-key" style="width: 100%;">
90
+ <label class="wiz-error-msg"></label>
91
+ </div>
92
+
93
+
94
+
95
+ </div>
96
+
97
+
98
+ </div>
99
+ </div>
100
+ </div>
101
+ <?php include WPFC_MAIN_PATH."templates/buttons.html"; ?>
102
+ </div>
103
+ </div>
104
+
105
+ <script type="text/javascript">
106
+ var WpFcCsp = {
107
+ init: function(){
108
+ this.click_event_for_add_button();
109
+ this.show_list();
110
+ },
111
+ show_list: function(){
112
+ var self = this;
113
+
114
+ jQuery.ajax({
115
+ type: 'POST',
116
+ dataType: "json",
117
+ url: ajaxurl,
118
+ data : {"action": "wpfc_get_list_csp", security: '<?php echo wp_create_nonce( "wpfc-save-csp-ajax-nonce" ); ?>'},
119
+ success: function(res){
120
+ if(typeof res.success != "undefined" && res.success){
121
+
122
+ jQuery.each(res.data, function( index, value ) {
123
+ self.add_item(value);
124
+ });
125
+ }
126
+ },
127
+ error: function(e) {
128
+ alert("unknown error");
129
+ }
130
+ });
131
+
132
+ },
133
+ add_item: function(data){
134
+ var self = this;
135
+ var existing_item = jQuery("div.wpfc-csp-item[order='" + data.order + "']");
136
+
137
+ if(existing_item.length == 1){
138
+ existing_item.find("span.wpfc-csp-item-url").text(data.url);
139
+ }else{
140
+ var item = jQuery(".wpfc-csp-item").first().clone();
141
+
142
+ item.find(".wpfc-csp-item-url").html(data.url);
143
+
144
+ item.attr("url", data.url);
145
+ item.attr("order", data.order);
146
+
147
+ item.click(function(){
148
+ self.open_modal(this);
149
+ });
150
+
151
+ item.show();
152
+
153
+ if(jQuery(".wpfc-csp-list > div").length%2){
154
+ item.addClass("wpfc-csp-item-right");
155
+ }
156
+
157
+ jQuery(".wpfc-csp-list").append(item);
158
+
159
+ self.reorder();
160
+ }
161
+
162
+ },
163
+ reorder: function(type){
164
+ jQuery(".wpfc-csp-list > div").each(function(i, e){
165
+ if(i%2 == 0){
166
+ jQuery(e).removeClass("wpfc-csp-item-right");
167
+ }else{
168
+ jQuery(e).addClass("wpfc-csp-item-right");
169
+ }
170
+ });
171
+ },
172
+ open_modal: function(item){
173
+ var self = this;
174
+
175
+
176
+ Wpfc_New_Dialog.dialog("wpfc-modal-csp", {
177
+ close: function(){
178
+
179
+ },
180
+ remove: function(e){
181
+ let modal = jQuery(e).closest("div[id^='wpfc-modal-csp']");
182
+ let modal_id = modal.attr("id");
183
+ let order = modal.find("input[name='order']").val();
184
+
185
+ Wpfc_New_Dialog.id = modal_id;
186
+ Wpfc_New_Dialog.disable_button("remove");
187
+
188
+
189
+ jQuery.ajax({
190
+ type: 'POST',
191
+ dataType: "json",
192
+ url: ajaxurl,
193
+ data : {"action": "wpfc_remove_csp", "order" : order, security: '<?php echo wp_create_nonce( "wpfc-save-csp-ajax-nonce" ); ?>'},
194
+ success: function(res){
195
+ if(res.success === true){
196
+ console.log(res);
197
+
198
+ Wpfc_New_Dialog.id = modal_id;
199
+ Wpfc_New_Dialog.enable_button("remove");
200
+
201
+ jQuery(".wpfc-csp-list > .wpfc-csp-item[order='" + order + "']").remove();
202
+
203
+ self.reorder();
204
+
205
+ modal.remove();
206
+ }
207
+ },
208
+ error: function(e) {
209
+ alert("unknown error");
210
+ }
211
+ });
212
+
213
+ },
214
+ finish: function(e){
215
+ let modal = jQuery(e).closest("div[id^='wpfc-modal-csp']");
216
+ let modal_id = modal.attr("id");
217
+ let url = modal.find("input[name='url']").val();
218
+ let order = modal.find("input[name='order']").val();
219
+ let error_label = modal.find("label.wiz-error-msg");
220
+
221
+ if(typeof order == "undefined"){
222
+ if(jQuery(".wpfc-csp-list > .wpfc-csp-item:last-child").length == 1){
223
+ order = parseInt(jQuery(".wpfc-csp-list > .wpfc-csp-item:last-child").attr("order"))+1;
224
+ }else{
225
+ order = 1;
226
+ }
227
+ }
228
+
229
+ if(url.length == 0){
230
+ error_label.text("Please enter a url");
231
+ return;
232
+ }
233
+
234
+ error_label.text("");
235
+
236
+ Wpfc_New_Dialog.id = modal_id;
237
+ Wpfc_New_Dialog.disable_button("finish");
238
+
239
+ jQuery.ajax({
240
+ type: 'POST',
241
+ dataType: "json",
242
+ url: ajaxurl,
243
+ data : {"action": "wpfc_save_csp", "url" : url, "order" : order, security: '<?php echo wp_create_nonce( "wpfc-save-csp-ajax-nonce" ); ?>'},
244
+ success: function(res){
245
+ Wpfc_New_Dialog.id = modal_id;
246
+ Wpfc_New_Dialog.enable_button("finish");
247
+
248
+ if(res.success === true){
249
+ self.add_item({"url" : url, "order" : order});
250
+
251
+ modal.remove();
252
+ }else{
253
+ error_label.text(res.data);
254
+ }
255
+ },
256
+ error: function(e) {
257
+ alert("unknown error");
258
+ }
259
+ });
260
+
261
+ }
262
+ }, function(dialog){
263
+ let url = jQuery(item).attr("url");
264
+ let order = jQuery(item).attr("order");
265
+
266
+ if(typeof url != "undefined" && typeof order != "undefined"){
267
+ Wpfc_New_Dialog.show_button("remove");
268
+ jQuery("#" + dialog.id).find("input[name='url']").val(url);
269
+
270
+ jQuery("<input type='hidden' name='order' value='" + order + "' > ").insertAfter(jQuery("#" + dialog.id).find("input[name='url']"));
271
+ }
272
+
273
+ Wpfc_New_Dialog.show_button("finish");
274
+
275
+ });
276
+ },
277
+ click_event_for_add_button: function(){
278
+ let self = this;
279
+
280
+ jQuery(".wpfc-add-new-csp-button").click(function(){
281
+ self.open_modal();
282
+
283
+ });
284
+
285
+ }
286
+ }
287
+
288
+ WpFcCsp.init();
289
+ </script>
290
+
291
+
uninstall.php CHANGED
@@ -20,6 +20,7 @@
20
  delete_option("WpFastestCache");
21
  delete_option("WpFcDeleteCacheLogs");
22
  delete_option("WpFastestCacheCDN");
 
23
  delete_option("WpFastestCacheExclude");
24
  delete_option("WpFastestCachePreLoad");
25
  delete_option("WpFastestCacheCSS");
20
  delete_option("WpFastestCache");
21
  delete_option("WpFcDeleteCacheLogs");
22
  delete_option("WpFastestCacheCDN");
23
+ delete_option("WpFastestCacheCSP");
24
  delete_option("WpFastestCacheExclude");
25
  delete_option("WpFastestCachePreLoad");
26
  delete_option("WpFastestCacheCSS");
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: 1.0.6
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -125,6 +125,11 @@ GNU General Public License for more details.
125
  add_action( 'profile_update', array($this, 'modify_htaccess_for_new_user'), 10, 1);
126
  add_action( 'edit_terms', array($this, 'delete_cache_of_term'), 10, 1);
127
 
 
 
 
 
 
128
  if(defined("WPFC_CLEAR_CACHE_AFTER_SWITCH_THEME") && WPFC_CLEAR_CACHE_AFTER_SWITCH_THEME){
129
  add_action('after_switch_theme', array($this, 'clear_cache_after_switch_theme'));
130
  }
@@ -514,7 +519,7 @@ GNU General Public License for more details.
514
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["trackback_pingback"];
515
 
516
  $element = "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '%\_transient\_%' ;";
517
- $statics["transient_options"] = $wpdb->get_var( $element ) > 50 ? $wpdb->get_var( $element ) : 0;
518
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["transient_options"];
519
 
520
  die(json_encode($statics));
@@ -644,6 +649,21 @@ GNU General Public License for more details.
644
  @file_put_contents($path.".htaccess", $htaccess);
645
  }
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  public function wpfc_save_timeout_pages_callback(){
648
  if(!wp_verify_nonce($_POST["security"], 'wpfc-save-timeout-ajax-nonce')){
649
  die( 'Security check' );
@@ -1087,8 +1107,11 @@ GNU General Public License for more details.
1087
  }
1088
  }
1089
 
1090
- if(isset($this->options->wpFastestCacheNewPost) && isset($this->options->wpFastestCacheStatus)){
1091
- if($new_status == "publish" && $old_status != "publish"){
 
 
 
1092
  if(isset($this->options->wpFastestCacheNewPost_type) && $this->options->wpFastestCacheNewPost_type){
1093
  if($this->options->wpFastestCacheNewPost_type == "all"){
1094
  $this->deleteCache();
@@ -1119,6 +1142,8 @@ GNU General Public License for more details.
1119
 
1120
  // }
1121
 
 
 
1122
  if(isset($this->options->wpFastestCacheUpdatePost)){
1123
 
1124
  if($this->options->wpFastestCacheUpdatePost_type == "post"){
@@ -1165,6 +1190,41 @@ GNU General Public License for more details.
1165
  }
1166
  }
1167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1168
  public function singleDeleteCache($comment_id = false, $post_id = false, $to_clear_parents = true){
1169
  include_once('inc/cdn.php');
1170
 
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: 1.0.7
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
125
  add_action( 'profile_update', array($this, 'modify_htaccess_for_new_user'), 10, 1);
126
  add_action( 'edit_terms', array($this, 'delete_cache_of_term'), 10, 1);
127
 
128
+ add_action( 'wp_ajax_wpfc_save_csp', array($this, 'wpfc_save_csp_callback'));
129
+ add_action( 'wp_ajax_wpfc_remove_csp', array($this, 'wpfc_remove_csp_callback'));
130
+ add_action( 'wp_ajax_wpfc_get_list_csp', array($this, 'wpfc_get_list_csp_callback'));
131
+
132
+
133
  if(defined("WPFC_CLEAR_CACHE_AFTER_SWITCH_THEME") && WPFC_CLEAR_CACHE_AFTER_SWITCH_THEME){
134
  add_action('after_switch_theme', array($this, 'clear_cache_after_switch_theme'));
135
  }
519
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["trackback_pingback"];
520
 
521
  $element = "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '%\_transient\_%' ;";
522
+ $statics["transient_options"] = $wpdb->get_var( $element ) > 100 ? $wpdb->get_var( $element ) : 0;
523
  $statics["all_warnings"] = $statics["all_warnings"] + $statics["transient_options"];
524
 
525
  die(json_encode($statics));
649
  @file_put_contents($path.".htaccess", $htaccess);
650
  }
651
 
652
+ public function wpfc_get_list_csp_callback(){
653
+ include_once('inc/clearing-specific-pages.php');
654
+ ClearingSpecificPagesWPFC::get_list();
655
+ }
656
+
657
+ public function wpfc_save_csp_callback(){
658
+ include_once('inc/clearing-specific-pages.php');
659
+ ClearingSpecificPagesWPFC::save();
660
+ }
661
+
662
+ public function wpfc_remove_csp_callback(){
663
+ include_once('inc/clearing-specific-pages.php');
664
+ ClearingSpecificPagesWPFC::remove();
665
+ }
666
+
667
  public function wpfc_save_timeout_pages_callback(){
668
  if(!wp_verify_nonce($_POST["security"], 'wpfc-save-timeout-ajax-nonce')){
669
  die( 'Security check' );
1107
  }
1108
  }
1109
 
1110
+ if($new_status == "publish" && $old_status != "publish"){
1111
+
1112
+ $this->specificDeleteCache();
1113
+
1114
+ if(isset($this->options->wpFastestCacheNewPost) && isset($this->options->wpFastestCacheStatus)){
1115
  if(isset($this->options->wpFastestCacheNewPost_type) && $this->options->wpFastestCacheNewPost_type){
1116
  if($this->options->wpFastestCacheNewPost_type == "all"){
1117
  $this->deleteCache();
1142
 
1143
  // }
1144
 
1145
+ $this->specificDeleteCache();
1146
+
1147
  if(isset($this->options->wpFastestCacheUpdatePost)){
1148
 
1149
  if($this->options->wpFastestCacheUpdatePost_type == "post"){
1190
  }
1191
  }
1192
 
1193
+ public function specificDeleteCache(){
1194
+ $urls = get_option("WpFastestCacheCSP");
1195
+ $files = array();
1196
+
1197
+ if(!empty($urls)){
1198
+ foreach ($urls as $key => $value) {
1199
+
1200
+ if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $value->url, $out)){
1201
+
1202
+ if(preg_match("/\/\(\.\*\)/", $out[1])){
1203
+ $out[1] = str_replace("(.*)", "", $out[1]);
1204
+
1205
+ $path = $this->getWpContentDir("/cache/all/").$out[1];
1206
+ $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1];
1207
+ }else{
1208
+ $out[1] = $out[1]."index.html";
1209
+
1210
+ $path = $this->getWpContentDir("/cache/all/").$out[1];
1211
+ $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1];
1212
+ }
1213
+
1214
+ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
1215
+ @mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true);
1216
+ }
1217
+
1218
+
1219
+ rename($path, $this->getWpContentDir("/cache/tmpWpfc/").time());
1220
+ rename($mobile_path, $this->getWpContentDir("/cache/tmpWpfc/mobile_").time());
1221
+
1222
+ }
1223
+
1224
+ }
1225
+ }
1226
+ }
1227
+
1228
  public function singleDeleteCache($comment_id = false, $post_id = false, $to_clear_parents = true){
1229
  include_once('inc/cdn.php');
1230