WP Gallery Custom Links - Version 1.5.0

Version Description

  • By popular demand, added support for Jetpack tiled galleries (and its use of the Photon CDN for URLs).
Download this release

Release Info

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

Code changes from version 1.4.0 to 1.5.0

Files changed (2) hide show
  1. readme.txt +9 -1
  2. wp-gallery-custom-links.php +20 -1
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.5
7
- Stable tag: 1.4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -65,6 +65,10 @@ that function outside of the WordPress [gallery] shortcode.
65
 
66
  == Changelog ==
67
 
 
 
 
 
68
  = 1.4.0 =
69
  * By popular demand, added an option to remove or keep Lightbox and other OnClick
70
  events ("remove" by default).
@@ -117,6 +121,10 @@ directly attached to the post.
117
 
118
  == Upgrade Notice ==
119
 
 
 
 
 
120
  = 1.4.0 =
121
  * By popular demand, added an option to remove or keep Lightbox and other OnClick
122
  events ("remove" by default).
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.2
6
  Tested up to: 3.5
7
+ Stable tag: 1.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.5.0 =
69
+ * By popular demand, added support for Jetpack tiled galleries (and its use
70
+ of the Photon CDN for URLs).
71
+
72
  = 1.4.0 =
73
  * By popular demand, added an option to remove or keep Lightbox and other OnClick
74
  events ("remove" by default).
121
 
122
  == Upgrade Notice ==
123
 
124
+ = 1.5.0 =
125
+ * By popular demand, added support for Jetpack tiled galleries (and its use
126
+ of the Photon CDN for URLs).
127
+
128
  = 1.4.0 =
129
  * By popular demand, added an option to remove or keep Lightbox and other OnClick
130
  events ("remove" by default).
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.4.0
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
@@ -193,6 +193,25 @@ class WPGalleryCustomLinks {
193
  // Replace the file href
194
  list( $needle ) = wp_get_attachment_image_src( $attachment_id, '' );
195
  $output = self::replace_link( $needle, $link, $target, $preserve_click, $output );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
  // Replace all possible file sizes - some themes etc.
198
  // may use sizes other than the full version
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.5.0
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
193
  // Replace the file href
194
  list( $needle ) = wp_get_attachment_image_src( $attachment_id, '' );
195
  $output = self::replace_link( $needle, $link, $target, $preserve_click, $output );
196
+ // Also, in case of jetpack photon with tiled galleries...
197
+ if( function_exists( 'jetpack_photon_url' ) ) {
198
+ // The CDN url currently is generated with "$subdomain = rand( 0, 2 );",
199
+ // and then "$photon_url = "http://i{$subdomain}.wp.com/$image_host_path";".
200
+ // So just to cover our bases, loop over a slightly larger range of numbers
201
+ // to make sure we include all possibilities for what the photon url
202
+ // could be. The max $j value may need to be increased someday if they
203
+ // get a lot busier. Also the URL could change. I guess I'll cross
204
+ // those bridges when we come to them. Blah.
205
+ for( $j = 0; $j < 10; $j++ ) {
206
+ $needle_parts = explode( '.wp.com', jetpack_photon_url( $needle ) );
207
+ if( count( $needle_parts ) == 2 ) {
208
+ $needle_part_1 = preg_replace( '/\d+$/', '', $needle_parts[0] );
209
+ $needle_part_2 = '.wp.com' . $needle_parts[1];
210
+ $needle_reassembled = $needle_part_1 . $j . $needle_part_2;
211
+ $output = self::replace_link( $needle_reassembled, $link, $target, $preserve_click, $output );
212
+ }
213
+ }
214
+ }
215
 
216
  // Replace all possible file sizes - some themes etc.
217
  // may use sizes other than the full version