Kraken.io Image Optimizer - Version 1.0.5.7

Version Description

  • Added ability to disable automatic optimization of uploads.
Download this release

Release Info

Developer karim79
Plugin Icon 128x128 Kraken.io Image Optimizer
Version 1.0.5.7
Comparing to
See all releases

Code changes from version 1.0.5.6 to 1.0.5.7

Files changed (2) hide show
  1. kraken.php +24 -4
  2. readme.txt +4 -1
kraken.php CHANGED
@@ -21,8 +21,8 @@
21
  * Plugin URI: http://wordpress.org/plugins/kraken-image-optimizer/
22
  * Description: This plugin allows you to optimize your WordPress images through the Kraken API, the world's most advanced image optimization solution.
23
  * Author: Karim Salman
24
- * Version: 1.0.5.6
25
- * Stable Tag: 1.0.5.6
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
@@ -50,8 +50,11 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
50
  add_action( 'wp_ajax_kraken_request', array( &$this, 'kraken_media_library_ajax_callback' ) );
51
  add_action( 'manage_media_custom_column', array( &$this, 'fill_media_columns' ), 10, 2 );
52
  add_filter( 'manage_media_columns', array( &$this, 'add_media_columns') );
53
- add_filter( 'wp_generate_attachment_metadata', array( &$this, 'optimize_thumbnails') );
54
- add_action( 'add_attachment', array( &$this, 'kraken_media_uploader_callback' ) );
 
 
 
55
  }
56
 
57
  /*
@@ -91,6 +94,14 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
91
  'kraken_image_optimizer'
92
  );
93
 
 
 
 
 
 
 
 
 
94
  add_settings_field(
95
  'credentials_valid',
96
  'API status:',
@@ -311,6 +322,7 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
311
  $valid = array();
312
  $error = '';
313
  $valid['api_lossy'] = $input['api_lossy'];
 
314
 
315
  if ( !function_exists( 'curl_exec' ) ) {
316
  $error = 'cURL not available. Kraken Image Optimizer requires cURL in order to communicate with Kraken.io servers. <br /> Please ask your system administrator or host to install PHP cURL, or contact support@kraken.io for advice';
@@ -377,6 +389,14 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
377
  echo $html;
378
  }
379
 
 
 
 
 
 
 
 
 
380
  function add_media_columns( $columns ) {
381
  $columns['original_size'] = 'Original Size';
382
  $columns['kraked_size'] = 'Kraked Size';
21
  * Plugin URI: http://wordpress.org/plugins/kraken-image-optimizer/
22
  * Description: This plugin allows you to optimize your WordPress images through the Kraken API, the world's most advanced image optimization solution.
23
  * Author: Karim Salman
24
+ * Version: 1.0.5.7
25
+ * Stable Tag: 1.0.5.7
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
50
  add_action( 'wp_ajax_kraken_request', array( &$this, 'kraken_media_library_ajax_callback' ) );
51
  add_action( 'manage_media_custom_column', array( &$this, 'fill_media_columns' ), 10, 2 );
52
  add_filter( 'manage_media_columns', array( &$this, 'add_media_columns') );
53
+
54
+ if ( ( !empty( $this->kraken_settings ) && !empty( $this->kraken_settings['auto_optimize'] ) ) || !isset( $this->kraken_settings['auto_optimize'] ) ) {
55
+ add_filter( 'wp_generate_attachment_metadata', array( &$this, 'optimize_thumbnails') );
56
+ add_action( 'add_attachment', array( &$this, 'kraken_media_uploader_callback' ) );
57
+ }
58
  }
59
 
60
  /*
94
  'kraken_image_optimizer'
95
  );
96
 
97
+ add_settings_field(
98
+ 'kraken_auto_optimize',
99
+ 'Automatically optimize uploads:',
100
+ array( &$this, 'show_auto_optimize' ),
101
+ 'media',
102
+ 'kraken_image_optimizer'
103
+ );
104
+
105
  add_settings_field(
106
  'credentials_valid',
107
  'API status:',
322
  $valid = array();
323
  $error = '';
324
  $valid['api_lossy'] = $input['api_lossy'];
325
+ $valid['auto_optimize'] = isset( $input['auto_optimize'] )? 1 : 0;
326
 
327
  if ( !function_exists( 'curl_exec' ) ) {
328
  $error = 'cURL not available. Kraken Image Optimizer requires cURL in order to communicate with Kraken.io servers. <br /> Please ask your system administrator or host to install PHP cURL, or contact support@kraken.io for advice';
389
  echo $html;
390
  }
391
 
392
+ function show_auto_optimize() {
393
+ $options = get_option( '_kraken_options' );
394
+ $auto_optimize = isset( $options['auto_optimize'] ) ? $options['auto_optimize'] : 1;
395
+ ?>
396
+ <input type="checkbox" id="auto_optimize" name="_kraken_options[auto_optimize]" value="1" <?php checked( 1, $auto_optimize, true ); ?>/>
397
+ <?php
398
+ }
399
+
400
  function add_media_columns( $columns ) {
401
  $columns['original_size'] = 'Original Size';
402
  $columns['kraked_size'] = 'Kraked Size';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Image Optimizer, Image Optimiser, Optimize, Images, Media, Performance, SE
4
  Requires at least: 3.0.1
5
  Tested up to: 4.1
6
  Donate link: https://kraken.io
7
- Stable tag: 1.0.5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
@@ -94,6 +94,9 @@ You will need to switch the Media Library from the Thumbnail view to the List vi
94
 
95
  == Changelog ==
96
 
 
 
 
97
  = 1.0.5.6 =
98
  * Rolled back to old way of replacing images in light of reported issues.
99
 
4
  Requires at least: 3.0.1
5
  Tested up to: 4.1
6
  Donate link: https://kraken.io
7
+ Stable tag: 1.0.5.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
94
 
95
  == Changelog ==
96
 
97
+ = 1.0.5.7 =
98
+ * Added ability to disable automatic optimization of uploads.
99
+
100
  = 1.0.5.6 =
101
  * Rolled back to old way of replacing images in light of reported issues.
102