WP Gallery Custom Links - Version 1.0.5

Version Description

  • Moving the $post_id code above first_call to avoid messing that up if a return does occur due to a missing post_id
Download this release

Release Info

Developer fourlightsweb
Plugin Icon wp plugin WP Gallery Custom Links
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

Files changed (2) hide show
  1. readme.txt +7 -1
  2. wp-gallery-custom-links.php +16 -16
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-li
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
  Tested up to: 3.3.2
7
- Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -38,6 +38,9 @@ As soon as someone asks me something. :)
38
 
39
  == Changelog ==
40
 
 
 
 
41
  = 1.0.4 =
42
  * The "id" attribute of the gallery shortcode is now supported
43
 
@@ -55,6 +58,9 @@ As soon as someone asks me something. :)
55
 
56
  == Upgrade Notice ==
57
 
 
 
 
58
  = 1.0.4 =
59
  * The "id" attribute of the gallery shortcode is now supported
60
 
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
  Tested up to: 3.3.2
7
+ Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
38
 
39
  == Changelog ==
40
 
41
+ = 1.0.5 =
42
+ * Moving the $post_id code above first_call to avoid messing that up if a return does occur due to a missing post_id
43
+
44
  = 1.0.4 =
45
  * The "id" attribute of the gallery shortcode is now supported
46
 
58
 
59
  == Upgrade Notice ==
60
 
61
+ = 1.0.5 =
62
+ * Moving the $post_id code above first_call to avoid messing that up if a return does occur due to a missing post_id
63
+
64
  = 1.0.4 =
65
  * The "id" attribute of the gallery shortcode is now supported
66
 
wp-gallery-custom-links.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Gallery Custom Links
4
  Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
5
  Description: Specifiy custom links for WordPress gallery images (instead of attachment or file only).
6
- Version: 1.0.4
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
@@ -72,6 +72,21 @@ class WPGalleryCustomLinks {
72
  public static function apply_filter_post_gallery( $output, $attr ) {
73
  global $post;
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  if( self::$first_call ) {
76
  // Our first run, so the gallery function thinks it's being
77
  // overwritten. Set the variable to prevent actual endless
@@ -87,21 +102,6 @@ class WPGalleryCustomLinks {
87
  self::$first_call = true;
88
  return $output;
89
  }
90
-
91
- // Get the shortcode attributes
92
- extract( shortcode_atts( array(), $attr ) );
93
-
94
- // Determine what our postID for attachments is - either
95
- // from our shortcode attr or from $post->ID. If we don't
96
- // have one from either of those places...something weird
97
- // is going on, so just bail.
98
- if( isset( $attr['id'] ) ) {
99
- $post_id = intval( $attr['id'] );
100
- } else if( $post ) {
101
- $post_id = intval( $post->ID );
102
- } else {
103
- return ' ';
104
- }
105
 
106
  // Get the normal gallery shortcode function
107
  if ( isset( $GLOBALS['shortcode_tags'] ) && isset( $GLOBALS['shortcode_tags']['gallery'] ) ) {
3
  Plugin Name: WP Gallery Custom Links
4
  Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
5
  Description: Specifiy custom links for WordPress gallery images (instead of attachment or file only).
6
+ Version: 1.0.5
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
72
  public static function apply_filter_post_gallery( $output, $attr ) {
73
  global $post;
74
 
75
+ // Get the shortcode attributes
76
+ extract( shortcode_atts( array(), $attr ) );
77
+
78
+ // Determine what our postID for attachments is - either
79
+ // from our shortcode attr or from $post->ID. If we don't
80
+ // have one from either of those places...something weird
81
+ // is going on, so just bail.
82
+ if( isset( $attr['id'] ) ) {
83
+ $post_id = intval( $attr['id'] );
84
+ } else if( $post ) {
85
+ $post_id = intval( $post->ID );
86
+ } else {
87
+ return ' ';
88
+ }
89
+
90
  if( self::$first_call ) {
91
  // Our first run, so the gallery function thinks it's being
92
  // overwritten. Set the variable to prevent actual endless
102
  self::$first_call = true;
103
  return $output;
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  // Get the normal gallery shortcode function
107
  if ( isset( $GLOBALS['shortcode_tags'] ) && isset( $GLOBALS['shortcode_tags']['gallery'] ) ) {