Kraken.io Image Optimizer - Version 1.0.8

Version Description

  • Added the ability to control the number of images the bulk tool optimizes at once. The default settings of 4 is recommended. Blogs with limited resources, for example those on small shared hosting plans should try a lower value if they run into issues with bulk optimization. Blogs on larger hosting plans can experiment with higher values.
Download this release

Release Info

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

Code changes from version 1.0.7 to 1.0.8

Files changed (4) hide show
  1. js/ajax.js +2 -3
  2. kraken.php +30 -4
  3. lib/Kraken.php +1 -1
  4. readme.txt +4 -1
js/ajax.js CHANGED
@@ -1,6 +1,5 @@
1
  jQuery(document).ready(function($) {
2
 
3
-
4
  var errors = [{
5
  code: 401,
6
  msg: 'Unnknown API Key. Please check your API key and try again'
@@ -146,7 +145,7 @@ jQuery(document).ready(function($) {
146
  closeText: 'close',
147
  showClose: false
148
  },
149
- setting = $("button.kraken_req").eq(0).data("setting"),
150
  nImages = bulkImageData.length,
151
  header = '<p class="krakenBulkHeader">Kraken Bulk Image Optimization</p>',
152
  krakEmAll = '<button class="kraken_req_bulk">Krak \'em all</button>',
@@ -298,7 +297,7 @@ jQuery(document).ready(function($) {
298
  });
299
  callback();
300
  });
301
- }, 5);
302
 
303
  q.drain = function() {
304
  $(".kraken_req_bulk")
1
  jQuery(document).ready(function($) {
2
 
 
3
  var errors = [{
4
  code: 401,
5
  msg: 'Unnknown API Key. Please check your API key and try again'
145
  closeText: 'close',
146
  showClose: false
147
  },
148
+ setting = kraken_settings.api_lossy,
149
  nImages = bulkImageData.length,
150
  header = '<p class="krakenBulkHeader">Kraken Bulk Image Optimization</p>',
151
  krakEmAll = '<button class="kraken_req_bulk">Krak \'em all</button>',
297
  });
298
  callback();
299
  });
300
+ }, kraken_settings.bulk_async_limit);
301
 
