Version Description
- Fix - fixed some broken links
Download this release
Release Info
Developer | zbtirrell |
Plugin | Image Widget |
Version | 4.4.1 |
Comparing to | |
See all releases |
Code changes from version 4.4 to 4.4.1
- image-widget.php +23 -23
- readme.txt +5 -1
image-widget.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
/*
|
3 |
Plugin Name: Image Widget
|
4 |
Plugin URI: http://wordpress.org/plugins/image-widget/
|
5 |
-
Description: A simple image widget that uses the native WordPress media manager to add image widgets to your site. <strong>COMING SOON: <a href="http://
|
6 |
Author: Modern Tribe, Inc.
|
7 |
-
Version: 4.4
|
8 |
Author URI: http://m.tri.be/iwpdoc
|
9 |
Text Domain: image-widget
|
10 |
Domain Path: /lang
|
@@ -26,7 +26,7 @@ add_action( 'widgets_init', 'tribe_load_image_widget' );
|
|
26 |
**/
|
27 |
class Tribe_Image_Widget extends WP_Widget {
|
28 |
|
29 |
-
const VERSION = '4.4';
|
30 |
|
31 |
const CUSTOM_IMAGE_SIZE_SLUG = 'tribe_image_widget_custom';
|
32 |
|
@@ -57,7 +57,7 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
57 |
add_action( 'admin_notices', array( $this, 'post_upgrade_nag' ) );
|
58 |
|
59 |
add_action( 'network_admin_notices', array( $this, 'post_upgrade_nag' ) );
|
60 |
-
add_action( 'wp_ajax_dismissed_image_widget_notice_handler',
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -291,7 +291,7 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
291 |
$instance['height'] = $image_details[2];
|
292 |
}
|
293 |
|
294 |
-
$image_srcset = wp_get_attachment_image_srcset( $instance['attachment_id'], $size);
|
295 |
if ( $image_srcset ) {
|
296 |
$instance['srcset'] = $image_srcset;
|
297 |
}
|
@@ -321,10 +321,10 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
321 |
if ( ! empty( $instance['align'] ) && $instance['align'] != 'none' ) {
|
322 |
$attr['class'] .= " align{$instance['align']}";
|
323 |
}
|
324 |
-
if
|
325 |
$attr['srcset'] = $instance['srcset'];
|
326 |
}
|
327 |
-
if ( ! empty($instance['sizes'] ) ) {
|
328 |
$attr['sizes'] = $instance['sizes'];
|
329 |
}
|
330 |
$attr = apply_filters( 'image_widget_image_attributes', $attr, $instance );
|
@@ -447,11 +447,11 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
447 |
break;
|
448 |
case 'widgets.php' :
|
449 |
$msg = $this->upgrade_nag_widget_admin_msg();
|
450 |
-
break;
|
451 |
}
|
452 |
-
|
453 |
-
if (
|
454 |
-
|
455 |
echo $msg;
|
456 |
?><script>
|
457 |
jQuery(document).ready(function($){
|
@@ -474,12 +474,12 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
474 |
/**
|
475 |
* AJAX handler to store the state of dismissible notices.
|
476 |
*/
|
477 |
-
function ajax_notice_handler() {
|
478 |
if ( empty( $_POST['key'] ) ) return;
|
479 |
$key = $this->generate_key( sanitize_text_field( $_POST['key'] ) );
|
480 |
update_site_option( $key, self::VERSION );
|
481 |
}
|
482 |
-
|
483 |
/**
|
484 |
* Generate version key for admin notice options
|
485 |
*
|
@@ -487,41 +487,41 @@ class Tribe_Image_Widget extends WP_Widget {
|
|
487 |
* @return string option key
|
488 |
*/
|
489 |
private function generate_key( $key ) {
|
490 |
-
$option_key = join(
|
491 |
self::VERSION_KEY,
|
492 |
-
$key
|
493 |
) );
|
494 |
return $option_key;
|
495 |
}
|
496 |
-
|
497 |
/**
|
498 |
* Upgrade nag: Plugins Admin
|
499 |
*
|
500 |
* @return string alert message.
|
501 |
*/
|
502 |
private function upgrade_nag_plugins_admin_msg() {
|
503 |
-
$key =
|
504 |
$option_key = $this->generate_key( $key );
|
505 |
if ( get_site_option( $option_key ) == self::VERSION ) return;
|
506 |
-
$msg = sprintf(
|
507 |
-
__( '<p class="dashicons-before dashicons-format-gallery"><strong><a href="%s" target="_blank">Image Widget Plus</a></strong> is coming soon! Add random images, lightbox, and slider - <strong><a href="%s">Sign up now for early access.</a></strong></p>','image-widget' ),
|
508 |
'http://m.tri.be/19my',
|
509 |
'http://m.tri.be/19my'
|
510 |
);
|
511 |
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
|
512 |
}
|
513 |
-
|
514 |
/**
|
515 |
* Upgrade nag: Widget Admin
|
516 |
*
|
517 |
* @return string alert message.
|
518 |
*/
|
519 |
private function upgrade_nag_widget_admin_msg() {
|
520 |
-
$key =
|
521 |
$option_key = $this->generate_key( $key );
|
522 |
if ( get_site_option( $option_key ) == self::VERSION ) return;
|
523 |
-
$msg = sprintf(
|
524 |
-
__( '<p class="dashicons-before dashicons-star-filled"><strong>Image Widget Plus</strong> - Add lightbox, slideshow, and random image widgets. <strong><a href="%s" target="_blank">Find out how!</a></strong></p>','image-widget' ),
|
525 |
'http://m.tri.be/19mx'
|
526 |
);
|
527 |
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
|
2 |
/*
|
3 |
Plugin Name: Image Widget
|
4 |
Plugin URI: http://wordpress.org/plugins/image-widget/
|
5 |
+
Description: A simple image widget that uses the native WordPress media manager to add image widgets to your site. <strong>COMING SOON: <a href="http://m.tri.be/19m-">Image Widget Plus</a> - Multiple images, slider and more.</strong>
|
6 |
Author: Modern Tribe, Inc.
|
7 |
+
Version: 4.4.1
|
8 |
Author URI: http://m.tri.be/iwpdoc
|
9 |
Text Domain: image-widget
|
10 |
Domain Path: /lang
|
26 |
**/
|
27 |
class Tribe_Image_Widget extends WP_Widget {
|
28 |
|
29 |
+
const VERSION = '4.4.1';
|
30 |
|
31 |
const CUSTOM_IMAGE_SIZE_SLUG = 'tribe_image_widget_custom';
|
32 |
|
57 |
add_action( 'admin_notices', array( $this, 'post_upgrade_nag' ) );
|
58 |
|
59 |
add_action( 'network_admin_notices', array( $this, 'post_upgrade_nag' ) );
|
60 |
+
add_action( 'wp_ajax_dismissed_image_widget_notice_handler', array( $this, 'ajax_notice_handler' ) );
|
61 |
}
|
62 |
|
63 |
/**
|
291 |
$instance['height'] = $image_details[2];
|
292 |
}
|
293 |
|
294 |
+
$image_srcset = wp_get_attachment_image_srcset( $instance['attachment_id'], $size );
|
295 |
if ( $image_srcset ) {
|
296 |
$instance['srcset'] = $image_srcset;
|
297 |
}
|
321 |
if ( ! empty( $instance['align'] ) && $instance['align'] != 'none' ) {
|
322 |
$attr['class'] .= " align{$instance['align']}";
|
323 |
}
|
324 |
+
if ( ! empty( $instance['srcset'] ) ) {
|
325 |
$attr['srcset'] = $instance['srcset'];
|
326 |
}
|
327 |
+
if ( ! empty( $instance['sizes'] ) ) {
|
328 |
$attr['sizes'] = $instance['sizes'];
|
329 |
}
|
330 |
$attr = apply_filters( 'image_widget_image_attributes', $attr, $instance );
|
447 |
break;
|
448 |
case 'widgets.php' :
|
449 |
$msg = $this->upgrade_nag_widget_admin_msg();
|
450 |
+
break;
|
451 |
}
|
452 |
+
|
453 |
+
if ( ! $msg ) return;
|
454 |
+
|
455 |
echo $msg;
|
456 |
?><script>
|
457 |
jQuery(document).ready(function($){
|
474 |
/**
|
475 |
* AJAX handler to store the state of dismissible notices.
|
476 |
*/
|
477 |
+
public function ajax_notice_handler() {
|
478 |
if ( empty( $_POST['key'] ) ) return;
|
479 |
$key = $this->generate_key( sanitize_text_field( $_POST['key'] ) );
|
480 |
update_site_option( $key, self::VERSION );
|
481 |
}
|
482 |
+
|
483 |
/**
|
484 |
* Generate version key for admin notice options
|
485 |
*
|
487 |
* @return string option key
|
488 |
*/
|
489 |
private function generate_key( $key ) {
|
490 |
+
$option_key = join( '_', array(
|
491 |
self::VERSION_KEY,
|
492 |
+
$key,
|
493 |
) );
|
494 |
return $option_key;
|
495 |
}
|
496 |
+
|
497 |
/**
|
498 |
* Upgrade nag: Plugins Admin
|
499 |
*
|
500 |
* @return string alert message.
|
501 |
*/
|
502 |
private function upgrade_nag_plugins_admin_msg() {
|
503 |
+
$key = 'plugin';
|
504 |
$option_key = $this->generate_key( $key );
|
505 |
if ( get_site_option( $option_key ) == self::VERSION ) return;
|
506 |
+
$msg = sprintf(
|
507 |
+
__( '<p class="dashicons-before dashicons-format-gallery"><strong><a href="%s" target="_blank">Image Widget Plus</a></strong> is coming soon! Add random images, lightbox, and slider - <strong><a href="%s">Sign up now for early access.</a></strong></p>', 'image-widget' ),
|
508 |
'http://m.tri.be/19my',
|
509 |
'http://m.tri.be/19my'
|
510 |
);
|
511 |
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
|
512 |
}
|
513 |
+
|
514 |
/**
|
515 |
* Upgrade nag: Widget Admin
|
516 |
*
|
517 |
* @return string alert message.
|
518 |
*/
|
519 |
private function upgrade_nag_widget_admin_msg() {
|
520 |
+
$key = 'widget';
|
521 |
$option_key = $this->generate_key( $key );
|
522 |
if ( get_site_option( $option_key ) == self::VERSION ) return;
|
523 |
+
$msg = sprintf(
|
524 |
+
__( '<p class="dashicons-before dashicons-star-filled"><strong>Image Widget Plus</strong> - Add lightbox, slideshow, and random image widgets. <strong><a href="%s" target="_blank">Find out how!</a></strong></p>', 'image-widget' ),
|
525 |
'http://m.tri.be/19mx'
|
526 |
);
|
527 |
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize, arabic, brazilian portuguese, dutch, german, hebrew, italian, japanese, polish, spanish, swedish, widget-only
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.7.3
|
7 |
-
Stable tag: 4.4
|
8 |
|
9 |
A simple image widget that uses the native WordPress media manager to add image widgets to your site.
|
10 |
|
@@ -207,6 +207,10 @@ For more info on the philosophy here, check out our [blog post](http://tri.be/de
|
|
207 |
|
208 |
== Changelog ==
|
209 |
|
|
|
|
|
|
|
|
|
210 |
= 4.4 =
|
211 |
|
212 |
* Feature - Add srcset and size attribute support (props @philwp)
|
4 |
Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize, arabic, brazilian portuguese, dutch, german, hebrew, italian, japanese, polish, spanish, swedish, widget-only
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.7.3
|
7 |
+
Stable tag: 4.4.1
|
8 |
|
9 |
A simple image widget that uses the native WordPress media manager to add image widgets to your site.
|
10 |
|
207 |
|
208 |
== Changelog ==
|
209 |
|
210 |
+
= 4.4.1 =
|
211 |
+
|
212 |
+
* Fix - fixed some broken links
|
213 |
+
|
214 |
= 4.4 =
|
215 |
|
216 |
* Feature - Add srcset and size attribute support (props @philwp)
|