reSmush.it Image Optimizer - Version 0.4.3

Version Description

  • Compatibility with WP 6.0.1
  • Security fix issues (https://www.pluginvulnerabilities.com/2022/02/01/wordpress-plugin-security-review-resmush-it-image-optimizer/)
    • force int to ID in some SQL requests
    • check that user is connected as admin/contributor for AJAX actions
    • Message to indicate that there's no collection of data in contacting remote feed service
Download this release

Release Info

Developer resmushit
Plugin Icon 128x128 reSmush.it Image Optimizer
Version 0.4.3
Comparing to
See all releases

Code changes from version 0.4.2 to 0.4.3

classes/resmushitUI.class.php CHANGED
@@ -337,11 +337,9 @@ Class reSmushitUI {
337
  }
338
 
339
  echo "<div class='social'>"
340
- . "<a class='social-maecia' title='"
341
- . __('Maecia Agency - Paris France', 'resmushit-image-optimizer')
342
- . "' href='https://www.maecia.com' target='_blank'>"
343
- . "<img src='"
344
- . RESMUSHIT_BASE_URL . "images/maecia.png' /></a>"
345
  . "<a class='social-resmushit' title='"
346
  . __('Visit resmush.it for more informations', 'resmushit-image-optimizer')
347
  . "' href='https://resmush.it' target='_blank'>"
337
  }
338
 
339
  echo "<div class='social'>"
340
+ . "<p class='datainformation'>"
341
+ . __('No user data nor any information is collected while requesting this news feed.', 'resmushit-image-optimizer')
342
+ . "<p>"
 
 
343
  . "<a class='social-resmushit' title='"
344
  . __('Visit resmush.it for more informations', 'resmushit-image-optimizer')
345
  . "' href='https://resmush.it' target='_blank'>"
css/resmushit.css CHANGED
@@ -237,6 +237,10 @@
237
  .rsmt-news h3 a{
238
  text-decoration: none;
239
  }
 
 
 
 
240
  .rsmt-news .social{
241
  text-align: right;
242
  }
237
  .rsmt-news h3 a{
238
  text-decoration: none;
239
  }
240
+ .rsmt-news .social .datainformation{
241
+ color: #ccc;
242
+ font-style: italic;
243
+ }
244
  .rsmt-news .social{
245
  text-align: right;
246
  }
languages/resmushit-image-optimizer-fr_FR.po CHANGED
@@ -175,10 +175,6 @@ msgstr ""
175
  msgid "News"
176
  msgstr "Actualités"
177
 
178
- #: classes/resmushitUI.class.php:316
179
- msgid "Maecia Agency - Paris France"
180
- msgstr "Agence Maecia - Paris, France"
181
-
182
  #: classes/resmushitUI.class.php:321
183
  msgid "Visit resmush.it for more informations"
184
  msgstr "Visitez resmush.it pour plus d'informations"
@@ -329,9 +325,3 @@ msgstr "Image Optimization API. Optimisation de la taille des images"
329
  #. Author of the plugin/theme
330
  msgid "reSmush.it"
331
  msgstr "reSmush.it"
332
-
333
- #~ msgid "Maecia"
334
- #~ msgstr "Maecia"
335
-
336
- #~ msgid "https://www.maecia.com"
337
- #~ msgstr "https://www.maecia.com"
175
  msgid "News"
176
  msgstr "Actualités"
177
 
 
 
 
 
178
  #: classes/resmushitUI.class.php:321
179
  msgid "Visit resmush.it for more informations"
180
  msgstr "Visitez resmush.it pour plus d'informations"
325
  #. Author of the plugin/theme
326
  msgid "reSmush.it"
327
  msgstr "reSmush.it"
 
 
 
 
 
 
languages/resmushit-image-optimizer-it_IT.po CHANGED
@@ -142,10 +142,6 @@ msgstr ""
142
  msgid "News"
143
  msgstr "Novità"
144
 
145
- #: classes/resmushitUI.class.php:262
146
- msgid "Maecia Agency - Paris France"
147
- msgstr "Maecia Agency - Parigi Francia"
148
-
149
  #: classes/resmushitUI.class.php:265
150
  msgid "Visit resmush.it for more informations"
151
  msgstr "Visita resmush.it per ottenere più informazioni"
@@ -187,11 +183,3 @@ msgid "Image Optimization API. Provides image size optimization"
187
  msgstr ""
