Image optimization & Lazy Load by Optimole - Version 2.5.2

Version Description

Download this release

Release Info

Developer optimole
Plugin Icon 128x128 Image optimization & Lazy Load by Optimole
Version 2.5.2
Comparing to
See all releases

Code changes from version 2.5.1 to 2.5.2

CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  ##### [Version 2.5.1](https://github.com/Codeinwp/optimole-wp/compare/v2.5.0...v2.5.1) (2020-08-26)
2
 
3
  * Fix small bug between native lazyload compatibility and caching plugins
1
+ ##### [Version 2.5.2](https://github.com/Codeinwp/optimole-wp/compare/v2.5.1...v2.5.2) (2020-09-02)
2
+
3
+ * Improve compatibility with various plugins for the video lazyload functionality
4
+
5
  ##### [Version 2.5.1](https://github.com/Codeinwp/optimole-wp/compare/v2.5.0...v2.5.1) (2020-08-26)
6
 
7
  * Fix small bug between native lazyload compatibility and caching plugins
inc/lazyload_replacer.php CHANGED
@@ -35,6 +35,12 @@ final class Optml_Lazyload_Replacer extends Optml_App_Replacer {
35
  * @var array Noscript flags.
36
  */
37
  private static $ignore_no_script_flags = null;
 
 
 
 
 
 
38
  /**
39
  * Holds classes responsabile for watching lazyload behaviour.
40
  *
@@ -253,18 +259,18 @@ final class Optml_Lazyload_Replacer extends Optml_App_Replacer {
253
  */
254
  public function lazyload_video_replace( $content ) {
255
  $video_tags = array();
256
- preg_match_all( '#<iframe(.*?)></iframe>#is', $content, $video_tags );
257
 
258
  $search = array();
259
  $replace = array();
260
  foreach ( $video_tags[0] as $video_tag ) {
261
- array_push( $search, $video_tag );
262
- if ( strpos( $video_tag, 'gform_ajax_frame' ) ) {
263
  continue;
264
  }
265
  if ( preg_match( "/ data-opt-video-src=['\"]/is", $video_tag ) ) {
266
  continue;
267
  }
 
268
  $no_script = $video_tag;
269
  // replace the src and add the data-opt-src attribute
270
  $video_tag = preg_replace( '/iframe(.*?)src=/is', 'iframe$1 src="about:blank" data-opt-src=', $video_tag );
@@ -393,6 +399,22 @@ final class Optml_Lazyload_Replacer extends Optml_App_Replacer {
393
 
394
  return true;
395
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
 
397
  /**
398
  * Returns flags for ignoring noscript tag additional watch.
@@ -409,7 +431,21 @@ final class Optml_Lazyload_Replacer extends Optml_App_Replacer {
409
 
410
  return self::$ignore_no_script_flags;
411
  }
 
 
 
 
 
 
 
 
 
 
 
 
412
 
 
 
413
  /**
414
  * Throw error on object clone
415
  *
35
  * @var array Noscript flags.
36
  */
37
  private static $ignore_no_script_flags = null;
38
+ /**
39
+ * Holds possible iframe lazyload flags where we should ignore our lazyload.
40
+ *
41
+ * @var array
42
+ */
43
+ protected static $iframe_lazyload_flags = null;
44
  /**
45
  * Holds classes responsabile for watching lazyload behaviour.
46
  *
259
  */
260
  public function lazyload_video_replace( $content ) {
261
  $video_tags = array();
262
+ preg_match_all( '#(?:<noscript\s*>(\s*|.*?))?<iframe(.*?)></iframe>#is', $content, $video_tags );
263
 
264
  $search = array();
265
  $replace = array();
266
  foreach ( $video_tags[0] as $video_tag ) {
267
+ if ( ! $this->should_lazyload_iframe( $video_tag ) ) {
 
268
  continue;
269
  }
270
  if ( preg_match( "/ data-opt-video-src=['\"]/is", $video_tag ) ) {
271
  continue;
272
  }
273
+ array_push( $search, $video_tag );
274
  $no_script = $video_tag;
275
  // replace the src and add the data-opt-src attribute
276
  $video_tag = preg_replace( '/iframe(.*?)src=/is', 'iframe$1 src="about:blank" data-opt-src=', $video_tag );
399
 
400
  return true;
401
  }
402
+ /**
403
+ * Check if we should lazyload iframe.
404
+ *
405
+ * @param string $tag Html tag.
406
+ *
407
+ * @return bool Should add?
408
+ */
409
+ public function should_lazyload_iframe( $tag ) {
410
+ foreach ( self::get_iframe_lazyload_flags() as $banned_string ) {
411
+ if ( strpos( $tag, $banned_string ) !== false ) {
412
+ return false;
413
+ }
414
+ }
415
+
416
+ return true;
417
+ }
418
 
419
  /**
420
  * Returns flags for ignoring noscript tag additional watch.
431
 
432
  return self::$ignore_no_script_flags;
433
  }
434
+ /**
435
+ * Returns possible lazyload flags for iframes.
436
+ *
437
+ * @return array
438
+ */
439
+ public static function get_iframe_lazyload_flags() {
440
+
441
+ if ( null != self::$iframe_lazyload_flags && is_array( self::$iframe_lazyload_flags ) ) {
442
+ return self::$iframe_lazyload_flags;
443
+ }
444
+
445
+ self::$iframe_lazyload_flags = apply_filters( 'optml_iframe_lazyload_flags', [ 'gform_ajax_frame', '<noscript' ] );
446
 
447
+ return self::$iframe_lazyload_flags;
448
+ }
449
  /**
450
  * Throw error on object clone
451
  *
optimole-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Image optimization service by Optimole
4
  * Description: Complete handling of your website images.
5
- * Version: 2.5.1
6
  * Author: Optimole
7
  * Author URI: https://optimole.com
8
  * License: GPL-2.0+
@@ -77,7 +77,7 @@ function optml() {
77
  define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' );
78
  }
79
  define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
80
- define( 'OPTML_VERSION', '2.5.1' );
81
  define( 'OPTML_NAMESPACE', 'optml' );
82
  define( 'OPTML_BASEFILE', __FILE__ );
83
  // Fallback for old PHP versions when this constant is not defined.
2
  /**
3
  * Plugin Name: Image optimization service by Optimole
4
  * Description: Complete handling of your website images.
5
+ * Version: 2.5.2
6
  * Author: Optimole
7
  * Author URI: https://optimole.com
8
  * License: GPL-2.0+
77
  define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' );
78
  }
79
  define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
80
+ define( 'OPTML_VERSION', '2.5.2' );
81
  define( 'OPTML_NAMESPACE', 'optml' );
82
  define( 'OPTML_BASEFILE', __FILE__ );
83
  // Fallback for old PHP versions when this constant is not defined.
readme.txt CHANGED
@@ -89,6 +89,13 @@ Premium users will be able to optimize images for more than 25k monthly active u
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
 
92
  ##### [Version 2.5.1](https://github.com/Codeinwp/optimole-wp/compare/v2.5.0...v2.5.1) (2020-08-26)
93
 
94
  * Fix small bug between native lazyload compatibility and caching plugins
89
 
90
  == Changelog ==
91
 
92
+ ##### [Version 2.5.2](https://github.com/Codeinwp/optimole-wp/compare/v2.5.1...v2.5.2) (2020-09-02)
93
+
94
+ * Improve compatibility with various plugins for the video lazyload functionality
95
+
96
+
97
+
98
+
99
  ##### [Version 2.5.1](https://github.com/Codeinwp/optimole-wp/compare/v2.5.0...v2.5.1) (2020-08-26)
100
 
101
  * Fix small bug between native lazyload compatibility and caching plugins
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit2c5f0875545c80f9422c7bcbc9139b53::getLoader();
vendor/codeinwp/themeisle-sdk/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ##### [Version 3.2.10](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.9...v3.2.10) (2020-05-28)
2
 
3
  * Remove extra files on export
1
+ ##### [Version 3.2.15](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.14...v3.2.15) (2020-07-23)
2
+
3
+ * remove no redundant module
4
+
5
+ ##### [Version 3.2.14](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.13...v3.2.14) (2020-06-10)
6
+
7
+ > Things are getting better every day. 🚀
8
+
9
+ ##### [Version 3.2.13](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.12...v3.2.13) (2020-06-10)
10
+
11
+ Adds plan logic and expiration
12
+
13
+ ##### [Version 3.2.12](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.11...v3.2.12) (2020-06-10)
14
+
15
+ Adds key filter
16
+
17
+ ##### [Version 3.2.11](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.10...v3.2.11) (2020-06-04)
18
+
19
+ * remove non-printable chars
20
+
21
  ##### [Version 3.2.10](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.9...v3.2.10) (2020-05-28)
22
 
23
  * Remove extra files on export
vendor/codeinwp/themeisle-sdk/load.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  return;
15
  }
16
  // Current SDK version and path.
17
- $themeisle_sdk_version = '3.2.10';
18
  $themeisle_sdk_path = dirname( __FILE__ );
19
 
20
  global $themeisle_sdk_max_version;
14
  return;
15
  }
16
  // Current SDK version and path.
17
+ $themeisle_sdk_version = '3.2.15';
18
  $themeisle_sdk_path = dirname( __FILE__ );
19
 
20
  global $themeisle_sdk_max_version;
vendor/codeinwp/themeisle-sdk/src/Loader.php CHANGED
@@ -50,7 +50,6 @@ final class Loader {
50
  'rollback',
51
  'uninstall_feedback',
52
  'licenser',
53
- 'endpoint',
54
  'logger',
55
  'translate',
56
  'review',
50
  'rollback',
51
  'uninstall_feedback',
52
  'licenser',
 
53
  'logger',
54
  'translate',
55
  'review',
vendor/codeinwp/themeisle-sdk/src/Modules/Endpoint.php DELETED
@@ -1,358 +0,0 @@
1
- <?php
2
- /**
3
- * The class that exposes endpoints.
4
- *
5
- * @package ThemeIsleSDK
6
- * @subpackage Rollback
7
- * @copyright Copyright (c) 2017, Marius Cristea
8
- * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
- * @since 1.0.0
10
- */
11
-
12
- namespace ThemeisleSDK\Modules;
13
-
14
- // Exit if accessed directly.
15
- use ThemeisleSDK\Common\Abstract_Module;
16
- use ThemeisleSDK\Loader;
17
- use ThemeisleSDK\Product;
18
-
19
- if ( ! defined( 'ABSPATH' ) ) {
20
- exit;
21
- }
22
-
23
- /**
24
- * Expose endpoints for ThemeIsle SDK.
25
- */
26
- class Endpoint extends Abstract_Module {
27
- /**
28
- * Endpoint slug.
29
- */
30
- const SDK_ENDPOINT = 'themeisle-sdk';
31
- /**
32
- * Endpoint version.
33
- */
34
- const SDK_ENDPOINT_VERSION = 1;
35
- /**
36
- * Hash file which contains the checksum.
37
- */
38
- const HASH_FILE = 'themeisle-hash.json';
39
-
40
- /*
41
- * If true, the endpoint will expect a product slug and will return the value only for that.
42
- */
43
- const PRODUCT_SPECIFIC = false;
44
-
45
- /**
46
- * Registers the endpoints.
47
- */
48
- function rest_register() {
49
- register_rest_route(
50
- self::SDK_ENDPOINT . '/v' . self::SDK_ENDPOINT_VERSION,
51
- '/checksum/' . ( self::PRODUCT_SPECIFIC ? '(?P<slug>.*)/' : '' ),
52
- array(
53
- 'methods' => 'GET',
54
- 'callback' => array( $this, 'checksum' ),
55
- )
56
- );
57
- }
58
-
59
- /**
60
- * The checksum endpoint.
61
- *
62
- * @param \WP_REST_Request $data the request.
63
- *
64
- * @return \WP_REST_Response Response or the error
65
- */
66
- function checksum( \WP_REST_Request $data ) {
67
- $products = Loader::get_products();
68
- if ( self::PRODUCT_SPECIFIC ) {
69
- $params = $this->validate_params( $data, array( 'slug' ) );
70
- foreach ( $products as $product ) {
71
- if ( $params['slug'] === $product->get_slug() ) {
72
- $products = array( $product );
73
- break;
74
- }
75
- }
76
- }
77
- $response = array();
78
- $custom_css = $this->has_custom_css();
79
- if ( is_bool( $custom_css ) ) {
80
- $response['custom_css'] = $custom_css;
81
- }
82
-
83
- $response['child_theme'] = $this->get_theme_properties();
84
-
85
- foreach ( $products as $product ) {
86
- $files = array();
87
- switch ( $product->get_type() ) {
88
- case 'plugin':
89
- $files = array();
90
- break;
91
- case 'theme':
92
- $files = array( 'style.css', 'functions.php' );
93
- break;
94
- }
95
-
96
- $error = '';
97
-
98
- // if any element in the $files array contains a '/', this would imply recursion is required.
99
- $diff = $this->generate_diff(
100
- $product,
101
- $files,
102
- array_reduce(
103
- $files,
104
- array(
105
- $this,
106
- 'is_recursion_required',
107
- ),
108
- false
109
- )
110
- );
111
- if ( is_wp_error( $diff ) ) {
112
- /**
113
- * Error returner by the diff checker method.
114
- *
115
- * @var \WP_Error $diff Error returned.
116
- */
117
- $error = $diff->get_error_message();
118
- $diff = array();
119
- }
120
-
121
- $response['products'][] = array(
122
- 'slug' => $product->get_slug(),
123
- 'version' => $product->get_version(),
124
- 'diffs' => $diff,
125
- 'error' => $error,
126
- );
127
- }
128
-
129
- return new \WP_REST_Response( array( 'checksum' => $response ) );
130
- }
131
-
132
- /**
133
- * Validates the parameters to the API
134
- *
135
- * @param \WP_REST_Request $data the request.
136
- * @param array $params the parameters to validate.
137
- *
138
- * @return array of parameter name=>value
139
- */
140
- private function validate_params( \WP_REST_Request $data, $params ) {
141
- $collect = array();
142
- foreach ( $params as $param ) {
143
- $value = sanitize_text_field( $data[ $param ] );
144
- if ( empty( $value ) ) {
145
- return rest_ensure_response(
146
- new \WP_Error(
147
- 'themeisle_' . $param . '_invalid',
148
- sprintf( 'Invalid %', $param ),
149
- array(
150
- 'status' => 403,
151
- )
152
- )
153
- );
154
- } else {
155
- $collect[ $param ] = $value;
156
- }
157
- }
158
-
159
- return $collect;
160
- }
161
-
162
- /**
163
- * Check if custom css has been added to the theme.
164
- *
165
- * @return bool Whether custom css has been added to the theme.
166
- */
167
- private function has_custom_css() {
168
- $query = new \WP_Query(
169
- array(
170
- 'post_type' => 'custom_css',
171
- 'post_status' => 'publish',
172
- 'numberposts' => 1,
173
- 'update_post_meta_cache' => false,
174
- 'update_post_term_cache' => false,
175
- )
176
- );
177
-
178
- if ( $query->have_posts() ) {
179
- $query->the_post();
180
- $content = get_the_content();
181
-
182
- // if the content contains a colon, a CSS rule has been added.
183
- return strpos( $content, ':' ) === false ? false : true;
184
- }
185
-
186
- return false;
187
- }
188
-
189
- /**
190
- * Get the current theme properties.
191
- *
192
- * @return mixed Properties of the current theme.
193
- */
194
- function get_theme_properties() {
195
- if ( ! is_child_theme() ) {
196
- return false;
197
- }
198
-
199
- $properties = array();
200
- $theme = wp_get_theme();
201
- // @codingStandardsIgnoreStart
202
- $properties['name'] = $theme->Name;
203
- // @codingStandardsIgnoreEnd
204
-
205
- // get the files in the child theme.
206
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
207
- WP_Filesystem();
208
- global $wp_filesystem;
209
- $path = str_replace( ABSPATH, $wp_filesystem->abspath(), get_stylesheet_directory() );
210
- $list = $wp_filesystem->dirlist( $path, false, false );
211
- if ( $list ) {
212
- $list = array_keys( self::flatten_dirlist( $list ) );
213
- $properties['files'] = $list;
214
- }
215
-
216
- return $properties;
217
- }
218
-
219
- /**
220
- * Flatten the results of WP_Filesystem::dirlist() for iterating over.
221
- *
222
- * @access private
223
- *
224
- * @param array $nested_files Array of files as returned by WP_Filesystem::dirlist().
225
- * @param string $path Relative path to prepend to child nodes. Optional.
226
- *
227
- * @return array $files A flattened array of the $nested_files specified.
228
- */
229
- private static function flatten_dirlist( $nested_files, $path = '' ) {
230
- $files = array();
231
- foreach ( $nested_files as $name => $details ) {
232
- $files[ $path . $name ] = $details;
233
- // Append children recursively.
234
- if ( ! empty( $details['files'] ) ) {
235
- $children = self::flatten_dirlist( $details['files'], $path . $name . '/' );
236
- // Merge keeping possible numeric keys, which array_merge() will reindex from 0..n.
237
- $files = $files + $children;
238
- }
239
- }
240
-
241
- return $files;
242
- }
243
-
244
- /**
245
- * Generate the diff of the files.
246
- *
247
- * @param Product $product Themeisle Product.
248
- * @param array $files Array of files.
249
- * @param bool $recurse Whether to recurse or not.
250
- *
251
- * @return mixed Diff data.
252
- */
253
- private function generate_diff( $product, $files, $recurse = false ) {
254
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
255
- WP_Filesystem();
256
- global $wp_filesystem;
257
-
258
- $diff = array();
259
- $path = str_replace( ABSPATH, $wp_filesystem->abspath(), plugin_dir_path( $product->get_basefile() ) );
260
- $list = $wp_filesystem->dirlist( $path, false, $recurse );
261
- // nothing found.
262
- if ( ! $list ) {
263
- return $diff;
264
- }
265
- $list = array_keys( self::flatten_dirlist( $list ) );
266
-
267
- // now let's get the valid files that actually exist.
268
- if ( empty( $files ) ) {
269
- $files = $list;
270
- } else {
271
- $files = array_intersect( $files, $list );
272
- }
273
-
274
- // fetch the calculated hashes.
275
- if ( ! $wp_filesystem->is_readable( $path . '/' . self::HASH_FILE ) ) {
276
- return new \WP_Error( 'themeisle_sdk_hash_not_found', sprintf( '%s not found', self::HASH_FILE ) );
277
- }
278
-
279
- $hashes = json_decode( $wp_filesystem->get_contents( $path . '/' . self::HASH_FILE ), true );
280
- ksort( $hashes );
281
-
282
- $diff = array();
283
- foreach ( $files as $file ) {
284
- // file does not exist in the hashes.
285
- if ( ! array_key_exists( $file, $hashes ) ) {
286
- continue;
287
- }
288
- $new = md5( $wp_filesystem->get_contents( $path . $file ) );
289
- $old = $hashes[ $file ];
290
-
291
- // same hash, bail.
292
- if ( $new === $old ) {
293
- continue;
294
- }
295
- $diff[] = $file;
296
- }
297
-
298
- return $diff;
299
- }
300
-
301
- /**
302
- * Check if recursion needs to be enabled on the WP_Filesystem by reducing the array of files to a boolean.
303
- *
304
- * @param string $carry Value of the previous iteration.
305
- * @param string $item Value of the current iteration.
306
- *
307
- * @return bool Whether to recurse or not.
308
- */
309
- function is_recursion_required( $carry, $item ) {
310
- if ( ! $carry ) {
311
- return ( strpos( $item, '/' ) !== false );
312
- }
313
-
314
- return $carry;
315
- }
316
-
317
- /**
318
- * Load module for this product.
319
- *
320
- * @param Product $product Product to check.
321
- *
322
- * @return bool Should we load this?
323
- */
324
- public function can_load( $product ) {
325
- return true;
326
- }
327
-
328
- /**
329
- * Load module logic.
330
- *
331
- * @param Product $product Product to load.
332
- */
333
- public function load( $product ) {
334
- $this->setup_endpoints();
335
-
336
- return $this;
337
- }
338
-
339
- /**
340
- * Setup endpoints.
341
- */
342
- private function setup_endpoints() {
343
- global $wp_version;
344
- if ( version_compare( $wp_version, '4.4', '<' ) ) {
345
- // no REST support.
346
- return;
347
- }
348
-
349
- $this->setup_rest();
350
- }
351
-
352
- /**
353
- * Setup REST endpoints.
354
- */
355
- private function setup_rest() {
356
- add_action( 'rest_api_init', array( $this, 'rest_register' ) );
357
- }
358
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php CHANGED
@@ -190,18 +190,37 @@ class Licenser extends Abstract_Module {
190
  /**
191
  * Return the license status.
192
  *
 
 
193
  * @return string The License status.
194
  */
195
- public function get_license_status() {
196
 
197
  $license_data = get_option( $this->product->get_key() . '_license_data', '' );
198
 
199
  if ( '' === $license_data ) {
200
  return get_option( $this->product->get_key() . '_license_status', 'not_active' );
201
  }
 
 
 
 
 
 
 
202
 
203
- return isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
 
 
 
 
 
 
 
 
 
204
 
 
205
  }
206
 
207
  /**
@@ -244,10 +263,10 @@ class Licenser extends Abstract_Module {
244
  return false;
245
  }
246
 
247
- $status = $this->get_license_status();
248
- $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.' );
249
- $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
250
-
251
  // No activations left for this license.
252
  if ( 'valid' != $status && $this->check_activation() ) {
253
  ?>
@@ -267,6 +286,19 @@ class Licenser extends Abstract_Module {
267
  <?php
268
  return false;
269
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  // Invalid license key.
271
  if ( 'valid' != $status ) {
272
  ?>
@@ -667,6 +699,7 @@ class Licenser extends Abstract_Module {
667
  if ( isset( $update_data->banners ) ) {
668
  $update_data->banners = (array) $update_data->banners;
669
  }
 
670
  return $update_data;
671
  }
672
 
@@ -696,6 +729,7 @@ class Licenser extends Abstract_Module {
696
  $_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
697
  }
698
  }
 
699
  return $_transient_data;
700
  }
701
 
@@ -796,7 +830,9 @@ class Licenser extends Abstract_Module {
796
 
797
  if ( false !== $namespace ) {
798
  add_filter( 'themeisle_sdk_license_process_' . $namespace, [ $this, 'do_license_process' ], 10, 2 );
799
- add_filter( 'product_' . $namespace . '_license_status', [ $this, 'get_license_status' ] );
 
 
800
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
801
  \WP_CLI::add_command( $namespace . ' activate', [ $this, 'cli_activate' ] );
802
  \WP_CLI::add_command( $namespace . ' deactivate', [ $this, 'cli_deactivate' ] );
190
  /**
191
  * Return the license status.
192
  *
193
+ * @param bool $check_expiration Should check if license is valid, but expired.
194
+ *
195
  * @return string The License status.
196
  */
197
+ public function get_license_status( $check_expiration = false ) {
198
 
199
  $license_data = get_option( $this->product->get_key() . '_license_data', '' );
200
 
201
  if ( '' === $license_data ) {
202
  return get_option( $this->product->get_key() . '_license_status', 'not_active' );
203
  }
204
+ $status = isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
205
+ if ( false === $check_expiration ) {
206
+ return $status;
207
+ }
208
+
209
+ return ( 'valid' === $status && isset( $license_data->is_expired ) && 'yes' === $license_data->is_expired ) ? 'active_expired' : $status;
210
+ }
211
 
212
+ /**
213
+ * License price id.
214
+ *
215
+ * @return int License plan.
216
+ */
217
+ public function get_plan() {
218
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
219
+ if ( ! isset( $license_data->price_id ) ) {
220
+ return -1;
221
+ }
222
 
223
+ return (int) $license_data->price_id;
224
  }
225
 
226
  /**
263
  return false;
264
  }
265
 
266
+ $status = $this->get_license_status( true );
267
+ $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.' );
268
+ $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s, please add your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a href="%s">here</a>. ' );
269
+ $expired_license_string = apply_filters( $this->product->get_key() . '_lc_expired_string', 'Your %s License Key has expired. In order to continue receiving support and software updates you must <a href="%s" target="_blank">renew</a> your license key.' );
270
  // No activations left for this license.
271
  if ( 'valid' != $status && $this->check_activation() ) {
272
  ?>
286
  <?php
287
  return false;
288
  }
289
+
290
+ // Invalid license key.
291
+ if ( 'active_expired' === $status ) {
292
+ ?>
293
+ <div class="error">
294
+ <p>
295
+ <strong><?php echo sprintf( $expired_license_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->get_api_url() . '?license=' . $this->license_key ); ?> </strong>
296
+ </p>
297
+ </div>
298
+ <?php
299
+
300
+ return false;
301
+ }
302
  // Invalid license key.
303
  if ( 'valid' != $status ) {
304
  ?>
699
  if ( isset( $update_data->banners ) ) {
700
  $update_data->banners = (array) $update_data->banners;
701
  }
702
+
703
  return $update_data;
704
  }
705
 
729
  $_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
730
  }
731
  }
732
+
733
  return $_transient_data;
734
  }
735
 
830
 
831
  if ( false !== $namespace ) {
832
  add_filter( 'themeisle_sdk_license_process_' . $namespace, [ $this, 'do_license_process' ], 10, 2 );
833
+ add_filter( 'product_' . $namespace . '_license_status', [ $this, 'get_license_status' ], PHP_INT_MAX );
834
+ add_filter( 'product_' . $namespace . '_license_key', [ $this->product, 'get_license' ] );
835
+ add_filter( 'product_' . $namespace . '_license_plan', [ $this, 'get_plan' ], PHP_INT_MAX );
836
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
837
  \WP_CLI::add_command( $namespace . ' activate', [ $this, 'cli_activate' ] );
838
  \WP_CLI::add_command( $namespace . ' deactivate', [ $this, 'cli_deactivate' ] );
vendor/codeinwp/themeisle-sdk/src/Modules/Review.php CHANGED
@@ -67,7 +67,7 @@ class Review extends Abstract_Module {
67
 
68
  $link = 'https://wordpress.org/support/' . $this->product->get_type() . '/' . $this->product->get_slug() . '/reviews/#wporg-footer';
69
 
70
- $message = apply_filters( $this->product->get_key() . '_feedback_review_message', '<p>Hey, its great to see you have <b>{product}</b> active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ {developer}, developer of {product}</p>' );
71
 
72
  $button_submit = apply_filters( $this->product->get_key() . '_feedback_review_button_do', 'Ok, I will gladly help.' );
73
  $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', 'No, thanks.' );
67
 
68
  $link = 'https://wordpress.org/support/' . $this->product->get_type() . '/' . $this->product->get_slug() . '/reviews/#wporg-footer';
69
 
70
+ $message = apply_filters( $this->product->get_key() . '_feedback_review_message', '<p>Hey, it\'s great to see you have <b>{product}</b> active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ {developer}, developer of {product}</p>' );
71
 
72
  $button_submit = apply_filters( $this->product->get_key() . '_feedback_review_button_do', 'Ok, I will gladly help.' );
73
  $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', 'No, thanks.' );
vendor/codeinwp/themeisle-sdk/src/Modules/Translate.php CHANGED
@@ -295,7 +295,7 @@ class Translate extends Abstract_Module {
295
  ),
296
  'gn' => array(
297
  'slug' => 'gn',
298
- 'name' => 'Guaraní',
299
  ),
300
  'gsw' => array(
301
  'slug' => 'gsw',
@@ -471,7 +471,7 @@ class Translate extends Abstract_Module {
471
  ),
472
  'nb_NO' => array(
473
  'slug' => 'nb',
474
- 'name' => 'Norwegian (Bokmål)',
475
  ),
476
  'nl_NL' => array(
477
  'slug' => 'nl',
295
  ),
296
  'gn' => array(
297
  'slug' => 'gn',
298
+ 'name' => 'Guarani',
299
  ),
300
  'gsw' => array(
301
  'slug' => 'gsw',
471
  ),
472
  'nb_NO' => array(
473
  'slug' => 'nb',
474
+ 'name' => 'Norwegian (Bokmal)',
475
  ),
476
  'nl_NL' => array(
477
  'slug' => 'nl',
vendor/codeinwp/themeisle-sdk/src/Modules/Uninstall_feedback.php CHANGED
@@ -109,7 +109,7 @@ class Uninstall_Feedback extends Abstract_Module {
109
  *
110
  * @var string $heading_plugin The heading of the modal
111
  */
112
- private $heading_plugin = 'Whats wrong?';
113
  /**
114
  * Default heading for theme.
115
  *
109
  *
110
  * @var string $heading_plugin The heading of the modal
111
  */
112
+ private $heading_plugin = 'What\'s wrong?';
113
  /**
114
  * Default heading for theme.
115
  *
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitcece4ff258dfa370529d92aa8c5b835f::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInitcece4ff258dfa370529d92aa8c5b835f
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitcece4ff258dfa370529d92aa8c5b835f::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequirecece4ff258dfa370529d92aa8c5b835f($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequirecece4ff258dfa370529d92aa8c5b835f($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit2c5f0875545c80f9422c7bcbc9139b53
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit2c5f0875545c80f9422c7bcbc9139b53', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit2c5f0875545c80f9422c7bcbc9139b53', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit2c5f0875545c80f9422c7bcbc9139b53::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit2c5f0875545c80f9422c7bcbc9139b53::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire2c5f0875545c80f9422c7bcbc9139b53($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire2c5f0875545c80f9422c7bcbc9139b53($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitcece4ff258dfa370529d92aa8c5b835f
8
  {
9
  public static $files = array (
10
  '9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit2c5f0875545c80f9422c7bcbc9139b53
8
  {
9
  public static $files = array (
10
  '9fef4034ed73e26a337d9856ea126f7f' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "codeinwp/themeisle-sdk",
4
- "version": "3.2.10",
5
- "version_normalized": "3.2.10.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
9
- "reference": "708ba8b6012c2a6411c23557f3b4d0fcd7a270e3"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/708ba8b6012c2a6411c23557f3b4d0fcd7a270e3",
14
- "reference": "708ba8b6012c2a6411c23557f3b4d0fcd7a270e3",
15
  "shasum": ""
16
  },
17
  "require-dev": {
@@ -19,7 +19,7 @@
19
  "squizlabs/php_codesniffer": "^3.1",
20
  "wp-coding-standards/wpcs": "^1.0.0"
21
  },
22
- "time": "2020-05-28T16:39:44+00:00",
23
  "type": "library",
24
  "installation-source": "dist",
25
  "notification-url": "https://packagist.org/downloads/",
1
  [
2
  {
3
  "name": "codeinwp/themeisle-sdk",
4
+ "version": "3.2.15",
5
+ "version_normalized": "3.2.15.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/Codeinwp/themeisle-sdk.git",
9
+ "reference": "95b7447a5f4faba410c281c4bf278fbd740fed71"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/95b7447a5f4faba410c281c4bf278fbd740fed71",
14
+ "reference": "95b7447a5f4faba410c281c4bf278fbd740fed71",
15
  "shasum": ""
16
  },
17
  "require-dev": {
19
  "squizlabs/php_codesniffer": "^3.1",
20
  "wp-coding-standards/wpcs": "^1.0.0"
21
  },
22
+ "time": "2020-07-23T15:02:10+00:00",
23
  "type": "library",
24
  "installation-source": "dist",
25
  "notification-url": "https://packagist.org/downloads/",