WP Retina 2x - Version 6.1.8

Version Description

(2021/09/23) = * Update: Common libs 3.6.

Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 WP Retina 2x
Version 6.1.8
Comparing to
See all releases

Code changes from version 6.1.7 to 6.1.8

classes/init.php CHANGED
@@ -14,12 +14,13 @@ spl_autoload_register(function ( $class ) {
14
  if ( strpos( $class, 'Meow_WR2X' ) !== false ) {
15
  $file = WR2X_PATH . '/classes/' . str_replace( 'meow_wr2x_', '', strtolower( $class ) ) . '.php';
16
  }
17
- else if ( strpos( $class, 'MeowCommon_Classes_' ) !== false ) {
18
- $file = WR2X_PATH . '/common/classes/' . str_replace( 'meowcommon_classes_', '', strtolower( $class ) ) . '.php';
19
- }
20
  else if ( strpos( $class, 'MeowCommon_' ) !== false ) {
21
  $file = WR2X_PATH . '/common/' . str_replace( 'meowcommon_', '', strtolower( $class ) ) . '.php';
22
  }
 
 
 
 
23
  else if ( strpos( $class, 'MeowPro_WR2X' ) !== false ) {
24
  $necessary = false;
25
  $file = WR2X_PATH . '/premium/' . str_replace( 'meowpro_wr2x_', '', strtolower( $class ) ) . '.php';
14
  if ( strpos( $class, 'Meow_WR2X' ) !== false ) {
15
  $file = WR2X_PATH . '/classes/' . str_replace( 'meow_wr2x_', '', strtolower( $class ) ) . '.php';
16
  }
 
 
 
17
  else if ( strpos( $class, 'MeowCommon_' ) !== false ) {
18
  $file = WR2X_PATH . '/common/' . str_replace( 'meowcommon_', '', strtolower( $class ) ) . '.php';
19
  }
20
+ else if ( strpos( $class, 'MeowCommonPro_' ) !== false ) {
21
+ $necessary = false;
22
+ $file = WR2X_PATH . '/common/premium/' . str_replace( 'meowcommonpro_', '', strtolower( $class ) ) . '.php';
23
+ }
24
  else if ( strpos( $class, 'MeowPro_WR2X' ) !== false ) {
25
  $necessary = false;
26
  $file = WR2X_PATH . '/premium/' . str_replace( 'meowpro_wr2x_', '', strtolower( $class ) ) . '.php';
common/admin.php CHANGED
@@ -5,8 +5,8 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
5
  class MeowCommon_Admin {
6
 
7
  public static $loaded = false;
8
- public static $version = "3.5";
9
- public static $admin_version = "3.5";
10
 
11
  public $prefix; // prefix used for actions, filters (mfrh)
12
  public $mainfile; // plugin main file (media-file-renamer.php)
@@ -21,7 +21,7 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
21
  if ( is_admin() ) {
22
 
23
  // Check potential issues with this WordPress install, other plugins, etc.
24
- new MeowCommon_Classes_Issues( $prefix, $mainfile, $domain );
25
 
26
  // Create the Meow Apps Menu
27
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
@@ -45,7 +45,7 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
45
  add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
46
  }
47
  if ( !$disableReview ) {
48
- new MeowCommon_Classes_Ratings( $prefix, $mainfile, $domain );
49
  }
50
  }
51
  add_filter( 'plugin_row_meta', array( $this, 'custom_plugin_row_meta' ), 10, 2 );
5
  class MeowCommon_Admin {
6
 
7
  public static $loaded = false;
8
+ public static $version = "3.6";
9
+ public static $admin_version = "3.6";
10
 
11
  public $prefix; // prefix used for actions, filters (mfrh)
12
  public $mainfile; // plugin main file (media-file-renamer.php)
21
  if ( is_admin() ) {
22
 
23
  // Check potential issues with this WordPress install, other plugins, etc.
24
+ new MeowCommon_Issues( $prefix, $mainfile, $domain );
25
 
26
  // Create the Meow Apps Menu
27
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
45
  add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
46
  }
47
  if ( !$disableReview ) {
48
+ new MeowCommon_Ratings( $prefix, $mainfile, $domain );
49
  }
50
  }
51
  add_filter( 'plugin_row_meta', array( $this, 'custom_plugin_row_meta' ), 10, 2 );
common/classes/rest_license.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
-
3
- class MeowCommon_Classes_Rest_License
4
- {
5
- private $licenser = null;
6
- private $namespace = null;
7
-
8
- public function __construct( &$licenser ) {
9
- $this->licenser = $licenser;
10
- $this->namespace = "meow-licenser/{$licenser->prefix}/v1";
11
- add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
12
- }
13
-
14
- function rest_api_init() {
15
- register_rest_route( $this->namespace, '/get_license/', [
16
- 'methods' => 'POST',
17
- 'permission_callback' => function () {
18
- return current_user_can( 'administrator' );
19
- },
20
- 'callback' => [ $this, 'get_license' ]
21
- ]);
22
- register_rest_route( $this->namespace, '/set_license/', [
23
- 'methods' => 'POST',
24
- 'permission_callback' => function () {
25
- return current_user_can( 'administrator' );
26
- },
27
- 'callback' => [ $this, 'set_license' ]
28
- ]);
29
- }
30
-
31
- function get_license() {
32
- return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
33
- }
34
-
35
- function set_license( $request ) {
36
- $params = $request->get_json_params();
37
- $serialKey = $params['serialKey'];
38
- $this->licenser->validate_pro( $serialKey );
39
- return new WP_REST_Response( [ 'success' => true, 'data' => $this->licenser->license ], 200 );
40
- }
41
- }
42
-
43
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common/classes/updater.php DELETED
@@ -1,595 +0,0 @@
1
- <?php
2
-
3
- //phpcs:disable
4
-
5
- // Exit if accessed directly
6
- if ( ! defined( 'ABSPATH' ) ) exit;
7
-
8
- /**
9
- * Allows plugins to use their own update API.
10
- *
11
- * @author Easy Digital Downloads
12
- * @version 1.6.18
13
- */
14
- class MeowCommon_Classes_Updater {
15
-
16
- private $api_url = '';
17
- private $api_data = array();
18
- private $name = '';
19
- private $slug = '';
20
- private $version = '';
21
- private $wp_override = false;
22
- private $cache_key = '';
23
-
24
- private $health_check_timeout = 5;
25
-
26
- /**
27
- * Class constructor.
28
- *
29
- * @uses plugin_basename()
30
- * @uses hook()
31
- *
32
- * @param string $_api_url The URL pointing to the custom API endpoint.
33
- * @param string $_plugin_file Path to the plugin file.
34
- * @param array $_api_data Optional data to send with API calls.
35
- */
36
- public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
37
-
38
- global $edd_plugin_data;
39
-
40
- $this->api_url = trailingslashit( $_api_url );
41
- $this->api_data = $_api_data;
42
- $this->name = plugin_basename( $_plugin_file );
43
- $this->slug = basename( $_plugin_file, '.php' );
44
- $this->version = $_api_data['version'];
45
- $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
46
- $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
47
- $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
48
-
49
- $edd_plugin_data[ $this->slug ] = $this->api_data;
50
-
51
- /**
52
- * Fires after the $edd_plugin_data is setup.
53
- *
54
- * @since x.x.x
55
- *
56
- * @param array $edd_plugin_data Array of EDD SL plugin data.
57
- */
58
- do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
59
-
60
- // Set up hooks.
61
- $this->init();
62
-
63
- }
64
-
65
- /**
66
- * Set up WordPress filters to hook into WP's update process.
67
- *
68
- * @uses add_filter()
69
- *
70
- * @return void
71
- */
72
- public function init() {
73
-
74
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
75
- add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
76
- remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
77
- add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
78
- add_action( 'admin_init', array( $this, 'show_changelog' ) );
79
-
80
- }
81
-
82
- /**
83
- * Check for Updates at the defined API endpoint and modify the update array.
84
- *
85
- * This function dives into the update API just when WordPress creates its update array,
86
- * then adds a custom API call and injects the custom plugin data retrieved from the API.
87
- * It is reassembled from parts of the native WordPress plugin update code.
88
- * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
89
- *
90
- * @uses api_request()
91
- *
92
- * @param array $_transient_data Update array build by WordPress.
93
- * @return array Modified update array with custom plugin data.
94
- */
95
- public function check_update( $_transient_data ) {
96
-
97
- global $pagenow;
98
-
99
- if ( ! is_object( $_transient_data ) ) {
100
- $_transient_data = new stdClass;
101
- }
102
-
103
- if ( 'plugins.php' == $pagenow && is_multisite() ) {
104
- return $_transient_data;
105
- }
106
-
107
- if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
108
- return $_transient_data;
109
- }
110
-
111
- $version_info = $this->get_cached_version_info();
112
-
113
- if ( false === $version_info ) {
114
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
115
-
116
- $this->set_version_info_cache( $version_info );
117
-
118
- }
119
-
120
- if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
121
-
122
- if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
123
-
124
- $_transient_data->response[ $this->name ] = $version_info;
125
-
126
- // Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
127
- $_transient_data->response[ $this->name ]->plugin = $this->name;
128
-
129
- }
130
-
131
- $_transient_data->last_checked = time();
132
- $_transient_data->checked[ $this->name ] = $this->version;
133
-
134
- }
135
-
136
- return $_transient_data;
137
- }
138
-
139
- /**
140
- * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
141
- *
142
- * @param string $file
143
- * @param array $plugin
144
- */
145
- public function show_update_notification( $file, $plugin ) {
146
-
147
- if ( is_network_admin() ) {
148
- return;
149
- }
150
-
151
- if( ! current_user_can( 'update_plugins' ) ) {
152
- return;
153
- }
154
-
155
- if( ! is_multisite() ) {
156
- return;
157
- }
158
-
159
- if ( $this->name != $file ) {
160
- return;
161
- }
162
-
163
- // Remove our filter on the site transient
164
- remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
165
-
166
- $update_cache = get_site_transient( 'update_plugins' );
167
-
168
- $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
169
-
170
- if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
171
-
172
- $version_info = $this->get_cached_version_info();
173
-
174
- if ( false === $version_info ) {
175
- $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
176
-
177
- // Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
178
- if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
179
- $version_info->banners = $this->convert_object_to_array( $version_info->banners );
180
- }
181
-
182
- if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
183
- $version_info->sections = $this->convert_object_to_array( $version_info->sections );
184
- }
185
-
186
- if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
187
- $version_info->icons = $this->convert_object_to_array( $version_info->icons );
188
- }
189
-
190
- $this->set_version_info_cache( $version_info );
191
- }
192
-
193
- if ( ! is_object( $version_info ) ) {
194
- return;
195
- }
196
-
197
- if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
198
-
199
- $update_cache->response[ $this->name ] = $version_info;
200
-
201
- }
202
-
203
- $update_cache->last_checked = time();
204
- $update_cache->checked[ $this->name ] = $this->version;
205
-
206
- set_site_transient( 'update_plugins', $update_cache );
207
-
208
- } else {
209
-
210
- $version_info = $update_cache->response[ $this->name ];
211
-
212
- }
213
-
214
- // Restore our filter
215
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
216
-
217
- if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
218
-
219
- // build a plugin list row, with update notification
220
- $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
221
- # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
222
- echo '<tr class="plugin-update-tr" id="' . esc_html( $this->slug ) .
223
- '-update" data-slug="' . esc_attr( $this->slug ) . '" data-plugin="' .
224
- esc_html( $this->slug . '/' . $file ) . '">';
225
- echo '<td colspan="3" class="plugin-update colspanchange">';
226
- echo '<div class="update-message notice inline notice-warning notice-alt">';
227
-
228
- $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
229
-
230
- if ( empty( $version_info->download_link ) ) {
231
- printf(
232
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
233
- esc_html( $version_info->name ),
234
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
235
- esc_html( $version_info->new_version ),
236
- '</a>'
237
- );
238
- } else {
239
- printf(
240
- __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
241
- esc_html( $version_info->name ),
242
- '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
243
- esc_html( $version_info->new_version ),
244
- '</a>',
245
- '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
246
- '</a>'
247
- );
248
- }
249
-
250
- do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
251
-
252
- echo '</div></td></tr>';
253
- }
254
- }
255
-
256
- /**
257
- * Updates information on the "View version x.x details" page with custom data.
258
- *
259
- * @uses api_request()
260
- *
261
- * @param mixed $_data
262
- * @param string $_action
263
- * @param object $_args
264
- * @return object $_data
265
- */
266
- public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
267
-
268
- if ( $_action != 'plugin_information' ) {
269
-
270
- return $_data;
271
-
272
- }
273
-
274
- if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
275
-
276
- return $_data;
277
-
278
- }
279
-
280
- $to_send = array(
281
- 'slug' => $this->slug,
282
- 'is_ssl' => is_ssl(),
283
- 'fields' => array(
284
- 'banners' => array(),
285
- 'reviews' => false,
286
- 'icons' => array(),
287
- )
288
- );
289
-
290
- $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
291
-
292
- // Get the transient where we store the api request for this plugin for 24 hours
293
- $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
294
-
295
- //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.
296
- if ( empty( $edd_api_request_transient ) ) {
297
-
298
- $api_response = $this->api_request( 'plugin_information', $to_send );
299
-
300
- // Expires in 3 hours
301
- $this->set_version_info_cache( $api_response, $cache_key );
302
-
303
- if ( false !== $api_response ) {
304
- $_data = $api_response;
305
- }
306
-
307
- } else {
308
- $_data = $edd_api_request_transient;
309
- }
310
-
311
- // Convert sections into an associative array, since we're getting an object, but Core expects an array.
312
- if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
313
- $_data->sections = $this->convert_object_to_array( $_data->sections );
314
- }
315
-
316
- // Convert banners into an associative array, since we're getting an object, but Core expects an array.
317
- if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
318
- $_data->banners = $this->convert_object_to_array( $_data->banners );
319
- }
320
-
321
- // Convert icons into an associative array, since we're getting an object, but Core expects an array.
322
- if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
323
- $_data->icons = $this->convert_object_to_array( $_data->icons );
324
- }
325
-
326
- // Convert icons into an associative array, since we're getting an object, but Core expects an array.
327
- if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
328
- $_data->contributors = $this->convert_object_to_array( $_data->contributors );
329
- foreach ( $_data->contributors as $key => $value ) {
330
- $_data->contributors[$key] = $this->convert_object_to_array( $value );
331
- }
332
- }
333
-
334
- // FOR DEBUG
335
- // $fordebug = clone $_data;
336
- // foreach ( $fordebug->sections as $key => $value ) {
337
- // if ( strlen( $fordebug->sections[$key] ) > 200 )
338
- // $fordebug->sections[$key] = '...';
339
- // }
340
- // $fordebug->description = '...';
341
- // $fordebug->changelog = '...';
342
- // var_dump( $fordebug, 1 );
343
- // exit;
344
-
345
- if ( !empty( $_data ) && !isset( $_data->plugin ) ) {
346
- $_data->plugin = $this->name;
347
- }
348
-
349
- return $_data;
350
- }
351
-
352
- /**
353
- * Convert some objects to arrays when injecting data into the update API
354
- *
355
- * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
356
- * decoding, they are objects. This method allows us to pass in the object and return an associative array.
357
- *
358
- * @since 3.6.5
359
- *
360
- * @param stdClass $data
361
- *
362
- * @return array
363
- */
364
- private function convert_object_to_array( $data ) {
365
- $new_data = array();
366
- foreach ( $data as $key => $value ) {
367
- $new_data[ $key ] = $value;
368
- }
369
-
370
- return $new_data;
371
- }
372
-
373
- /**
374
- * Disable SSL verification in order to prevent download update failures
375
- *
376
- * @param array $args
377
- * @param string $url
378
- * @return object $array
379
- */
380
- public function http_request_args( $args, $url ) {
381
-
382
- $verify_ssl = $this->verify_ssl();
383
- if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
384
- $args['sslverify'] = $verify_ssl;
385
- }
386
- return $args;
387
-
388
- }
389
-
390
- /**
391
- * Calls the API and, if successfull, returns the object delivered by the API.
392
- *
393
- * @uses get_bloginfo()
394
- * @uses wp_remote_post()
395
- * @uses is_wp_error()
396
- *
397
- * @param string $_action The requested action.
398
- * @param array $_data Parameters for the API action.
399
- * @return false|object
400
- */
401
- private function api_request( $_action, $_data ) {
402
-
403
- global $wp_version, $edd_plugin_url_available;
404
-
405
- $verify_ssl = $this->verify_ssl();
406
-
407
- // Do a quick status check on this domain if we haven't already checked it.
408
- $store_hash = md5( $this->api_url );
409
- if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
410
- $test_url_parts = parse_url( $this->api_url );
411
-
412
- $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
413
- $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
414
- $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
415
-
416
- if ( empty( $host ) ) {
417
- $edd_plugin_url_available[ $store_hash ] = false;
418
- } else {
419
- $test_url = $scheme . '://' . $host . $port;
420
- $response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
421
- $edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
422
- }
423
- }
424
-
425
- if ( false === $edd_plugin_url_available[ $store_hash ] ) {
426
- return;
427
- }
428
-
429
- $data = array_merge( $this->api_data, $_data );
430
-
431
- if ( $data['slug'] != $this->slug ) {
432
- return;
433
- }
434
-
435
- if( $this->api_url == trailingslashit ( home_url() ) ) {
436
- return false; // Don't allow a plugin to ping itself
437
- }
438
-
439
- $api_params = array(
440
- 'edd_action' => 'get_version',
441
- 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
442
- 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
443
- 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
444
- 'version' => isset( $data['version'] ) ? $data['version'] : false,
445
- 'slug' => $data['slug'],
446
- 'author' => $data['author'],
447
- 'url' => home_url(),
448
- 'beta' => ! empty( $data['beta'] ),
449
- );
450
-
451
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
452
-
453
- if ( ! is_wp_error( $request ) ) {
454
- $request = json_decode( wp_remote_retrieve_body( $request ) );
455
- }
456
-
457
- if ( $request && isset( $request->sections ) ) {
458
- $request->sections = maybe_unserialize( $request->sections );
459
- } else {
460
- $request = false;
461
- }
462
-
463
- if ( $request && isset( $request->banners ) ) {
464
- $request->banners = maybe_unserialize( $request->banners );
465
- }
466
-
467
- if ( $request && isset( $request->icons ) ) {
468
- $request->icons = maybe_unserialize( $request->icons );
469
- }
470
-
471
- if( ! empty( $request->sections ) ) {
472
- foreach( $request->sections as $key => $section ) {
473
- $request->$key = (array) $section;
474
- }
475
- }
476
-
477
- return $request;
478
- }
479
-
480
- public function show_changelog() {
481
-
482
- global $edd_plugin_data;
483
-
484
- if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
485
- return;
486
- }
487
-
488
- if( empty( $_REQUEST['plugin'] ) ) {
489
- return;
490
- }
491
-
492
- if( empty( $_REQUEST['slug'] ) ) {
493
- return;
494
- }
495
-
496
- if( ! current_user_can( 'update_plugins' ) ) {
497
- wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
498
- }
499
-
500
- $data = $edd_plugin_data[ $_REQUEST['slug'] ];
501
- $beta = ! empty( $data['beta'] ) ? true : false;
502
- $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
503
- $version_info = $this->get_cached_version_info( $cache_key );
504
-
505
- if( false === $version_info ) {
506
-
507
- $api_params = array(
508
- 'edd_action' => 'get_version',
509
- 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
510
- 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
511
- 'slug' => sanitize_text_field( $_REQUEST['slug'] ),
512
- 'author' => $data['author'],
513
- 'url' => home_url(),
514
- 'beta' => ! empty( $data['beta'] )
515
- );
516
-
517
- $verify_ssl = $this->verify_ssl();
518
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
519
-
520
- if ( ! is_wp_error( $request ) ) {
521
- $version_info = json_decode( wp_remote_retrieve_body( $request ) );
522
- }
523
-
524
-
525
- if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
526
- $version_info->sections = maybe_unserialize( $version_info->sections );
527
- } else {
528
- $version_info = false;
529
- }
530
-
531
- if( ! empty( $version_info ) ) {
532
- foreach( $version_info->sections as $key => $section ) {
533
- $version_info->$key = (array) $section;
534
- }
535
- }
536
-
537
- $this->set_version_info_cache( $version_info, $cache_key );
538
-
539
- }
540
-
541
- if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
542
- echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
543
- }
544
-
545
- exit;
546
- }
547
-
548
- public function get_cached_version_info( $cache_key = '' ) {
549
-
550
- if( empty( $cache_key ) ) {
551
- $cache_key = $this->cache_key;
552
- }
553
-
554
- $cache = get_option( $cache_key );
555
-
556
- if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
557
- return false; // Cache is expired
558
- }
559
-
560
- // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
561
- $cache['value'] = json_decode( $cache['value'] );
562
- if ( ! empty( $cache['value']->icons ) ) {
563
- $cache['value']->icons = (array) $cache['value']->icons;
564
- }
565
-
566
- return $cache['value'];
567
-
568
- }
569
-
570
- public function set_version_info_cache( $value = '', $cache_key = '' ) {
571
-
572
- if( empty( $cache_key ) ) {
573
- $cache_key = $this->cache_key;
574
- }
575
-
576
- $data = array(
577
- 'timeout' => strtotime( '+3 hours', time() ),
578
- 'value' => json_encode( $value )
579
- );
580
-
581
- update_option( $cache_key, $data, 'no' );
582
-
583
- }
584
-
585
- /**
586
- * Returns if the SSL of the store should be verified.
587
- *
588
- * @since 1.6.13
589
- * @return bool
590
- */
591
- private function verify_ssl() {
592
- return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
593
- }
594
-
595
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common/helpers.php CHANGED
@@ -36,7 +36,7 @@ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
36
  // WP_REST_Request init.
