FancyBox for WordPress - Version 3.1.8

Version Description

  • Fixed "Click to Hide on Overlay only works with Images"
  • Fixed "The requested content cannot be loaded" when trying to view page/post in fancybox
Download this release

Release Info

Developer machothemes
Plugin Icon wp plugin FancyBox for WordPress
Version 3.1.8
Comparing to
See all releases

Code changes from version 3.1.7 to 3.1.8

Files changed (2) hide show
  1. fancybox.php +27 -8
  2. readme.txt +5 -1
fancybox.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: FancyBox for WordPress
5
  Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
6
  Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
7
- Version: 3.1.7
8
  Author: Colorlib
9
  Author URI: https://colorlib.com/wp/
10
 
@@ -19,7 +19,7 @@ Author URI: https://colorlib.com/wp/
19
  * Plugin Init
20
  */
21
  // Constants
22
- define( 'FBFW_VERSION', '3.1.7' );
23
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
25
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
@@ -276,28 +276,38 @@ function mfbfw_init() {
276
 
277
  // Supported file extensions
278
  var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter( function() { return /\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href')) });
 
 
 
 
 
279
  <?php if ( $mfbfw['galleryType'] == 'post' ) { ?>
280
 
281
  // Gallery type BY POST and on post or page (so only one post or page is visible)
282
  <?php if ( is_singular() ) { ?>
283
  // Gallery by post
284
  thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
 
285
 
286
- <?php } else { ?>
287
  // Gallery by post
288
  var posts = jQuery(".post");
289
  posts.each(function() {
290
- jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox","gallery"+posts.index(this)).attr("rel","fancybox"+posts.index(this)).getTitle()
 
 
 
291
  });
292
 
293
  <?php } ?>
294
 
295
- // Gallery type ALL
296
  <?php } elseif ( $mfbfw['galleryType'] == 'all' ) { ?>
297
  // Gallery All
298
  thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
 
299
 
300
- // Gallery type NONE
301
  <?php } elseif ( $mfbfw['galleryType'] == 'none' ) { ?>
302
  // No Galleries
303
  thumbnails.each(function(){
@@ -307,12 +317,21 @@ function mfbfw_init() {
307
  jQuery(this).attr("title",imgTitle);
308
  });
309
 
310
- // Else, gallery type is custom, so just print the custom expression
 
 
 
 
 
 
 
311
  <?php } else { ?>
312
  /* Custom Expression */
313
  <?php echo $mfbfw['customExpression']; ?>
314
  <?php } ?>
315
 
 
 
316
  // Call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
317
  jQuery("a.fancyboxforwp").fancyboxforwp({
318
  loop: <?php echo ( isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false' ) ?>,
@@ -330,7 +349,7 @@ function mfbfw_init() {
330
  showCloseButton: <?php echo ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) ?>,
331
  arrows: <?php echo ( isset( $mfbfw['showNavArrows'] ) && $mfbfw['showNavArrows'] ? 'true' : 'false' ) ?>,
332
  clickContent: <?php echo ( isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : 'false' ) ?>,
333
- clickSlide: <?php echo ( isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? 'function(current, event) {return current.type === "image" ? "close" : false;}' : 'false' ) ?>,
334
  wheel: <?php echo ( isset( $mfbfw['mouseWheel'] ) && $mfbfw['mouseWheel'] ? 'true' : 'false' ) ?>,
335
  toolbar: <?php echo ( isset( $mfbfw['showToolbar'] ) && $mfbfw['showToolbar'] ? 'true' : 'false' ) ?>,
336
  preventCaptionOverlap: true,
4
  Plugin Name: FancyBox for WordPress
5
  Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
6
  Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
7
+ Version: 3.1.8
8
  Author: Colorlib
9
  Author URI: https://colorlib.com/wp/
10
 
19
  * Plugin Init
20
  */
21
  // Constants
22
+ define( 'FBFW_VERSION', '3.1.8' );
23
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
25
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
276
 
277
  // Supported file extensions
278
  var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter( function() { return /\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href')) });
279
+
280
+ // Add data-type iframe for links that are not images or videos.
281
+ var iframeLinks = jQuery('.fancyboxforwp').filter( function() { return ! /\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href')) }).filter( function() { return ! /vimeo|youtube/i.test(jQuery(this).attr('href')) });
282
+ iframeLinks.attr({ "data-type" : "iframe" }).getTitle();
283
+
284
  <?php if ( $mfbfw['galleryType'] == 'post' ) { ?>
285
 
286
  // Gallery type BY POST and on post or page (so only one post or page is visible)
287
  <?php if ( is_singular() ) { ?>
288
  // Gallery by post
289
  thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
290
+ iframeLinks.attr({ "data-fancybox":"gallery" }).getTitle();
291
 
292
+ <?php } else { ?>
293
  // Gallery by post
294
  var posts = jQuery(".post");
295
  posts.each(function() {
296
+ jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox","gallery"+posts.index(this)).attr("rel","fancybox"+posts.index(this)).getTitle();
297
+
298
+ jQuery(this).find(iframeLinks).attr({ "data-fancybox":"gallery"+posts.index(this) }).attr("rel","fancybox"+posts.index(this)).getTitle();
299
+
300
  });
301
 
302
  <?php } ?>
303
 
304
+ // Gallery type ALL
305
  <?php } elseif ( $mfbfw['galleryType'] == 'all' ) { ?>
306
  // Gallery All
307
  thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
308
+ iframeLinks.attr({ "data-fancybox":"gallery" }).getTitle();
309
 
310
+ // Gallery type NONE
311
  <?php } elseif ( $mfbfw['galleryType'] == 'none' ) { ?>
312
  // No Galleries
313
  thumbnails.each(function(){
317
  jQuery(this).attr("title",imgTitle);
318
  });
319
 
320
+ iframeLinks.each(function(){
321
+ var rel = jQuery(this).attr("rel");
322
+ var imgTitle = jQuery(this).children("img").attr("title");
323
+ jQuery(this).attr({"data-fancybox":rel});
324
+ jQuery(this).attr("title",imgTitle);
325
+ });
326
+
327
+ // Else, gallery type is custom, so just print the custom expression
328
  <?php } else { ?>
329
  /* Custom Expression */
330
  <?php echo $mfbfw['customExpression']; ?>
331
  <?php } ?>
332
 
333
+
334
+
335
  // Call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
336
  jQuery("a.fancyboxforwp").fancyboxforwp({
337
  loop: <?php echo ( isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false' ) ?>,
349
  showCloseButton: <?php echo ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) ?>,
350
  arrows: <?php echo ( isset( $mfbfw['showNavArrows'] ) && $mfbfw['showNavArrows'] ? 'true' : 'false' ) ?>,
351
  clickContent: <?php echo ( isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : 'false' ) ?>,
352
+ clickSlide: <?php echo ( isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? '"close"' : 'false' ) ?>,
353
  wheel: <?php echo ( isset( $mfbfw['mouseWheel'] ) && $mfbfw['mouseWheel'] ? 'true' : 'false' ) ?>,
354
  toolbar: <?php echo ( isset( $mfbfw['showToolbar'] ) && $mfbfw['showToolbar'] ? 'true' : 'false' ) ?>,
355
  preventCaptionOverlap: true,
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: silkalns
3
  Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
4
  Requires at least: 3.4
5
  Tested up to: 5.0
6
- Stable tag: 3.1.7
7
  License: GPL/MIT
8
 
9
  Seamlessly integrates FancyBox lightbox into your WordPress blog: Upload, activate, and you're done. Additional configuration optional.
@@ -31,6 +31,10 @@ If you enjoy using FancyBox lightbox for WordPress please leave a [positive feed
31
 
32
  == Changelog ==
33
 
 
 
 
 
34
  = 3.1.7 =
35
  * Fixed incompatibilty with Envira Gallery
36
  * Fixed incompatibilty with NextGen Gallery
3
  Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
4
  Requires at least: 3.4
5
  Tested up to: 5.0
6
+ Stable tag: 3.1.8
7
  License: GPL/MIT
8
 
9
  Seamlessly integrates FancyBox lightbox into your WordPress blog: Upload, activate, and you're done. Additional configuration optional.
31
 
32
  == Changelog ==
33
 
34
+ = 3.1.8 =
35
+ * Fixed "Click to Hide on Overlay only works with Images"
36
+ * Fixed "The requested content cannot be loaded" when trying to view page/post in fancybox
37
+
38
  = 3.1.7 =
39
  * Fixed incompatibilty with Envira Gallery
40
  * Fixed incompatibilty with NextGen Gallery