Document Gallery - Version 1.0.3

Version Description

  • Bug Fix: Resolved issue with detecting plugin directory. (Thanks, Brigitte!)
  • Enhancement: Minor improvement to how linking to individual documents is handled.
Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

Files changed (2) hide show
  1. document-gallery.php +9 -4
  2. readme.txt +22 -16
document-gallery.php CHANGED
@@ -2,13 +2,13 @@
2
  /*
3
  Plugin Name: Document Gallery
4
  Description: Display non-images in gallery format on page.
5
- Version: 1.0.2
6
  Author: Dan Rossiter
7
  Author URI: http://danrossiter.org/
8
  License: GPL2
9
  */
10
 
11
- define( 'DG_URL', plugin_dir_url().'document-gallery/' );
12
 
13
  // CREATE GALLERY STRING //
14
  function dg_get_attachment_icons($atts) {
@@ -38,7 +38,7 @@ function dg_get_attachment_icons($atts) {
38
  $count = 0;
39
  foreach( $attachments as $attachment ) { //setup array for more than one file attachment
40
  $url = wp_get_attachment_url( $attachment->ID );
41
- $title = wp_get_attachment_link( $attachment->ID );
42
  $icon = dg_get_attachment_icon( $attachment->ID, $tile, $url );
43
 
44
  if($descriptions) {
@@ -50,7 +50,7 @@ function dg_get_attachment_icons($atts) {
50
  $attachment_str[] = '<div class="document-icon">';
51
  }
52
 
53
- $attachment_str[] = "<a href=\"$url\">$icon</a><br><a href=\"$url\">$title</a>";
54
 
55
  if($descriptions) {
56
  $attachment_str[] = "</td><td valign=\"top\"><p>$attachment->post_content</p></td></tr>";
@@ -255,4 +255,9 @@ function dg_get_attachment_icon( $id, $title, $url ) {
255
  $icon = '<img src="'.DG_URL.'icons/'.$icon."\" title=\"$title\" alt=\"$title\"/>";
256
  return $icon;
257
  }
 
 
 
 
 
258
  ?>
2
  /*
3
  Plugin Name: Document Gallery
4
  Description: Display non-images in gallery format on page.
5
+ Version: 1.0.3
6
  Author: Dan Rossiter
7
  Author URI: http://danrossiter.org/
8
  License: GPL2
9
  */
10
 
11
+ define( 'DG_URL', plugin_dir_url( __FILE__ ) );
12
 
13
  // CREATE GALLERY STRING //
14
  function dg_get_attachment_icons($atts) {
38
  $count = 0;
39
  foreach( $attachments as $attachment ) { //setup array for more than one file attachment
40
  $url = wp_get_attachment_url( $attachment->ID );
41
+ $title = get_the_title( $attachment->ID );
42
  $icon = dg_get_attachment_icon( $attachment->ID, $tile, $url );
43
 
44
  if($descriptions) {
50
  $attachment_str[] = '<div class="document-icon">';
51
  }
52
 
53
+ $attachment_str[] = "<a href=\"$url\">$icon<br>$title</a>";
54
 
55
  if($descriptions) {
56
  $attachment_str[] = "</td><td valign=\"top\"><p>$attachment->post_content</p></td></tr>";
255
  $icon = '<img src="'.DG_URL.'icons/'.$icon."\" title=\"$title\" alt=\"$title\"/>";
256
  return $icon;
257
  }
258
+ // Filtering attachment_icon was considered, then dismissed in v1.0.3 because it would mean almost
259
+ // doubling the amount of processing for each icon. The native WP function would create the icon,
260
+ // then 99% of the time this function would replace it. Better to just call the native WP function
261
+ // at the end when needed. Filter would look like this:
262
+ // add_filter( 'attachment_icon', 'dg_get_attachment_icon', 10, 2 );v
263
  ?>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: dan.rossiter
3
  Tags: attachments, icons, documents, gallery
4
  Requires at least: 2.6
5
  Tested up to: 3.5
6
- Stable tag: 1.0.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -13,10 +13,11 @@ making them easy to share.
13
  == Description ==
14
 
15
  This plugin allows the user to effortlessly include a gallery, much like a photo gallery,
16
- of all your non-image attachments anywhere within your post.
 
17
 
18
- *NOTE: If you find this plugin useful, please take 10 seconds to rate it so others can find it also. Thanks so
19
- much for your support!*
20
 
21
  == Installation ==
22
 
@@ -60,33 +61,38 @@ code wherever you would like it to appear: `<?php echo do_shortcode('[dg]'); ?>`
60
  = Coming Soon! =
61
 
62
  * Option to include player for any music files uploaded to page.
63
- * Option to open documents directly within your browser (a la [Google Drive Viewer](https://drive.google.com/viewer)).
64
  * Support for adding your own filetypes/icons.
65
  * Whatever else **you** would like (post on the [support forum](http://wordpress.org/support/plugin/document-gallery) if you have ideas)!
66
 
 
 
 
 
 
67
  = 1.0.2 =
68
 
69
- * Merge for changes in 1.0 did not go through correctly so users downloaded the old icon set which broke the functioning. Sorry about that, but
70
  all is resolved with this release!
71
 
72
  = 1.0.1 =
73
 
74
- * Resolved issue with long document titles being cut off in some themes.
75
 
76
  = 1.0 =
77
 
78
- * Optimized gallery generation (faster!)
79
- * Plugin now has **36 icons** representing **72 filetypes**!
80
- * Added fallback to WordPress default icons if you happen to include one of the few filetypes not yet supported.
81
- * Changed shortcode to `[dg]` (`[document gallery]` will still work for backward compatibility).
82
- * Gave documentation some **much needed** revisions.
83
 
84
  = 0.8.5 =
85
 
86
- * Added support for [OpenDocuments](http://en.wikipedia.org/wiki/OpenDocument).
87
 
88
  = 0.8 =
89
 
90
- * First public release of Document Gallery.
91
- * Displays PDF, Word, PowerPoint, Excel, and ZIP documents from a given page or post.
92
- * Documents can be ordered by a number of different factors.
3
  Tags: attachments, icons, documents, gallery
4
  Requires at least: 2.6
5
  Tested up to: 3.5
6
+ Stable tag: 1.0.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
13
  == Description ==
14
 
15
  This plugin allows the user to effortlessly include a gallery, much like a photo gallery,
16
+ of all your non-image attachments anywhere within your post. Read more in the
17
+ **Installation** tab!
18
 
19
+ *If this plugin has helped you, please take a moment to
20
+ [rate it](http://wordpress.org/support/view/plugin-reviews/document-gallery#postform)!*
21
 
22
  == Installation ==
23
 
61
  = Coming Soon! =
62
 
63
  * Option to include player for any music files uploaded to page.
64
+ * Option to open documents directly within your browser (&#224; la [Google Drive Viewer](https://drive.google.com/viewer)).
65
  * Support for adding your own filetypes/icons.
66
  * Whatever else **you** would like (post on the [support forum](http://wordpress.org/support/plugin/document-gallery) if you have ideas)!
67
 
68
+ = 1.0.3 =
69
+
70
+ * **Bug Fix:** Resolved issue with detecting plugin directory. (Thanks, Brigitte!)
71
+ * **Enhancement:** Minor improvement to how linking to individual documents is handled.
72
+
73
  = 1.0.2 =
74
 
75
+ * **Bug Fix:** Merge for changes in 1.0 did not go through correctly so users downloaded the old icon set which broke the functioning. Sorry about that, but
76
  all is resolved with this release!
77
 
78
  = 1.0.1 =
79
 
80
+ * **Bug Fix:** Resolved issue with long document titles being cut off in some themes.
81
 
82
  = 1.0 =
83
 
84
+ * **Enhancement:** Optimized gallery generation (faster!)
85
+ * **Enhancement:** Plugin now has **36 icons** representing **72 filetypes**!
86
+ * **Enhancement:** Added fallback to WordPress default icons if you happen to include one of the few filetypes not yet supported.
87
+ * **Enhancement:** Changed shortcode to `[dg]` (`[document gallery]` will still work for backward compatibility).
88
+ * **Enhancement:** Gave documentation some **much needed** revisions.
89
 
90
  = 0.8.5 =
91
 
92
+ * **Enhancement:** Added support for [OpenDocuments](http://en.wikipedia.org/wiki/OpenDocument).
93
 
94
  = 0.8 =
95
 
96
+ * **Release:** First public release of Document Gallery.
97
+ * **Feature:** Displays PDF, Word, PowerPoint, Excel, and ZIP documents from a given page or post.
98
+ * **Feature:** Documents can be ordered by a number of different factors.