WP Retina 2x - Version 6.1.7

Version Description

(2021/09/17) = * Fix: Was trying to add a Retina image in the srcset even if it was non-existent (when used with a CDN). * Update: Better sanitization in the common library.

Download this release

Release Info

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

Code changes from version 6.1.6 to 6.1.7

classes/core.php CHANGED
@@ -347,7 +347,7 @@ class Meow_WR2X_Core {
347
  $img_pathinfo = $this->get_pathinfo_from_image_src( $tag->getAttribute('src') );
348
  $filepath = trailingslashit( $this->get_upload_root() ) . $img_pathinfo;
349
  $system_retina = $this->get_retina( $filepath );
350
- if ( $system_retina != null ) {
351
  $retina_pathinfo = $this->cdn_this( ltrim( str_replace( $this->get_upload_root(), "", $system_retina ), '/' ) );
352
  $buffer = str_replace( $img_pathinfo, $retina_pathinfo, $buffer );
353
  $this->log( "The img src '$img_pathinfo' was replaced by '$retina_pathinfo'" );
@@ -405,10 +405,13 @@ class Meow_WR2X_Core {
405
  $total++;
406
  $retinized_srcset[$s]['url'] = $this->cdn_this( $cfg['url'], $attachment_id );
407
  if ( $this->method !== "none" ) {
408
- $retina = $this->cdn_this( $this->get_retina_from_url( $cfg['url'] ), $attachment_id );
409
- if ( !empty( $retina ) ) {
410
- $count++;
411
- $retinized_srcset[(int)$s * 2] = array( 'url' => $retina, 'descriptor' => 'w', 'value' => (int)$s * 2 );
 
 
 
412
  }
413
  }
414
  }
347
  $img_pathinfo = $this->get_pathinfo_from_image_src( $tag->getAttribute('src') );
348
  $filepath = trailingslashit( $this->get_upload_root() ) . $img_pathinfo;
349
  $system_retina = $this->get_retina( $filepath );
350
+ if ( !empty( $system_retina ) ) {
351
  $retina_pathinfo = $this->cdn_this( ltrim( str_replace( $this->get_upload_root(), "", $system_retina ), '/' ) );
352
  $buffer = str_replace( $img_pathinfo, $retina_pathinfo, $buffer );
353
  $this->log( "The img src '$img_pathinfo' was replaced by '$retina_pathinfo'" );
405
  $total++;
406
  $retinized_srcset[$s]['url'] = $this->cdn_this( $cfg['url'], $attachment_id );
407
  if ( $this->method !== "none" ) {
408
+ $retinaForUrl = $this->get_retina_from_url( $cfg['url'] );
409
+ if ( !empty( $retinaForUrl ) ) {
410
+ $retina = $this->cdn_this( $retinaForUrl, $attachment_id );
411
+ if ( !empty( $retina ) ) {
412
+ $count++;
413
+ $retinized_srcset[(int)$s * 2] = array( 'url' => $retina, 'descriptor' => 'w', 'value' => (int)$s * 2 );
414
+ }
415
  }
416
  }
417
  }
common/admin.php CHANGED
@@ -98,19 +98,19 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
98
  delete_option( $this->prefix . '_license' );
99
  return;
100
  }
101
- echo '<div class="notice notice-error">';
102
- printf(
103
  __( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
104
  $this->nice_name_from_file( $this->mainfile ) );
105
- echo '<p>
106
  <form method="post" action="">
107
  <input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
108
  <input type="submit" name="submit" id="submit" class="button" value="'
109
  . __( 'Remove the license', $this->domain ) . '">
110
  </form>
111
- </p>
112
- ';
113
- echo '</div>';
114
  }
115
 
116
  function admin_menu_start() {
@@ -144,19 +144,25 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
144
  }
145
 
146
  function get_phpinfo() {
 
 
 
147
  ob_start();
 
148
  phpinfo( INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES );
 
149
  $html = ob_get_contents();
150
  ob_end_clean();
151
  $html = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $html );
152
- echo wp_kses_post( $html );
153
  }
