Optimus – WordPress Image Optimizer - Version 1.3.9

Version Description

  • Bug fixing and activation update
Download this release

Release Info

Developer keycdn
Plugin Icon 128x128 Optimus – WordPress Image Optimizer
Version 1.3.9
Comparing to
See all releases

Code changes from version 1.3.8 to 1.3.9

inc/optimus_hq.class.php CHANGED
@@ -253,7 +253,7 @@ class Optimus_HQ
253
 
254
  <label for="_optimus_key">
255
  Optimus HQ Key:
256
- <input type="text" name="_optimus_key" id="_optimus_key" maxlength="17" pattern="[A-Z0-9]{17}" />
257
  </label>
258
 
259
  <input type="submit" name="submit" value="<?php _e("Activate", "optimus"); ?>" class="button button-primary regular" />
@@ -313,7 +313,7 @@ class Optimus_HQ
313
  $optimus_key = sanitize_text_field($_POST['_optimus_key']);
314
 
315
  /* Advanced check */
316
- if ( ! preg_match('/^[A-Z0-9]{17}$/', $optimus_key) ) {
317
  return;
318
  }
319
 
@@ -380,7 +380,7 @@ class Optimus_HQ
380
  break;
381
 
382
  case 'expired':
383
- $msg = __("<p><strong>Optimus HQ license key</strong> has expired. Get a new Optimus HQ license key on <a href=\"https://optimus.io\" target=\"_blank\">optimus.io</a>. Thank you!", "optimus");
384
  $class = 'error';
385
  break;
386
 
253
 
254
  <label for="_optimus_key">
255
  Optimus HQ Key:
256
+ <input type="text" name="_optimus_key" id="_optimus_key" maxlength="24" pattern="[A-Z0-9]{17,24}" />
257
  </label>
258
 
259
  <input type="submit" name="submit" value="<?php _e("Activate", "optimus"); ?>" class="button button-primary regular" />
313
  $optimus_key = sanitize_text_field($_POST['_optimus_key']);
314
 
315
  /* Advanced check */
316
+ if ( ! preg_match('/^[A-Z0-9]{17,24}$/', $optimus_key) ) {
317
  return;
318
  }
319
 
380
  break;
381
 
382
  case 'expired':
383
+ $msg = __("<p><strong>Optimus HQ license key</strong> has expired. Get a new Optimus HQ license key on <a href=\"https://optimus.io/en/\" target=\"_blank\">optimus.io</a>. Thank you!", "optimus");
384
  $class = 'error';
385
  break;
386
 
inc/optimus_request.class.php CHANGED
@@ -72,9 +72,8 @@ class Optimus_Request
72
  /* optimize image */
73
  $optimus_metadata = self::optimize_upload_images($metadata, $id);
74
 
75
- if (!isset($optimus_metadata['optimus'])) {
76
- $message = __("Optimus HQ required", "optimus");
77
- echo json_encode(array('error' => $message));
78
  exit;
79
  }
80
 
@@ -135,6 +134,7 @@ class Optimus_Request
135
 
136
  /* Simple regex check */
137
  if ( ! preg_match('/^[^\?\%]+\.(?:jpe?g|png)$/i', $upload_file) ) {
 
138
  return $upload_data;
139
  }
140
 
@@ -146,6 +146,7 @@ class Optimus_Request
146
 
147
  /* Mime type check */
148
  if ( ! self::_allowed_mime_type($mime_type) ) {
 
149
  return $upload_data;
150
  }
151
 
@@ -235,6 +236,8 @@ class Optimus_Request
235
  if ( is_numeric($action_response) ) {
236
  $response_filesize = $action_response;
237
  } else {
 
 
238
  return $upload_data;
239
  }
240
 
@@ -299,12 +302,12 @@ class Optimus_Request
299
 
300
  /* Not success status code? */
301
  if ( $response_code !== 200 ) {
302
- return false;
303
  }
304
 
305
  /* Response error? */
306
  if ( is_wp_error($response) ) {
307
- return false;
308
  }
309
 
310
  /* Response properties */
@@ -314,12 +317,12 @@ class Optimus_Request
314
 
315
  /* Empty file? */
316
  if ( empty($response_body) OR empty($response_type) OR empty($response_length) ) {
317
- return false;
318
  }
319
 
320
  /* Mime type check */
321
  if ( ! self::_allowed_mime_type($response_type) ) {
322
- return false;
323
  }
324
 
325
  /* Extension replace for WebP */
@@ -332,7 +335,7 @@ class Optimus_Request
332
 
333
  /* Rewrite image file */
334
  if ( ! file_put_contents($file, $response_body) ) {
335
- return false;
336
  }
337
 
338
  return $response_length;
72
  /* optimize image */
73
  $optimus_metadata = self::optimize_upload_images($metadata, $id);
74
 
75
+ if (!empty($optimus_metadata['optimus']['error'])) {
76
+ echo json_encode(array('error' => $optimus_metadata['optimus']['error']));
 
77
  exit;
78
  }
79
 
134
 
135
  /* Simple regex check */
136
  if ( ! preg_match('/^[^\?\%]+\.(?:jpe?g|png)$/i', $upload_file) ) {
137
+ $upload_data['optimus']['error'] = __("Format not supported", "optimus");
138
  return $upload_data;
139
  }
140
 
146
 
147
  /* Mime type check */
