Document Gallery - Version 3.5.4

Version Description

  • Bug Fix: There were issues in the structure of HTML generated for galleries. This resulted in issues with icon generation.
  • Notice: For any developers using PHP filters with Document Gallery, the structure of the content being filtered in dg_gallery_template has changed. Documentation has been updated accordingly.
Download this release

Release Info

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

Code changes from version 3.5.3 to 3.5.4

Files changed (3) hide show
  1. README.txt +9 -2
  2. document-gallery.php +2 -2
  3. inc/class-gallery.php +7 -6
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.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -250,9 +250,10 @@ allows you to handle galleries with and without descriptions differently.
250
  If you wish to wrap your galleries in some additional content,
251
  the `dg_gallery_template` is the tool for the job. With it you can include
252
  content prior to or following your document galleries. The filter
253
- exposes 1 special tag which is replaced during gallery generation
254
  with data specific to that gallery. The tag is described below:
255
 
 
256
  * **%rows%**: This tag is replaced by all of the document gallery rows.
257
  Everything before this string will be rendered before the gallery and
258
  everything after this string will be rendered following the gallery.
@@ -438,6 +439,12 @@ 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.3 =
442
  * **Bug Fix:** The `images` attribute was not being parsed correctly. Thanks to
443
  [kalico](https://wordpress.org/support/profile/kalico) for pointing this out!
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.4
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
250
  If you wish to wrap your galleries in some additional content,
251
  the `dg_gallery_template` is the tool for the job. With it you can include
252
  content prior to or following your document galleries. The filter
253
+ exposes 2 special tags which are replaced during gallery generation
254
  with data specific to that gallery. The tag is described below:
255
 
256
+ * **%id%**: This tag is replaced by the document gallery HTML id attribute.
257
  * **%rows%**: This tag is replaced by all of the document gallery rows.
258
  Everything before this string will be rendered before the gallery and
259
  everything after this string will be rendered following the gallery.
439
  ideas for future Document Gallery development, take a look at our
440
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
441
 
442
+ = 3.5.4 =
443
+ * **Bug Fix:** There were issues in the structure of HTML generated for galleries. This resulted in issues
444
+ with icon generation.
445
+ * **Notice:** For any developers using PHP filters with Document Gallery, the structure of the content being
446
+ filtered in `dg_gallery_template` has changed. Documentation has been updated accordingly.
447
+
448
  = 3.5.3 =
449
  * **Bug Fix:** The `images` attribute was not being parsed correctly. Thanks to
450
  [kalico](https://wordpress.org/support/profile/kalico) for pointing this out!
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.3
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.3' );
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.4
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.4' );
16
 
17
  // define helper paths & URLs
18
  define( 'DG_BASENAME', plugin_basename( __FILE__ ) );
inc/class-gallery.php CHANGED
@@ -794,7 +794,7 @@ class DG_Gallery {
794
  */
795
  public function __toString() {
796
  static $instance = 0;
797
- $instance ++;
798
 
799
  static $find = null;
800
  if ( is_null( $find ) ) {
@@ -809,9 +809,10 @@ class DG_Gallery {
809
  return self::$no_docs;
810
  }
811
 
 
812
  $selector = "document-gallery-$instance";
813
  $template =
814
- "<div id='$selector' class='%class%'>" . PHP_EOL .
815
  '%icons%' . PHP_EOL .
816
  '</div>' . PHP_EOL;
817
 
@@ -840,7 +841,7 @@ class DG_Gallery {
840
  // .document-icon as style attribute in element.
841
  if ( apply_filters( 'dg_use_default_gallery_style', true ) ) {
842
  $itemwidth = $cols > 0 ? ( floor( 100 / $cols ) - 1 ) : 100;
843
- $core .= "<style type='text/css'>#$selector .document-icon{width:$itemwidth%}</style>";
844
  }
845
 
846
  for ( $i = 0; $i < $count; $i += $cols ) {
@@ -855,9 +856,9 @@ class DG_Gallery {
855
  }
856
  }
857
 
858
- // allow user to wrap gallery output
859
- $gallery = apply_filters( 'dg_gallery_template', '%rows%', $this->useDescriptions() );
860
 
861
- return self::$comment . str_replace( '%rows%', $core, $gallery );
862
  }
863
  }
794
  */
795
  public function __toString() {
796
  static $instance = 0;
797
+ $instance++;
798
 
799
  static $find = null;
800
  if ( is_null( $find ) ) {
809
  return self::$no_docs;
810
  }
811
 
812
+ $style = '';
813
  $selector = "document-gallery-$instance";
814
  $template =
815
+ "<div class='%class%'>" . PHP_EOL .
816
  '%icons%' . PHP_EOL .
817
  '</div>' . PHP_EOL;
818
 
841
  // .document-icon as style attribute in element.
842
  if ( apply_filters( 'dg_use_default_gallery_style', true ) ) {
843
  $itemwidth = $cols > 0 ? ( floor( 100 / $cols ) - 1 ) : 100;
844
+ $style = "<style type='text/css'>#$selector .document-icon{width:$itemwidth%}</style>" . PHP_EOL;
845
  }
846
 
847
  for ( $i = 0; $i < $count; $i += $cols ) {
856
  }
857
  }
858
 
859
+ // allow user to filter gallery wrapper
860
+ $gallery = apply_filters( 'dg_gallery_template', '<div id="%id%">' . PHP_EOL . '%rows%</div>', $this->useDescriptions() );
861
 
862
+ return self::$comment . $style . str_replace( array( '%id%', '%rows%' ), array( $selector, $core ), $gallery );
863
  }
864
  }