154
-
155
  function admin_meow_apps() {
156
- echo "<div id='meow-common-dashboard'></div>";
157
- echo "<div style='display: none;' id='meow-common-phpinfo'>";
158
- echo wp_kses_post( $this->get_phpinfo() );
159
- echo "</div>";
 
160
  }
161
 
162
  function admin_footer_text( $current ) {
@@ -169,5 +175,3 @@ if ( !class_exists( 'MeowCommon_Admin' ) ) {
169
  }
170
  }
171
  }
172
-
173
- ?>
98
  delete_option( $this->prefix . '_license' );
99
  return;
100
  }
101
+ $html = '<div class="notice notice-error">';
102
+ $html .= sprintf(
103
  __( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
104
  $this->nice_name_from_file( $this->mainfile ) );
105
+ $html .= '<p>
106
  <form method="post" action="">
107
  <input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
108
  <input type="submit" name="submit" id="submit" class="button" value="'
109
  . __( 'Remove the license', $this->domain ) . '">
110
  </form>
111
+ </p>';
112
+ $html .= '</div>';
113
+ wp_kses_post( $html );
114
  }
115
 
116
  function admin_menu_start() {
144
  }
145
 
146
  function get_phpinfo() {
147
+ if ( !current_user_can( 'administrator' ) ) {
148
+ return;
149
+ }
150
  ob_start();
151
+ // phpcs:disable WordPress.PHP.DevelopmentFunctions
152
  phpinfo( INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES );
153
+ // phpcs:enable
154
  $html = ob_get_contents();
155
  ob_end_clean();
156
  $html = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $html );
157
+ return $html;
158
  }
159
+
160
  function admin_meow_apps() {
161
+ $html = "<div id='meow-common-dashboard'></div>";
162
+ $html .= "<div style='height: 0; width: 0; overflow: hidden;' id='meow-common-phpinfo'>";
163
+ $html .= $this->get_phpinfo();
164
+ $html .= "</div>";
165
+ echo wp_kses_post( $html );
166
  }
167
 
168
  function admin_footer_text( $current ) {
175
  }
176
  }
177
  }
 
 
common/classes/ratings.php CHANGED
@@ -58,15 +58,15 @@ if ( !class_exists( 'MeowCommon_Classes_Ratings' ) ) {
58
  return;
59
  }
60
  $rating_date = get_option( $this->prefix . '_rating_date' );
61
- echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
62
- echo '<p style="font-size: 100%;">';
63
- printf(
64
- // translators: %1$s is a plugin nicename, %2$s is a short url (slug)
65
- __( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation! I will get back to you :)', $this->domain ),
66
- $this->nice_name_from_file( $this->mainfile ),
67
- $this->nice_short_url_from_file( $this->mainfile )
68
- );
69
- echo '<p>
70
  <form method="post" action="" style="float: right;">
71
  <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
72
  <input type="submit" name="submit" id="submit" class="button button-red" value="'
@@ -83,9 +83,9 @@ if ( !class_exists( 'MeowCommon_Classes_Ratings' ) ) {
83
  . __( 'Yes, I did it!', $this->domain ) . '">
84
  </form>
85
  <div style="clear: both;"></div>
86
- </p>
87
- ';
88
- echo '</div>';
89
  }
90
 
91
  function nice_short_url_from_file( $file ) {
58
  return;
59
  }
60
  $rating_date = get_option( $this->prefix . '_rating_date' );
61
+ $html = '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
62
+ $html .= '<p style="font-size: 100%;">';
63
+ $html .= sprintf(
64
+ // translators: %1$s is a plugin nicename, %2$s is a short url (slug)
65
+ __( 'You have been using <b>%1$s</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/%2$s/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation! I will get back to you :)', $this->domain ),
66
+ $this->nice_name_from_file( $this->mainfile ),
67
+ $this->nice_short_url_from_file( $this->mainfile )
68
+ );
69
+ $html .= '<p>
70
  <form method="post" action="" style="float: right;">
71
  <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
72
  <input type="submit" name="submit" id="submit" class="button button-red" value="'
83
  . __( 'Yes, I did it!', $this->domain ) . '">
