Simple Image Sizes - Version 3.1.1

Version Description

Download this release

Release Info

Developer Rahe
Plugin Icon wp plugin Simple Image Sizes
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0 to 3.1.1

assets/js/dist/app.min.js CHANGED
@@ -2,6 +2,6 @@ var rahe;if(rahe){if("object"!=typeof rahe)throw new Error("rahe already exists
2
 
3
  var sis;if(sis){if("object"!=typeof sis)throw new Error("sis already exists and not an object")}else sis={};jQuery(function(){"use strict";var e=jQuery(document.body),t=null,s=null;jQuery('select[name="action"], select[name="action2"]').append(jQuery("<option/>").attr("value","sis-regenerate").text(sis.regenerate)),e.on("click",".sis-regenerate-one",function(e){e.preventDefault(),s=new t(this)}),jQuery("#doaction, #doaction2").on("click",function(e){if("sis-regenerate"===jQuery(this).parent().find("select").val()){var n=jQuery('#the-list .check-column input[type="checkbox"]:checked').closest("tr").find(".sis-regenerate-one");n.length>0&&(e.preventDefault(),n.each(function(e,n){s=new t(this)}))}}),t=function(e){var t={list:{},parent:null,el:null,id:null,messageZone:"",init:function(e){this.el=e,this.parent=e.closest("tr"),this.id=this.el.data("id"),this.list={id:this.id,title:""},this.messageZone=this.parent.find(".title em"),0===this.parent.find(".title em").length&&this.parent.find(".title strong").after("<em/>"),this.messageZone=this.parent.find(".title em"),this.parent.hasClass("ajaxing")||this.regenItem()},setMessage:function(e){this.messageZone.html(" - "+e).addClass("updated").addClass("fade").show()},regenItem:function(){var e=this;jQuery.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"sis_rebuild_image",id:this.list.id,nonce:sis.regen_one},beforeSend:function(){e.parent.addClass("ajaxing").find(".sis-regenerate-one").hide().end().find(".spinner").addClass("is-active").show(),e.parent.find("a.sis-regenerate-one").closest("tr").fadeTo("fast","0.3")},success:function(t){var s="";s=t.src&&t.time&&!t.error&&"object"==typeof t?sis.soloRegenerated.replace("%s",t.time):"object"!=typeof t?s=sis.phpError:t.error,e.setMessage(s),e.parent.removeClass("ajaxing").find(".sis-regenerate-one").show().end().find(".spinner").removeClass("is-active").hide(),e.parent.find("a.sis-regenerate-one").closest("tr").fadeTo("fast","1")}})}};t.init(jQuery(e))}});
4
 
5
- var rahe;if(rahe){if("object"!=typeof rahe)throw new Error("rahe already exists and not an object")}else rahe={};if(rahe.sis){if("object"!=typeof rahe.sis)throw new Error("rahe.sis already exists and not an object")}else rahe.sis={};rahe.sis.featured={messageZone:"",parent:"",element:"",init:function(){this.element=jQuery("#sis_featured_regenerate"),this.parent=this.element.closest(".inside"),this.nonce=this.element.attr("data-nonce"),this.id=jQuery("#post_ID").val(),this.parent.on("click","#sis_featured_regenerate",function(e){e.preventDefault(),rahe.sis.featured.regenItem()})},setMessage:function(e){this.parent.find(".sis_message").html("<p>"+e+"</p>").show()},regenItem:function(){var e=this;jQuery.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"sis_rebuild_featured",id:this.id,nonce:this.nonce},beforeSend:function(){e.parent.find(".spinner").addClass("is-active"),e.parent.find("#sis_featured_regenerate").attr("disabled","disabled")},success:function(t){var s="";s=!t.time||t.error||"object"!=typeof t?"object"!=typeof t?s=sis.phpError:t.error:sis.soloRegenerated.replace("%s",t.time),console.log(s),e.setMessage(s),e.parent.find(".spinner").removeClass("is-active"),e.parent.find("#sis_featured_regenerate").removeAttr("disabled")}})}},jQuery(function(){rahe.sis.featured.init()});
6
 
7
  //# sourceMappingURL=app.min.js.map
2
 
