Responsive Lightbox & Gallery - Version 1.6.6

Version Description

  • Tweak: Confirmed WordPress 4.4 compatibility
Download this release

Release Info

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

Code changes from version 1.6.5 to 1.6.6

includes/class-frontend.php CHANGED
@@ -32,11 +32,9 @@ class Responsive_Lightbox_Frontend {
32
  * @return mixed
33
  */
34
  public function add_videos_lightbox_selector( $content ) {
35
-
36
- if ( Responsive_Lightbox()->options['settings']['videos'] === true ) {
37
-
38
- // search for image-links
39
- preg_match_all( '/<a(.*?)href=(?:\'|")((?:http|https|)(?::\/\/|)(?:www.|)(?:(?:(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))(?:[\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*)|(?:vimeo\.com\/[0-9]+)))(?:\'|")(.*?)>/i', $content, $links );
40
 
41
  // found?
42
  if ( ! empty ( $links[0] ) ) {
@@ -63,7 +61,6 @@ class Responsive_Lightbox_Frontend {
63
  }
64
  }
65
  }
66
-
67
  }
68
 
69
  return $content;
@@ -76,7 +73,7 @@ class Responsive_Lightbox_Frontend {
76
  * @return mixed
77
  */
78
  public function add_links_lightbox_selector( $content ) {
79
- if ( Responsive_Lightbox()->options['settings']['image_links'] === true || Responsive_Lightbox()->options['settings']['images_as_gallery'] === true ) {
80
 
81
  // search for image-links
82
  preg_match_all( '/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links );
@@ -84,7 +81,7 @@ class Responsive_Lightbox_Frontend {
84
  // found?
85
  if ( ! empty ( $links[0] ) ) {
86
  // generate hash for single images gallery
87
- if ( Responsive_Lightbox()->options['settings']['images_as_gallery'] === true )
88
  $rel_hash = '-gallery-' . $this->generate_password( 4 );
89
 
90
  foreach ( $links[0] as $id => $link ) {
@@ -107,15 +104,15 @@ class Responsive_Lightbox_Frontend {
107
  continue;
108
 
109
  // single images gallery
110
- if ( Responsive_Lightbox()->options['settings']['images_as_gallery'] === true )
111
- $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(?:.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . $rel_hash . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . $title . '"', $link ), $content );
112
  // single image
113
  else {
114
- $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(?:.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-' . $id . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . $title . '"', $link ), $content );
115
  }
116
  // link without data-rel
117
  } else {
118
- $content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . ( Responsive_Lightbox()->options['settings']['images_as_gallery'] === true ? $rel_hash : '-' . $id ) . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . $title . '">', $content );
119
  }
120
  }
121
  }
@@ -129,7 +126,7 @@ class Responsive_Lightbox_Frontend {
129
  */
130
  public function add_gallery_lightbox_selector( $link, $id, $size, $permalink, $icon, $text ) {
131
 
132
- if ( Responsive_Lightbox()->options['settings']['galleries'] === true && wp_attachment_is_image( $id ) ) {
133
 
134
  // gallery link target image
135
  $src = array();
@@ -143,7 +140,7 @@ class Responsive_Lightbox_Frontend {
143
  }
144
 
145
  if ( $title )
146
- $link = str_replace( '<a href', '<a title="'. $title .'" href', $link );
147
 
148
  $link = ( preg_match( '/<a.*? (?:data-rel)=("|\').*?("|\')>/', $link ) === 1 ? preg_replace( '/(<a.*? data-rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 ' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '$2', $link ) : preg_replace( '/(<a.*?)>/', '$1 data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '">', $link ) );
149
 
@@ -174,7 +171,7 @@ class Responsive_Lightbox_Frontend {
174
  */
175
  public function add_custom_gallery_lightbox_selector( $content, $attr ) {
176
 
177
- if ( Responsive_Lightbox()->options['settings']['force_custom_gallery'] === true ) {
178
 
179
  preg_match_all( '/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links );
180
 
@@ -196,9 +193,9 @@ class Responsive_Lightbox_Frontend {
196
  }
197
 
198
  if ( preg_match( '/<a.*?(?:data-rel)=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result ) === 1 ) {
199
- $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '"' . ( ! empty ( $title ) ? ' title="' . $title . '"' : '' ) . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ), $link ), $content );
200
  } else {
201
- $content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ( ! empty ( $title ) ? ' title="' . $title . '"' : '' ) . '>', $content );
202
  }
203
  }
204
  }
32
  * @return mixed
33
  */
34
  public function add_videos_lightbox_selector( $content ) {
35
+ if ( Responsive_Lightbox()->options['settings']['videos'] ) {
36
+ // search for video-links
37
+ preg_match_all('/<a(.*?)href=(?:\'|")((?:http|https)(?::\/\/|)(?:www.)?(?:(?:(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=))(?:[\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*)|(?:vimeo\.com\/[0-9]+[a-z0-9;:@#?&%=+\/\$_.-]*)))(?:\'|")(.*?)>/i', $content, $links );
 
 
38
 
39
  // found?
40
  if ( ! empty ( $links[0] ) ) {
61
  }
62
  }
63
  }
 
64
  }
65
 
66
  return $content;
73
  * @return mixed
74
  */
75
  public function add_links_lightbox_selector( $content ) {
76
+ if ( Responsive_Lightbox()->options['settings']['image_links'] || Responsive_Lightbox()->options['settings']['images_as_gallery'] ) {
77
 
78
  // search for image-links
79
  preg_match_all( '/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links );
81
  // found?
82
  if ( ! empty ( $links[0] ) ) {
83
  // generate hash for single images gallery
84
+ if ( Responsive_Lightbox()->options['settings']['images_as_gallery'] )
85
  $rel_hash = '-gallery-' . $this->generate_password( 4 );
86
 
87
  foreach ( $links[0] as $id => $link ) {
104
  continue;
105
 
106
  // single images gallery
107
+ if ( Responsive_Lightbox()->options['settings']['images_as_gallery'] )
108
+ $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(?:.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . $rel_hash . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . esc_attr( $title ) . '"', $link ), $content );
109
  // single image
110
  else {
111
+ $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(?:.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-' . $id . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . esc_attr( $title ) . '"', $link ), $content );
112
  }
113
  // link without data-rel
114
  } else {
115
+ $content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . ( Responsive_Lightbox()->options['settings']['images_as_gallery'] ? $rel_hash : '-' . $id ) . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ' title="' . esc_attr( $title ) . '">', $content );
116
  }
117
  }
118
  }
126
  */
127
  public function add_gallery_lightbox_selector( $link, $id, $size, $permalink, $icon, $text ) {
128
 
129
+ if ( Responsive_Lightbox()->options['settings']['galleries'] && wp_attachment_is_image( $id ) ) {
130
 
131
  // gallery link target image
132
  $src = array();
140
  }
141
 
142
  if ( $title )
143
+ $link = str_replace( '<a href', '<a title="'. esc_attr( $title ) .'" href', $link );
144
 
145
  $link = ( preg_match( '/<a.*? (?:data-rel)=("|\').*?("|\')>/', $link ) === 1 ? preg_replace( '/(<a.*? data-rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 ' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '$2', $link ) : preg_replace( '/(<a.*?)>/', '$1 data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '">', $link ) );
146
 
171
  */
172
  public function add_custom_gallery_lightbox_selector( $content, $attr ) {
173
 
174
+ if ( Responsive_Lightbox()->options['settings']['force_custom_gallery'] ) {
175
 
176
  preg_match_all( '/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links );
177
 
193
  }
194
 
195
  if ( preg_match( '/<a.*?(?:data-rel)=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result ) === 1 ) {
196
+ $content = str_replace( $link, preg_replace( '/(?:data-rel)=(?:\'|")(.*?)(?:\'|")/', 'data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '"' . ( ! empty ( $title ) ? ' title="' . esc_attr( $title ) . '"' : '' ) . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ), $link ), $content );
197
  } else {
198
+ $content = str_replace( $link, '<a' . $links[1][$id] . 'href="' . $links[2][$id] . '.' . $links[3][$id] . '"' . $links[4][$id] . ' data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '"' . ( Responsive_Lightbox()->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="' . $id . '"' : '' ) . ( ! empty ( $title ) ? ' title="' . esc_attr( $title ) . '"' : '' ) . '>', $content );
199
  }
200
  }
201
  }
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: 4.0
6
- Tested up to: 4.3.1
7
- Stable tag: 1.6.5
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -74,6 +74,9 @@ No questions yet.
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.6.5 =
78
  * Fix: Lightbox activated on non-video youtube links
79
  * Tweak: Added a way to change settings required capability
@@ -271,6 +274,5 @@ Initial release
271
 
272
  == Upgrade Notice ==
273
 
274
- = 1.6.5 =
275
- * Fix: Lightbox activated on non-video youtube links
276
- * Tweak: Added a way to change settings required capability
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: 4.0
6
+ Tested up to: 4.4
7
+ Stable tag: 1.6.6
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.6.6 =
78
+ * Tweak: Confirmed WordPress 4.4 compatibility
79
+
80
  = 1.6.5 =
81
  * Fix: Lightbox activated on non-video youtube links
82
  * Tweak: Added a way to change settings required capability
274
 
275
  == Upgrade Notice ==
276
 
277
+ = 1.6.6 =
278
+ * Tweak: Confirmed WordPress 4.4 compatibility
 
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.6.5
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
@@ -36,7 +36,7 @@ include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes/class-settings.php' );
36
  * Responsive Lightbox class.
37
  *
38
  * @class Responsive_Lightbox
39
- * @version 1.6.5
40
  */
41
  class Responsive_Lightbox {
42
 
@@ -146,7 +146,7 @@ class Responsive_Lightbox {
146
  'pagination_type' => 'thumbnails'
147
  )
148
  ),
149
- 'version' => '1.6.5'
150
  );
151
  public $options = array();
152
  private $notices = array();
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.6.6
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
36
  * Responsive Lightbox class.
37
  *
38
  * @class Responsive_Lightbox
39
+ * @version 1.6.6
40
  */
41
  class Responsive_Lightbox {
42
 
146
  'pagination_type' => 'thumbnails'
147
  )
148
  ),
149
+ 'version' => '1.6.6'
150
  );
151
  public $options = array();
152
  private $notices = array();