Optimus – WordPress Image Optimizer - Version 1.3.6

Version Description

  • Neue Option: Keine Optimierung der Originalbilder
  • Korrektur: Lschung der WebP-Bilder im AJAX-Modus
  • Ausfhrlich auf Google+
Download this release

Release Info

Developer sergej.mueller
Plugin Icon 128x128 Optimus – WordPress Image Optimizer
Version 1.3.6
Comparing to
See all releases

Code changes from version 1.3.5 to 1.3.6

inc/optimus.class.php CHANGED
@@ -47,6 +47,13 @@ class Optimus
47
  10,
48
  2
49
  );
 
 
 
 
 
 
 
50
 
51
  /* Filter */
52
  if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) OR (defined('DOING_CRON') && DOING_CRON) OR (defined('DOING_AJAX') && DOING_AJAX) OR (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) ) {
@@ -127,13 +134,6 @@ class Optimus
127
  'add_page'
128
  )
129
  );
130
- add_filter(
131
- 'wp_delete_file',
132
- array(
133
- 'Optimus_Request',
134
- 'delete_converted_file'
135
- )
136
- );
137
 
138
  /* Admin notices */
139
  add_action(
@@ -316,7 +316,7 @@ class Optimus
316
  * Return plugin options
317
  *
318
  * @since 1.1.2
319
- * @change 1.3.0
320
  *
321
  * @return array $diff Data pairs
322
  */
@@ -328,6 +328,7 @@ class Optimus
328
  array(
329
  'copy_markers' => 0,
330
  'webp_convert' => 0,
 
331
  'secure_transport' => 0
332
  )
333
  );
47
  10,
48
  2
49
  );
50
+ add_filter(
51
+ 'wp_delete_file',
52
+ array(
53
+ 'Optimus_Request',
54
+ 'delete_converted_file'
55
+ )
56
+ );
57
 
58
  /* Filter */
59
  if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) OR (defined('DOING_CRON') && DOING_CRON) OR (defined('DOING_AJAX') && DOING_AJAX) OR (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) ) {
134
  'add_page'
135
  )
136
  );
 
 
 
 
 
 
 
137
 
138
  /* Admin notices */
139
  add_action(
316
  * Return plugin options
317
  *
318
  * @since 1.1.2
319
+ * @change 1.3.6
320
  *
321
  * @return array $diff Data pairs
322
  */
328
  array(
329
  'copy_markers' => 0,
330
  'webp_convert' => 0,
331
+ 'keep_original' => 0,
332
  'secure_transport' => 0
333
  )
334
  );
inc/optimus_hq.class.php CHANGED
@@ -369,7 +369,7 @@ class Optimus_HQ
369
  /* Matching */