302
  q.drain = function() {
303
  $(".kraken_req_bulk")
kraken.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2014 Karim Salman (email : ksalman@kraken.io)
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License, version 2, as
@@ -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.7
25
- * Stable Tag: 1.0.7
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
@@ -40,7 +40,7 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
40
 
41
  private $optimization_type = 'lossy';
42
 
43
- public static $kraken_plugin_version = '1.0.7';
44
 
45
  function __construct() {
46
  $plugin_dir_path = dirname( __FILE__ );
@@ -114,6 +114,14 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
114
  'kraken_image_optimizer'
115
  );
116
 
 
 
 
 
 
 
 
 
117
  add_settings_field(
118
  'credentials_valid',
119
  'API status:',
@@ -133,6 +141,7 @@ if ( !class_exists( 'Wp_Kraken' ) ) {
133
  wp_enqueue_style( 'tipsy-style', plugins_url( 'css/tipsy.css', __FILE__ ) );
134
  wp_enqueue_style( 'modal-style', plugins_url( 'css/jquery.modal.css', __FILE__ ) );
135
  wp_localize_script( 'ajax-script', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
 
136
  wp_enqueue_script( 'modal-js', plugins_url( '/js/jquery.modal.min.js', __FILE__ ), array( 'jquery' ) );
137
  }
138
  }
@@ -373,6 +382,8 @@ EOD;
373
  $valid['api_lossy'] = $input['api_lossy'];
374
  $valid['auto_optimize'] = isset( $input['auto_optimize'] )? 1 : 0;
375
  $valid['show_reset'] = isset( $input['show_reset'] ) ? $input['show_reset'] : 0;
 
 
376
 
377
  if ( !function_exists( 'curl_exec' ) ) {
378
  $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';
@@ -456,6 +467,21 @@ EOD;
456
  <?php
457
  }
458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  function add_media_columns( $columns ) {
460
  $columns['original_size'] = 'Original Size';
461
  $columns['kraked_size'] = 'Kraked Size';
1
  <?php
2
  /*
3
+ Copyright 2015 Karim Salman (email : ksalman@kraken.io)
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License, version 2, as
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.8
25
+ * Stable Tag: 1.0.8
26
  * Author URI: https://kraken.io
27
  * License GPL2
28
  */
40
 
41
  private $optimization_type = 'lossy';
42
 
43
+ public static $kraken_plugin_version = '1.0.8';
44
 
45
  function __construct() {
46
  $plugin_dir_path = dirname( __FILE__ );
114
  'kraken_image_optimizer'
115
  );
116
 
117
+ add_settings_field(
118
+ 'bulk_async_limit',
119
+ 'Bulk Concurrency: <small class="krakenWhatsThis" title="This settings defines how many images can be processed at the same time using the bulk optimizer. The recommended value is 4. For blogs on very small hosting plans, or with reduced connectivity, a lower number might be necessary to avoid hitting request limits.">what\'s this?</small>',
120
+ array( &$this, 'show_bulk_async_limit' ),
121
+ 'media',
122
+ 'kraken_image_optimizer'
123
+ );
124
+
125
  add_settings_field(
126
  'credentials_valid',
127
  'API status:',
141
  wp_enqueue_style( 'tipsy-style', plugins_url( 'css/tipsy.css', __FILE__ ) );
142
  wp_enqueue_style( 'modal-style', plugins_url( 'css/jquery.modal.css', __FILE__ ) );
143
  wp_localize_script( 'ajax-script', 'ajax_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
144
+ wp_localize_script( 'ajax-script', 'kraken_settings', $this->kraken_settings );
145
  wp_enqueue_script( 'modal-js', plugins_url( '/js/jquery.modal.min.js', __FILE__ ), array( 'jquery' ) );
146
  }
147
  }
382
  $valid['api_lossy'] = $input['api_lossy'];
383
  $valid['auto_optimize'] = isset( $input['auto_optimize'] )? 1 : 0;
384
  $valid['show_reset'] = isset( $input['show_reset'] ) ? $input['show_reset'] : 0;
385
+ $valid['bulk_async_limit'] = isset( $input['bulk_async_limit'] ) ? $input['bulk_async_limit'] : 4;
386
+
387
 
388
  if ( !function_exists( 'curl_exec' ) ) {
389
  $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';
467
  <?php
468
  }
469
 
470
+ function show_bulk_async_limit() {
471
+ $options = get_option( '_kraken_options' );
472
+ $bulk_limit = isset( $options['bulk_async_limit'] ) ? $options['bulk_async_limit'] : 4;
473
+ ?>
474
+ <select name="_kraken_options[bulk_async_limit]">
475
+ <?php foreach ( range(1, 10) as $number ) { ?>
476
+ <option value="<?php echo $number ?>" <?php selected( $bulk_limit, $number, true); ?>>
477
+ <?php echo $number ?>
478
+ </option>
479
+ <?php } ?>
480
+ </select>
481
+ <?php
482
+ }
483
+
484
+
485
  function add_media_columns( $columns ) {
486
  $columns['original_size'] = 'Original Size';
487
  $columns['kraked_size'] = 'Kraked Size';
lib/Kraken.php CHANGED
@@ -4,7 +4,7 @@ class Kraken
4
  {
5
 
6
  protected $auth = array();
7
- public static $kraken_plugin_version = '1.0.5.8';
8
 
9
  public function __construct($key = '', $secret = '')
10
  {
4
  {
5
 
6
  protected $auth = array();
7
+ public static $kraken_plugin_version = '1.0.8';
8
 
9
  public function __construct($key = '', $secret = '')
10
  {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Image Optimizer, Image Optimiser, Optimize, Optimise, Images, Media, Perfo
4
  Requires at least: 3.0.1
5
  Tested up to: 4.1
6
  Donate link: https://kraken.io
7
- Stable tag: 1.0.7
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.7 =
98
  * Added the ability to reset (or remove Kraken.io metadata) from individual images or all images at once, allowing further optimization in certain cases, for example, reoptimizing a previously losslessly optimized image as lossy.
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.8
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.8 =
98
+ * Added the ability to control the number of images the bulk tool optimizes at once. The default settings of 4 is recommended. Blogs with limited resources, for example those on small shared hosting plans should try a lower value if they run into issues with bulk optimization. Blogs on larger hosting plans can experiment with higher values.
99
+
100
  = 1.0.7 =
101
  * Added the ability to reset (or remove Kraken.io metadata) from individual images or all images at once, allowing further optimization in certain cases, for example, reoptimizing a previously losslessly optimized image as lossy.
102