188
  "Image Optimization API. Fornisce l'ottimizzazione della dimensione "
189
  "dell'immagine"
190
-
191
- #. Author of the plugin/theme
192
- msgid "Maecia"
193
- msgstr "Maecia"
194
-
195
- #. Author URI of the plugin/theme
196
- msgid "https://www.maecia.com"
197
- msgstr "https://www.maecia.com"
142
  msgid "News"
143
  msgstr "Novità"
144
 
 
 
 
 
145
  #: classes/resmushitUI.class.php:265
146
  msgid "Visit resmush.it for more informations"
147
  msgstr "Visita resmush.it per ottenere più informazioni"
183
  msgstr ""
184
  "Image Optimization API. Fornisce l'ottimizzazione della dimensione "
185
  "dell'immagine"
 
 
 
 
 
 
 
 
languages/resmushit-image-optimizer-sk_SK.po CHANGED
@@ -140,10 +140,6 @@ msgstr ""
140
  msgid "News"
141
  msgstr "Novinky"
142
 
143
- #: classes/resmushitUI.class.php:262
144
- msgid "Maecia Agency - Paris France"
145
- msgstr "Maecia Agency - Paris France"
146
-
147
  #: classes/resmushitUI.class.php:265
148
  msgid "Visit resmush.it for more informations"
149
  msgstr "Navštívte resmush.it pre viac informácii"
@@ -183,11 +179,3 @@ msgstr "https://resmush.it"
183
  #. Description of the plugin/theme
184
  msgid "Image Optimization API. Provides image size optimization"
185
  msgstr "Image Optimization API. Poskytuje optimalizáciu veľkosti obrázka"
186
-
187
- #. Author of the plugin/theme
188
- msgid "Maecia"
189
- msgstr "Maecia"
190
-
191
- #. Author URI of the plugin/theme
192
- msgid "https://www.maecia.com"
193
- msgstr "https://www.maecia.com"
140
  msgid "News"
141
  msgstr "Novinky"
142
 
 
 
 
 
143
  #: classes/resmushitUI.class.php:265
144
  msgid "Visit resmush.it for more informations"
145
  msgstr "Navštívte resmush.it pre viac informácii"
179
  #. Description of the plugin/theme
180
  msgid "Image Optimization API. Provides image size optimization"
181
  msgstr "Image Optimization API. Poskytuje optimalizáciu veľkosti obrázka"
 
 
 
 
 
 
 
 
languages/resmushit-image-optimizer.pot CHANGED
@@ -167,10 +167,6 @@ msgstr ""
167
  msgid "News"
168
  msgstr ""
169
 
170
- #: classes/resmushitUI.class.php:316
171
- msgid "Maecia Agency - Paris France"
172
- msgstr ""
173
-
174
  #: classes/resmushitUI.class.php:321
175
  msgid "Visit resmush.it for more informations"
176
  msgstr ""
167
  msgid "News"
168
  msgstr ""
169
 
 
 
 
 
170
  #: classes/resmushitUI.class.php:321
171
  msgid "Visit resmush.it for more informations"
172
  msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
- Tested up to: 5.8.2
6
- Stable tag: 0.4.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -34,7 +34,7 @@ Since Aug. 2016, reSmush.it allows to optimize pictures up to 5MB, for free !
34
 
35
  = How great is reSmush.it ? =
36
 
37
- Since we've optimized more than 8,000,000,000 pictures, we've risen new skills. Our service is still in development to bring you new crazy functionalities.
38
 
39
  = What about WebP and next generation image formats ? =
40
 
@@ -74,6 +74,13 @@ Yes ! Absolutely free, the only restriction is to send images below 5MB.
74
 
75
  == Changelog ==
76
 
 
 
 
 
 
 
 
77
  = 0.4.2 =
78
  * Compatibility with PHP8+WP 5.8.2
79
 
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
+ Tested up to: 6.0.1
6
+ Stable tag: 0.4.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
34
 
35
  = How great is reSmush.it ? =
36
 
37
+ Since we've optimized more than 15,000,000,000 pictures, we've risen new skills. Our service is still in development to bring you new crazy functionalities.
38
 
39
  = What about WebP and next generation image formats ? =
40
 
74
 
75
  == Changelog ==
76
 