37
  $is_rest_request = defined('REST_REQUEST') && REST_REQUEST;
38
  if ( $is_rest_request ) {
39
- MeowCommon_Classes_Rest::init_once();
40
  return true;
41
  }
42
 
@@ -44,7 +44,7 @@ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
44
  $prefix = rest_get_url_prefix();
45
  $request_contains_rest = isset( $_GET['rest_route'] ) && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0;
46
  if ( $request_contains_rest) {
47
- MeowCommon_Classes_Rest::init_once();
48
  return true;
49
  }
50
 
@@ -62,7 +62,7 @@ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
62
  if ( !empty( $current_url['path'] ) && !empty( $rest_url['path'] ) ) {
63
  $request_contains_rest = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
64
  if ( $request_contains_rest) {
65
- MeowCommon_Classes_Rest::init_once();
66
  return true;
67
  }
68
  }
36
  // WP_REST_Request init.
37
  $is_rest_request = defined('REST_REQUEST') && REST_REQUEST;
38
  if ( $is_rest_request ) {
39
+ MeowCommon_Rest::init_once();
40
  return true;
41
  }
42
 
44
  $prefix = rest_get_url_prefix();
45
  $request_contains_rest = isset( $_GET['rest_route'] ) && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0;
46
  if ( $request_contains_rest) {
47
+ MeowCommon_Rest::init_once();
48
  return true;
49
  }
