Version Description
- to move "cache timeout" to under "delete cache" tab [Details]
- to prevent clearing cache after Ninja Form is submitted
- [FEATURE] Preload for custom post types
- to fix PHP Fatal error: Call to undefined function add_settings_error()
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.8.8 |
Comparing to | |
See all releases |
Code changes from version 0.8.8.7 to 0.8.8.8
- inc/admin.php +18 -5
- inc/preload.php +379 -0
- readme.txt +8 -2
- templates/preload.php +11 -6
- wpFastestCache.php +15 -336
inc/admin.php
CHANGED
@@ -856,6 +856,7 @@
|
|
856 |
$wpFastestCachePreload_homepage = isset($this->options->wpFastestCachePreload_homepage) ? 'checked="checked"' : "";
|
857 |
$wpFastestCachePreload_post = isset($this->options->wpFastestCachePreload_post) ? 'checked="checked"' : "";
|
858 |
$wpFastestCachePreload_category = isset($this->options->wpFastestCachePreload_category) ? 'checked="checked"' : "";
|
|
|
859 |
$wpFastestCachePreload_page = isset($this->options->wpFastestCachePreload_page) ? 'checked="checked"' : "";
|
860 |
$wpFastestCachePreload_tag = isset($this->options->wpFastestCachePreload_tag) ? 'checked="checked"' : "";
|
861 |
$wpFastestCachePreload_attachment = isset($this->options->wpFastestCachePreload_attachment) ? 'checked="checked"' : "";
|
@@ -881,8 +882,7 @@
|
|
881 |
<div class="tabGroup">
|
882 |
<?php
|
883 |
$tabs = array(array("id"=>"wpfc-options","title"=>"Settings"),
|
884 |
-
array("id"=>"wpfc-deleteCache","title"=>"Delete Cache")
|
885 |
-
array("id"=>"wpfc-cacheTimeout","title"=>"Cache Timeout"));
|
886 |
|
887 |
array_push($tabs, array("id"=>"wpfc-imageOptimisation","title"=>"Image Optimization"));
|
888 |
array_push($tabs, array("id"=>"wpfc-premium","title"=>"Premium"));
|
@@ -1335,6 +1335,9 @@
|
|
1335 |
<?php
|
1336 |
}
|
1337 |
?>
|
|
|
|
|
|
|
1338 |
<h2 id="delete-cache-h2" style="padding-left:20px;padding-bottom:10px;">Delete Cache</h2>
|
1339 |
<form method="post" name="wp_manager" class="delete-line" action="options.php">
|
1340 |
<?php settings_fields( 'wpfc-group' ); ?>
|
@@ -1371,9 +1374,11 @@
|
|
1371 |
$logs->printLogs();
|
1372 |
}
|
1373 |
?>
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
|
|
|
|
1377 |
|
1378 |
<!-- samples start: clones -->
|
1379 |
<div class="wpfc-timeout-rule-line" style="display:none;">
|
@@ -1480,6 +1485,14 @@
|
|
1480 |
} ?>
|
1481 |
</script>
|
1482 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
<?php if(class_exists("WpFastestCacheImageOptimisation")){ ?>
|
1484 |
<div class="tab4">
|
1485 |
<h2 style="padding-left:20px;padding-bottom:10px;">Optimize Image Tool</h2>
|
856 |
$wpFastestCachePreload_homepage = isset($this->options->wpFastestCachePreload_homepage) ? 'checked="checked"' : "";
|
857 |
$wpFastestCachePreload_post = isset($this->options->wpFastestCachePreload_post) ? 'checked="checked"' : "";
|
858 |
$wpFastestCachePreload_category = isset($this->options->wpFastestCachePreload_category) ? 'checked="checked"' : "";
|
859 |
+
$wpFastestCachePreload_customposttypes = isset($this->options->wpFastestCachePreload_customposttypes) ? 'checked="checked"' : "";
|
860 |
$wpFastestCachePreload_page = isset($this->options->wpFastestCachePreload_page) ? 'checked="checked"' : "";
|
861 |
$wpFastestCachePreload_tag = isset($this->options->wpFastestCachePreload_tag) ? 'checked="checked"' : "";
|
862 |
$wpFastestCachePreload_attachment = isset($this->options->wpFastestCachePreload_attachment) ? 'checked="checked"' : "";
|
882 |
<div class="tabGroup">
|
883 |
<?php
|
884 |
$tabs = array(array("id"=>"wpfc-options","title"=>"Settings"),
|
885 |
+
array("id"=>"wpfc-deleteCache","title"=>"Delete Cache"));
|
|
|
886 |
|
887 |
array_push($tabs, array("id"=>"wpfc-imageOptimisation","title"=>"Image Optimization"));
|
888 |
array_push($tabs, array("id"=>"wpfc-premium","title"=>"Premium"));
|
1335 |
<?php
|
1336 |
}
|
1337 |
?>
|
1338 |
+
|
1339 |
+
<div class="exclude_section_clear" style=" margin-left: 3%; width: 95%; margin-bottom: 20px; margin-top: 0;"><div></div></div>
|
1340 |
+
|
1341 |
<h2 id="delete-cache-h2" style="padding-left:20px;padding-bottom:10px;">Delete Cache</h2>
|
1342 |
<form method="post" name="wp_manager" class="delete-line" action="options.php">
|
1343 |
<?php settings_fields( 'wpfc-group' ); ?>
|
1374 |
$logs->printLogs();
|
1375 |
}
|
1376 |
?>
|
1377 |
+
|
1378 |
+
<div class="exclude_section_clear" style=" margin-left: 3%; width: 95%; margin-bottom: 12px; margin-top: 0;"><div></div></div>
|
1379 |
+
|
1380 |
+
|
1381 |
+
<h2 style="padding-bottom:10px;padding-left:20px;float:left;">Timeout Rules</h2>
|
1382 |
|
1383 |
<!-- samples start: clones -->
|
1384 |
<div class="wpfc-timeout-rule-line" style="display:none;">
|
1485 |
} ?>
|
1486 |
</script>
|
1487 |
</div>
|
1488 |
+
|
1489 |
+
|
1490 |
+
|
1491 |
+
<div class="tab3" style="display:none;"> </div>
|
1492 |
+
|
1493 |
+
|
1494 |
+
|
1495 |
+
|
1496 |
<?php if(class_exists("WpFastestCacheImageOptimisation")){ ?>
|
1497 |
<div class="tab4">
|
1498 |
<h2 style="padding-left:20px;padding-bottom:10px;">Optimize Image Tool</h2>
|
inc/preload.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PreloadWPFC{
|
3 |
+
public static function set_preload($slug){
|
4 |
+
$preload_arr = array();
|
5 |
+
|
6 |
+
if(!empty($_POST) && isset($_POST["wpFastestCachePreload"])){
|
7 |
+
foreach ($_POST as $key => $value) {
|
8 |
+
$key = esc_attr($key);
|
9 |
+
$value = esc_attr($value);
|
10 |
+
|
11 |
+
preg_match("/wpFastestCachePreload_(.+)/", $key, $type);
|
12 |
+
|
13 |
+
if(!empty($type)){
|
14 |
+
if($type[1] == "restart"){
|
15 |
+
//to need to remove "restart" value
|
16 |
+
}else if($type[1] == "number"){
|
17 |
+
$preload_arr[$type[1]] = $value;
|
18 |
+
}else{
|
19 |
+
$preload_arr[$type[1]] = 0;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
if($data = get_option("WpFastestCachePreLoad")){
|
26 |
+
$preload_std = json_decode($data);
|
27 |
+
|
28 |
+
if(!empty($preload_arr)){
|
29 |
+
foreach ($preload_arr as $key => &$value) {
|
30 |
+
if(!empty($preload_std->$key)){
|
31 |
+
if($key != "number"){
|
32 |
+
$value = $preload_std->$key;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
$preload_std = $preload_arr;
|
38 |
+
}else{
|
39 |
+
foreach ($preload_std as $key => &$value) {
|
40 |
+
if($key != "number"){
|
41 |
+
$value = 0;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
update_option("WpFastestCachePreLoad", json_encode($preload_std));
|
47 |
+
|
48 |
+
if(!wp_next_scheduled($slug."_Preload")){
|
49 |
+
wp_schedule_event(time() + 5, 'everyfiveminute', $slug."_Preload");
|
50 |
+
}
|
51 |
+
}else{
|
52 |
+
if(!empty($preload_arr)){
|
53 |
+
add_option("WpFastestCachePreLoad", json_encode($preload_arr), null, "yes");
|
54 |
+
|
55 |
+
if(!wp_next_scheduled($slug."_Preload")){
|
56 |
+
wp_schedule_event(time() + 5, 'everyfiveminute', $slug."_Preload");
|
57 |
+
}
|
58 |
+
}else{
|
59 |
+
//toDO
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
public static function create_preload_cache($options, $wpfc_remote_get){
|
65 |
+
if($data = get_option("WpFastestCachePreLoad")){
|
66 |
+
if(!isset($options->wpFastestCacheStatus)){
|
67 |
+
die("Cache System must be enabled");
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
$count_posts = wp_count_posts("post");
|
72 |
+
$count_pages = wp_count_posts('page');
|
73 |
+
|
74 |
+
$pre_load = json_decode($data);
|
75 |
+
|
76 |
+
if(defined("WPFC_PRELOAD_NUMBER") && WPFC_PRELOAD_NUMBER){
|
77 |
+
$number = WPFC_PRELOAD_NUMBER;
|
78 |
+
}else{
|
79 |
+
$number = $pre_load->number;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
$urls_limit = isset($options->wpFastestCachePreload_number) ? $options->wpFastestCachePreload_number : 4; // must be even
|
84 |
+
$urls = array();
|
85 |
+
|
86 |
+
if(isset($options->wpFastestCacheMobileTheme) && $options->wpFastestCacheMobileTheme){
|
87 |
+
$mobile_theme = true;
|
88 |
+
$number = $number/2;
|
89 |
+
}else{
|
90 |
+
$mobile_theme = false;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
// HOME
|
95 |
+
if(isset($pre_load->homepage) && $pre_load->homepage > -1){
|
96 |
+
if($mobile_theme){
|
97 |
+
array_push($urls, array("url" => get_option("home"), "user-agent" => "mobile"));
|
98 |
+
$number--;
|
99 |
+
}
|
100 |
+
|
101 |
+
array_push($urls, array("url" => get_option("home"), "user-agent" => "desktop"));
|
102 |
+
$number--;
|
103 |
+
|
104 |
+
$pre_load->homepage = -1;
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
// CUSTOM POSTS
|
109 |
+
if($number > 0 && isset($pre_load->customposttypes) && $pre_load->customposttypes > -1){
|
110 |
+
global $wpdb;
|
111 |
+
$post_types = get_post_types(array('public' => true), "names", "and");
|
112 |
+
$where_query = "";
|
113 |
+
|
114 |
+
foreach ($post_types as $post_type_key => $post_type_value) {
|
115 |
+
if(!in_array($post_type_key, array("post", "page", "attachment"))){
|
116 |
+
$where_query = $where_query.$wpdb->prefix."posts.post_type = '".$post_type_value."' OR ";
|
117 |
+
}
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
if($where_query){
|
122 |
+
$where_query = preg_replace("/(\s*OR\s*)$/", "", $where_query);
|
123 |
+
}
|
124 |
+
|
125 |
+
$recent_custom_posts = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$where_query.") AND ((".$wpdb->prefix."posts.post_status = 'publish')) ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->customposttypes.", ".$number, ARRAY_A);
|
126 |
+
|
127 |
+
if(count($recent_custom_posts) > 0){
|
128 |
+
foreach ($recent_custom_posts as $key => $post) {
|
129 |
+
if($mobile_theme){
|
130 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
|
131 |
+
$number--;
|
132 |
+
}
|
133 |
+
|
134 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
|
135 |
+
$number--;
|
136 |
+
|
137 |
+
$pre_load->customposttypes = $pre_load->customposttypes + 1;
|
138 |
+
}
|
139 |
+
}else{
|
140 |
+
$pre_load->customposttypes = -1;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
// POST
|
146 |
+
if($number > 0 && isset($pre_load->post) && $pre_load->post > -1){
|
147 |
+
// $recent_posts = wp_get_recent_posts(array(
|
148 |
+
// 'numberposts' => $number,
|
149 |
+
// 'offset' => $pre_load->post,
|
150 |
+
// 'orderby' => 'ID',
|
151 |
+
// 'order' => 'DESC',
|
152 |
+
// 'post_type' => 'post',
|
153 |
+
// 'post_status' => 'publish',
|
154 |
+
// 'suppress_filters' => true
|
155 |
+
// ), ARRAY_A);
|
156 |
+
global $wpdb;
|
157 |
+
$recent_posts = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$wpdb->prefix."posts.post_type = 'post') AND ((".$wpdb->prefix."posts.post_status = 'publish')) ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->post.", ".$number, ARRAY_A);
|
158 |
+
|
159 |
+
|
160 |
+
if(count($recent_posts) > 0){
|
161 |
+
foreach ($recent_posts as $key => $post) {
|
162 |
+
if($mobile_theme){
|
163 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
|
164 |
+
$number--;
|
165 |
+
}
|
166 |
+
|
167 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
|
168 |
+
$number--;
|
169 |
+
|
170 |
+
$pre_load->post = $pre_load->post + 1;
|
171 |
+
}
|
172 |
+
}else{
|
173 |
+
$pre_load->post = -1;
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
// ATTACHMENT
|
179 |
+
if($number > 0 && isset($pre_load->attachment) && $pre_load->attachment > -1){
|
180 |
+
global $wpdb;
|
181 |
+
$recent_attachments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$wpdb->prefix."posts.post_type = 'attachment') ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->attachment.", ".$number, ARRAY_A);
|
182 |
+
|
183 |
+
if(count($recent_attachments) > 0){
|
184 |
+
foreach ($recent_attachments as $key => $attachment) {
|
185 |
+
if($mobile_theme){
|
186 |
+
array_push($urls, array("url" => get_permalink($attachment["ID"]), "user-agent" => "mobile"));
|
187 |
+
$number--;
|
188 |
+
}
|
189 |
+
|
190 |
+
array_push($urls, array("url" => get_permalink($attachment["ID"]), "user-agent" => "desktop"));
|
191 |
+
$number--;
|
192 |
+
|
193 |
+
$pre_load->attachment = $pre_load->attachment + 1;
|
194 |
+
}
|
195 |
+
}else{
|
196 |
+
$pre_load->attachment = -1;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
// PAGE
|
201 |
+
if($number > 0 && isset($pre_load->page) && $pre_load->page > -1){
|
202 |
+
$pages = get_pages(array(
|
203 |
+
'sort_order' => 'DESC',
|
204 |
+
'sort_column' => 'ID',
|
205 |
+
'parent' => -1,
|
206 |
+
'hierarchical' => 0,
|
207 |
+
'number' => $number,
|
208 |
+
'offset' => $pre_load->page,
|
209 |
+
'post_type' => 'page',
|
210 |
+
'post_status' => 'publish'
|
211 |
+
));
|
212 |
+
|
213 |
+
if(count($pages) > 0){
|
214 |
+
foreach ($pages as $key => $page) {
|
215 |
+
$page_url = get_option("home")."/".get_page_uri($page->ID);
|
216 |
+
|
217 |
+
if($mobile_theme){
|
218 |
+
array_push($urls, array("url" => $page_url, "user-agent" => "mobile"));
|
219 |
+
$number--;
|
220 |
+
}
|
221 |
+
|
222 |
+
array_push($urls, array("url" => $page_url, "user-agent" => "desktop"));
|
223 |
+
$number--;
|
224 |
+
|
225 |
+
$pre_load->page = $pre_load->page + 1;
|
226 |
+
}
|
227 |
+
}else{
|
228 |
+
$pre_load->page = -1;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
// CATEGORY
|
233 |
+
if($number > 0 && isset($pre_load->category) && $pre_load->category > -1){
|
234 |
+
// $categories = get_terms(array(
|
235 |
+
// 'taxonomy' => array('category', 'product_cat'),
|
236 |
+
// 'orderby' => 'id',
|
237 |
+
// 'order' => 'DESC',
|
238 |
+
// 'hide_empty' => false,
|
239 |
+
// 'number' => $number,
|
240 |
+
// 'fields' => 'all',
|
241 |
+
// 'pad_counts' => false,
|
242 |
+
// 'offset' => $pre_load->category
|
243 |
+
// ));
|
244 |
+
|
245 |
+
global $wpdb;
|
246 |
+
$categories = $wpdb->get_results("SELECT t.*, tt.* FROM ".$wpdb->prefix."terms AS t INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category', 'product_cat', 'hersteller', 'anschlussart', 'typ') ORDER BY t.term_id ASC LIMIT ".$pre_load->category.", ".$number, ARRAY_A);
|
247 |
+
|
248 |
+
if(count($categories) > 0){
|
249 |
+
foreach ($categories as $key => $category) {
|
250 |
+
if($mobile_theme){
|
251 |
+
array_push($urls, array("url" => get_term_link($category["slug"], $category["taxonomy"]), "user-agent" => "mobile"));
|
252 |
+
$number--;
|
253 |
+
}
|
254 |
+
|
255 |
+
array_push($urls, array("url" => get_term_link($category["slug"], $category["taxonomy"]), "user-agent" => "desktop"));
|
256 |
+
$number--;
|
257 |
+
|
258 |
+
$pre_load->category = $pre_load->category + 1;
|
259 |
+
|
260 |
+
}
|
261 |
+
}else{
|
262 |
+
$pre_load->category = -1;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
// TAG
|
267 |
+
if($number > 0 && isset($pre_load->tag) && $pre_load->tag > -1){
|
268 |
+
// $tags = get_terms(array(
|
269 |
+
// 'taxonomy' => array('post_tag', 'product_tag'),
|
270 |
+
// 'orderby' => 'id',
|
271 |
+
// 'order' => 'DESC',
|
272 |
+
// 'hide_empty' => false,
|
273 |
+
// 'number' => $number,
|
274 |
+
// 'fields' => 'all',
|
275 |
+
// 'pad_counts' => false,
|
276 |
+
// 'offset' => $pre_load->tag
|
277 |
+
// ));
|
278 |
+
|
279 |
+
global $wpdb;
|
280 |
+
$tags = $wpdb->get_results("SELECT t.*, tt.* FROM ".$wpdb->prefix."terms AS t INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_tag', 'product_tag') ORDER BY t.term_id ASC LIMIT ".$pre_load->tag.", ".$number, ARRAY_A);
|
281 |
+
|
282 |
+
|
283 |
+
if(count($tags) > 0){
|
284 |
+
foreach ($tags as $key => $tag) {
|
285 |
+
if($mobile_theme){
|
286 |
+
array_push($urls, array("url" => get_term_link($tag["slug"], $tag["taxonomy"]), "user-agent" => "mobile"));
|
287 |
+
$number--;
|
288 |
+
}
|
289 |
+
|
290 |
+
array_push($urls, array("url" => get_term_link($tag["slug"], $tag["taxonomy"]), "user-agent" => "desktop"));
|
291 |
+
$number--;
|
292 |
+
|
293 |
+
$pre_load->tag = $pre_load->tag + 1;
|
294 |
+
|
295 |
+
}
|
296 |
+
}else{
|
297 |
+
$pre_load->tag = -1;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
if(count($urls) > 0){
|
307 |
+
foreach ($urls as $key => $arr) {
|
308 |
+
$user_agent = "";
|
309 |
+
|
310 |
+
if($arr["user-agent"] == "desktop"){
|
311 |
+
$user_agent = "WP Fastest Cache Preload Bot";
|
312 |
+
}else if($arr["user-agent"] == "mobile"){
|
313 |
+
$user_agent = "WP Fastest Cache Preload iPhone Mobile Bot";
|
314 |
+
}
|
315 |
+
|
316 |
+
if($wpfc_remote_get($arr["url"], $user_agent)){
|
317 |
+
$status = "<strong style=\"color:lightgreen;\">OK</strong>";
|
318 |
+
}else{
|
319 |
+
$status = "<strong style=\"color:red;\">ERROR</strong>";
|
320 |
+
}
|
321 |
+
|
322 |
+
echo $status." ".$arr["url"]." (".$arr["user-agent"].")<br>";
|
323 |
+
}
|
324 |
+
echo "<br>";
|
325 |
+
echo count($urls)." page have been cached";
|
326 |
+
|
327 |
+
update_option("WpFastestCachePreLoad", json_encode($pre_load));
|
328 |
+
|
329 |
+
echo "<br><br>";
|
330 |
+
|
331 |
+
// if(isset($pre_load->homepage)){
|
332 |
+
// if($pre_load->homepage == -1){
|
333 |
+
// echo "Homepage: 1/1"."<br>";
|
334 |
+
// }
|
335 |
+
// }
|
336 |
+
|
337 |
+
// if(isset($pre_load->post)){
|
338 |
+
// if($pre_load->post > -1){
|
339 |
+
// echo "Posts: ".$pre_load->post."/".$count_posts->publish."<br>";
|
340 |
+
// }else{
|
341 |
+
// echo "Posts: ".$count_posts->publish."/".$count_posts->publish."<br>";
|
342 |
+
// }
|
343 |
+
// }
|
344 |
+
|
345 |
+
// if(isset($pre_load->page)){
|
346 |
+
// if($pre_load->page > -1){
|
347 |
+
// echo "Pages: ".$pre_load->page."/".$count_pages->publish."<br>";
|
348 |
+
// }else{
|
349 |
+
// echo "Pages: ".$count_pages->publish."/".$count_pages->publish."<br>";
|
350 |
+
// }
|
351 |
+
// }
|
352 |
+
}else{
|
353 |
+
if(isset($options->wpFastestCachePreload_restart)){
|
354 |
+
foreach ($pre_load as $pre_load_key => &$pre_load_value) {
|
355 |
+
if($pre_load_key != "number"){
|
356 |
+
$pre_load_value = 0;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
update_option("WpFastestCachePreLoad", json_encode($pre_load));
|
361 |
+
|
362 |
+
echo "Preload Restarted";
|
363 |
+
|
364 |
+
include_once('cdn.php');
|
365 |
+
CdnWPFC::cloudflare_clear_cache();
|
366 |
+
}else{
|
367 |
+
echo "Completed";
|
368 |
+
|
369 |
+
wp_clear_scheduled_hook("wp_fastest_cache_Preload");
|
370 |
+
}
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
if(isset($_GET) && isset($_GET["type"]) && $_GET["type"] == "preload"){
|
375 |
+
die();
|
376 |
+
}
|
377 |
+
}
|
378 |
+
}
|
379 |
+
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: emrevona
|
|
3 |
Donate link: http://profiles.wordpress.org/emrevona/
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 0.8.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,6 +103,12 @@ Wpfc does not support Wordpress Multisite yet.
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 0.8.8.7 =
|
107 |
* to fix error which is Undefined index: SERVER_PORT
|
108 |
* to prevent running preload when cache is disabled
|
3 |
Donate link: http://profiles.wordpress.org/emrevona/
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 5.0
|
7 |
+
Stable tag: 0.8.8.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 0.8.8.8 =
|
107 |
+
* to move "cache timeout" to under "delete cache" tab [<a target="_blank" href="https://www.wpfastestcache.com/features/cache-timeout-page/">Details</a>]
|
108 |
+
* to prevent clearing cache after Ninja Form is submitted
|
109 |
+
* <strong>[FEATURE]</strong> Preload for custom post types
|
110 |
+
* to fix PHP Fatal error: Call to undefined function add_settings_error()
|
111 |
+
|
112 |
= 0.8.8.7 =
|
113 |
* to fix error which is Undefined index: SERVER_PORT
|
114 |
* to prevent running preload when cache is disabled
|
templates/preload.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<style type="text/css">
|
2 |
div[id^="wpfc-modal-preload"] .wiz-input-cont{
|
3 |
margin-top: 0 !important;
|
4 |
-
margin-bottom:
|
5 |
float: left !important;
|
6 |
-
width:
|
7 |
}
|
8 |
.wiz-input-cont label{
|
9 |
margin-right: 0 !important;
|
@@ -28,7 +28,7 @@
|
|
28 |
</div>
|
29 |
<div class="window-content-wrapper" style="padding: 15px;">
|
30 |
<div class="window-content" style="z-index: 1000; height: auto; position: relative; display: inline-block; width: 100%;">
|
31 |
-
<div class="wiz-input-cont" style="margin-right:
|
32 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_homepage; ?> id="wpFastestCachePreload_homepage" name="wpFastestCachePreload_homepage"></label>
|
33 |
<label for="wpFastestCachePreload_homepage">Homepage</label>
|
34 |
</div>
|
@@ -36,7 +36,7 @@
|
|
36 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_post; ?> id="wpFastestCachePreload_post" name="wpFastestCachePreload_post"></label>
|
37 |
<label for="wpFastestCachePreload_post">Posts</label>
|
38 |
</div>
|
39 |
-
<div class="wiz-input-cont" style="margin-right:
|
40 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_category; ?> id="wpFastestCachePreload_category" name="wpFastestCachePreload_category"></label>
|
41 |
<label for="wpFastestCachePreload_category">Categories</label>
|
42 |
</div>
|
@@ -44,7 +44,7 @@
|
|
44 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_page; ?> id="wpFastestCachePreload_page" name="wpFastestCachePreload_page"></label>
|
45 |
<label for="wpFastestCachePreload_page">Pages</label>
|
46 |
</div>
|
47 |
-
<div class="wiz-input-cont" style="margin-right:
|
48 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_tag; ?> id="wpFastestCachePreload_tag" name="wpFastestCachePreload_tag"></label>
|
49 |
<label for="wpFastestCachePreload_tag">Tags</label>
|
50 |
</div>
|
@@ -53,7 +53,12 @@
|
|
53 |
<label for="wpFastestCachePreload_attachment">Attachments</label>
|
54 |
</div>
|
55 |
|
56 |
-
<div class="wiz-input-cont" style="width: 91% !important;margin-bottom:
|
|
|
|
|
|
|
|
|
|
|
57 |
<label class="mc-input-label" style="float:left;">
|
58 |
<table id="wpfc-form-spinner-preload" class="wpfc-form-spinner" cellpadding="0" cellspacing="0" border="0" height="20" width="70" style="border: 1px solid rgb(204, 204, 204); border-collapse: collapse; background: rgb(255, 255, 255);">
|
59 |
<tbody>
|
1 |
<style type="text/css">
|
2 |
div[id^="wpfc-modal-preload"] .wiz-input-cont{
|
3 |
margin-top: 0 !important;
|
4 |
+
margin-bottom: 10px !important;
|
5 |
float: left !important;
|
6 |
+
width: 108px !important;
|
7 |
}
|
8 |
.wiz-input-cont label{
|
9 |
margin-right: 0 !important;
|
28 |
</div>
|
29 |
<div class="window-content-wrapper" style="padding: 15px;">
|
30 |
<div class="window-content" style="z-index: 1000; height: auto; position: relative; display: inline-block; width: 100%;">
|
31 |
+
<div class="wiz-input-cont" style="padding-right: 8px;margin-right: 10px;">
|
32 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_homepage; ?> id="wpFastestCachePreload_homepage" name="wpFastestCachePreload_homepage"></label>
|
33 |
<label for="wpFastestCachePreload_homepage">Homepage</label>
|
34 |
</div>
|
36 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_post; ?> id="wpFastestCachePreload_post" name="wpFastestCachePreload_post"></label>
|
37 |
<label for="wpFastestCachePreload_post">Posts</label>
|
38 |
</div>
|
39 |
+
<div class="wiz-input-cont" style="padding-right: 8px;margin-right: 10px;">
|
40 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_category; ?> id="wpFastestCachePreload_category" name="wpFastestCachePreload_category"></label>
|
41 |
<label for="wpFastestCachePreload_category">Categories</label>
|
42 |
</div>
|
44 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_page; ?> id="wpFastestCachePreload_page" name="wpFastestCachePreload_page"></label>
|
45 |
<label for="wpFastestCachePreload_page">Pages</label>
|
46 |
</div>
|
47 |
+
<div class="wiz-input-cont" style="padding-right: 8px;margin-right: 10px;">
|
48 |
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_tag; ?> id="wpFastestCachePreload_tag" name="wpFastestCachePreload_tag"></label>
|
49 |
<label for="wpFastestCachePreload_tag">Tags</label>
|
50 |
</div>
|
53 |
<label for="wpFastestCachePreload_attachment">Attachments</label>
|
54 |
</div>
|
55 |
|
56 |
+
<div class="wiz-input-cont" style="width: 91% !important;margin-bottom: 10px !important;">
|
57 |
+
<label class="mc-input-label" style="margin-right: 5px;"><input type="checkbox" <?php echo $wpFastestCachePreload_customposttypes; ?> id="wpFastestCachePreload_customposttypes" name="wpFastestCachePreload_customposttypes"></label>
|
58 |
+
<label for="wpFastestCachePreload_customposttypes">Custom Post Types</label>
|
59 |
+
</div>
|
60 |
+
|
61 |
+
<div class="wiz-input-cont" style="width: 91% !important;margin-bottom: 10px !important;">
|
62 |
<label class="mc-input-label" style="float:left;">
|
63 |
<table id="wpfc-form-spinner-preload" class="wpfc-form-spinner" cellpadding="0" cellspacing="0" border="0" height="20" width="70" style="border: 1px solid rgb(204, 204, 204); border-collapse: collapse; background: rgb(255, 255, 255);">
|
64 |
<tbody>
|
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.8.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -764,8 +764,14 @@ GNU General Public License for more details.
|
|
764 |
}
|
765 |
}
|
766 |
|
767 |
-
public function on_all_status_transitions($new_status, $old_status, $post)
|
768 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
if(isset($this->options->wpFastestCacheNewPost) && isset($this->options->wpFastestCacheStatus)){
|
770 |
if($new_status == "publish" && $old_status != "publish"){
|
771 |
if(isset($this->options->wpFastestCacheNewPost_type) && $this->options->wpFastestCacheNewPost_type){
|
@@ -1099,342 +1105,15 @@ GNU General Public License for more details.
|
|
1099 |
}
|
1100 |
|
1101 |
public function set_preload(){
|
1102 |
-
|
1103 |
-
|
1104 |
-
if(!empty($_POST) && isset($_POST["wpFastestCachePreload"])){
|
1105 |
-
foreach ($_POST as $key => $value) {
|
1106 |
-
$key = esc_attr($key);
|
1107 |
-
$value = esc_attr($value);
|
1108 |
-
|
1109 |
-
preg_match("/wpFastestCachePreload_(.+)/", $key, $type);
|
1110 |
-
|
1111 |
-
if(!empty($type)){
|
1112 |
-
if($type[1] == "restart"){
|
1113 |
-
//to need to remove "restart" value
|
1114 |
-
}else if($type[1] == "number"){
|
1115 |
-
$preload_arr[$type[1]] = $value;
|
1116 |
-
}else{
|
1117 |
-
$preload_arr[$type[1]] = 0;
|
1118 |
-
}
|
1119 |
-
}
|
1120 |
-
}
|
1121 |
-
}
|
1122 |
-
|
1123 |
-
if($data = get_option("WpFastestCachePreLoad")){
|
1124 |
-
$preload_std = json_decode($data);
|
1125 |
-
|
1126 |
-
if(!empty($preload_arr)){
|
1127 |
-
foreach ($preload_arr as $key => &$value) {
|
1128 |
-
if(!empty($preload_std->$key)){
|
1129 |
-
if($key != "number"){
|
1130 |
-
$value = $preload_std->$key;
|
1131 |
-
}
|
1132 |
-
}
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
$preload_std = $preload_arr;
|
1136 |
-
}else{
|
1137 |
-
foreach ($preload_std as $key => &$value) {
|
1138 |
-
if($key != "number"){
|
1139 |
-
$value = 0;
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
update_option("WpFastestCachePreLoad", json_encode($preload_std));
|
1145 |
-
|
1146 |
-
if(!wp_next_scheduled($this->slug()."_Preload")){
|
1147 |
-
wp_schedule_event(time() + 5, 'everyfiveminute', $this->slug()."_Preload");
|
1148 |
-
}
|
1149 |
-
}else{
|
1150 |
-
if(!empty($preload_arr)){
|
1151 |
-
add_option("WpFastestCachePreLoad", json_encode($preload_arr), null, "yes");
|
1152 |
-
|
1153 |
-
if(!wp_next_scheduled($this->slug()."_Preload")){
|
1154 |
-
wp_schedule_event(time() + 5, 'everyfiveminute', $this->slug()."_Preload");
|
1155 |
-
}
|
1156 |
-
}else{
|
1157 |
-
//toDO
|
1158 |
-
}
|
1159 |
-
}
|
1160 |
}
|
1161 |
|
1162 |
public function create_preload_cache(){
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
die("Cache System must be enabled");
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
|
1171 |
-
$count_posts = wp_count_posts("post");
|
1172 |
-
$count_pages = wp_count_posts('page');
|
1173 |
-
|
1174 |
-
$pre_load = json_decode($data);
|
1175 |
-
|
1176 |
-
if(defined("WPFC_PRELOAD_NUMBER") && WPFC_PRELOAD_NUMBER){
|
1177 |
-
$number = WPFC_PRELOAD_NUMBER;
|
1178 |
-
}else{
|
1179 |
-
$number = $pre_load->number;
|
1180 |
-
}
|
1181 |
-
|
1182 |
-
|
1183 |
-
$urls_limit = isset($this->options->wpFastestCachePreload_number) ? $this->options->wpFastestCachePreload_number : 4; // must be even
|
1184 |
-
$urls = array();
|
1185 |
-
|
1186 |
-
if(isset($this->options->wpFastestCacheMobileTheme) && $this->options->wpFastestCacheMobileTheme){
|
1187 |
-
$mobile_theme = true;
|
1188 |
-
$number = $number/2;
|
1189 |
-
}else{
|
1190 |
-
$mobile_theme = false;
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
|
1194 |
-
// HOME
|
1195 |
-
if(isset($pre_load->homepage) && $pre_load->homepage > -1){
|
1196 |
-
if($mobile_theme){
|
1197 |
-
array_push($urls, array("url" => get_option("home"), "user-agent" => "mobile"));
|
1198 |
-
$number--;
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
array_push($urls, array("url" => get_option("home"), "user-agent" => "desktop"));
|
1202 |
-
$number--;
|
1203 |
-
|
1204 |
-
$pre_load->homepage = -1;
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
// POST
|
1208 |
-
if($number > 0 && isset($pre_load->post) && $pre_load->post > -1){
|
1209 |
-
// $recent_posts = wp_get_recent_posts(array(
|
1210 |
-
// 'numberposts' => $number,
|
1211 |
-
// 'offset' => $pre_load->post,
|
1212 |
-
// 'orderby' => 'ID',
|
1213 |
-
// 'order' => 'DESC',
|
1214 |
-
// 'post_type' => 'post',
|
1215 |
-
// 'post_status' => 'publish',
|
1216 |
-
// 'suppress_filters' => true
|
1217 |
-
// ), ARRAY_A);
|
1218 |
-
global $wpdb;
|
1219 |
-
$recent_posts = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$wpdb->prefix."posts.post_type = 'post' OR ".$wpdb->prefix."posts.post_type = 'product' OR ".$wpdb->prefix."posts.post_type = 'ajde_events' OR ".$wpdb->prefix."posts.post_type = 'artists') AND ((".$wpdb->prefix."posts.post_status = 'publish')) ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->post.", ".$number, ARRAY_A);
|
1220 |
-
|
1221 |
-
|
1222 |
-
if(count($recent_posts) > 0){
|
1223 |
-
foreach ($recent_posts as $key => $post) {
|
1224 |
-
if($mobile_theme){
|
1225 |
-
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
|
1226 |
-
$number--;
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
|
1230 |
-
$number--;
|
1231 |
-
|
1232 |
-
$pre_load->post = $pre_load->post + 1;
|
1233 |
-
}
|
1234 |
-
}else{
|
1235 |
-
$pre_load->post = -1;
|
1236 |
-
}
|
1237 |
-
}
|
1238 |
-
|
1239 |
-
// ATTACHMENT
|
1240 |
-
if($number > 0 && isset($pre_load->attachment) && $pre_load->attachment > -1){
|
1241 |
-
global $wpdb;
|
1242 |
-
$recent_attachments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$wpdb->prefix."posts.post_type = 'attachment') ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->attachment.", ".$number, ARRAY_A);
|
1243 |
-
|
1244 |
-
if(count($recent_attachments) > 0){
|
1245 |
-
foreach ($recent_attachments as $key => $attachment) {
|
1246 |
-
if($mobile_theme){
|
1247 |
-
array_push($urls, array("url" => get_permalink($attachment["ID"]), "user-agent" => "mobile"));
|
1248 |
-
$number--;
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
array_push($urls, array("url" => get_permalink($attachment["ID"]), "user-agent" => "desktop"));
|
1252 |
-
$number--;
|
1253 |
-
|
1254 |
-
$pre_load->attachment = $pre_load->attachment + 1;
|
1255 |
-
}
|
1256 |
-
}else{
|
1257 |
-
$pre_load->attachment = -1;
|
1258 |
-
}
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
// PAGE
|
1262 |
-
if($number > 0 && isset($pre_load->page) && $pre_load->page > -1){
|
1263 |
-
$pages = get_pages(array(
|
1264 |
-
'sort_order' => 'DESC',
|
1265 |
-
'sort_column' => 'ID',
|
1266 |
-
'parent' => -1,
|
1267 |
-
'hierarchical' => 0,
|
1268 |
-
'number' => $number,
|
1269 |
-
'offset' => $pre_load->page,
|
1270 |
-
'post_type' => 'page',
|
1271 |
-
'post_status' => 'publish'
|
1272 |
-
));
|
1273 |
-
|
1274 |
-
if(count($pages) > 0){
|
1275 |
-
foreach ($pages as $key => $page) {
|
1276 |
-
$page_url = get_option("home")."/".get_page_uri($page->ID);
|
1277 |
-
|
1278 |
-
if($mobile_theme){
|
1279 |
-
array_push($urls, array("url" => $page_url, "user-agent" => "mobile"));
|
1280 |
-
$number--;
|
1281 |
-
}
|
1282 |
-
|
1283 |
-
array_push($urls, array("url" => $page_url, "user-agent" => "desktop"));
|
1284 |
-
$number--;
|
1285 |
-
|
1286 |
-
$pre_load->page = $pre_load->page + 1;
|
1287 |
-
}
|
1288 |
-
}else{
|
1289 |
-
$pre_load->page = -1;
|
1290 |
-
}
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
// CATEGORY
|
1294 |
-
if($number > 0 && isset($pre_load->category) && $pre_load->category > -1){
|
1295 |
-
// $categories = get_terms(array(
|
1296 |
-
// 'taxonomy' => array('category', 'product_cat'),
|
1297 |
-
// 'orderby' => 'id',
|
1298 |
-
// 'order' => 'DESC',
|
1299 |
-
// 'hide_empty' => false,
|
1300 |
-
// 'number' => $number,
|
1301 |
-
// 'fields' => 'all',
|
1302 |
-
// 'pad_counts' => false,
|
1303 |
-
// 'offset' => $pre_load->category
|
1304 |
-
// ));
|
1305 |
-
|
1306 |
-
global $wpdb;
|
1307 |
-
$categories = $wpdb->get_results("SELECT t.*, tt.* FROM ".$wpdb->prefix."terms AS t INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category', 'product_cat', 'hersteller', 'anschlussart', 'typ') ORDER BY t.term_id ASC LIMIT ".$pre_load->category.", ".$number, ARRAY_A);
|
1308 |
-
|
1309 |
-
if(count($categories) > 0){
|
1310 |
-
foreach ($categories as $key => $category) {
|
1311 |
-
if($mobile_theme){
|
1312 |
-
array_push($urls, array("url" => get_term_link($category["slug"], $category["taxonomy"]), "user-agent" => "mobile"));
|
1313 |
-
$number--;
|
1314 |
-
}
|
1315 |
-
|
1316 |
-
array_push($urls, array("url" => get_term_link($category["slug"], $category["taxonomy"]), "user-agent" => "desktop"));
|
1317 |
-
$number--;
|
1318 |
-
|
1319 |
-
$pre_load->category = $pre_load->category + 1;
|
1320 |
-
|
1321 |
-
}
|
1322 |
-
}else{
|
1323 |
-
$pre_load->category = -1;
|
1324 |
-
}
|
1325 |
-
}
|
1326 |
-
|
1327 |
-
// TAG
|
1328 |
-
if($number > 0 && isset($pre_load->tag) && $pre_load->tag > -1){
|
1329 |
-
// $tags = get_terms(array(
|
1330 |
-
// 'taxonomy' => array('post_tag', 'product_tag'),
|
1331 |
-
// 'orderby' => 'id',
|
1332 |
-
// 'order' => 'DESC',
|
1333 |
-
// 'hide_empty' => false,
|
1334 |
-
// 'number' => $number,
|
1335 |
-
// 'fields' => 'all',
|
1336 |
-
// 'pad_counts' => false,
|
1337 |
-
// 'offset' => $pre_load->tag
|
1338 |
-
// ));
|
1339 |
-
|
1340 |
-
global $wpdb;
|
1341 |
-
$tags = $wpdb->get_results("SELECT t.*, tt.* FROM ".$wpdb->prefix."terms AS t INNER JOIN ".$wpdb->prefix."term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_tag', 'product_tag') ORDER BY t.term_id ASC LIMIT ".$pre_load->tag.", ".$number, ARRAY_A);
|
1342 |
-
|
1343 |
-
|
1344 |
-
if(count($tags) > 0){
|
1345 |
-
foreach ($tags as $key => $tag) {
|
1346 |
-
if($mobile_theme){
|
1347 |
-
array_push($urls, array("url" => get_term_link($tag["slug"], $tag["taxonomy"]), "user-agent" => "mobile"));
|
1348 |
-
$number--;
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
array_push($urls, array("url" => get_term_link($tag["slug"], $tag["taxonomy"]), "user-agent" => "desktop"));
|
1352 |
-
$number--;
|
1353 |
-
|
1354 |
-
$pre_load->tag = $pre_load->tag + 1;
|
1355 |
-
|
1356 |
-
}
|
1357 |
-
}else{
|
1358 |
-
$pre_load->tag = -1;
|
1359 |
-
}
|
1360 |
-
}
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
if(count($urls) > 0){
|
1368 |
-
foreach ($urls as $key => $arr) {
|
1369 |
-
$user_agent = "";
|
1370 |
-
|
1371 |
-
if($arr["user-agent"] == "desktop"){
|
1372 |
-
$user_agent = "WP Fastest Cache Preload Bot";
|
1373 |
-
}else if($arr["user-agent"] == "mobile"){
|
1374 |
-
$user_agent = "WP Fastest Cache Preload iPhone Mobile Bot";
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
if($this->wpfc_remote_get($arr["url"], $user_agent)){
|
1378 |
-
$status = "<strong style=\"color:lightgreen;\">OK</strong>";
|
1379 |
-
}else{
|
1380 |
-
$status = "<strong style=\"color:red;\">ERROR</strong>";
|
1381 |
-
}
|
1382 |
-
|
1383 |
-
echo $status." ".$arr["url"]." (".$arr["user-agent"].")<br>";
|
1384 |
-
}
|
1385 |
-
echo "<br>";
|
1386 |
-
echo count($urls)." page have been cached";
|
1387 |
-
|
1388 |
-
update_option("WpFastestCachePreLoad", json_encode($pre_load));
|
1389 |
-
|
1390 |
-
echo "<br><br>";
|
1391 |
-
|
1392 |
-
// if(isset($pre_load->homepage)){
|
1393 |
-
// if($pre_load->homepage == -1){
|
1394 |
-
// echo "Homepage: 1/1"."<br>";
|
1395 |
-
// }
|
1396 |
-
// }
|
1397 |
-
|
1398 |
-
// if(isset($pre_load->post)){
|
1399 |
-
// if($pre_load->post > -1){
|
1400 |
-
// echo "Posts: ".$pre_load->post."/".$count_posts->publish."<br>";
|
1401 |
-
// }else{
|
1402 |
-
// echo "Posts: ".$count_posts->publish."/".$count_posts->publish."<br>";
|
1403 |
-
// }
|
1404 |
-
// }
|
1405 |
-
|
1406 |
-
// if(isset($pre_load->page)){
|
1407 |
-
// if($pre_load->page > -1){
|
1408 |
-
// echo "Pages: ".$pre_load->page."/".$count_pages->publish."<br>";
|
1409 |
-
// }else{
|
1410 |
-
// echo "Pages: ".$count_pages->publish."/".$count_pages->publish."<br>";
|
1411 |
-
// }
|
1412 |
-
// }
|
1413 |
-
}else{
|
1414 |
-
if(isset($this->options->wpFastestCachePreload_restart)){
|
1415 |
-
foreach ($pre_load as $pre_load_key => &$pre_load_value) {
|
1416 |
-
if($pre_load_key != "number"){
|
1417 |
-
$pre_load_value = 0;
|
1418 |
-
}
|
1419 |
-
}
|
1420 |
-
|
1421 |
-
update_option("WpFastestCachePreLoad", json_encode($pre_load));
|
1422 |
-
|
1423 |
-
echo "Preload Restarted";
|
1424 |
-
|
1425 |
-
include_once('inc/cdn.php');
|
1426 |
-
CdnWPFC::cloudflare_clear_cache();
|
1427 |
-
}else{
|
1428 |
-
echo "Completed";
|
1429 |
-
|
1430 |
-
wp_clear_scheduled_hook("wp_fastest_cache_Preload");
|
1431 |
-
}
|
1432 |
-
}
|
1433 |
-
}
|
1434 |
-
|
1435 |
-
if(isset($_GET) && isset($_GET["type"]) && $_GET["type"] == "preload"){
|
1436 |
-
die();
|
1437 |
-
}
|
1438 |
}
|
1439 |
|
1440 |
public function wpfc_remote_get($url, $user_agent){
|
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.8.8
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
764 |
}
|
765 |
}
|
766 |
|
767 |
+
public function on_all_status_transitions($new_status, $old_status, $post){
|
768 |
+
if(!wp_is_post_revision($post->ID)){
|
769 |
+
if(isset($post->post_type)){
|
770 |
+
if($post->post_type == "nf_sub"){
|
771 |
+
return 0;
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
if(isset($this->options->wpFastestCacheNewPost) && isset($this->options->wpFastestCacheStatus)){
|
776 |
if($new_status == "publish" && $old_status != "publish"){
|
777 |
if(isset($this->options->wpFastestCacheNewPost_type) && $this->options->wpFastestCacheNewPost_type){
|
1105 |
}
|
1106 |
|
1107 |
public function set_preload(){
|
1108 |
+
include_once('inc/preload.php');
|
1109 |
+
PreloadWPFC::set_preload($this->slug());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1110 |
}
|
1111 |
|
1112 |
public function create_preload_cache(){
|
1113 |
+
$this->options = $this->getOptions();
|
1114 |
+
|
1115 |
+
include_once('inc/preload.php');
|
1116 |
+
PreloadWPFC::create_preload_cache($this->options, array($this, "wpfc_remote_get"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1117 |
}
|
1118 |
|
1119 |
public function wpfc_remote_get($url, $user_agent){
|