3
  var sis;if(sis){if("object"!=typeof sis)throw new Error("sis already exists and not an object")}else sis={};jQuery(function(){"use strict";var e=jQuery(document.body),t=null,s=null;jQuery('select[name="action"], select[name="action2"]').append(jQuery("<option/>").attr("value","sis-regenerate").text(sis.regenerate)),e.on("click",".sis-regenerate-one",function(e){e.preventDefault(),s=new t(this)}),jQuery("#doaction, #doaction2").on("click",function(e){if("sis-regenerate"===jQuery(this).parent().find("select").val()){var n=jQuery('#the-list .check-column input[type="checkbox"]:checked').closest("tr").find(".sis-regenerate-one");n.length>0&&(e.preventDefault(),n.each(function(e,n){s=new t(this)}))}}),t=function(e){var t={list:{},parent:null,el:null,id:null,messageZone:"",init:function(e){this.el=e,this.parent=e.closest("tr"),this.id=this.el.data("id"),this.list={id:this.id,title:""},this.messageZone=this.parent.find(".title em"),0===this.parent.find(".title em").length&&this.parent.find(".title strong").after("<em/>"),this.messageZone=this.parent.find(".title em"),this.parent.hasClass("ajaxing")||this.regenItem()},setMessage:function(e){this.messageZone.html(" - "+e).addClass("updated").addClass("fade").show()},regenItem:function(){var e=this;jQuery.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"sis_rebuild_image",id:this.list.id,nonce:sis.regen_one},beforeSend:function(){e.parent.addClass("ajaxing").find(".sis-regenerate-one").hide().end().find(".spinner").addClass("is-active").show(),e.parent.find("a.sis-regenerate-one").closest("tr").fadeTo("fast","0.3")},success:function(t){var s="";s=t.src&&t.time&&!t.error&&"object"==typeof t?sis.soloRegenerated.replace("%s",t.time):"object"!=typeof t?s=sis.phpError:t.error,e.setMessage(s),e.parent.removeClass("ajaxing").find(".sis-regenerate-one").show().end().find(".spinner").removeClass("is-active").hide(),e.parent.find("a.sis-regenerate-one").closest("tr").fadeTo("fast","1")}})}};t.init(jQuery(e))}});
4
 
5
+ var rahe;if(rahe){if("object"!=typeof rahe)throw new Error("rahe already exists and not an object")}else rahe={};if(rahe.sis){if("object"!=typeof rahe.sis)throw new Error("rahe.sis already exists and not an object")}else rahe.sis={};rahe.sis.featured={messageZone:"",parent:"",element:"",init:function(){this.element=jQuery("#sis_featured_regenerate"),this.parent=this.element.closest(".inside"),this.nonce=this.element.attr("data-nonce"),this.id=jQuery("#post_ID").val(),this.parent.on("click","#sis_featured_regenerate",function(e){e.preventDefault(),rahe.sis.featured.regenItem()})},setMessage:function(e){this.parent.find(".sis_message").html("<p>"+e+"</p>").show()},regenItem:function(){var e=this;jQuery.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"sis_rebuild_featured",id:this.id,nonce:this.nonce},beforeSend:function(){e.parent.find(".spinner").addClass("is-active"),e.parent.find("#sis_featured_regenerate").attr("disabled","disabled")},success:function(t){var s="";s=!t.time||t.error||"object"!=typeof t?"object"!=typeof t?s=sis.phpError:t.error:sis.soloRegenerated.replace("%s",t.time),e.setMessage(s),e.parent.find(".spinner").removeClass("is-active"),e.parent.find("#sis_featured_regenerate").removeAttr("disabled")}})}},jQuery(function(){rahe.sis.featured.init()});
6
 
7
  //# sourceMappingURL=app.min.js.map
assets/js/src/featured.js CHANGED
@@ -56,7 +56,6 @@ rahe.sis.featured = {
56
  } else {
57
  message = sis.soloRegenerated.replace( '%s', r.time );
58
  }
59
- console.log(message);
60
  self.setMessage( message );
61
 
62
  self.parent.find('.spinner').removeClass( 'is-active');
56
  } else {
57
  message = sis.soloRegenerated.replace( '%s', r.time );
58
  }
 
59
  self.setMessage( message );
60
 
61
  self.parent.find('.spinner').removeClass( 'is-active');
classes/admin/post.php CHANGED
@@ -26,6 +26,7 @@ Class SIS_Admin_Post {
26
  // Add filter for the Media single
27
  add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'add_field_regenerate' ), 9, 2 );
28
 
 
29
  add_filter( 'admin_post_thumbnail_html', array( __CLASS__, 'admin_post_thumbnail_html' ), 10, 2 );
30
  }
31
 
@@ -38,12 +39,19 @@ Class SIS_Admin_Post {
38
  * @return string
39
  */
40
  public static function admin_post_thumbnail_html( $content, $ID ) {
 
 
 
 
 
 
41
 
42
  $content .= '<span class="spinner"></span>';
43
- $content .= get_submit_button( 'Regenerate image sizes', 'primary', 'sis_featured', false, array(
44
- 'id' => 'sis_featured_regenerate',
45
- 'data-nonce' => wp_create_nonce( 'sis-regenerate-featured-'.$ID ),
46
- ) );
 
47
  $content .= '<div class="sis_message"></div>';
48
 
49
  return $content;
26
  // Add filter for the Media single
27
  add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'add_field_regenerate' ), 9, 2 );
28
 
29
+ // Media regenerate on admin featured
30
  add_filter( 'admin_post_thumbnail_html', array( __CLASS__, 'admin_post_thumbnail_html' ), 10, 2 );
31
  }
32
 
39
  * @return string
40
  */