50
 
62
  if ( !empty( $current_url['path'] ) && !empty( $rest_url['path'] ) ) {
63
  $request_contains_rest = strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
64
  if ( $request_contains_rest) {
65
+ MeowCommon_Rest::init_once();
66
  return true;
67
  }
68
  }
common/{classes/issues.php → issues.php} RENAMED
@@ -1,8 +1,8 @@
1
  <?php
2
 
3
- if ( !class_exists( 'MeowCommon_Classes_Issues' ) ) {
4
 
5
- class MeowCommon_Classes_Issues {
6
 
7
  public function __construct( $prefix, $mainfile, $domain ) {
8
  $this->check_plugins();
1
  <?php
2
 
3
+ if ( !class_exists( 'MeowCommon_Issues' ) ) {
4
 
5
+ class MeowCommon_Issues {
6
 
7
  public function __construct( $prefix, $mainfile, $domain ) {
8
  $this->check_plugins();
common/licenser.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
-
3
- //phpcs:disable
4
-
5
- if ( !class_exists( 'MeowCommon_Licenser' ) ) {
6
-
7
- class MeowCommon_Licenser {
8
- public $license = null;
9
- public $prefix; // prefix used for actions, filters (mfrh)
10
- public $mainfile; // plugin main file (media-file-renamer.php)
11
- public $domain; // domain used for translation (media-file-renamer)
12
- public $item; // name of the Pro plugin (Media File Renamer Pro)
13
- public $version; // version of the plugin (Media File Renamer Pro)
14
-
15
- public function __construct( $prefix, $mainfile, $domain, $item, $version ) {
16
- $this->prefix = $prefix;
17
- $this->mainfile = $mainfile;
18
- $this->domain = $domain;
19
- $this->item = $item;
20
- $this->version = $version;
21
-
22
- if ( $this->is_registered() ) {
23
- add_filter( $this->prefix . '_meowapps_is_registered', array( $this, 'is_registered' ), 10 );
24
- }
25
-
26
- if ( MeowCommon_Helpers::is_rest() ) {
27
- new MeowCommon_Classes_Rest_License( $this );
28
- }
29
- else if ( is_admin() ) {
30
- $license_key = $this->license && isset( $this->license['key'] ) ? $this->license['key'] : "";
31
- new MeowCommon_Classes_Updater(
32
- ( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) . '://store.meowapps.com', $this->mainfile,
33
- array(
34
- 'version' => $this->version,
35
- 'license' => $license_key,
36
- 'item_name' => $this->item,
37
- 'wp_override' => true,
38
- 'author' => 'Jordy Meow',
39
- 'url' => strtolower( home_url() ),
40
- 'beta' => false
41
- )
42
- );
43
- }
44
- }
45
-
46
- function retry_validation() {
47
- if ( isset( $_POST[$this->prefix . '_pro_serial'] ) ) {
48
- $serial = sanitize_text_field( $_POST[$this->prefix . '_pro_serial'] );
49
- $this->validate_pro( $serial );
50
- }
51
- }
52
-
53
- function is_registered( $force = false ) {
54
- if ( !$force && !empty( $this->license ) )
55
- return empty( $this->license['issue'] );
56
- $this->license = get_option( $this->prefix . '_license', "" );
57
- if ( empty( $this->license ) || !empty( $this->license['issue'] ) )
58
- return false;
59
- if ( $this->license['expires'] == "lifetime" )
60
- return true;
61
- $datediff = strtotime( $this->license['expires'] ) - time();
62
- $days = floor( $datediff / ( 60 * 60 * 24 ) );
63
- if ( $days < 0 )
64
- $this->validate_pro( $this->license['key'] );
65
- return true;
66
- }
67
-
68
- function validate_pro( $subscr_id ) {
69
- $prefix = $this->prefix;
70
- delete_option( $prefix . '_license', "" );
71
- if ( empty( $subscr_id ) )
72
- return false;
73
- $url = ( get_option( 'force_sslverify', false ) ? 'https' : 'http' ) .
74
- '://store.meowapps.com/?edd_action=activate_license' .
75
- '&item_name=' . urlencode( $this->item ) .
76
- '&license=' . $subscr_id . '&url=' . strtolower( home_url() ) . '&cache=' . bin2hex( openssl_random_pseudo_bytes( 4 ) );
77
- $response = wp_remote_get( $url, array(
78
- 'user-agent' => "MeowApps",
79
- 'sslverify' => get_option( 'force_sslverify', false ),
80
- 'timeout' => 45,
81
- 'method' => 'GET'
82
- )
83
- );
84
- $body = is_array( $response ) ? $response['body'] : null;
85
- $post = @json_decode( $body );
86
- $status = null;
87
- $license = null;
88
- $expires = null;
89
- $logs = null;
90
- if ( !$post || ( property_exists( $post, 'code' ) ) ) {
91
- $status = 'error';
92
- // $status = __( "There was an error while validating the serial.<br />Please contact <a target='_blank' href='https://meowapps.com/contact/'>Meow Apps</a> and mention the following log: <br /><ul>", $this->domain );
93
- $logs = "<li>Server IP: <b>" . gethostbyname( $_SERVER['SERVER_NAME'] ) . "</b></li>";
94
- $logs .= "<li>Google GET: ";
95
- $r = wp_remote_get( 'http://google.com' );
96
- $logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
97
- $logs .= "</li><li>MeowApps GET: ";
98
- $r = wp_remote_get( 'http://meowapps.com' );
99
- $logs .= is_wp_error( $r ) ? print_r( $r, true ) : 'OK';
100
- $logs .= "</li><li>MeowApps STORE:<br /><br />";
101
- $logs .= "REQUEST: $url<br /><br />";
102
- $logs .= "RESPONSE: ";
103
- $logs .= print_r( $response, true );
104
- $logs .= "</li></ul>";
105
- error_log( print_r( $response, true ) );
106
- }
107
- else if ( $post->license !== "valid" ) {
108
- $status = $post->error ;
109
- }
110
- else {
111
- $license = $post->license;
112
- $expires = $post->expires;
113
- delete_option( '_site_transient_update_plugins' );
114
- }
115
- update_option( $prefix . '_license', array(
116
- 'key' => $subscr_id,
117
- 'issue' => $status,
118
- 'logs' => $logs,
119
- 'expires' => $expires,
120
- 'license' => $license ) );
121
- return $this->is_registered( true );
122
- }
123
-
124
- }
125
-
126
- }
127
-
128
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
common/{classes/ratings.php → ratings.php} RENAMED
@@ -1,8 +1,8 @@
1
  <?php
2
 
3
- if ( !class_exists( 'MeowCommon_Classes_Ratings' ) ) {
4
 
5
- class MeowCommon_Classes_Ratings {
6
 
7
  public $mainfile; // plugin main file (media-file-renamer.php)
8
  public $domain; // domain used for translation (media-file-renamer)
1
  <?php
2
 
3
+ if ( !class_exists( 'MeowCommon_Ratings' ) ) {
4
 
5
+ class MeowCommon_Ratings {
6
 
7
  public $mainfile; // plugin main file (media-file-renamer.php)
8
  public $domain; // domain used for translation (media-file-renamer)
common/releases.txt CHANGED
@@ -1,6 +1,9 @@
1
  Releases of the Meow Commmon has to be carefully made, and version_compare
2
  should be used when big changes are made.
3
 
 
 
 
4
  = 3.5 (2021/08/31) =
5
  * Better security.
6
  * New images.
1
  Releases of the Meow Commmon has to be carefully made, and version_compare
2
  should be used when big changes are made.
3
 
4
+ = 3.6 (2021/09/22) =
5
+ * Premium classes are now separated.
6
+
7
  = 3.5 (2021/08/31) =
8
  * Better security.
9
  * New images.
common/{classes/rest.php → rest.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
- class MeowCommon_Classes_Rest
4
  {
5
  private $namespace = "meow-common/v1";
6
  static public $instance = null;
7
 
8
  static public function init_once() {
9
- if ( !MeowCommon_Classes_Rest::$instance ) {
10
- MeowCommon_Classes_Rest::$instance = new self();
11
  }
12
  }
13
 
1
  <?php
2
 
3
+ class MeowCommon_Rest
4
  {
5
  private $namespace = "meow-common/v1";
6
  static public $instance = null;
7
 
8
  static public function init_once() {
9
+ if ( !MeowCommon_Rest::$instance ) {
10
+ MeowCommon_Rest::$instance = new self();
11
  }
12
  }
13
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://meowapps.com/donation/
5
  Requires at least: 5.0
6
  Tested up to: 5.8.1
7
  Requires PHP: 7.0
8
- Stable tag: 6.1.7
9
 
10
  Retina, Regenerate Thumbnails, Image Sizes Management, Replace Images, Image Threshold and more.
11
 
@@ -52,6 +52,9 @@ The plugin cannot inject CSS to handles the images added through CSS, that's bot
52
 
53
  == Changelog ==
54
 
 
 
 
55
  = 6.1.7 (2021/09/17) =
56
  * Fix: Was trying to add a Retina image in the srcset even if it was non-existent (when used with a CDN).
57
  * Update: Better sanitization in the common library.
5
  Requires at least: 5.0
6
  Tested up to: 5.8.1
7
  Requires PHP: 7.0
8
+ Stable tag: 6.1.8
9
 
10
  Retina, Regenerate Thumbnails, Image Sizes Management, Replace Images, Image Threshold and more.
11
 
52
 
53
  == Changelog ==
54
 
55
+ = 6.1.8 (2021/09/23) =
56
+ * Update: Common libs 3.6.
57
+
58
  = 6.1.7 (2021/09/17) =
59
  * Fix: Was trying to add a Retina image in the srcset even if it was non-existent (when used with a CDN).
60
  * Update: Better sanitization in the common library.
wp-retina-2x.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Perfect Images (Retina, Thumbnails, Replace)
4
  Plugin URI: https://meowapps.com
5
  Description: Retina, Replace Images, Regenerate Thumbnails, Image Sizes Management, Image Threshold and more.
6
- Version: 6.1.7
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: wp-retina-2x
@@ -58,17 +58,18 @@ if ( !get_option( 'wr2x_notice_easyio' ) ) {
58
  add_action( 'admin_notices', 'wr2x_easy_io_admin_notices' );
59
  }
60
 
61
- define( 'WR2X_VERSION', '6.1.7' );
62
- define( 'WR2X_PREFIX', 'wr2x' );
63
- define( 'WR2X_DOMAIN', ' wp-retina-2x' );
64
- define( 'WR2X_ENTRY', __FILE__ );
65
- define( 'WR2X_PATH', dirname( __FILE__ ) );
66
- define( 'WR2X_URL', plugin_dir_url( __FILE__ ) );
67
-
68
- define ( 'WR2X_VERSION_RETINAJS', '5.6.1' );
69
- define ( 'WR2X_VERSION_PICTUREFILL', '3.0.2' );
70
- define ( 'WR2X_VERSION_LAZYSIZES', '5.1.0' );
71
- define ( 'WR2X_VERSION_RETINA_IMAGES', '1.7.2' );
 
72
 
73
  require_once( 'classes/init.php');
74
 
3
  Plugin Name: Perfect Images (Retina, Thumbnails, Replace)
4
  Plugin URI: https://meowapps.com
5
  Description: Retina, Replace Images, Regenerate Thumbnails, Image Sizes Management, Image Threshold and more.
6
+ Version: 6.1.8
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: wp-retina-2x
58
  add_action( 'admin_notices', 'wr2x_easy_io_admin_notices' );
59
  }
60
 
61
+ if ( !defined( 'WR2X_VERSION' ) ) {
62
+ define( 'WR2X_VERSION', '6.1.8' );
63
+ define( 'WR2X_PREFIX', 'wr2x' );
64
+ define( 'WR2X_DOMAIN', ' wp-retina-2x' );
65
+ define( 'WR2X_ENTRY', __FILE__ );
66
+ define( 'WR2X_PATH', dirname( __FILE__ ) );
67
+ define( 'WR2X_URL', plugin_dir_url( __FILE__ ) );
68
+ define ( 'WR2X_VERSION_RETINAJS', '5.6.1' );
69
+ define ( 'WR2X_VERSION_PICTUREFILL', '3.0.2' );
70
+ define ( 'WR2X_VERSION_LAZYSIZES', '5.1.0' );
71
+ define ( 'WR2X_VERSION_RETINA_IMAGES', '1.7.2' );
72
+ }
73
 
74
  require_once( 'classes/init.php');
75