FancyBox for WordPress - Version 3.1.2

Version Description

  • Fixed "All links get the fancybox class"
Download this release

Release Info

Developer colorlibplugins
Plugin Icon wp plugin FancyBox for WordPress
Version 3.1.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.1.2

Files changed (2) hide show
  1. fancybox.php +59 -78
  2. readme.txt +4 -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.1
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.1' );
23
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
25
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
@@ -106,7 +106,7 @@ function mfbfw_defaults() {
106
  jQuery.each(arr, function() {
107
  var title = jQuery(this).children("img").attr("title");
108
  var caption = jQuery(this).next("figcaption").html();
109
- if(caption.length){jQuery(this).attr("title",title+" " + caption)}else{ jQuery(this).attr("title",title);}console.log(caption);
110
  }); ',
111
  'nojQuery' => '',
112
  'extraCallsEnable' => '',
@@ -266,111 +266,92 @@ function mfbfw_init() {
266
  ' . ( isset( $mfbfw['titleColor'] ) && $mfbfw['titlePosition'] == 'inside' ? 'div.fancybox-caption p.caption-title{color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#fff}' ) . '
267
  ' . ( isset( $mfbfw['titlePosition'] ) ? 'div.fancybox-caption {color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#333333}' ) . $captionPosition . '
268
  </style>';
269
-
270
- echo '
271
  <script type="text/javascript">
272
  jQuery(function(){
273
 
274
  jQuery.fn.getTitle = function() { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles
275
- ' . $mfbfw['copyTitleFunction'] . '
276
  }
277
 
278
  // Supported file extensions
279
- var thumbnails = jQuery("a:has(img)").not(".nolightbox, .nofancybox, a:has(img.nolightbox, img.nofancybox)").filter( function() { return /\.(jpe?g|png|gif|bmp|mp4)?.+$/i.test(jQuery(this).attr("href")) });';
280
- if ( $mfbfw['galleryType'] == 'post' ) {
281
 
282
  // Gallery type BY POST and on post or page (so only one post or page is visible)
283
- if ( is_singular() ) {
284
- echo '
285
- // Gallery by post
286
- thumbnails.addClass("fancybox").attr("data-fancybox","gallery").getTitle();
287
- ';
288
-
289
- // Gallery type BY POST, but neither on post or page, so make a different rel attribute on each post
290
- } else {
291
- echo '
292
- // Gallery by post
293
- var posts = jQuery(".post");
294
- posts.each(function() {
295
- jQuery(this).find(thumbnails).addClass("fancybox").attr("data-fancybox","gallery"+posts.index(this)).attr("rel","fancybox"+posts.index(this)).getTitle()
296
- });
297
- ';
298
- }
299
 
300
  // Gallery type ALL
301
- } elseif ( $mfbfw['galleryType'] == 'all' ) {
302
- echo '
303
  // Gallery All
304
  thumbnails.addClass("fancybox").attr("data-fancybox","gallery").getTitle();
305
- ';
306
 
307
  // Gallery type NONE
308
- } elseif ( $mfbfw['galleryType'] == 'none' ) {
309
- echo '
310
  // No Galleries
311
  thumbnails.each(function(){
312
  var rel = jQuery(this).attr("rel");
313
  var imgTitle = jQuery(this).children("img").attr("title");
314
  jQuery(this).addClass("fancybox").attr("data-fancybox",rel);
315
  jQuery(this).attr("title",imgTitle);
316
- })
317
- ';
318
 
319
  // Else, gallery type is custom, so just print the custom expression
320
- } else {
321
- echo '
322
- // Custom Expression
323
- ' . $mfbfw['customExpression'] . '
324
- ';
325
- }
326
 
327
- // Call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
328
- echo '
329
  jQuery("a.fancybox").fancybox({
330
- "loop": ' . ( isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false' ) . ',
331
- "smallBtn": ' . ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) . ',
332
- "zoomOpacity": "' . ( isset( $mfbfw['zoomOpacity'] ) && $mfbfw['zoomOpacity'] ? 'auto' : 'false' ) . '",
333
- "animationEffect": "' . $mfbfw['transitionIn'] . '",
334
- "animationDuration": ' . $mfbfw['zoomSpeedIn'] . ',
335
- "transitionEffect": "' . $mfbfw['transitionEffect'] . '",
336
- "transitionDuration" : "' . $mfbfw['zoomSpeedChange'] . '",
337
- "overlayShow": ' . ( isset( $mfbfw['overlayShow'] ) && $mfbfw['overlayShow'] ? 'true' : 'false' ) . ',
338
- "overlayOpacity": "' . $mfbfw['overlayOpacity'] . '",
339
- "titleShow": ' . ( isset( $mfbfw['titleShow'] ) && $mfbfw['titleShow'] ? 'true' : 'false' ) . ',
340
- "titlePosition": "' . $mfbfw['titlePosition'] . '",
341
- "keyboard": ' . ( isset( $mfbfw['enableEscapeButton'] ) && $mfbfw['enableEscapeButton'] ? 'true' : 'false' ) . ',
342
- "showCloseButton": ' . ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) . ',
343
- "arrows": ' . ( isset( $mfbfw['showNavArrows'] ) && $mfbfw['showNavArrows'] ? 'true' : 'false' ) . ',
344
- "clickContent": ' . ( isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : 'false' ) . ',
345
- "clickSlide": ' . ( isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? 'function(current, event) {
346
- return current.type === "image" ? "close" : false;
347
- }' : 'false' ) . ',
348
- "wheel": ' . ( isset( $mfbfw['mouseWheel'] ) && $mfbfw['mouseWheel'] ? 'true' : 'false' ) . ',
349
- ' . $frameSize . '
350
- "onInit": ' . ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnStart'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnStart'] ? $mfbfw['callbackOnStart'] . ',' : 'function() { },' ) . '
351
- "onDeactivate": ' . ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCancel'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCancel'] ? $mfbfw['callbackOnCancel'] . ',' : 'function() { },' ) . '
352
- "beforeClose": ' . ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCleanup'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCleanup'] ? $mfbfw['callbackOnCleanup'] . ',' : 'function() { },' ) . '
353
- "afterShow": ' . ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnComplete'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnComplete'] ? $mfbfw['callbackOnComplete'] . ',' : 'function() { },' ) . '
354
- "afterClose": ' . ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnClose'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnClose'] ? $mfbfw['callbackOnClose'] . ',' : 'function() { },' ) . '
355
- "toolbar":' . ( isset( $mfbfw['showToolbar'] ) && $mfbfw['showToolbar'] ? 'true' : 'false' ) . ',
356
- "preventCaptionOverlap": true,
357
- "caption" : ' . $caption . ',
358
- "afterLoad" : ' . $afterLoad . ',
359
  });
360
- ';
 
 
 
361
 
362
- if ( isset( $mfbfw['extraCallsEnable'] ) && $mfbfw['extraCallsEnable'] ) {
363
- echo '
364
- // Extra Calls
365
- ' . $mfbfw['extraCallsData'] . '
366
- ';
367
- }
368
-
369
- echo '
370
  })
371
  </script>
372
  <!-- END Fancybox for WordPress -->
373
- ';
374
  }
375
  }
376
 
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.2
8
  Author: Colorlib
9
  Author URI: https://colorlib.com/wp/
10
 
19
  * Plugin Init
20
  */
21
  // Constants
22
+ define( 'FBFW_VERSION', '3.1.2' );
23
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
24
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
25
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
106
  jQuery.each(arr, function() {
107
  var title = jQuery(this).children("img").attr("title");
108
  var caption = jQuery(this).next("figcaption").html();
109
+ if(caption.length){jQuery(this).attr("title",title+" " + caption)}else{ jQuery(this).attr("title",title);};
110
  }); ',
111
  'nojQuery' => '',
112
  'extraCallsEnable' => '',
266
  ' . ( isset( $mfbfw['titleColor'] ) && $mfbfw['titlePosition'] == 'inside' ? 'div.fancybox-caption p.caption-title{color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#fff}' ) . '
267
  ' . ( isset( $mfbfw['titlePosition'] ) ? 'div.fancybox-caption {color:' . $mfbfw['titleColor'] . '}' : 'div.fancybox-caption p.caption-title{color:#333333}' ) . $captionPosition . '
268
  </style>';
269
+ ?>
 
270
  <script type="text/javascript">
271
  jQuery(function(){
272
 
273
  jQuery.fn.getTitle = function() { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles
274
+ <?php echo $mfbfw['copyTitleFunction'] ?>
275
  }
276
 
277
  // Supported file extensions
278
+ var thumbnails = jQuery("a:has(img)").not(".nolightbox").filter( function() { return /\.(jpe?g|png|gif|bmp)$/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("fancybox").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("fancybox").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("fancybox").attr("data-fancybox","gallery").getTitle();
 
299
 
300
  // Gallery type NONE
301
+ <?php } elseif ( $mfbfw['galleryType'] == 'none' ) { ?>
 
302
  // No Galleries
303
  thumbnails.each(function(){
304
  var rel = jQuery(this).attr("rel");
305
  var imgTitle = jQuery(this).children("img").attr("title");
306
  jQuery(this).addClass("fancybox").attr("data-fancybox",rel);
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.fancybox").fancybox({
318
+ loop: <?php echo ( isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false' ) ?>,
319
+ smallBtn: <?php echo ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) ?>,
320
+ zoomOpacity: <?php echo ( isset( $mfbfw['zoomOpacity'] ) && $mfbfw['zoomOpacity'] ? '"auto"' : 'false' ) ?>,
321
+ animationEffect: "<?php echo $mfbfw['transitionIn'] ?>",
322
+ animationDuration: <?php echo $mfbfw['zoomSpeedIn'] ?>,
323
+ transitionEffect: "<?php echo $mfbfw['transitionEffect'] ?>",
324
+ transitionDuration : "<?php echo $mfbfw['zoomSpeedChange'] ?>",
325
+ overlayShow: <?php echo ( isset( $mfbfw['overlayShow'] ) && $mfbfw['overlayShow'] ? 'true' : 'false' ) ?>,
326
+ overlayOpacity: "<?php echo $mfbfw['overlayOpacity'] ?>",
327
+ titleShow: <?php echo ( isset( $mfbfw['titleShow'] ) && $mfbfw['titleShow'] ? 'true' : 'false' ) ?>,
328
+ titlePosition: "<?php echo $mfbfw['titlePosition'] ?>",
329
+ keyboard: <?php echo ( isset( $mfbfw['enableEscapeButton'] ) && $mfbfw['enableEscapeButton'] ? 'true' : 'false' ) ?>,
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,
337
+ onInit: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnStart'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnStart'] ? $mfbfw['callbackOnStart'] . ',' : 'function() { },' ) ?>
338
+ onDeactivate: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCancel'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCancel'] ? $mfbfw['callbackOnCancel'] . ',' : 'function() { },' ) ?>
339
+ beforeClose: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCleanup'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCleanup'] ? $mfbfw['callbackOnCleanup'] . ',' : 'function() { },' ) ?>
340
+ afterShow: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnComplete'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnComplete'] ? $mfbfw['callbackOnComplete'] . ',' : 'function() { },' ) ?>
341
+ afterClose: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnClose'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnClose'] ? $mfbfw['callbackOnClose'] . ',' : 'function() { },' ) ?>
342
+ caption : <?php echo $caption ?>,
343
+ afterLoad : <?php echo $afterLoad ?>,
344
+ <?php echo $frameSize ?>
 
 
345
  });
346
+ <?php if ( isset( $mfbfw['extraCallsEnable'] ) && $mfbfw['extraCallsEnable'] ) {
347
+ echo "/* Extra Calls */";
348
+ echo $mfbfw['extraCallsData'];
349
+ } ?>
350
 
 
 
 
 
 
 
 
 
351
  })
352
  </script>
353
  <!-- END Fancybox for WordPress -->
354
+ <?php
355
  }
356
  }
357
 
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: 4.9
6
- Stable tag: 3.1.1
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,9 @@ If you enjoy using FancyBox lightbox for WordPress please leave a [positive feed
31
 
32
  == Changelog ==
33
 
 
 
 
34
  = 3.1.1 =
35
  * Removed print_r from fancybox.php
36
 
3
  Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
+ Stable tag: 3.1.2
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.2 =
35
+ * Fixed "All links get the fancybox class"
36
+
37
  = 3.1.1 =
38
  * Removed print_r from fancybox.php
39