77
+ = 0.4.3 =
78
+ * Compatibility with WP 6.0.1
79
+ * Security fix issues (https://www.pluginvulnerabilities.com/2022/02/01/wordpress-plugin-security-review-resmush-it-image-optimizer/)
80
+ * force int to ID in some SQL requests
81
+ * check that user is connected as admin/contributor for AJAX actions
82
+ * Message to indicate that there's no collection of data in contacting remote feed service
83
+
84
  = 0.4.2 =
85
  * Compatibility with PHP8+WP 5.8.2
86
 
resmushit.php CHANGED
@@ -4,14 +4,14 @@
4
  * @author Charles Bourgeaux <hello@resmush.it>
5
  * @license GPL-2.0+
6
  * @link http://www.resmush.it
7
- * @copyright 2021 Resmush.it
8
  *
9
  * @wordpress-plugin
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
- * Version: 0.4.2
14
- * Timestamp: 2021.11.27
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
@@ -193,6 +193,7 @@ if(get_option('resmushit_on_upload'))
193
  * @return json object
194
  */
195
  function resmushit_bulk_get_images() {
 
196
  echo reSmushit::getNonOptimizedPictures();
197
  die();
198
  }
@@ -209,8 +210,12 @@ add_action( 'wp_ajax_resmushit_bulk_get_images', 'resmushit_bulk_get_images' );
209
  * @return json object
210
  */
211
  function resmushit_update_disabled_state() {
 
 
 
 
212
  if(isset($_POST['data']['id']) && $_POST['data']['id'] != null && isset($_POST['data']['disabled'])){
213
- echo reSmushit::updateDisabledState(sanitize_text_field($_POST['data']['id']), sanitize_text_field($_POST['data']['disabled']));
214
  }
215
  die();
216
  }
@@ -228,9 +233,13 @@ add_action( 'wp_ajax_resmushit_update_disabled_state', 'resmushit_update_disable
228
  * @return json object
229
  */
230
  function resmushit_optimize_single_attachment() {
 
 
 
 
231
  if(isset($_POST['data']['id']) && $_POST['data']['id'] != null){
232
- reSmushit::revert(sanitize_text_field($_POST['data']['id']));
233
- echo json_encode(reSmushit::getStatistics($_POST['data']['id']));
234
  }
235
  die();
236
  }
@@ -248,8 +257,12 @@ add_action( 'wp_ajax_resmushit_optimize_single_attachment', 'resmushit_optimize_
248
  * @return boolean
249
  */
250
  function resmushit_bulk_process_image() {
251
- rlog('Bulk optimization launched for file : ' . get_attached_file( sanitize_text_field($_POST['data']['ID']) ));
252
- echo reSmushit::revert(sanitize_text_field($_POST['data']['ID']));
 
 
 
 
253
  die();
254
  }
255
  add_action( 'wp_ajax_resmushit_bulk_process_image', 'resmushit_bulk_process_image' );
@@ -266,6 +279,10 @@ add_action( 'wp_ajax_resmushit_bulk_process_image', 'resmushit_bulk_process_imag
266
  * @return json object
267
  */
268
  function resmushit_update_statistics() {
 
 
 
 
269
  $output = reSmushit::getStatistics();
270
  $output['total_saved_size_formatted'] = reSmushitUI::sizeFormat($output['total_saved_size']);
271
  echo json_encode($output);
@@ -365,7 +382,7 @@ function resmushit_cron_process() {
365
  }
366
  rlog('CRON Processing attachments #' . $el->ID);
367
  update_option( 'resmushit_cron_lastaction', time() );
368
- reSmushit::revert($el->ID);
369
  }
370
  }
371
  add_action('resmushit_optimize', 'resmushit_cron_process');
@@ -431,8 +448,13 @@ add_action('update_option_resmushit_remove_unsmushed', 'resmushit_on_remove_unsm
431
  * @return json object
432
  */
433
  function resmushit_remove_backup_files() {
434
- $files=detect_unsmushed_files();
435
  $return = array('success' => 0);
 
 
 
 
 
 
436
 
437
  foreach($files as $f) {
438
  if(unlink($f)) {
@@ -469,6 +491,10 @@ function resmushit_get_image_id($image_url) {
469
  * @return json object
470
  */
471
  function resmushit_restore_backup_files() {
 
 
 
 
472
  $files=detect_unsmushed_files();
473
  $return = array('success' => 0);
474
  $wp_upload_dir=wp_upload_dir();
@@ -485,8 +511,6 @@ function resmushit_restore_backup_files() {
485
  }
486
  }
487
  echo json_encode($return);
488
- //update_option( 'resmushit_has_no_backup_files', 1);
489
-
490
  die();
491
  }
492
  add_action( 'wp_ajax_resmushit_restore_backup_files', 'resmushit_restore_backup_files' );
4
  * @author Charles Bourgeaux <hello@resmush.it>
5
  * @license GPL-2.0+
6
  * @link http://www.resmush.it
7
+ * @copyright 2022 Resmush.it
8
  *
9
  * @wordpress-plugin
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
+ * Version: 0.4.3
14
+ * Timestamp: 2022.08.09
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
193
  * @return json object
194
  */
195
  function resmushit_bulk_get_images() {
196
+
197
  echo reSmushit::getNonOptimizedPictures();
198
  die();
199
  }
210
  * @return json object
211
  */
212
  function resmushit_update_disabled_state() {
213
+ if( !is_admin() ){
214
+ return(json_encode(array('error' => 'User must be at least contributor to retrieve these data')));
215
+ die();
216
+ }
217
  if(isset($_POST['data']['id']) && $_POST['data']['id'] != null && isset($_POST['data']['disabled'])){
218
+ echo reSmushit::updateDisabledState(sanitize_text_field((int)$_POST['data']['id']), sanitize_text_field($_POST['data']['disabled']));
219
  }
220
  die();
221
  }
233
  * @return json object
234
  */
235
  function resmushit_optimize_single_attachment() {
236
+ if( !is_admin() ){
237
+ return(json_encode(array('error' => 'User must be at least contributor to retrieve these data')));
238
+ die();
239
+ }
240
  if(isset($_POST['data']['id']) && $_POST['data']['id'] != null){
241
+ reSmushit::revert(sanitize_text_field((int)$_POST['data']['id']));
242
+ echo json_encode(reSmushit::getStatistics((int)$_POST['data']['id']));
243
  }
244
  die();
245
  }
257
  * @return boolean
258
  */
259
  function resmushit_bulk_process_image() {
260
+ if( !is_admin() ){
261
+ return(json_encode(array('error' => 'User must be at least contributor to retrieve these data')));
262
+ die();
263
+ }
264
+ rlog('Bulk optimization launched for file : ' . get_attached_file( sanitize_text_field((int)$_POST['data']['ID']) ));
265
+ echo reSmushit::revert(sanitize_text_field((int)$_POST['data']['ID']));
266
  die();
267
  }
268
  add_action( 'wp_ajax_resmushit_bulk_process_image', 'resmushit_bulk_process_image' );
279
  * @return json object
280
  */
281
  function resmushit_update_statistics() {
282
+ if( !is_admin() ){
283
+ return(json_encode(array('error' => 'User must be at least contributor to retrieve these data')));
284
+ die();
285
+ }
286
  $output = reSmushit::getStatistics();
287
  $output['total_saved_size_formatted'] = reSmushitUI::sizeFormat($output['total_saved_size']);
288
  echo json_encode($output);
382
  }
383
  rlog('CRON Processing attachments #' . $el->ID);
384
  update_option( 'resmushit_cron_lastaction', time() );
385
+ reSmushit::revert((int)$el->ID);
386
  }
387
  }
388
  add_action('resmushit_optimize', 'resmushit_cron_process');
448
  * @return json object
449
  */
450
  function resmushit_remove_backup_files() {
 
451
  $return = array('success' => 0);
452
+ if( !is_admin() ){
453
+ return(json_encode(array('error' => 'User must be at least administrator to retrieve these data')));
454
+ die();
455
+ }
456
+
457
+ $files=detect_unsmushed_files();
458
 
459
  foreach($files as $f) {
460
  if(unlink($f)) {
491
  * @return json object
492
  */
493
  function resmushit_restore_backup_files() {
494
+ if( !is_admin() ){
495
+ return(json_encode(array('error' => 'User must be at least administrator to retrieve these data')));
496
+ die();
497
+ }
498
  $files=detect_unsmushed_files();
499
  $return = array('success' => 0);
500
  $wp_upload_dir=wp_upload_dir();
511
  }
512
  }
513
  echo json_encode($return);
 
 
514
  die();
515
  }
516
  add_action( 'wp_ajax_resmushit_restore_backup_files', 'resmushit_restore_backup_files' );
resmushit.settings.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
- define('RESMUSHIT_VERSION', '0.4.2');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
+ define('RESMUSHIT_VERSION', '0.4.3');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');