Version Description
2020-07-07 =
TWEAK: Update software licenser
Download this release
Release Info
Developer | buzztone |
Plugin | Contact Form 7 Skins |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- includes/EDD_SL_Plugin_Updater.php +192 -39
- index.php +2 -2
- readme.txt +6 -2
includes/EDD_SL_Plugin_Updater.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
-
* @version 1.
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
@@ -19,6 +19,8 @@ class EDD_SL_Plugin_Updater {
|
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
|
|
|
|
22 |
/**
|
23 |
* Class constructor.
|
24 |
*
|
@@ -40,10 +42,19 @@ class EDD_SL_Plugin_Updater {
|
|
40 |
$this->version = $_api_data['version'];
|
41 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
42 |
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
43 |
-
$this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
44 |
|
45 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
// Set up hooks.
|
48 |
$this->init();
|
49 |
|
@@ -106,15 +117,33 @@ class EDD_SL_Plugin_Updater {
|
|
106 |
|
107 |
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
108 |
|
|
|
109 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
110 |
|
111 |
$_transient_data->response[ $this->name ] = $version_info;
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
-
$_transient_data->last_checked =
|
116 |
$_transient_data->checked[ $this->name ] = $this->version;
|
117 |
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
return $_transient_data;
|
@@ -158,6 +187,23 @@ class EDD_SL_Plugin_Updater {
|
|
158 |
if ( false === $version_info ) {
|
159 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$this->set_version_info_cache( $version_info );
|
162 |
}
|
163 |
|
@@ -165,14 +211,29 @@ class EDD_SL_Plugin_Updater {
|
|
165 |
return;
|
166 |
}
|
167 |
|
|
|
168 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
169 |
|
170 |
$update_cache->response[ $this->name ] = $version_info;
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
-
$update_cache->last_checked
|
175 |
$update_cache->checked[ $this->name ] = $this->version;
|
|
|
|
|
|
|
176 |
|
177 |
set_site_transient( 'update_plugins', $update_cache );
|
178 |
|
@@ -251,14 +312,13 @@ class EDD_SL_Plugin_Updater {
|
|
251 |
'is_ssl' => is_ssl(),
|
252 |
'fields' => array(
|
253 |
'banners' => array(),
|
254 |
-
'reviews' => false
|
|
|
255 |
)
|
256 |
);
|
257 |
|
258 |
-
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
259 |
-
|
260 |
// Get the transient where we store the api request for this plugin for 24 hours
|
261 |
-
$edd_api_request_transient = $this->get_cached_version_info(
|
262 |
|
263 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
264 |
if ( empty( $edd_api_request_transient ) ) {
|
@@ -266,7 +326,7 @@ class EDD_SL_Plugin_Updater {
|
|
266 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
267 |
|
268 |
// Expires in 3 hours
|
269 |
-
$this->set_version_info_cache( $api_response
|
270 |
|
271 |
if ( false !== $api_response ) {
|
272 |
$_data = $api_response;
|
@@ -278,27 +338,52 @@ class EDD_SL_Plugin_Updater {
|
|
278 |
|
279 |
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
280 |
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
281 |
-
$
|
282 |
-
foreach ( $_data->sections as $key => $value ) {
|
283 |
-
$new_sections[ $key ] = $value;
|
284 |
-
}
|
285 |
-
|
286 |
-
$_data->sections = $new_sections;
|
287 |
}
|
288 |
|
289 |
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
290 |
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
291 |
-
$
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
295 |
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
}
|
298 |
|
299 |
return $_data;
|
300 |
}
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
/**
|
303 |
* Disable SSL verification in order to prevent download update failures
|
304 |
*
|
@@ -307,11 +392,13 @@ class EDD_SL_Plugin_Updater {
|
|
307 |
* @return object $array
|
308 |
*/
|
309 |
public function http_request_args( $args, $url ) {
|
310 |
-
|
|
|
311 |
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
312 |
-
$args['sslverify'] =
|
313 |
}
|
314 |
return $args;
|
|
|
315 |
}
|
316 |
|
317 |
/**
|
@@ -327,7 +414,31 @@ class EDD_SL_Plugin_Updater {
|
|
327 |
*/
|
328 |
private function api_request( $_action, $_data ) {
|
329 |
|
330 |
-
global $wp_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
|
332 |
$data = array_merge( $this->api_data, $_data );
|
333 |
|
@@ -335,7 +446,7 @@ class EDD_SL_Plugin_Updater {
|
|
335 |
return;
|
336 |
}
|
337 |
|
338 |
-
if( $this->api_url == trailingslashit (home_url() ) ) {
|
339 |
return false; // Don't allow a plugin to ping itself
|
340 |
}
|
341 |
|
@@ -351,15 +462,17 @@ class EDD_SL_Plugin_Updater {
|
|
351 |
'beta' => ! empty( $data['beta'] ),
|
352 |
);
|
353 |
|
354 |
-
$request
|
355 |
|
356 |
if ( ! is_wp_error( $request ) ) {
|
357 |
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
358 |
|
359 |
// @cf7skins: save log
|
|
|
|
|
360 |
$logs = get_option( 'cf7skins_get_version' );
|
361 |
$logs[$this->slug] = $request;
|
362 |
-
update_option( 'cf7skins_get_version', $logs );
|
363 |
}
|
364 |
|
365 |
if ( $request && isset( $request->sections ) ) {
|
@@ -372,6 +485,10 @@ class EDD_SL_Plugin_Updater {
|
|
372 |
$request->banners = maybe_unserialize( $request->banners );
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
375 |
if( ! empty( $request->sections ) ) {
|
376 |
foreach( $request->sections as $key => $section ) {
|
377 |
$request->$key = (array) $section;
|
@@ -381,6 +498,9 @@ class EDD_SL_Plugin_Updater {
|
|
381 |
return $request;
|
382 |
}
|
383 |
|
|
|
|
|
|
|
384 |
public function show_changelog() {
|
385 |
|
386 |
global $edd_plugin_data;
|
@@ -402,9 +522,7 @@ class EDD_SL_Plugin_Updater {
|
|
402 |
}
|
403 |
|
404 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
405 |
-
$
|
406 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
407 |
-
$version_info = $this->get_cached_version_info( $cache_key );
|
408 |
|
409 |
if( false === $version_info ) {
|
410 |
|
@@ -418,13 +536,13 @@ class EDD_SL_Plugin_Updater {
|
|
418 |
'beta' => ! empty( $data['beta'] )
|
419 |
);
|
420 |
|
421 |
-
$
|
|
|
422 |
|
423 |
if ( ! is_wp_error( $request ) ) {
|
424 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
425 |
}
|
426 |
|
427 |
-
|
428 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
429 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
430 |
} else {
|
@@ -437,17 +555,28 @@ class EDD_SL_Plugin_Updater {
|
|
437 |
}
|
438 |
}
|
439 |
|
440 |
-
$this->set_version_info_cache( $version_info
|
441 |
|
|
|
|
|
442 |
}
|
443 |
|
444 |
-
if
|
445 |
-
|
|
|
|
|
|
|
446 |
}
|
447 |
|
448 |
exit;
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
public function get_cached_version_info( $cache_key = '' ) {
|
452 |
|
453 |
if( empty( $cache_key ) ) {
|
@@ -456,14 +585,26 @@ class EDD_SL_Plugin_Updater {
|
|
456 |
|
457 |
$cache = get_option( $cache_key );
|
458 |
|
459 |
-
if( empty( $cache['timeout'] ) ||
|
460 |
return false; // Cache is expired
|
461 |
}
|
462 |
|
463 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
|
465 |
}
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
468 |
|
469 |
if( empty( $cache_key ) ) {
|
@@ -471,12 +612,24 @@ class EDD_SL_Plugin_Updater {
|
|
471 |
}
|
472 |
|
473 |
$data = array(
|
474 |
-
'timeout' => strtotime( '+3 hours',
|
475 |
'value' => json_encode( $value )
|
476 |
);
|
477 |
|
478 |
-
update_option( $cache_key, $data );
|
|
|
|
|
|
|
|
|
479 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
}
|
481 |
|
482 |
-
}
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Easy Digital Downloads
|
10 |
+
* @version 1.7.1
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
|
19 |
private $wp_override = false;
|
20 |
private $cache_key = '';
|
21 |
|
22 |
+
private $health_check_timeout = 5;
|
23 |
+
|
24 |
/**
|
25 |
* Class constructor.
|
26 |
*
|
42 |
$this->version = $_api_data['version'];
|
43 |
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
44 |
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
45 |
+
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
46 |
|
47 |
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
48 |
|
49 |
+
/**
|
50 |
+
* Fires after the $edd_plugin_data is setup.
|
51 |
+
*
|
52 |
+
* @since x.x.x
|
53 |
+
*
|
54 |
+
* @param array $edd_plugin_data Array of EDD SL plugin data.
|
55 |
+
*/
|
56 |
+
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
|
57 |
+
|
58 |
// Set up hooks.
|
59 |
$this->init();
|
60 |
|
117 |
|
118 |
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
119 |
|
120 |
+
$no_update = false;
|
121 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
122 |
|
123 |
$_transient_data->response[ $this->name ] = $version_info;
|
124 |
|
125 |
+
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
|
126 |
+
$_transient_data->response[ $this->name ]->plugin = $this->name;
|
127 |
+
|
128 |
+
} else {
|
129 |
+
$no_update = new stdClass();
|
130 |
+
$no_update->id = '';
|
131 |
+
$no_update->slug = $this->slug;
|
132 |
+
$no_update->plugin = $this->name;
|
133 |
+
$no_update->new_version = $version_info->new_version;
|
134 |
+
$no_update->url = $version_info->homepage;
|
135 |
+
$no_update->package = $version_info->package;
|
136 |
+
$no_update->icons = $version_info->icons;
|
137 |
+
$no_update->banners = $version_info->banners;
|
138 |
+
$no_update->banners_rtl = array();
|
139 |
}
|
140 |
|
141 |
+
$_transient_data->last_checked = time();
|
142 |
$_transient_data->checked[ $this->name ] = $this->version;
|
143 |
|
144 |
+
if ( $no_update ) {
|
145 |
+
$_transient_data->no_update[ $this->name ] = $no_update;
|
146 |
+
}
|
147 |
}
|
148 |
|
149 |
return $_transient_data;
|
187 |
if ( false === $version_info ) {
|
188 |
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
189 |
|
190 |
+
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
|
191 |
+
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
|
192 |
+
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
|
196 |
+
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
|
200 |
+
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
|
201 |
+
}
|
202 |
+
|
203 |
+
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
|
204 |
+
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
|
205 |
+
}
|
206 |
+
|
207 |
$this->set_version_info_cache( $version_info );
|
208 |
}
|
209 |
|
211 |
return;
|
212 |
}
|
213 |
|
214 |
+
$no_update = false;
|
215 |
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
216 |
|
217 |
$update_cache->response[ $this->name ] = $version_info;
|
218 |
|
219 |
+
} else {
|
220 |
+
$no_update = new stdClass();
|
221 |
+
$no_update->id = '';
|
222 |
+
$no_update->slug = $this->slug;
|
223 |
+
$no_update->plugin = $this->name;
|
224 |
+
$no_update->new_version = $version_info->new_version;
|
225 |
+
$no_update->url = $version_info->homepage;
|
226 |
+
$no_update->package = $version_info->package;
|
227 |
+
$no_update->icons = $version_info->icons;
|
228 |
+
$no_update->banners = $version_info->banners;
|
229 |
+
$no_update->banners_rtl = array();
|
230 |
}
|
231 |
|
232 |
+
$update_cache->last_checked = time();
|
233 |
$update_cache->checked[ $this->name ] = $this->version;
|
234 |
+
if ( $no_update ) {
|
235 |
+
$update_cache->no_update[ $this->name ] = $no_update;
|
236 |
+
}
|
237 |
|
238 |
set_site_transient( 'update_plugins', $update_cache );
|
239 |
|
312 |
'is_ssl' => is_ssl(),
|
313 |
'fields' => array(
|
314 |
'banners' => array(),
|
315 |
+
'reviews' => false,
|
316 |
+
'icons' => array(),
|
317 |
)
|
318 |
);
|
319 |
|
|
|
|
|
320 |
// Get the transient where we store the api request for this plugin for 24 hours
|
321 |
+
$edd_api_request_transient = $this->get_cached_version_info();
|
322 |
|
323 |
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
324 |
if ( empty( $edd_api_request_transient ) ) {
|
326 |
$api_response = $this->api_request( 'plugin_information', $to_send );
|
327 |
|
328 |
// Expires in 3 hours
|
329 |
+
$this->set_version_info_cache( $api_response );
|
330 |
|
331 |
if ( false !== $api_response ) {
|
332 |
$_data = $api_response;
|
338 |
|
339 |
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
340 |
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
341 |
+
$_data->sections = $this->convert_object_to_array( $_data->sections );
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
|
344 |
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
345 |
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
346 |
+
$_data->banners = $this->convert_object_to_array( $_data->banners );
|
347 |
+
}
|
348 |
+
|
349 |
+
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
|
350 |
+
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
|
351 |
+
$_data->icons = $this->convert_object_to_array( $_data->icons );
|
352 |
+
}
|
353 |
|
354 |
+
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
|
355 |
+
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
|
356 |
+
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
|
357 |
+
}
|
358 |
+
|
359 |
+
if( ! isset( $_data->plugin ) ) {
|
360 |
+
$_data->plugin = $this->name;
|
361 |
}
|
362 |
|
363 |
return $_data;
|
364 |
}
|
365 |
|
366 |
+
/**
|
367 |
+
* Convert some objects to arrays when injecting data into the update API
|
368 |
+
*
|
369 |
+
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
|
370 |
+
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
|
371 |
+
*
|
372 |
+
* @since 3.6.5
|
373 |
+
*
|
374 |
+
* @param stdClass $data
|
375 |
+
*
|
376 |
+
* @return array
|
377 |
+
*/
|
378 |
+
private function convert_object_to_array( $data ) {
|
379 |
+
$new_data = array();
|
380 |
+
foreach ( $data as $key => $value ) {
|
381 |
+
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
|
382 |
+
}
|
383 |
+
|
384 |
+
return $new_data;
|
385 |
+
}
|
386 |
+
|
387 |
/**
|
388 |
* Disable SSL verification in order to prevent download update failures
|
389 |
*
|
392 |
* @return object $array
|
393 |
*/
|
394 |
public function http_request_args( $args, $url ) {
|
395 |
+
|
396 |
+
$verify_ssl = $this->verify_ssl();
|
397 |
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
398 |
+
$args['sslverify'] = $verify_ssl;
|
399 |
}
|
400 |
return $args;
|
401 |
+
|
402 |
}
|
403 |
|
404 |
/**
|
414 |
*/
|
415 |
private function api_request( $_action, $_data ) {
|
416 |
|
417 |
+
global $wp_version, $edd_plugin_url_available;
|
418 |
+
|
419 |
+
$verify_ssl = $this->verify_ssl();
|
420 |
+
|
421 |
+
// Do a quick status check on this domain if we haven't already checked it.
|
422 |
+
$store_hash = md5( $this->api_url );
|
423 |
+
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
|
424 |
+
$test_url_parts = parse_url( $this->api_url );
|
425 |
+
|
426 |
+
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
|
427 |
+
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
|
428 |
+
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
|
429 |
+
|
430 |
+
if ( empty( $host ) ) {
|
431 |
+
$edd_plugin_url_available[ $store_hash ] = false;
|
432 |
+
} else {
|
433 |
+
$test_url = $scheme . '://' . $host . $port;
|
434 |
+
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
|
435 |
+
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
440 |
+
return;
|
441 |
+
}
|
442 |
|
443 |
$data = array_merge( $this->api_data, $_data );
|
444 |
|
446 |
return;
|
447 |
}
|
448 |
|
449 |
+
if( $this->api_url == trailingslashit ( home_url() ) ) {
|
450 |
return false; // Don't allow a plugin to ping itself
|
451 |
}
|
452 |
|
462 |
'beta' => ! empty( $data['beta'] ),
|
463 |
);
|
464 |
|
465 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
466 |
|
467 |
if ( ! is_wp_error( $request ) ) {
|
468 |
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
469 |
|
470 |
// @cf7skins: save log
|
471 |
+
$request->last_checked = date_i18n( __( 'F j, Y' ) ) . ' ' . date_i18n( __( 'g:i a' ) );
|
472 |
+
$request->current_version = $api_params['version'];
|
473 |
$logs = get_option( 'cf7skins_get_version' );
|
474 |
$logs[$this->slug] = $request;
|
475 |
+
update_option( 'cf7skins_get_version', $logs );
|
476 |
}
|
477 |
|
478 |
if ( $request && isset( $request->sections ) ) {
|
485 |
$request->banners = maybe_unserialize( $request->banners );
|
486 |
}
|
487 |
|
488 |
+
if ( $request && isset( $request->icons ) ) {
|
489 |
+
$request->icons = maybe_unserialize( $request->icons );
|
490 |
+
}
|
491 |
+
|
492 |
if( ! empty( $request->sections ) ) {
|
493 |
foreach( $request->sections as $key => $section ) {
|
494 |
$request->$key = (array) $section;
|
498 |
return $request;
|
499 |
}
|
500 |
|
501 |
+
/**
|
502 |
+
* If available, show the changelog for sites in a multisite install.
|
503 |
+
*/
|
504 |
public function show_changelog() {
|
505 |
|
506 |
global $edd_plugin_data;
|
522 |
}
|
523 |
|
524 |
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
525 |
+
$version_info = $this->get_cached_version_info();
|
|
|
|
|
526 |
|
527 |
if( false === $version_info ) {
|
528 |
|
536 |
'beta' => ! empty( $data['beta'] )
|
537 |
);
|
538 |
|
539 |
+
$verify_ssl = $this->verify_ssl();
|
540 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
541 |
|
542 |
if ( ! is_wp_error( $request ) ) {
|
543 |
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
544 |
}
|
545 |
|
|
|
546 |
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
547 |
$version_info->sections = maybe_unserialize( $version_info->sections );
|
548 |
} else {
|
555 |
}
|
556 |
}
|
557 |
|
558 |
+
$this->set_version_info_cache( $version_info );
|
559 |
|
560 |
+
// Delete the unneeded option
|
561 |
+
delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
|
562 |
}
|
563 |
|
564 |
+
if ( isset( $version_info->sections ) ) {
|
565 |
+
$sections = $this->convert_object_to_array( $version_info->sections );
|
566 |
+
if ( ! empty( $sections['changelog'] ) ) {
|
567 |
+
echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
|
568 |
+
}
|
569 |
}
|
570 |
|
571 |
exit;
|
572 |
}
|
573 |
|
574 |
+
/**
|
575 |
+
* Gets the plugin's cached version information from the database.
|
576 |
+
*
|
577 |
+
* @param string $cache_key
|
578 |
+
* @return boolean|string
|
579 |
+
*/
|
580 |
public function get_cached_version_info( $cache_key = '' ) {
|
581 |
|
582 |
if( empty( $cache_key ) ) {
|
585 |
|
586 |
$cache = get_option( $cache_key );
|
587 |
|
588 |
+
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
|
589 |
return false; // Cache is expired
|
590 |
}
|
591 |
|
592 |
+
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
|
593 |
+
$cache['value'] = json_decode( $cache['value'] );
|
594 |
+
if ( ! empty( $cache['value']->icons ) ) {
|
595 |
+
$cache['value']->icons = (array) $cache['value']->icons;
|
596 |
+
}
|
597 |
+
|
598 |
+
return $cache['value'];
|
599 |
|
600 |
}
|
601 |
|
602 |
+
/**
|
603 |
+
* Adds the plugin version information to the database.
|
604 |
+
*
|
605 |
+
* @param string $value
|
606 |
+
* @param string $cache_key
|
607 |
+
*/
|
608 |
public function set_version_info_cache( $value = '', $cache_key = '' ) {
|
609 |
|
610 |
if( empty( $cache_key ) ) {
|
612 |
}
|
613 |
|
614 |
$data = array(
|
615 |
+
'timeout' => strtotime( '+3 hours', time() ),
|
616 |
'value' => json_encode( $value )
|
617 |
);
|
618 |
|
619 |
+
update_option( $cache_key, $data, 'no' );
|
620 |
+
|
621 |
+
// Delete the duplicate option
|
622 |
+
delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
|
623 |
+
}
|
624 |
|
625 |
+
/**
|
626 |
+
* Returns if the SSL of the store should be verified.
|
627 |
+
*
|
628 |
+
* @since 1.6.13
|
629 |
+
* @return bool
|
630 |
+
*/
|
631 |
+
private function verify_ssl() {
|
632 |
+
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
633 |
}
|
634 |
|
635 |
+
}
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Contact Form 7 Skins
|
4 |
* Plugin URI: http://cf7skins.com
|
5 |
* Description: Adds drag & drop Visual Editor with Templates & Styles to Contact Form 7. Requires Contact Form 7.
|
6 |
-
* Version: 2.3.
|
7 |
* Author: Neil Murray
|
8 |
* Author URI: http://cf7skins.com
|
9 |
* License: GPL-2.0+
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
*
|
31 |
* @since 0.1.0
|
32 |
*/
|
33 |
-
define( 'CF7SKINS_VERSION', '2.3.
|
34 |
define( 'CF7SKINS_OPTIONS', 'cf7skins' ); // Database option names
|
35 |
define( 'CF7SKINS_TEXTDOMAIN', 'contact-form-7-skins' );
|
36 |
define( 'CF7SKINS_FEATURE_FILTER', false ); // @since 0.4.0
|
3 |
* Plugin Name: Contact Form 7 Skins
|
4 |
* Plugin URI: http://cf7skins.com
|
5 |
* Description: Adds drag & drop Visual Editor with Templates & Styles to Contact Form 7. Requires Contact Form 7.
|
6 |
+
* Version: 2.3.3
|
7 |
* Author: Neil Murray
|
8 |
* Author URI: http://cf7skins.com
|
9 |
* License: GPL-2.0+
|
30 |
*
|
31 |
* @since 0.1.0
|
32 |
*/
|
33 |
+
define( 'CF7SKINS_VERSION', '2.3.3' );
|
34 |
define( 'CF7SKINS_OPTIONS', 'cf7skins' ); // Database option names
|
35 |
define( 'CF7SKINS_TEXTDOMAIN', 'contact-form-7-skins' );
|
36 |
define( 'CF7SKINS_FEATURE_FILTER', false ); // @since 0.4.0
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: buzztone
|
3 |
Tags: contact form 7, contact form 7 editor, contact form 7 addon, contact form 7 style, contact form 7 theme
|
4 |
Requires at least: 4.3
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.3.
|
8 |
Author URI: https://cf7skins.com
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -122,6 +122,10 @@ Absolutely not. You can create and manage Contact Form 7 forms without any codin
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
|
|
|
|
|
|
|
|
125 |
= 2.3.2 - 2020-06-30 =
|
126 |
|
127 |
* TWEAK: Enable translation of Pro Tips
|
2 |
Contributors: buzztone
|
3 |
Tags: contact form 7, contact form 7 editor, contact form 7 addon, contact form 7 style, contact form 7 theme
|
4 |
Requires at least: 4.3
|
5 |
+
Tested up to: 5.4
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.3.3
|
8 |
Author URI: https://cf7skins.com
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
+
= 2.3.3 - 2020-07-07 =
|
126 |
+
|
127 |
+
* TWEAK: Update software licenser
|
128 |
+
|
129 |
= 2.3.2 - 2020-06-30 =
|
130 |
|
131 |
* TWEAK: Enable translation of Pro Tips
|