148
  if ( ! self::_allowed_mime_type($mime_type) ) {
149
+ $upload_data['optimus']['error'] = __("Mime type not supported", "optimus");
150
  return $upload_data;
151
  }
152
 
236
  if ( is_numeric($action_response) ) {
237
  $response_filesize = $action_response;
238
  } else {
239
+ // return error message
240
+ $upload_data['optimus']['error'] = $action_response;
241
  return $upload_data;
242
  }
243
 
302
 
303
  /* Not success status code? */
304
  if ( $response_code !== 200 ) {
305
+ return 'code '.$response_code;
306
  }
307
 
308
  /* Response error? */
309
  if ( is_wp_error($response) ) {
310
+ return get_error_message($response);
311
  }
312
 
313
  /* Response properties */
317
 
318
  /* Empty file? */
319
  if ( empty($response_body) OR empty($response_type) OR empty($response_length) ) {
320
+ return __("File empty", "optimus");
321
  }
322
 
323
  /* Mime type check */
324
  if ( ! self::_allowed_mime_type($response_type) ) {
325
+ return __("Mime type not supported", "optimus");
326
  }
327
 
328
  /* Extension replace for WebP */
335
 
336
  /* Rewrite image file */
337
  if ( ! file_put_contents($file, $response_body) ) {
338
+ return __("Write operation failed", "optimus");
339
  }
340
 
341
  return $response_length;
js/scripts.js CHANGED
@@ -80,7 +80,7 @@
80
  }).call()
81
 
82
  jQuery(document).ready(function() {
83
- if (adminpage === "upload-php") {
84
  jQuery('<option>').val('optimus_bulk_optimizer').text(optimusOptimize.bulkAction).appendTo('select[name="action"]')
85
  jQuery('<option>').val('optimus_bulk_optimizer').text(optimusOptimize.bulkAction).appendTo('select[name="action2"]')
86
  }
80
  }).call()
81
 
82
  jQuery(document).ready(function() {
83
+ if (typeof adminpage != "undefined" && adminpage === "upload-php") {
84
  jQuery('<option>').val('optimus_bulk_optimizer').text(optimusOptimize.bulkAction).appendTo('select[name="action"]')
85
  jQuery('<option>').val('optimus_bulk_optimizer').text(optimusOptimize.bulkAction).appendTo('select[name="action2"]')
86
  }
lang/optimus-de_DE.mo CHANGED
Binary file
lang/optimus-de_DE.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: Optimus\n"
4
  "Report-Msgid-Bugs-To: KeyCDN\n"
5
  "POT-Creation-Date: 2015-06-16 19:46+0100\n"
6
- "PO-Revision-Date: 2015-06-29 14:23+0100\n"
7
  "Last-Translator: KeyCDN <optimus@keycdn.com>\n"
8
  "Language-Team: KeyCDN\n"
9
  "Language: de_DE\n"
@@ -224,8 +224,8 @@ msgstr ""
224
  #: inc/optimus_hq.class.php:xx
225
  msgid ""
226
  "<p><strong>Optimus HQ license key</strong> has expired. Get a new Optimus HQ "
227
- "license key on <a href=\"https://optimus.io\" target=\"_blank\">optimus.io</"
228
- "a>. Thank you!</p>"
229
  msgstr ""
230
  "<p><strong>Optimus HQ Key</strong> ist abgelaufen. Ein neuer Optimus HQ Key "
231
  "kann auf <a href=\"https://optimus.io\" target=\"_blank\">optimus.io</a> "
3
  "Project-Id-Version: Optimus\n"
4
  "Report-Msgid-Bugs-To: KeyCDN\n"
5
  "POT-Creation-Date: 2015-06-16 19:46+0100\n"
6
+ "PO-Revision-Date: 2015-07-06 21:03+0100\n"
7
  "Last-Translator: KeyCDN <optimus@keycdn.com>\n"
8
  "Language-Team: KeyCDN\n"
9
  "Language: de_DE\n"
224
  #: inc/optimus_hq.class.php:xx
225
  msgid ""
226
  "<p><strong>Optimus HQ license key</strong> has expired. Get a new Optimus HQ "
227
+ "license key on <a href=\"https://optimus.io/en/\" target=\"_blank\">optimus."
228
+ "io</a>. Thank you!"
229
  msgstr ""
230
  "<p><strong>Optimus HQ Key</strong> ist abgelaufen. Ein neuer Optimus HQ Key "
231
  "kann auf <a href=\"https://optimus.io\" target=\"_blank\">optimus.io</a> "
optimus.php CHANGED
@@ -7,7 +7,7 @@ Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  Plugin URI: https://optimus.io
9
  License: GPLv2 or later
10
- Version: 1.3.8
11
  */
12
 
13
  /*
7
  Author URI: https://www.keycdn.com
8
  Plugin URI: https://optimus.io
9
  License: GPLv2 or later
10
+ Version: 1.3.9
11
  */
12
 
13
  /*
readme.txt CHANGED
@@ -98,6 +98,9 @@ Optimus optional support the conversion of images to the thrifty [*WebP* image f
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 1.3.8 =
102
  * Bulk optimization feature
103
 
98
 
99
  == Changelog ==
100
 
101
+ = 1.3.9 =
102
+ * Bug fixing and activation update
103
+
104
  = 1.3.8 =
105
  * Bulk optimization feature
106