370
  switch( $type ) {
371
  case 'unlocked':
372
- $msg = 'Vielen Dank für die Nutzung von <strong>Optimus HQ</strong>. Wissenswertes und Aktualisierungen rund um das Plugin auf <a href="https://plus.google.com/b/114450218898660299759/114450218898660299759/posts" target="_blank">Google+</a>.';
373
  $class = 'updated';
374
  break;
375
 
369
  /* Matching */
370
  switch( $type ) {
371
  case 'unlocked':
372
+ $msg = 'Vielen Dank für die Nutzung von <strong>Optimus HQ</strong>. Wissenswertes und Aktualisierungen rund um das Plugin auf <a href="https://plus.google.com/b/114450218898660299759/114450218898660299759/posts" target="_blank">Google+</a> und <a href="https://twitter.com/optimusHQ" target="_blank">Twitter</a>.';
373
  $class = 'updated';
374
  break;
375
 
inc/optimus_request.class.php CHANGED
@@ -28,7 +28,7 @@ class Optimus_Request
28
  * Build optimization for a upload image including previews
29
  *
30
  * @since 0.0.1
31
- * @change 1.3.4
32
  *
33
  * @param array $upload_data Incoming upload information
34
  * @param integer $attachment_id Attachment ID
@@ -90,12 +90,18 @@ class Optimus_Request
90
  /* Get plugin options */
91
  $options = Optimus::get_options();
92
 
93
- /* Todo files array */
94
- $todo_files = array($upload_file);
95
-
96
- /* Diff file sizes */
97
  $diff_filesizes = array();
98
 
 
 
 
 
 
 
 
 
99
  /* Set cURL options */
100
  add_action(
101
  'http_api_curl',
@@ -127,6 +133,11 @@ class Optimus_Request
127
  );
128
  }
129
 
 
 
 
 
 
130
  /* Loop todo files */
131
  foreach ($todo_files as $file) {
132
  /* Merge path & file */
@@ -281,8 +292,10 @@ class Optimus_Request
281
  {
282
  return wp_safe_remote_post(
283
  sprintf(
284
- '%s://magic.optimus.io/%s?%s',
285
  self::$_remote_scheme,
 
 
286
  Optimus_HQ::get_key(),
287
  self::_curl_optimus_task($args)
288
  ),
28
  * Build optimization for a upload image including previews
29
  *
30
  * @since 0.0.1
31
+ * @change 1.3.6
32
  *
33
  * @param array $upload_data Incoming upload information
34
  * @param integer $attachment_id Attachment ID
90
  /* Get plugin options */
91
  $options = Optimus::get_options();
92
 
93
+ /* Init arrays */
94
+ $todo_files = array();
 
 
95
  $diff_filesizes = array();
96
 
97
+ /* Keep the master */
98
+ if ( ! $options['keep_original'] ) {
99
+ array_push(
100
+ $todo_files,
101
+ $upload_file
102
+ );
103
+ }
104
+
105
  /* Set cURL options */
106
  add_action(
107
  'http_api_curl',
133
  );
134
  }
135
 
136
+ /* No images to process */
137
+ if ( empty($todo_files) ) {
138
+ return $upload_data;
139
+ }
140
+
141
  /* Loop todo files */
142
  foreach ($todo_files as $file) {
143
  /* Merge path & file */
292
  {
293
  return wp_safe_remote_post(
294
  sprintf(
295
+ '%s://%s.%s/%s?%s',
296
  self::$_remote_scheme,
297
+ 'magic',
298
+ 'optimus.io',
299
  Optimus_HQ::get_key(),
300
  self::_curl_optimus_task($args)
301
  ),
inc/optimus_settings.class.php CHANGED
@@ -39,7 +39,7 @@ class Optimus_Settings
39
  * Valisierung der Optionsseite
40
  *
41
  * @since 1.0.0
42
- * @change 1.3.1
43
  *
44
  * @param array $data Array mit Formularwerten
45
  * @return array Array mit geprüften Werten
@@ -50,6 +50,7 @@ class Optimus_Settings
50
  return array(
51
  'copy_markers' => (int)(!empty($data['copy_markers'])),
52
  'webp_convert' => (int)(!empty($data['webp_convert'])),
 
53
  'secure_transport' => (int)(!empty($data['secure_transport']))
54
  );
55
  }
@@ -80,8 +81,8 @@ class Optimus_Settings
80
  /**
81
  * Darstellung der Optionsseite
82
  *
83
- * @since 1.3.2 Implementierung von get_intermediate_image_sizes
84
  * @since 1.0.0
 
85
  *
86
  * @return void
87
  */
@@ -116,6 +117,24 @@ class Optimus_Settings
116
  </tr>
117
  <?php } ?>
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  <tr valign="top">
120
  <th scope="row">
121
  Bild-Metadaten
39
  * Valisierung der Optionsseite
40
  *
41
  * @since 1.0.0
42
+ * @change 1.3.6
43
  *
44
  * @param array $data Array mit Formularwerten
45
  * @return array Array mit geprüften Werten
50
  return array(
51
  'copy_markers' => (int)(!empty($data['copy_markers'])),
52
  'webp_convert' => (int)(!empty($data['webp_convert'])),
53
+ 'keep_original' => (int)(!empty($data['keep_original'])),
54
  'secure_transport' => (int)(!empty($data['secure_transport']))
55
  );
56
  }
81
  /**
82
  * Darstellung der Optionsseite
83
  *
 
84
  * @since 1.0.0
85
+ * @change 1.3.6
86
  *
87
  * @return void
88
  */
117
  </tr>
118
  <?php } ?>
119
 
120
+ <tr valign="top">
121
+ <th scope="row">
122
+ Originalbilder
123
+ </th>
124
+ <td>
125
+ <fieldset>
126
+ <label for="optimus_keep_original">
127
+ <input type="checkbox" name="optimus[keep_original]" id="optimus_keep_original" value="1" <?php checked(1, $options['keep_original']) ?> />
128
+ Keine Optimierung der Originalbilder
129
+ </label>
130
+
131
+ <p class="description">
132
+ Optimus komprimiert ausschließlich Vorschaubilder (Thumbnails). In WordPress hochgeladene Originalbilder bleiben unangetastet.
133
+ </p>
134
+ </fieldset>
135
+ </td>
136
+ </tr>
137
+
138
  <tr valign="top">
139
  <th scope="row">
140
  Bild-Metadaten
optimus.php CHANGED
@@ -6,11 +6,11 @@ Author: Sergej M&uuml;ller
6
  Author URI: http://wpcoder.de
7
  Plugin URI: https://optimus.io
8
  License: GPLv2 or later
9
- Version: 1.3.5
10
  */
11
 
12
  /*
13
- Copyright (C) 2012-2014 Sergej Müller
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
6
  Author URI: http://wpcoder.de
7
  Plugin URI: https://optimus.io
8
  License: GPLv2 or later
9
+ Version: 1.3.6
10
  */
11
 
12
  /*
13
+ Copyright (C) 2012-2015 Sergej Müller
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: sergej.mueller
3
  Tags: images, optimize, compress, progressive, performance, png, jpeg, webp
4
  Requires at least: 3.8
5
- Tested up to: 4.0
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -86,8 +86,14 @@ NEU für Optimus HQ: Optionale [Konvertierung](https://plus.google.com/b/1144502
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
89
  = 1.3.5 =
90
  * Erhöhung des Limits für PNG-Dateien auf 512 KB (Optimus HQ)
 
91
 
92
  = 1.3.4 =
93
  * Umstellung des Plugins auf die neue Optimus API (cURL only)
2
  Contributors: sergej.mueller
3
  Tags: images, optimize, compress, progressive, performance, png, jpeg, webp
4
  Requires at least: 3.8
5
+ Tested up to: 4.1
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
86
 
87
  == Changelog ==
88
 
89
+ = 1.3.6 =
90
+ * Neue Option: Keine Optimierung der Originalbilder
91
+ * Korrektur: Löschung der WebP-Bilder im AJAX-Modus
92
+ * [Ausführlich auf Google+](https://plus.google.com/b/114450218898660299759/114450218898660299759/posts/hWjiVYht9yF)
93
+
94
  = 1.3.5 =
95
  * Erhöhung des Limits für PNG-Dateien auf 512 KB (Optimus HQ)
96
+ * [Ausführlich auf Google+](https://plus.google.com/b/114450218898660299759/114450218898660299759/posts/EUA797D8aYS)
97
 
98
  = 1.3.4 =
99
  * Umstellung des Plugins auf die neue Optimus API (cURL only)