WP Gallery Custom Links - Version 1.10.2

Version Description

  • Added a translation for Portuguese, courtesy of Carlos Jordo (thanks!)
  • Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
  • Tested with WordPress 4.2
Download this release

Release Info

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

Code changes from version 1.10.1 to 1.10.2

languages/wp-gallery-custom-links-pt_BR.mo ADDED
Binary file
languages/wp-gallery-custom-links-pt_BR.po ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 WP Gallery Custom Links
2
+ # This file is distributed under the same license as the WP Gallery Custom Links package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: WP Gallery Custom Links 1.10.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-gallery-custom-links\n"
7
+ "POT-Creation-Date: 2015-04-19 16:39-0300\n"
8
+ "PO-Revision-Date: 2015-04-19 16:39-0300\n"
9
+ "Last-Translator: Carlos Jordao <carlosjordao@gmail.com>\n"
10
+ "Language-Team: <LL@li.org>\n"
11
+ "Language: pt_BR\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.5.4\n"
16
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
19
+ "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
20
+ "X-Poedit-Basepath: ./\n"
21
+ "X-Textdomain-Support: yes\n"
22
+ "X-Poedit-SearchPath-0: ..\n"
23
+
24
+ #: ../wp-gallery-custom-links.php:79
25
+ msgid "Gallery Link URL"
26
+ msgstr "URL do Atalho"
27
+
28
+ #: ../wp-gallery-custom-links.php:82
29
+ msgid ""
30
+ "Will replace \"Image File\" or \"Attachment Page\" link for this image in "
31
+ "galleries. Use [none] to remove the link from this image in galleries."
32
+ msgstr ""
33
+ "Irá trocar atalho para \"Arquivo da Imagem\" ou \"Página anexa\" desta "
34
+ "imagem nas galerias. Use [none] para remover o atalho desta imagem nas "
35
+ "galerias."
36
+
37
+ #: ../wp-gallery-custom-links.php:91
38
+ msgid "Gallery Link Target"
39
+ msgstr "Alvo do atalho"
40
+
41
+ #: ../wp-gallery-custom-links.php:94
42
+ msgid ""
43
+ "This setting will be applied to this image in galleries regardless of "
44
+ "whether or not a Gallery Link URL has been specified."
45
+ msgstr ""
46
+ "Esta opção será aplicada a esta imagem nas galerias independentemente do "
47
+ "link ter sido especificado ou não."
48
+
49
+ #: ../wp-gallery-custom-links.php:100
50
+ msgid "Same Window"
51
+ msgstr "Mesma janela"
52
+
53
+ #: ../wp-gallery-custom-links.php:101
54
+ msgid "New Window"
55
+ msgstr "Nova janela"
56
+
57
+ #: ../wp-gallery-custom-links.php:107
58
+ msgid "Gallery Link OnClick Effect"
59
+ msgstr "Efeitos de OnClick dos atalhos"
60
+
61
+ #: ../wp-gallery-custom-links.php:110
62
+ msgid ""
63
+ "Lightbox and other OnClick events are removed by default from this image in "
64
+ "galleries. This setting will only be applied to this image in galleries if "
65
+ "this image has a Gallery Link URL specified."
66
+ msgstr ""
67
+ "Lighbox e outros eventos OnClick são removidos normalmente desta imagem nas "
68
+ "galerias. Esta configuração apenas será aplicada para esta imagem nas "
69
+ "galerias se esta imagem tiver uma URL de Atalho de Galeria especificado."
70
+
71
+ #: ../wp-gallery-custom-links.php:116
72
+ msgid "Remove"
73
+ msgstr "Remover"
74
+
75
+ #: ../wp-gallery-custom-links.php:117
76
+ msgid "Keep"
77
+ msgstr "Manter"
78
+
79
+ #: ../wp-gallery-custom-links.php:122
80
+ msgid "Gallery Link Additional CSS Classes"
81
+ msgstr "Classes CSS adicionais"
82
+
83
+ #: ../wp-gallery-custom-links.php:125
84
+ msgid ""
85
+ "Additional CSS classes specified here will be applied to the "
86
+ "<strong><em>link</em></strong> around this image in galleries regardless of "
87
+ "whether or not a Gallery Link URL has been specified."
88
+ msgstr ""
89
+ "Classes CSS extras especificadas aqui serão aplicadas para o "
90
+ "<strong><em>atalho</em></strong> relativo a esta imagem em galerias "
91
+ "independentemente de um atalho ter sido especificado."
92
+
93
+ #~ msgid "WP Gallery Custom Links"
94
+ #~ msgstr "Atalhos customizáveis do WP Gallery"
95
+
96
+ #~ msgid ""
97
+ #~ "http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/"
98
+ #~ msgstr ""
99
+ #~ "http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/"
100
+
101
+ #~ msgid ""
102
+ #~ "Specify custom links for WordPress gallery images (instead of attachment "
103
+ #~ "or file only)."
104
+ #~ msgstr ""
105
+ #~ "Especifique atalhos customizados para as imagens de galeria do WordPress "
106
+ #~ "(ao invés de anexar apenas)"
107
+
108
+ #~ msgid "Four Lights Web Development"
109
+ #~ msgstr "Four Lights Web Development"
110
+
111
+ #~ msgid "http://www.fourlightsweb.com"
112
+ #~ msgstr "http://www.fourlightsweb.com"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fourlightsweb
3
  Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/#donate
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.1
6
- Tested up to: 4.0
7
- Stable tag: 1.10.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -133,7 +133,13 @@ doesn't alter layout or styling - that's something you'd need to change in your
133
  plugin you may be using to display the gallery. Note: if you're using [none] to remove links from gallery
