Responsive Lightbox & Gallery - Version 1.4.7

Version Description

  • New: Option to modify native WP gallery links image size
  • New: Option to donate this plugin :)
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Responsive Lightbox & Gallery
Version 1.4.7
Comparing to
See all releases

Code changes from version 1.4.6 to 1.4.7

Files changed (4) hide show
  1. css/admin.css +2 -0
  2. js/admin.js +8 -0
  3. readme.txt +12 -6
  4. responsive-lightbox.php +84 -7
css/admin.css CHANGED
@@ -4,6 +4,8 @@
4
  .df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
5
  .df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
6
  .df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
 
 
7
  .responsive-lightbox-settings { margin-right: 300px; }
8
  .responsive-lightbox-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
9
  .responsive-lightbox-settings form { float: left; min-width: 463px; width: auto; }
4
  .df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
5
  .df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
6
  .df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
7
+ .responsive-lightbox-settings .df-credits form { min-width: 260px; margin-bottom: 1em; }
8
+ .responsive-lightbox-settings .df-credits form input { margin: 0; padding: 0; }
9
  .responsive-lightbox-settings { margin-right: 300px; }
10
  .responsive-lightbox-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
11
  .responsive-lightbox-settings form { float: left; min-width: 463px; width: auto; }
js/admin.js CHANGED
@@ -86,6 +86,14 @@ jQuery(document).ready(function($) {
86
  $('#rl_custom_events').fadeOut(300);
87
  }
88
  });
 
 
 
 
 
 
 
 
89
 
90
  $(document).on('click', 'input#reset_rl_configuration', function(event) {
91
  return confirm(rlArgs.resetScriptToDefaults);
86
  $('#rl_custom_events').fadeOut(300);
87
  }
88
  });
89
+
90
+ $(document).on('change', '#rl-enable-gallery-image-size-yes, #rl-enable-gallery-image-size-no', function(event) {
91
+ if($(this).val() === 'yes') {
92
+ $('#rl_gallery_image_size').fadeIn(300);
93
+ } else {
94
+ $('#rl_gallery_image_size').fadeOut(300);
95
+ }
96
+ });
97
 