84
  </form>
85
  <div style="clear: both;"></div>
86
+ </p>';
87
+ $html .= '</div>';
88
+ wp_kses_post( $html );
89
  }
90
 
91
  function nice_short_url_from_file( $file ) {
common/classes/rest.php CHANGED
@@ -131,5 +131,3 @@ class MeowCommon_Classes_Rest
131
  }
132
 
133
  }
134
-
135
- ?>
131
  }
132
 
133
  }
 
 
common/classes/updater.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  // Exit if accessed directly
4
  if ( ! defined( 'ABSPATH' ) ) exit;
5
 
1
  <?php
2
 
3
+ //phpcs:disable
4
+
5
  // Exit if accessed directly
6
  if ( ! defined( 'ABSPATH' ) ) exit;
7
 
common/helpers.php CHANGED
@@ -177,5 +177,3 @@ if ( !class_exists( 'MeowCommon_Helpers' ) ) {
177
  // ini_set( 'display_errors', 0 );
178
  // }
179
  }
180
-
181
- ?>
177
  // ini_set( 'display_errors', 0 );
178
  // }
179
  }
 
 
common/licenser.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  if ( !class_exists( 'MeowCommon_Licenser' ) ) {
4
 
5
  class MeowCommon_Licenser {
1
  <?php
2
 
3
+ //phpcs:disable
4
+
5
  if ( !class_exists( 'MeowCommon_Licenser' ) ) {
6
 
7
  class MeowCommon_Licenser {
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Perfect Images (Retina, Thumbnails, Replace) ===
2
  Contributors: TigrouMeow
3
  Tags: retina, images, replace, regenerate, sizes, lazysizes, high-dpi
4
  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.6
9
 
10
  Retina, Regenerate Thumbnails, Image Sizes Management, Replace Images, Image Threshold and more.
11
 
@@ -17,6 +17,7 @@ Originally, this plugin only took care of one thing: Retina Images. But with tim
17
  * Image Sizes Management
18
  * Disable Image Threshold
19
  * Regenerate Thumbnails
 
20
  * Replace Images
21
 
22
  === Retina Images ===
@@ -51,6 +52,10 @@ The plugin cannot inject CSS to handles the images added through CSS, that's bot
51
 
52
  == Changelog ==
53
 
 
 
 
 
54
  = 6.1.6 (2021/08/31) =
55
  * Update: Enhanced security.
56
  * Info: If you enjoy this plugin, please share some love by [writing a little review here](https://wordpress.org/support/plugin/wp-retina-2x/reviews/?rate=5#new-post). And since I read them all, don't hesitate to drop a few remarks and feature requests in those reviews. Thank you :)
1
+ === Perfect Images (Retina, Thumbnails, Replace & CDN) ===
2
  Contributors: TigrouMeow
3
  Tags: retina, images, replace, regenerate, sizes, lazysizes, high-dpi
4
  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
 
17
  * Image Sizes Management
18
  * Disable Image Threshold
19
  * Regenerate Thumbnails
20
+ * CDN (Image Optimization with EWWW)
21
  * Replace Images
22
 
23
  === Retina Images ===
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.
58
+
59
  = 6.1.6 (2021/08/31) =
60
  * Update: Enhanced security.
61
  * Info: If you enjoy this plugin, please share some love by [writing a little review here](https://wordpress.org/support/plugin/wp-retina-2x/reviews/?rate=5#new-post). And since I read them all, don't hesitate to drop a few remarks and feature requests in those reviews. Thank you :)
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.6
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: wp-retina-2x
@@ -58,7 +58,7 @@ if ( !get_option( 'wr2x_notice_easyio' ) ) {
58
  add_action( 'admin_notices', 'wr2x_easy_io_admin_notices' );
59
  }
60
 
61
- define( 'WR2X_VERSION', '6.1.6' );
62
  define( 'WR2X_PREFIX', 'wr2x' );
63
  define( 'WR2X_DOMAIN', ' wp-retina-2x' );
64
  define( 'WR2X_ENTRY', __FILE__ );
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
  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__ );