134
  images, it may affect the styling, depending on whether your stylesheet is expecting all gallery images
135
  to have `<a>` tags around them, in which case you would need to modify your stylesheet to also apply
136
- the same styles to `<img>` tags without a link around them.
 
 
 
 
 
 
137
 
138
  == Screenshots ==
139
 
@@ -141,6 +147,11 @@ the same styles to `<img>` tags without a link around them.
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = 1.10.1 =
145
  * Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
146
  * Added a translation for Spanish, courtesy of Andrew Kurtis of WebHostingHub (thanks!)
@@ -241,6 +252,11 @@ directly attached to the post.
241
 
242
  == Upgrade Notice ==
243
 
 
 
 
 
 
244
  = 1.10.1 =
245
  * Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
246
  * Added a translation for Spanish, courtesy of Andrew Kurtis of WebHostingHub (thanks!)
3
  Donate link: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/#donate
4
  Tags: gallery links, gallery link, gallery
5
  Requires at least: 3.3.1
6
+ Tested up to: 4.2
7
+ Stable tag: 1.10.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
133
  plugin you may be using to display the gallery. Note: if you're using [none] to remove links from gallery
134
  images, it may affect the styling, depending on whether your stylesheet is expecting all gallery images
135
  to have `<a>` tags around them, in which case you would need to modify your stylesheet to also apply
136
+ the same styles to `<img>` tags without a link around them.
137
+
138
+ = #8) I have a lightbox/carousel set up when a user clicks an image, and I would like to make the image in the lightbox/carousel window link to the custom link. How can I accomplish this? =
139
+
140
+ Unfortunately those images are placed in those locations via your particular lightbox/carousel javascript library,
141
+ which this plugin isn't able to hook into to modify. You would need to modify your javascript library or theme to
142
+ accomplish this, which is outside the scope of this plugin.
143
 
144
  == Screenshots ==
145
 
147
 
148
  == Changelog ==
149
 
150
+ = 1.10.2 =
151
+ * Added a translation for Portuguese, courtesy of Carlos Jordão (thanks!)
152
+ * Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
153
+ * Tested with WordPress 4.2
154
+
155
  = 1.10.1 =
156
  * Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
157
  * Added a translation for Spanish, courtesy of Andrew Kurtis of WebHostingHub (thanks!)
252
 
253
  == Upgrade Notice ==
254
 
255
+ = 1.10.2 =
256
+ * Added a translation for Portuguese, courtesy of Carlos Jordão (thanks!)
257
+ * Added the U ungreedy modifier to regular expressions to attempt to resolve occasional not-easily-reproduced blank page issues
258
+ * Tested with WordPress 4.2
259
+
260
  = 1.10.1 =
261
  * Changed javascript to queue in wp_enqueue_scripts hook instead of the all-encompassing init.