41
  public static function admin_post_thumbnail_html( $content, $ID ) {
42
+ /**
43
+ * Allow to not display the regenerate image link
44
+ */
45
+ if ( false === apply_filters( 'SIS/Admin/Post/Display_Thumbnail_Regenerate', true ) ) {
46
+ return $content;
47
+ }
48
 
49
  $content .= '<span class="spinner"></span>';
50
+ $content .= sprintf(
51
+ "<a id='sis_featured_regenerate' data-nonce='%s' href='#' >%s</a>",
52
+ wp_create_nonce( 'sis-regenerate-featured-'.$ID ) ,
53
+ esc_html__( 'Regenerate image sizes', 'simple-image-sizes' )
54
+ );
55
  $content .= '<div class="sis_message"></div>';
56
 
57
  return $content;
package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "simple-image-sizes",
3
- "version": "3.1.0",
4
  "description": "Simple image sizes for WordPress",
5
  "author": "Nicolas Juen",
6
  "license": "GPL-2.0",
1
  {
2
  "name": "simple-image-sizes",
3
+ "version": "3.1.1",
4
  "description": "Simple image sizes for WordPress",
5
  "author": "Nicolas Juen",
6
  "license": "GPL-2.0",
README → readme.md RENAMED
@@ -9,7 +9,7 @@
9
 
10
  **Tested up to:** 4.5
11
 
12
- **Stable tag:** 3.1.0
13
 
14
 
15
  ## Description ##
@@ -64,6 +64,9 @@ And then you can choose if the image is displayed on the media insertion or not
64
  ](http://s.wordpress.org/extend/plugins/simple-image-sizes/screenshot-3.png)
65
 
66
  ## Changelog ##
 
 
 
67
  * 3.1.0
68
  * Regenerate images from the featured image
69
  * Use wp_send_json since the minimum WordPress version is 3.5
9
 
10
  **Tested up to:** 4.5
11
 
12
+ **Stable tag:** 3.1.1
13
 
14
 
15
  ## Description ##
64
  ](http://s.wordpress.org/extend/plugins/simple-image-sizes/screenshot-3.png)
65
 
66
  ## Changelog ##
67
+ * 3.1.1
68
+ * Make translatable the link on admin featured image metabox
69
+ * Add filter to allow to remove the button : filter SIS/Admin/Post/Display_Thumbnail_Regenerate
70
  * 3.1.0
71
  * Regenerate images from the featured image
72
  * Use wp_send_json since the minimum WordPress version is 3.5
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.beapi.fr/donate/
4
  Tags: images, image, custom sizes, custom images, thumbnail regenerate, thumbnail, regenerate
5
  Requires at least: 3.5
6
  Tested up to: 4.5
7
- Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -48,7 +48,9 @@ And then you can choose if the image is displayed on the media insertion or not
48
  3. Choose the sizes to regenerate and regenerate them
49
 
50
  == Changelog ==
51
-
 
 
52
  * 3.1.0
53
  * Regenerate images from the featured image
54
  * Use wp_send_json since the minimum WordPress version is 3.5
4
  Tags: images, image, custom sizes, custom images, thumbnail regenerate, thumbnail, regenerate
5
  Requires at least: 3.5
6
  Tested up to: 4.5
7
+ Stable tag: 3.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
48
  3. Choose the sizes to regenerate and regenerate them
49
 
50
  == Changelog ==
51
+ * 3.1.1
52
+ * Make translatable the link on admin featured image metabox
53
+ * Add filter to allow to remove the button : filter SIS/Admin/Post/Display_Thumbnail_Regenerate
54
  * 3.1.0
55
  * Regenerate images from the featured image
56
  * Use wp_send_json since the minimum WordPress version is 3.5
simple_image_sizes.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple Image Sizes
4
  Plugin URI: https://github.com/Rahe/simple-image-sizes
5
  Description: Add options in media setting page for images sizes
6
- Version: 3.1.0
7
  Author: Rahe
8
  Author URI: http://nicolas-juen.fr
9
  Text Domain: simple-image-sizes
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
 
31
  define( 'SIS_URL', plugin_dir_url( __FILE__ ) );
32
  define( 'SIS_DIR', plugin_dir_path( __FILE__ ) );
33
- define( 'SIS_VERSION', '3.1.0' );
34
  define( 'SIS_OPTION', 'custom_image_sizes' );
35
 
36
  // Function for easy load files
3
  Plugin Name: Simple Image Sizes
4
  Plugin URI: https://github.com/Rahe/simple-image-sizes
5
  Description: Add options in media setting page for images sizes
6
+ Version: 3.1.1
7
  Author: Rahe
8
  Author URI: http://nicolas-juen.fr
9
  Text Domain: simple-image-sizes
30
 
31
  define( 'SIS_URL', plugin_dir_url( __FILE__ ) );
32
  define( 'SIS_DIR', plugin_dir_path( __FILE__ ) );
33
+ define( 'SIS_VERSION', '3.1.1' );
34
  define( 'SIS_OPTION', 'custom_image_sizes' );
35
 
36
  // Function for easy load files