Document Gallery - Version 2.2.3

Version Description

  • Enhancement: This will only be relevant to developers. %descriptions% tag is now available in the dg_icon_template filter.
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.2.3

Files changed (3) hide show
  1. README.txt +7 -2
  2. document-gallery.php +2 -2
  3. inc/class-document.php +13 -11
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: 3.6
6
  Tested up to: 4.0
7
- Stable tag: 2.2.1
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -251,7 +251,7 @@ the document that will be used in generating this icon. The first
251
  argument is a bool value which indicates whether descriptions will
252
  be used along with the icon and the second value is an integer WordPress
253
  attachment ID which may be used to lookup any relevant information
254
- you need specific to that document. The filter exposes 4 special tags
255
  which are replaced during gallery generation with document-specific data.
256
  These tags are as follows:
257
 
@@ -259,6 +259,7 @@ These tags are as follows:
259
  * **%img%**: The URL pointing the the image that will be displayed.
260
  * **%title%**: The human-readable title of the attachment.
261
  * **%title_attribute%**: The escaped title (above), safe for using HTML tag attributes.
 
262
 
263
 
264
  **Filter Thumbnail Generation Methods**
@@ -392,6 +393,10 @@ To see a list of features planned for the future as well as to propose your own
392
  ideas for future Document Gallery development, take a look at our
393
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
394
 
 
 
 
 
395
  = 2.2.2 =
396
  * **Bug Fix:** Resolves minor issue in `2.2.1` that resulted in a warning being
397
  logged while interacting with the new thumbnail management table in the
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: 3.6
6
  Tested up to: 4.0
7
+ Stable tag: 2.2.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
251
  argument is a bool value which indicates whether descriptions will
252
  be used along with the icon and the second value is an integer WordPress
253
  attachment ID which may be used to lookup any relevant information
254
+ you need specific to that document. The filter exposes 5 special tags
255
  which are replaced during gallery generation with document-specific data.
256
  These tags are as follows:
257
 
259
  * **%img%**: The URL pointing the the image that will be displayed.
260
  * **%title%**: The human-readable title of the attachment.
261
  * **%title_attribute%**: The escaped title (above), safe for using HTML tag attributes.
262
+ * **%description%**: The attachment description (only present when rendering descriptions).
263
 
264
 
265
  **Filter Thumbnail Generation Methods**
393
  ideas for future Document Gallery development, take a look at our
394
  [issue tracker](https://github.com/thenadz/document-gallery/issues).
395
 
396
+ = 2.2.3 =
397
+ * **Enhancement:** This will only be relevant to developers. `%descriptions%` tag
398
+ is now available in the `dg_icon_template` filter.
399
+
400
  = 2.2.2 =
401
  * **Bug Fix:** Resolves minor issue in `2.2.1` that resulted in a warning being
402
  logged while interacting with the new thumbnail management table in the
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: 2.2.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', '2.2.1');
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: 2.2.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', '2.2.3');
16
 
17
  // define helper paths & URLs
18
  define('DG_BASENAME', plugin_basename(__FILE__));
inc/class-document.php CHANGED
@@ -50,32 +50,34 @@ class DG_Document {
50
  * @return string
51
  */
52
  public function __toString() {
53
- static $find = null;
54
- if (is_null($find)) {
55
- $find = array("%link%", "%img%", "%title_attribute%", "%title%");
56
- }
57
-
58
  $thumb = $this->gallery->useFancyThumbs()
59
  ? DG_Thumber::getThumbnail($this->ID)
60
  : DG_Thumber::getDefaultThumbnail($this->ID);
61
 
62
  $repl = array($this->link, $thumb, $this->title_attribute, $this->title);
 
 
 
 
 
 
 
 
 
63
 
 
64
  $doc_icon = apply_filters(
65
  'dg_icon_template',
66
  ' <div class="document-icon">' . PHP_EOL .
67
  ' <a href="%link%"><img src="%img%" title="%title_attribute%" alt="%title_attribute%" /><br>%title%</a>' . PHP_EOL .
 
68
  ' </div>' . PHP_EOL,
69
  $this->gallery->useDescriptions(),
70
  $this->ID);
71
-
72
  $core = str_replace($find, $repl, $doc_icon);
73
-
74
- if($this->gallery->useDescriptions()) {
75
- $core .= " <p>$this->description</p>" . PHP_EOL;
76
- }
77
 
78
- // users may filter icon here
79
  return apply_filters('dg_doc_icon', $core, $this->ID, $this->gallery->useDescriptions());
80
  }
81
  }
50
  * @return string
51
  */
52
  public function __toString() {
 
 
 
 
 
53
  $thumb = $this->gallery->useFancyThumbs()
54
  ? DG_Thumber::getThumbnail($this->ID)
55
  : DG_Thumber::getDefaultThumbnail($this->ID);
56
 
57
  $repl = array($this->link, $thumb, $this->title_attribute, $this->title);
58
+ $find = array('%link%', '%img%', '%title_attribute%', '%title%');
59
+ $description = '';
60
+
61
+ // if descriptions then add filterable tag and value to replaced tag
62
+ if ($this->gallery->useDescriptions()) {
63
+ $repl[] = $this->description;
64
+ $find[] = '%description%';
65
+ $description = ' <p>%description%</p>';
66
+ }
67
 
68
+ // allow developers to filter icon output
69
  $doc_icon = apply_filters(
70
  'dg_icon_template',
71
  ' <div class="document-icon">' . PHP_EOL .
72
  ' <a href="%link%"><img src="%img%" title="%title_attribute%" alt="%title_attribute%" /><br>%title%</a>' . PHP_EOL .
73
+ $description .
74
  ' </div>' . PHP_EOL,
75
  $this->gallery->useDescriptions(),
76
  $this->ID);
77
+
78
  $core = str_replace($find, $repl, $doc_icon);
 
 
 
 
79
 
80
+ // deprecated: users may filter icon here
81
  return apply_filters('dg_doc_icon', $core, $this->ID, $this->gallery->useDescriptions());
82
  }
83
  }