262
  * Added a translation for Spanish, courtesy of Andrew Kurtis of WebHostingHub (thanks!)
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: Specify custom links for WordPress gallery images (instead of attachment or file only).
6
- Version: 1.10.1
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
@@ -301,7 +301,7 @@ class WPGalleryCustomLinks {
301
  for( $j = 0; $j < 10; $j++ ) {
302
  $needle_parts = explode( '.wp.com', jetpack_photon_url( $needle ) );
303
  if( count( $needle_parts ) == 2 ) {
304
- $needle_part_1 = preg_replace( '/\d+$/', '', $needle_parts[0] );
305
  $needle_part_2 = '.wp.com' . $needle_parts[1];
306
  $needle_reassembled = $needle_part_1 . $j . $needle_part_2;
307
  $output = self::replace_link( $needle_reassembled, $link, $target, $preserve_click, $remove_link, $additional_css_classes, $output );
@@ -331,7 +331,7 @@ class WPGalleryCustomLinks {
331
  // Build the regex for matching/replacing
332
  $needle = preg_quote( $default_link );
333
  $needle = str_replace( '/', '\/', $needle );
334
- $needle = '/href\s*=\s*["\']' . $needle . '["\']/';
335
  if( preg_match( $needle, $output ) > 0 ) {
336
  if( $additional_css_classes != '' ) {
337
  $classes_to_add = $additional_css_classes . ' ';
@@ -430,13 +430,13 @@ class WPGalleryCustomLinks {
430
  // javascript later
431
  if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
432
  // href comes before class
433
- $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*>)/', '$1 '.$class.'$2', $output );
434
  } elseif( preg_match( '/<a[^>]*class\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
435
  // href comes after class
436
- $output = preg_replace( '/(<a[^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/', '$1 '.$class.'$2', $output );
437
  } else {
438
  // No previous class
439
- $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/', '$1 class="'.$class.'"$2', $output );
440
  } // End if we have a class on the a tag or not
441
 
442
  return $output;
@@ -450,13 +450,13 @@ class WPGalleryCustomLinks {
450
  // Add a target to the link (or overwrite what's there)
451
  if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
452
  // href comes before target
453
- $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*>)/', '$1'.$target.'$2', $output );
454
  } elseif( preg_match( '/<a[^>]*target\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
455
  // href comes after target
456
- $output = preg_replace( '/(<a[^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/', '$1'.$target.'$2', $output );
457
  } else {
458
  // No previous target
459
- $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/', '$1 target="'.$target.'"$2', $output );
460
  } // End if we have a class on the a tag or not
461
 
462
  return $output;
3
  Plugin Name: WP Gallery Custom Links
4
  Plugin URI: http://www.fourlightsweb.com/wordpress-plugins/wp-gallery-custom-links/
5
  Description: Specify custom links for WordPress gallery images (instead of attachment or file only).
6
+ Version: 1.10.2
7
  Author: Four Lights Web Development
8
  Author URI: http://www.fourlightsweb.com
9
  License: GPL2
301
  for( $j = 0; $j < 10; $j++ ) {
302
  $needle_parts = explode( '.wp.com', jetpack_photon_url( $needle ) );
303
  if( count( $needle_parts ) == 2 ) {
304
+ $needle_part_1 = preg_replace( '/\d+$/U', '', $needle_parts[0] );
305
  $needle_part_2 = '.wp.com' . $needle_parts[1];
306
  $needle_reassembled = $needle_part_1 . $j . $needle_part_2;
307
  $output = self::replace_link( $needle_reassembled, $link, $target, $preserve_click, $remove_link, $additional_css_classes, $output );
331
  // Build the regex for matching/replacing
332
  $needle = preg_quote( $default_link );
333
  $needle = str_replace( '/', '\/', $needle );
334
+ $needle = '/href\s*=\s*["\']' . $needle . '["\']/U';
335
  if( preg_match( $needle, $output ) > 0 ) {
336
  if( $additional_css_classes != '' ) {
337
  $classes_to_add = $additional_css_classes . ' ';
430
  // javascript later
431
  if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
432
  // href comes before class
433
+ $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*>)/U', '$1 '.$class.'$2', $output );
434
  } elseif( preg_match( '/<a[^>]*class\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
435
  // href comes after class
436
+ $output = preg_replace( '/(<a[^>]*class\s*=\s*["\'][^"\']*)(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/U', '$1 '.$class.'$2', $output );
437
  } else {
438
  // No previous class
439
+ $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/U', '$1 class="'.$class.'"$2', $output );
440
  } // End if we have a class on the a tag or not
441
 
442
  return $output;
450
  // Add a target to the link (or overwrite what's there)
451
  if( preg_match( '/<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'][^"\']*["\'][^>]*>/', $output ) > 0 ) {
452
  // href comes before target
453
+ $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*>)/U', '$1'.$target.'$2', $output );
454
  } elseif( preg_match( '/<a[^>]*target\s*=\s*["\'][^"\']*["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>/', $output ) > 0 ) {
455
  // href comes after target
456
+ $output = preg_replace( '/(<a[^>]*target\s*=\s*["\'])[^"\']*(["\'][^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*>)/U', '$1'.$target.'$2', $output );
457
  } else {
458
  // No previous target
459
+ $output = preg_replace( '/(<a[^>]*href\s*=\s*["\']' . $needle . '["\'][^>]*)(>)/U', '$1 target="'.$target.'"$2', $output );
460
  } // End if we have a class on the a tag or not
461
 
462
  return $output;