Document Gallery - Version 3.5.1

Version Description

  • Bug Fix: There was a minor bug in 3.5 with the new gallery loading logic. It was a compatibility issue with other plugins.
Download this release

Release Info

Developer dan.rossiter
Plugin Icon 128x128 Document Gallery
Version 3.5.1
Comparing to
See all releases

Code changes from version 3.5 to 3.5.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Tags: attachments, thumbnail, documents, gallery, MS office, pdf
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.1
6
  Tested up to: 4.3
7
- Stable tag: 3.5
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -438,6 +438,10 @@ To see a list of features planned for the future as well as to propose your own
438
  ideas for future Document Gallery development, take a look at our
439
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
440
 
 
 
 
 
441
  = 3.5 =
442
  * **Enhancement:** No more waiting a **LONG** time for your new gallery to load. If you create a new gallery and view
443
  it, rendering will complete immediately and the thumbnails will be generated after your gallery initially loads.
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.1
6
  Tested up to: 4.3
7
+ Stable tag: 3.5.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
438
  ideas for future Document Gallery development, take a look at our
439
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
440
 
441
+ = 3.5.1 =
442
+ * **Bug Fix:** There was a minor bug in `3.5` with the new gallery loading logic. It was a compatibility issue with
443
+ other plugins.
444
+
445
  = 3.5 =
446
  * **Enhancement:** No more waiting a **LONG** time for your new gallery to load. If you create a new gallery and view
447
  it, rendering will complete immediately and the thumbnails will be generated after your gallery initially loads.
assets/js/gallery.js CHANGED
@@ -52,14 +52,12 @@
52
  for (var id in response) {
53
  if (response.hasOwnProperty(id)) {
54
  var target = jQuery('.document-icon[data-dg-id="' + id + '"] img');
55
- if (target.attr('src') !== response[id]) {
56
- (function(id, target) {
57
- target.fadeOut('fast', function () {
58
- jQuery(this).attr('src', response[id]);
59
- jQuery(this).fadeIn('fast');
60
- })
61
- })(id, target);
62
- }
63
  }
64
  }
65
 
52
  for (var id in response) {
53
  if (response.hasOwnProperty(id)) {
54
  var target = jQuery('.document-icon[data-dg-id="' + id + '"] img');
55
+ (function(id, target) {
56
+ target.fadeOut('fast', function () {
57
+ jQuery(this).attr('src', response[id]);
58
+ jQuery(this).fadeIn('fast');
59
+ })
60
+ })(id, target);
 
 
61
  }
62
  }
63
 
assets/js/gallery.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){function d(){for(var a=[];c<b.length&&2!==a.length;c++)a.push(b[c]);0!=a.length&&jQuery.post(ajaxurl,{action:"dg_generate_icons",ids:a},e)}function e(a){for(var b in a)if(a.hasOwnProperty(b)){var c=jQuery('.document-icon[data-dg-id="'+b+'"] img');c.attr("src")!==a[b]&&function(b,c){c.fadeOut("fast",function(){jQuery(this).attr("src",a[b]);jQuery(this).fadeIn("fast")})}(b,c)}d()}var b=[],c=0;jQuery(document).ready(function(){jQuery(".document-icon[data-dg-id]").each(function(){var a=jQuery(this).data("dg-id");
2
  -1===jQuery.inArray(a,b)&&b.push(a)});d()})})();
1
+ (function(){function d(){for(var a=[];c<b.length&&2!==a.length;c++)a.push(b[c]);0!=a.length&&jQuery.post(ajaxurl,{action:"dg_generate_icons",ids:a},e)}function e(a){for(var b in a)if(a.hasOwnProperty(b)){var c=jQuery('.document-icon[data-dg-id="'+b+'"] img');(function(b,c){c.fadeOut("fast",function(){jQuery(this).attr("src",a[b]);jQuery(this).fadeIn("fast")})})(b,c)}d()}var b=[],c=0;jQuery(document).ready(function(){jQuery(".document-icon[data-dg-id]").each(function(){var a=jQuery(this).data("dg-id");
2
  -1===jQuery.inArray(a,b)&&b.push(a)});d()})})();
document-gallery.php CHANGED
@@ -5,14 +5,14 @@ defined( 'WPINC' ) OR exit;
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
- Version: 3.5
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
- define( 'DG_VERSION', '3.5' );
16
 
17
  // define helper paths & URLs
18
  define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
5
  Plugin Name: Document Gallery
6
  Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
7
  Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
8
+ Version: 3.5.1
9
  Author: Dan Rossiter
10
  Author URI: http://danrossiter.org/
11
  License: GPLv2
12
  Text Domain: document-gallery
13
  */
14
 
15
+ define( 'DG_VERSION', '3.5.1' );
16
 
17
  // define helper paths & URLs
18
  define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
inc/class-document-gallery.php CHANGED
@@ -78,13 +78,19 @@ class DocumentGallery {
78
 
79
  /**
80
  * Accepts AJAX request containing list of IDs to be generated and returned.
 
 
81
  */
82
  public static function ajaxGenerateIcons() {
83
  $ret = array();
84
 
85
  if ( array_key_exists( 'ids', $_REQUEST ) ) {
86
- foreach ($_REQUEST['ids'] as $id) {
87
- $ret[$id] = DG_Thumber::getThumbnail($id);
 
 
 
 
88
  }
89
  }
90
 
78
 
79
  /**
80
  * Accepts AJAX request containing list of IDs to be generated and returned.
81
+ * Returns associative array mapping ID to thumbnail URL for all icons that were generated,
82
+ * skipping any that could not be processed.
83
  */
84
  public static function ajaxGenerateIcons() {
85
  $ret = array();
86
 
87
  if ( array_key_exists( 'ids', $_REQUEST ) ) {
88
+ foreach ( $_REQUEST['ids'] as $id ) {
89
+ // only return URL if different from default -- default image is already displayed on the client side
90
+ $url = DG_Thumber::getThumbnail( $id );
91
+ if ( $url !== DG_Thumber::getDefaultThumbnail( $id ) ) {
92
+ $ret[$id] = $url;
93
+ }
94
  }
95
  }
96