Skip to content

Commit

Permalink
Merge pull request #30 from moderntribe/release/4.4.1
Browse files Browse the repository at this point in the history
Release/4.4.1
  • Loading branch information
zbtirrell authored Apr 17, 2017
2 parents 31d48b5 + 5f212c3 commit ed520bd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
46 changes: 23 additions & 23 deletions image-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/*
Plugin Name: Image Widget
Plugin URI: http://wordpress.org/plugins/image-widget/
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://theeventscalendar.org/products/image-widget-plus/?utm_campaign=in-app&utm_source=docblock&utm_medium=image-widget">Image Widget Plus</a> - Multiple images, slider and more.</strong>
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>
Author: Modern Tribe, Inc.
Version: 4.4
Version: 4.4.1
Author URI: http://m.tri.be/iwpdoc
Text Domain: image-widget
Domain Path: /lang
Expand All @@ -26,7 +26,7 @@ function tribe_load_image_widget() {
**/
class Tribe_Image_Widget extends WP_Widget {

const VERSION = '4.4';
const VERSION = '4.4.1';

const CUSTOM_IMAGE_SIZE_SLUG = 'tribe_image_widget_custom';

Expand Down Expand Up @@ -57,7 +57,7 @@ public function __construct() {
add_action( 'admin_notices', array( $this, 'post_upgrade_nag' ) );

add_action( 'network_admin_notices', array( $this, 'post_upgrade_nag' ) );
add_action( 'wp_ajax_dismissed_image_widget_notice_handler', array( $this, 'ajax_notice_handler' ) );
add_action( 'wp_ajax_dismissed_image_widget_notice_handler', array( $this, 'ajax_notice_handler' ) );
}

/**
Expand Down Expand Up @@ -291,7 +291,7 @@ private function get_image_html( $instance, $include_link = true ) {
$instance['height'] = $image_details[2];
}

$image_srcset = wp_get_attachment_image_srcset( $instance['attachment_id'], $size);
$image_srcset = wp_get_attachment_image_srcset( $instance['attachment_id'], $size );
if ( $image_srcset ) {
$instance['srcset'] = $image_srcset;
}
Expand Down Expand Up @@ -321,10 +321,10 @@ private function get_image_html( $instance, $include_link = true ) {
if ( ! empty( $instance['align'] ) && $instance['align'] != 'none' ) {
$attr['class'] .= " align{$instance['align']}";
}
if ( !empty($instance['srcset'] ) ) {
if ( ! empty( $instance['srcset'] ) ) {
$attr['srcset'] = $instance['srcset'];
}
if ( ! empty($instance['sizes'] ) ) {
if ( ! empty( $instance['sizes'] ) ) {
$attr['sizes'] = $instance['sizes'];
}
$attr = apply_filters( 'image_widget_image_attributes', $attr, $instance );
Expand Down Expand Up @@ -447,11 +447,11 @@ public function post_upgrade_nag() {
break;
case 'widgets.php' :
$msg = $this->upgrade_nag_widget_admin_msg();
break;
break;
}
if ( !$msg ) return;

if ( ! $msg ) return;

echo $msg;
?><script>
jQuery(document).ready(function($){
Expand All @@ -474,54 +474,54 @@ public function post_upgrade_nag() {
/**
* AJAX handler to store the state of dismissible notices.
*/
function ajax_notice_handler() {
public function ajax_notice_handler() {
if ( empty( $_POST['key'] ) ) return;
$key = $this->generate_key( sanitize_text_field( $_POST['key'] ) );
update_site_option( $key, self::VERSION );
}

/**
* Generate version key for admin notice options
*
* @param string $key
* @return string option key
*/
private function generate_key( $key ) {
$option_key = join( "_", array(
$option_key = join( '_', array(
self::VERSION_KEY,
$key
$key,
) );
return $option_key;
}

/**
* Upgrade nag: Plugins Admin
*
* @return string alert message.
*/
private function upgrade_nag_plugins_admin_msg() {
$key = "plugin";
$key = 'plugin';
$option_key = $this->generate_key( $key );
if ( get_site_option( $option_key ) == self::VERSION ) return;
$msg = sprintf(
__( '<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' ),
$msg = sprintf(
__( '<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' ),
'http://m.tri.be/19my',
'http://m.tri.be/19my'
);
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
}

/**
* Upgrade nag: Widget Admin
*
* @return string alert message.
*/
private function upgrade_nag_widget_admin_msg() {
$key = "widget";
$key = 'widget';
$option_key = $this->generate_key( $key );
if ( get_site_option( $option_key ) == self::VERSION ) return;
$msg = sprintf(
__( '<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' ),
$msg = sprintf(
__( '<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' ),
'http://m.tri.be/19mx'
);
return "<div class='notice notice-info is-dismissible image-widget-notice' data-key='$key'>$msg</div>";
Expand Down
16 changes: 10 additions & 6 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: ModernTribe, peterchester, borkweb, zbtirrell
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize, arabic, brazilian portuguese, dutch, german, hebrew, italian, japanese, polish, spanish, swedish, widget-only
Requires at least: 3.5
Tested up to: 4.4.2
Stable tag: 4.4
Tested up to: 4.7.3
Stable tag: 4.4.1

A simple image widget that uses the native WordPress media manager to add image widgets to your site.

Expand All @@ -28,15 +28,15 @@ Need to add slideshows, lightboxes, or random images? Check out [Image Widget Pl

= Quality You Can Trust =

Image Widget is developed and maintained by [Modern Tribe](http://m.tri.be/19md), the same folks behind [The Events Calendar, Event Tickets, and a full suite of premium plugins](http://m.tri.be/19me).
Image Widget is developed and maintained by [Modern Tribe](http://m.tri.be/19md), the same folks behind [The Events Calendar, Event Tickets, and a full suite of premium plugins](http://m.tri.be/19me).

This plugin is actively supported by our team and contributions from community members. If you see a question in the forum you can help with or have a great idea and want to code it up or submit a patch, that would be awesome! Not only will we shower you with praise and thanks, it’s also a good way to get to know us and lead into options for paid work if you freelance.
This plugin is actively supported by our team and contributions from community members. If you see a question in the forum you can help with or have a great idea and want to code it up or submit a patch, that would be awesome! Not only will we shower you with praise and thanks, it’s also a good way to get to know us and lead into options for paid work if you freelance.

= Coming Soon - Image Widget Plus! =

Looking for more features? Our [new Image Widget Plus plugin](http://m.tri.be/19mf) is coming soon!

Image Widget Plus features include:
Image Widget Plus features include:

* Multiple image support
* Random image
Expand All @@ -59,7 +59,7 @@ Getting started with Image Widget is a breeze!

1. Download and install the Image Widget plugin
1. From your WordPress admin screen, select Plugins from the menu
1. Activate the Image Widget plugin
1. Activate the Image Widget plugin
1. Go to Appearance > Widget to place the widget in your sidebar in the Design

If you run into any questions or have suggestions, please visit the forum to post questions or comments.
Expand Down Expand Up @@ -207,6 +207,10 @@ For more info on the philosophy here, check out our [blog post](http://tri.be/de

== Changelog ==

= 4.4.1 =

* Fix - fixed some broken links

= 4.4 =

* Feature - Add srcset and size attribute support (props @philwp)
Expand Down

0 comments on commit ed520bd

Please sign in to comment.