98
  $(document).on('click', 'input#reset_rl_configuration', function(event) {
99
  return confirm(rlArgs.resetScriptToDefaults);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
5
  Requires at least: 3.3
6
- Tested up to: 3.9.1
7
- Stable tag: 1.4.6
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -23,6 +23,7 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
23
  * Automatically add lightbox to WordPress image links
24
  * Automatically add lightbox to WordPress video links (YouTube, Vimeo)
25
  * Option to display single post images as a gallery
 
26
  * Option to trigger lightbox on custom jquery events
27
  * Enter a selector for lightbox
28
  * Highly customizable settings for each of the lightbox scripts
@@ -42,7 +43,7 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
42
  * Polish - by Bartosz Arendt
43
  * Russian - by [Konstantin](http://l-konstantin.ru)
44
  * Serbo-Croatian - by [Borisa Djuraskovic](http://www.webhostinghub.com/)
45
- * Slovak - by [Patrik �ec](http://patwist.com)
46
  * Spanish - by [Gaston](http://www.detodoynada.com.ar)
47
 
48
 
@@ -63,8 +64,12 @@ No questions yet.
63
 
64
  == Changelog ==
65
 
 
 
 
 
66
  = 1.4.6 =
67
- * New: Slovak translation, thanks to [Patrik �ec](http://patwist.com)
68
 
69
  = 1.4.5 =
70
  * New: Russian translation, thanks to [Konstantin](http://l-konstantin.ru)
@@ -163,5 +168,6 @@ Initial release
163
 
164
  == Upgrade Notice ==
165
 
166
- = 1.4.6 =
167
- * New: Slovak translation, thanks to [Patrik �ec](http://patwist.com)
 
3
  Donate link: http://www.dfactory.eu/
4
  Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
5
  Requires at least: 3.3
6
+ Tested up to: 3.9.2
7
+ Stable tag: 1.4.7
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
23
  * Automatically add lightbox to WordPress image links
24
  * Automatically add lightbox to WordPress video links (YouTube, Vimeo)
25
  * Option to display single post images as a gallery
26
+ * Option to modify native WP gallery links image size
27
  * Option to trigger lightbox on custom jquery events
28
  * Enter a selector for lightbox
29
  * Highly customizable settings for each of the lightbox scripts
43
  * Polish - by Bartosz Arendt
44
  * Russian - by [Konstantin](http://l-konstantin.ru)
45
  * Serbo-Croatian - by [Borisa Djuraskovic](http://www.webhostinghub.com/)
46
+ * Slovak - by [Patrik Zec](http://patwist.com)
47
  * Spanish - by [Gaston](http://www.detodoynada.com.ar)
48
 
49
 
64
 
65
  == Changelog ==
66
 
67
+ = 1.4.7 =
68
+ * New: Option to modify native WP gallery links image size
69
+ * New: Option to donate this plugin :)
70
+
71
  = 1.4.6 =
72
+ * New: Slovak translation, thanks to [Patrik Zec](http://patwist.com)
73
 
74
  = 1.4.5 =
75
  * New: Russian translation, thanks to [Konstantin](http://l-konstantin.ru)
168
 
169
  == Upgrade Notice ==
170
 
171
+ = 1.4.7 =
172
+ * New: Option to modify native WP gallery links image size
173
+ * New: Option to donate this plugin :)
responsive-lightbox.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Responsive Lightbox
4
  Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
5
- Version: 1.4.6
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
@@ -29,6 +29,8 @@ class Responsive_Lightbox
29
  'script' => 'swipebox',
30
  'selector' => 'lightbox',
31
  'galleries' => true,
 
 
32
  'videos' => true,
33
  'image_links' => true,
34
  'images_as_gallery' => false,
@@ -109,7 +111,7 @@ class Responsive_Lightbox
109
  'quit_on_document_click' => true
110
  )
111
  ),
112
- 'version' => '1.4.6'
113
  );
114
  private $scripts = array();
115
  private $options = array();
@@ -168,13 +170,16 @@ class Responsive_Lightbox
168
  add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
169
  add_filter('post_gallery', array(&$this, 'gallery_attributes'), 1000);
170
 
171
- if($this->options['settings']['galleries'] === TRUE)
172
  add_filter('wp_get_attachment_link', array(&$this, 'add_gallery_lightbox_selector'), 1000, 6);
 
 
 
173
 
174
- if($this->options['settings']['videos'] === TRUE)
175
  add_filter('the_content', array(&$this, 'add_videos_lightbox_selector'));
176
 
177
- if($this->options['settings']['image_links'] === TRUE || $this->options['settings']['images_as_gallery'] === TRUE)
178
  add_filter('the_content', array(&$this, 'add_links_lightbox_selector'));
179
  }
180
 
@@ -470,6 +475,7 @@ class Responsive_Lightbox
470
  add_settings_field('rl_script', __('Lightbox script', 'responsive-lightbox'), array(&$this, 'rl_script'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
471
  add_settings_field('rl_selector', __('Selector', 'responsive-lightbox'), array(&$this, 'rl_selector'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
472
  add_settings_field('rl_galleries', __('Galleries', 'responsive-lightbox'), array(&$this, 'rl_galleries'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
 
473
  add_settings_field('rl_videos', __('Video links', 'responsive-lightbox'), array(&$this, 'rl_videos'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
474
  add_settings_field('rl_image_links', __('Image links', 'responsive-lightbox'), array(&$this, 'rl_image_links'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
475
  add_settings_field('rl_images_as_gallery', __('Single images as gallery', 'responsive-lightbox'), array(&$this, 'rl_images_as_gallery'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
@@ -646,6 +652,46 @@ class Responsive_Lightbox
646
  <p class="description">'.__('Add lightbox to WordPress image galleries by default.', 'responsive-lightbox').'</p>
647
  </div>';
648
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
649
 
650
 
651
  public function rl_videos()
@@ -1656,6 +1702,15 @@ class Responsive_Lightbox
1656
  {
1657
  $input['custom_events'] = sanitize_text_field(isset($input['custom_events']) && $input['custom_events'] !== '' ? $input['custom_events'] : $this->defaults['settings']['custom_events']);
1658
  }
 
 
 
 
 
 
 
 
 
1659
 
1660
  // checkboxes
1661
  $input['galleries'] = (isset($input['galleries'], $this->choices[$input['galleries']]) ? ($input['galleries'] === 'yes' ? true : false) : $this->defaults['settings']['galleries']);
@@ -1949,7 +2004,13 @@ class Responsive_Lightbox
1949
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/responsive-lightbox" target="_blank" title="'.__('Rate it 5', 'responsive-lightbox').'">'.__('Rate it 5', 'responsive-lightbox').'</a> '.__('on WordPress.org', 'responsive-lightbox').'<br />'.
1950
  __('Blog about it & link to the', 'responsive-lightbox').' <a href="http://www.dfactory.eu/plugins/responsive-lightbox/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'responsive-lightbox').'">'.__('plugin page', 'responsive-lightbox').'</a><br />'.
1951
  __('Check out our other', 'responsive-lightbox').' <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'responsive-lightbox').'">'.__('WordPress plugins', 'responsive-lightbox').'</a>
1952
- </p>
 
 
 
 
 
 
1953
  <hr />
1954
  <p class="df-link inner">Created by <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.plugins_url('/images/logo-dfactory.png' , __FILE__ ).'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
1955
  </div>
@@ -2296,7 +2357,7 @@ class Responsive_Lightbox
2296
  /**
2297
  * Add links to Settings page
2298
  */
2299
- function plugin_settings_link($links, $file)
2300
  {
2301
  if(!is_admin() || !current_user_can('manage_options'))
2302
  return $links;
@@ -2313,6 +2374,22 @@ class Responsive_Lightbox
2313
 
2314
  return $links;
2315
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2316
  }
2317
 
2318
  $responsive_lightbox = new Responsive_Lightbox();
2
  /*
3
  Plugin Name: Responsive Lightbox
4
  Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
5
+ Version: 1.4.7
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
29
  'script' => 'swipebox',
30
  'selector' => 'lightbox',
31
  'galleries' => true,
32
+ 'enable_gallery_image_size' => false,
33
+ 'gallery_image_size' => 'full',
34
  'videos' => true,
35
  'image_links' => true,
36
  'images_as_gallery' => false,
111
  'quit_on_document_click' => true
112
  )
113
  ),
114
+ 'version' => '1.4.7'
115
  );
116
  private $scripts = array();
117
  private $options = array();
170
  add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
171
  add_filter('post_gallery', array(&$this, 'gallery_attributes'), 1000);
172
 
173
+ if($this->options['settings']['galleries'] === true)
174
  add_filter('wp_get_attachment_link', array(&$this, 'add_gallery_lightbox_selector'), 1000, 6);
175
+
176
+ if ($this->options['settings']['enable_gallery_image_size'] === true)
177
+ add_filter('wp_get_attachment_link', array(&$this, 'gallery_attachment_link_filter'), 1001, 6);
178
 
179
+ if($this->options['settings']['videos'] === true)
180
  add_filter('the_content', array(&$this, 'add_videos_lightbox_selector'));
181
 
182
+ if($this->options['settings']['image_links'] === true || $this->options['settings']['images_as_gallery'] === true)
183
  add_filter('the_content', array(&$this, 'add_links_lightbox_selector'));
184
  }
185
 
475
  add_settings_field('rl_script', __('Lightbox script', 'responsive-lightbox'), array(&$this, 'rl_script'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
476
  add_settings_field('rl_selector', __('Selector', 'responsive-lightbox'), array(&$this, 'rl_selector'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
477
  add_settings_field('rl_galleries', __('Galleries', 'responsive-lightbox'), array(&$this, 'rl_galleries'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
478
+ add_settings_field('rl_enable_gallery_image_size', __('Gallery image size', 'responsive-lightbox'), array(&$this, 'rl_enable_gallery_image_size'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
479
  add_settings_field('rl_videos', __('Video links', 'responsive-lightbox'), array(&$this, 'rl_videos'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
480
  add_settings_field('rl_image_links', __('Image links', 'responsive-lightbox'), array(&$this, 'rl_image_links'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
481
  add_settings_field('rl_images_as_gallery', __('Single images as gallery', 'responsive-lightbox'), array(&$this, 'rl_images_as_gallery'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
652
  <p class="description">'.__('Add lightbox to WordPress image galleries by default.', 'responsive-lightbox').'</p>
653
  </div>';
654
  }
655
+
656
+
657
+ public function rl_enable_gallery_image_size()
658
+ {
659
+ echo '
660
+ <div id="rl_enable_gallery_image_size" class="wplikebtns">';
661
+
662
+ foreach($this->choices as $val => $trans)
663
+ {
664
+ $val = esc_attr($val);
665
+
666
+ echo '
667
+ <input id="rl-enable-gallery-image-size-'.$val.'" type="radio" name="responsive_lightbox_settings[enable_gallery_image_size]" value="'.$val.'" '.checked(($val === 'yes' ? true : false), $this->options['settings']['enable_gallery_image_size'], false).' />
668
+ <label for="rl-enable-gallery-image-size-'.$val.'">'.esc_html($trans).'</label>';
669
+ }
670
+
671
+ echo '
672
+ <p class="description">'.__('By default WP gallery links point to full size images only. Enable that to modify the image size of native WP gallery image links.', 'responsive-lightbox').'</p>';
673
+
674
+ // get available image sizes
675
+ $image_sizes = get_intermediate_image_sizes();
676
+
677
+ // print_r($image_sizes);
678
+
679
+ echo '
680
+ <div id="rl_gallery_image_size"'.($this->options['settings']['enable_gallery_image_size'] === false ? ' style="display: none;"' : '').'>
681
+ <select name="responsive_lightbox_settings[gallery_image_size]" value="'.esc_attr($this->options['settings']['gallery_image_size']).'" />
682
+ <option value="full" '.selected($this->options['settings']['gallery_image_size'], 'full').'>'.esc_attr(__('full', 'responsive-lightbox')).'</option>';
683
+
684
+ foreach ($image_sizes as $image_size)
685
+ {
686
+ echo '<option value="'.esc_attr($image_size).'" '.selected($this->options['settings']['gallery_image_size'], esc_attr($image_size)).'>'.esc_attr($image_size).'</option>';
687
+ }
688
+
689
+ echo '
690
+ </select>
691
+ <p class="description">'.__('Select image size for gallery image links.', 'responsive-lightbox').'</p>
692
+ </div>
693
+ </div>';
694
+ }
695
 
696
 
697
  public function rl_videos()
1702
  {
1703
  $input['custom_events'] = sanitize_text_field(isset($input['custom_events']) && $input['custom_events'] !== '' ? $input['custom_events'] : $this->defaults['settings']['custom_events']);
1704
  }
1705
+
1706
+ // enable gallery image size
1707
+ $input['enable_gallery_image_size'] = (isset($input['enable_gallery_image_size'], $this->choices[$input['enable_gallery_image_size']]) ? ($input['enable_gallery_image_size'] === 'yes' ? true : false) : $this->defaults['settings']['enable_gallery_image_size']);
1708
+
1709
+ // gallery image size
1710
+ if($input['enable_gallery_image_size'] === true)
1711
+ {
1712
+ $input['gallery_image_size'] = esc_attr(isset($input['gallery_image_size']) && $input['gallery_image_size'] !== '' ? $input['gallery_image_size'] : $this->defaults['settings']['gallery_image_size']);
1713
+ }
1714
 
1715
  // checkboxes
1716
  $input['galleries'] = (isset($input['galleries'], $this->choices[$input['galleries']]) ? ($input['galleries'] === 'yes' ? true : false) : $this->defaults['settings']['galleries']);
2004
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/responsive-lightbox" target="_blank" title="'.__('Rate it 5', 'responsive-lightbox').'">'.__('Rate it 5', 'responsive-lightbox').'</a> '.__('on WordPress.org', 'responsive-lightbox').'<br />'.
2005
  __('Blog about it & link to the', 'responsive-lightbox').' <a href="http://www.dfactory.eu/plugins/responsive-lightbox/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'responsive-lightbox').'">'.__('plugin page', 'responsive-lightbox').'</a><br />'.
2006
  __('Check out our other', 'responsive-lightbox').' <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'responsive-lightbox').'">'.__('WordPress plugins', 'responsive-lightbox').'</a>
2007
+ </p>
2008
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
2009
+ <input type="hidden" name="cmd" value="_s-xclick">
2010
+ <input type="hidden" name="hosted_button_id" value="8AL8ULUN9R76U">
2011
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
2012
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
2013
+ </form>
2014
  <hr />
2015
  <p class="df-link inner">Created by <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.plugins_url('/images/logo-dfactory.png' , __FILE__ ).'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
2016
  </div>
2357
  /**
2358
  * Add links to Settings page
2359
  */
2360
+ public function plugin_settings_link($links, $file)
2361
  {
2362
  if(!is_admin() || !current_user_can('manage_options'))
2363
  return $links;
2374
 
2375
  return $links;
2376
  }
2377
+
2378
+
2379
+ /**
2380
+ * Modify gallery image link size
2381
+ */
2382
+ public function gallery_attachment_link_filter($content, $post_id, $size, $permalink, $icon, $text)
2383
+ {
2384
+ if ($permalink) {
2385
+ $image = wp_get_attachment_image_src($post_id, $this->options['settings']['gallery_image_size']); // or other image size
2386
+ $new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content);
2387
+ return $new_content;
2388
+ } else {
2389
+ return $content;
2390
+ }
2391
+ }
2392
+
2393
  }
2394
 
2395
  $responsive_lightbox = new Responsive_Lightbox();