FancyBox for WordPress - Version 3.2.8

Version Description

  • Fix property title of undefined when using newer versions of jQuery
  • Add option to disable FancyBox on mobile view
Download this release

Release Info

Developer giucu91
Plugin Icon wp plugin FancyBox for WordPress
Version 3.2.8
Comparing to
See all releases

Code changes from version 3.2.7 to 3.2.8

admin.php CHANGED
@@ -79,70 +79,6 @@ function mfbfw_options_page() {
79
  </div>
80
 
81
  </div>
82
-
83
- <div class="modula-wrap">
84
- <a target="_blank" href="http://wp-modula.com/?utm_source=fancybox-for-wp&utm_medium=options-page&utm_campaign=Modula%20Lite" class="modula-link">
85
- <img src="<?php echo FBFW_URL; ?>assets/images/modula-300x300.jpg"/>
86
- <h2>Easy Image Gallery for WP</h2>
87
- <p>Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. The result is a dynamic, creative, interesting and attractive gallery.</p>
88
-
89
- <?php
90
-
91
- $plugin_slug = 'modula-best-grid-gallery';
92
- $plugin_path = 'modula-best-grid-gallery/Modula.php';
93
-
94
- $installed = false;
95
- $activated = false;
96
- if ( file_exists( ABSPATH . 'wp-content/plugins/' . $plugin_slug ) ) {
97
- $installed = true;
98
- }
99
-
100
- if ( file_exists( ABSPATH . 'wp-content/plugins/' . $plugin_path ) ) {
101
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
102
- if ( is_plugin_active( $plugin_path ) ) {
103
- $activated = true;
104
- }
105
- }
106
-
107
- if ( ! $activated ) {
108
-
109
- if ( ! $installed ) {
110
- $label = esc_html__( 'Install & Activate Modula', 'mfbfw' );
111
- $link = wp_nonce_url(
112
- add_query_arg(
113
- array(
114
- 'action' => 'install-plugin',
115
- 'plugin' => $plugin_slug,
116
- ),
117
- network_admin_url( 'update.php' )
118
- ),
119
- 'install-plugin_' . $plugin_slug
120
- );
121
- $action = 'install';
122
- }else{
123
- $label = esc_html__( 'Activate Modula', 'mfbfw' );
124
- $link = add_query_arg(
125
- array(
126
- 'action' => 'activate',
127
- 'plugin' => rawurlencode( $plugin_path ),
128
- 'plugin_status' => 'all',
129
- 'paged' => '1',
130
- '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_path ),
131
- ),
132
- admin_url( 'plugins.php' )
133
- );
134
- $action = 'activate';
135
- }
136
-
137
- echo '<a href="' . esc_url( $link ) . '" class="mfbfw-modula-link button button-primary button-large" data-action="' . esc_attr( $action ) . '">' . esc_html( $label ) . '</a>';
138
-
139
- }
140
-
141
- ?>
142
-
143
- </a>
144
- </div>
145
-
146
 
147
  <?php
148
  }
79
  </div>
80
 
81
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  <?php
84
  }
assets/css/fancybox-admin.css CHANGED
@@ -43,6 +43,10 @@
43
  border: none
44
  }
45
 
 
 
 
 
46
  #fbfwTabs .ui-tabs-nav {
47
  background: 0 0;
48
  border: 0;
@@ -267,20 +271,6 @@ tr.spacer {
267
  float:left;
268
  }
269
 
270
- .modula-wrap {
271
- float: left;
272
- max-width: 20%;
273
- padding-top: 32px;
274
- }
275
-
276
- a.modula-link {
277
- color:#000;
278
- text-decoration: none;
279
- }
280
- a.modula-link:hover {
281
- text-decoration: none;
282
- }
283
-
284
  .cf:after,
285
  .cf:before {
286
  content: " ";
43
  border: none
44
  }
45
 
46
+ #fbfwTabs th {
47
+ min-width:250px;
48
+ }
49
+
50
  #fbfwTabs .ui-tabs-nav {
51
  background: 0 0;
52
  border: 0;
271
  float:left;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  .cf:after,
275
  .cf:before {
276
  content: " ";
assets/js/admin.js CHANGED
@@ -133,42 +133,4 @@ function activatePlugin( url ) {
133
  location.reload();
134
  }
135
  } );
136
- }
137
-
138
- jQuery( '.mfbfw-modula-link' ).click(function(evt){
139
- evt.preventDefault();
140
-
141
- var action = jQuery( this ).data( 'action' ),
142
- link = jQuery( this ).attr( 'href' );
143
-
144
- jQuery(this).addClass( 'updating-message' );
145
- jQuery(this).attr( 'disabled', 'disabled' );
146
-
147
- if ( 'install' == action ) {
148
- wp.updates.installPlugin( { slug: 'modula-best-grid-gallery' } );
149
- }else{
150
- activatePlugin( link );
151
- }
152
-
153
- });
154
-
155
- jQuery( document ).on( 'wp-plugin-install-success', function( response, data ) {
156
-
157
- if ( 'modula-best-grid-gallery' == data.slug ) {
158
-
159
- jQuery.ajax( {
160
- type: 'POST',
161
- data: { action: 'mfbfw_activate_link' },
162
- dataType: 'json',
163
- url: ajaxurl,
164
- success: function( json ) {
165
- if ( json.status ) {
166
- activatePlugin( json.link );
167
- }
168
- }
169
- });
170
-
171
- }
172
- console.log( response );
173
- console.log( data );
174
- });
133
  location.reload();
134
  }
135
  } );
136
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fancybox.php CHANGED
@@ -3,10 +3,10 @@
3
  * Plugin Name: FancyBox for WordPress
4
  * Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
5
  * Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
6
- * Version: 3.2.7
7
  * Author: Colorlib
8
  * Author URI: https://colorlib.com/wp/
9
- * Tested up to: 5.4
10
  * Requires: 4.6 or higher
11
  * License: GPLv3 or later
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -36,7 +36,7 @@
36
  * Plugin Init
37
  */
38
  // Constants
39
- define( 'FBFW_VERSION', '3.2.7' );
40
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
41
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
42
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
@@ -89,6 +89,7 @@ function mfbfw_defaults() {
89
  'titlePosition' => 'inside',
90
  'titleColor' => '#333333',
91
  'showNavArrows' => 'on',
 
92
  'titleSize' => '14',
93
  'showCloseButton' => '',
94
  'showToolbar' => 'on',
@@ -159,17 +160,23 @@ function mfbfw_enqueue_scripts() {
159
 
160
  global $mfbfw, $wp_styles;
161
 
 
 
 
 
162
  // Check if script should be loaded in footer
163
  if ( isset( $mfbfw['loadAtFooter'] ) && $mfbfw['loadAtFooter'] ) {
164
  $footer = true;
165
- } else {
 
166
  $footer = false;
167
  }
168
 
169
  // Check if plugin should not call jQuery script (for troubleshooting only)
170
  if ( isset( $mfbfw['nojQuery'] ) && $mfbfw['nojQuery'] ) {
171
  $jquery = false;
172
- } else {
 
173
  $jquery = array( 'jquery' );
174
  }
175
 
@@ -207,10 +214,10 @@ function mfbfw_init() {
207
 
208
  //caption function to display image title
209
  $caption = 'function( instance, item ) {' .
210
- 'var testing = jQuery(this).context.title;' .
211
  'var caption = jQuery(this).data(\'caption\') || \'\';' .
212
- 'if ( item.type === \'image\' && testing.length ) {' .
213
- 'caption = (caption.length ? caption + \'<br />\' : \'\') + \'<p class="caption-title">\'+testing+\'</p>\' ;' .
214
  '}' .
215
  'return caption;' .
216
  '}';
@@ -297,145 +304,158 @@ function mfbfw_init() {
297
  </style>';
298
  ?>
299
  <script type="text/javascript">
300
- jQuery(function(){
 
 
 
 
 
301
 
302
- jQuery.fn.getTitle = function() { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles
 
 
 
 
303
  <?php echo $mfbfw['copyTitleFunction'] ?>
304
  }
305
 
306
  // Supported file extensions
307
 
308
- <?php
309
- if(isset($mfbfw['exclude_pdf']) && 'on' == $mfbfw['exclude_pdf']){
310
- ?>
311
- var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter(function () {
312
- return /\.(jpe?g|png|gif|mp4|webp|bmp)(\?[^/]*)*$/i.test(jQuery(this).attr('href'))
313
- });
314
- <?php
315
- } else {
316
- ?>
317
- var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter(function () {
318
- return /\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href'))
319
- });
320
- <?php
321
- }
322
- ?>
323
 
324
 
325
  // Add data-type iframe for links that are not images or videos.
326
- 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')) });
327
- iframeLinks.attr({ "data-type" : "iframe" }).getTitle();
 
 
 
 
328
 
329
  <?php if ( $mfbfw['galleryType'] == 'post' ) { ?>
330
 
331
- // Gallery type BY POST and on post or page (so only one post or page is visible)
332
- <?php if ( is_singular() ) { ?>
333
- // Gallery by post
334
- thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
335
- iframeLinks.attr({ "data-fancybox":"gallery" }).getTitle();
336
 
337
- <?php } else { ?>
338
- // Gallery by post
339
- var posts = jQuery(".post");
340
- posts.each(function() {
341
- jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox","gallery"+posts.index(this)).attr("rel","fancybox"+posts.index(this)).getTitle();
342
 
343
- jQuery(this).find(iframeLinks).attr({ "data-fancybox":"gallery"+posts.index(this) }).attr("rel","fancybox"+posts.index(this)).getTitle();
344
 
345
- });
346
 
347
- <?php } ?>
348
 
349
  // Gallery type ALL
350
  <?php } elseif ( $mfbfw['galleryType'] == 'all' ) { ?>
351
  // Gallery All
352
- thumbnails.addClass("fancyboxforwp").attr("data-fancybox","gallery").getTitle();
353
- iframeLinks.attr({ "data-fancybox":"gallery" }).getTitle();
354
 
355
  // Gallery type NONE
356
  <?php } elseif ( $mfbfw['galleryType'] == 'none' ) { ?>
357
  // No Galleries
358
- thumbnails.each(function(){
359
  var rel = jQuery(this).attr("rel");
360
  var imgTitle = jQuery(this).children("img").attr("title");
361
- jQuery(this).addClass("fancyboxforwp").attr("data-fancybox",rel);
362
- jQuery(this).attr("title",imgTitle);
363
  });
364
 
365
- iframeLinks.each(function(){
366
- var rel = jQuery(this).attr("rel");
367
- var imgTitle = jQuery(this).children("img").attr("title");
368
- jQuery(this).attr({"data-fancybox":rel});
369
- jQuery(this).attr("title",imgTitle);
370
- });
371
 
372
  // Else, gallery type is custom, so just print the custom expression
373
  <?php } else if( $mfbfw['galleryType'] == 'single_gutenberg_block'){
374
- ?>
375
 
376
- var gallery_block;
377
- if(jQuery('ul.wp-block-gallery').length){
378
- var gallery_block = jQuery('ul.wp-block-gallery');
379
- } else if(jQuery('ul.blocks-gallery-grid')) {
380
- var gallery_block = jQuery('ul.blocks-gallery-grid');
381
- }
382
- gallery_block.each(function() {
383
- jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox","gallery"+gallery_block.index(this)).attr("rel","fancybox"+gallery_block.index(this)).getTitle();
384
 
385
- jQuery(this).find(iframeLinks).attr({ "data-fancybox":"gallery"+gallery_block.index(this) }).attr("rel","fancybox"+gallery_block.index(this)).getTitle();
386
 
387
- });
388
- <?php
389
  } else { ?>
390
- /* Custom Expression */
391
- <?php echo $mfbfw['customExpression']; ?>
392
  <?php } ?>
393
 
394
-
395
-
396
  // Call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
397
  jQuery("a.fancyboxforwp").fancyboxforwp({
398
- loop: <?php echo ( isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false' ) ?>,
399
- smallBtn: <?php echo ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) ?>,
400
- zoomOpacity: <?php echo ( isset( $mfbfw['zoomOpacity'] ) && $mfbfw['zoomOpacity'] ? '"auto"' : 'false' ) ?>,
401
  animationEffect: "<?php echo $mfbfw['transitionIn'] ?>",
402
  animationDuration: <?php echo $mfbfw['zoomSpeedIn'] ?>,
403
  transitionEffect: "<?php echo $mfbfw['transitionEffect'] ?>",
404
- transitionDuration : "<?php echo $mfbfw['zoomSpeedChange'] ?>",
405
- overlayShow: <?php echo ( isset( $mfbfw['overlayShow'] ) && $mfbfw['overlayShow'] ? 'true' : 'false' ) ?>,
406
  overlayOpacity: "<?php echo $mfbfw['overlayOpacity'] ?>",
407
- titleShow: <?php echo ( isset( $mfbfw['titleShow'] ) && $mfbfw['titleShow'] ? 'true' : 'false' ) ?>,
408
  titlePosition: "<?php echo $mfbfw['titlePosition'] ?>",
409
- keyboard: <?php echo ( isset( $mfbfw['enableEscapeButton'] ) && $mfbfw['enableEscapeButton'] ? 'true' : 'false' ) ?>,
410
- showCloseButton: <?php echo ( isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false' ) ?>,
411
- arrows: <?php echo ( isset( $mfbfw['showNavArrows'] ) && $mfbfw['showNavArrows'] ? 'true' : 'false' ) ?>,
412
- clickContent: <?php echo ( isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : 'false' ) ?>,
413
- clickSlide: <?php echo ( isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? '"close"' : 'false' ) ?>,
414
- mobile:{
415
- clickContent: function(current, event) {
416
- return current.type === "image" ? <?php echo ( isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : '"toggleControls"' ) ?> : false;
417
- },
418
- clickSlide: function(current, event) {
419
- return current.type === "image" ? <?php echo ( isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? '"close"' : '"toggleControls"' ) ?> : "close";
420
- },
421
- },
422
- wheel: <?php echo ( isset( $mfbfw['mouseWheel'] ) && $mfbfw['mouseWheel'] ? 'true' : 'false' ) ?>,
423
- toolbar: <?php echo ( isset( $mfbfw['showToolbar'] ) && $mfbfw['showToolbar'] ? 'true' : 'false' ) ?>,
424
  preventCaptionOverlap: true,
425
- onInit: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnStart'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnStart'] ? $mfbfw['callbackOnStart'] . ',' : 'function() { },' ) ?>
426
- onDeactivate: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCancel'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCancel'] ? $mfbfw['callbackOnCancel'] . ',' : 'function() { },' ) ?>
427
- beforeClose: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCleanup'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCleanup'] ? $mfbfw['callbackOnCleanup'] . ',' : 'function() { },' ) ?>
428
- afterShow: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnComplete'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnComplete'] ? $mfbfw['callbackOnComplete'] . ',' : 'function() { },' ) ?>
429
- afterClose: <?php echo ( isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnClose'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnClose'] ? $mfbfw['callbackOnClose'] . ',' : 'function() { },' ) ?>
430
- caption : <?php echo $caption ?>,
431
- afterLoad : <?php echo $afterLoad ?>,
432
- <?php echo $frameSize ?>
433
- });
434
- <?php if ( isset( $mfbfw['extraCallsEnable'] ) && $mfbfw['extraCallsEnable'] ) {
435
- echo "/* Extra Calls */";
436
- echo $mfbfw['extraCallsData'];
437
- } ?>
438
 
 
 
 
 
439
  })
440
  </script>
441
  <!-- END Fancybox for WordPress -->
@@ -572,31 +592,4 @@ function fancy_check_if_woocommerce() {
572
  } else {
573
  return 'true';
574
  }
575
- }
576
-
577
- // Ajax request for activate link
578
- add_action( 'wp_ajax_mfbfw_activate_link', 'mfbfw_get_activate_link' );
579
- function mfbfw_get_activate_link() {
580
-
581
- $plugin_path = 'modula-best-grid-gallery/Modula.php';
582
- $link = add_query_arg(
583
- array(
584
- 'action' => 'activate',
585
- 'plugin' => rawurlencode( $plugin_path ),
586
- 'plugin_status' => 'all',
587
- 'paged' => '1',
588
- '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_path ),
589
- ),
590
- admin_url( 'plugins.php' )
591
- );
592
-
593
- wp_die(
594
- wp_json_encode(
595
- array(
596
- 'status' => 'succes',
597
- 'link' => $link,
598
- )
599
- )
600
- );
601
-
602
  }
3
  * Plugin Name: FancyBox for WordPress
4
  * Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
5
  * Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
6
+ * Version: 3.2.8
7
  * Author: Colorlib
8
  * Author URI: https://colorlib.com/wp/
9
+ * Tested up to: 5.5
10
  * Requires: 4.6 or higher
11
  * License: GPLv3 or later
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
36
  * Plugin Init
37
  */
38
  // Constants
39
+ define( 'FBFW_VERSION', '3.2.8' );
40
  define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
41
  define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
42
  define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
89
  'titlePosition' => 'inside',
90
  'titleColor' => '#333333',
91
  'showNavArrows' => 'on',
92
+ 'disableOnMobile' => '',
93
  'titleSize' => '14',
94
  'showCloseButton' => '',
95
  'showToolbar' => 'on',
160
 
161
  global $mfbfw, $wp_styles;
162
 
163
+ if ( (isset( $mfbfw['disableOnMobile'] ) && $mfbfw['disableOnMobile']) && wp_is_mobile() ) {
164
+ return;
165
+ }
166
+
167
  // Check if script should be loaded in footer
168
  if ( isset( $mfbfw['loadAtFooter'] ) && $mfbfw['loadAtFooter'] ) {
169
  $footer = true;
170
+ }
171
+ else {
172
  $footer = false;
173
  }
174
 
175
  // Check if plugin should not call jQuery script (for troubleshooting only)
176
  if ( isset( $mfbfw['nojQuery'] ) && $mfbfw['nojQuery'] ) {
177
  $jquery = false;
178
+ }
179
+ else {
180
  $jquery = array( 'jquery' );
181
  }
182
 
214
 
215
  //caption function to display image title
216
  $caption = 'function( instance, item ) {' .
217
+ 'if("undefined" != typeof jQuery(this).context ){var title = jQuery(this).context.title;} else { var title = jQuery(this).attr("title");}' .
218
  'var caption = jQuery(this).data(\'caption\') || \'\';' .
219
+ 'if ( item.type === \'image\' && title.length ) {' .
220
+ 'caption = (caption.length ? caption + \'<br />\' : \'\') + \'<p class="caption-title">\'+title+\'</p>\' ;' .
221
  '}' .
222
  'return caption;' .
223
  '}';
304
  </style>';
305
  ?>
306
  <script type="text/javascript">
307
+ jQuery(function () {
308
+
309
+ var mobileOnly = false;
310
+ <?php if(isset( $mfbfw['disableOnMobile'] ) && 'on' == $mfbfw['disableOnMobile'] && wp_is_mobile() ){ ?>
311
+ mobileOnly = true;
312
+ <?php } ?>
313
 
314
+ if (mobileOnly) {
315
+ return;
316
+ }
317
+
318
+ jQuery.fn.getTitle = function () { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles
319
  <?php echo $mfbfw['copyTitleFunction'] ?>
320
  }
321
 
322
  // Supported file extensions
323
 
324
+ <?php
325
+ if(isset( $mfbfw['exclude_pdf'] ) && 'on' == $mfbfw['exclude_pdf']){
326
+ ?>
327
+ var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter(function () {
328
+ return /\.(jpe?g|png|gif|mp4|webp|bmp)(\?[^/]*)*$/i.test(jQuery(this).attr('href'))
329
+ });
330
+ <?php
331
+ } else {
332
+ ?>
333
+ var thumbnails = jQuery("a:has(img)").not(".nolightbox").not('.envira-gallery-link').not('.ngg-simplelightbox').filter(function () {
334
+ return /\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href'))
335
+ });
336
+ <?php
337
+ }
338
+ ?>
339
 
340
 
341
  // Add data-type iframe for links that are not images or videos.
342
+ var iframeLinks = jQuery('.fancyboxforwp').filter(function () {
343
+ return !/\.(jpe?g|png|gif|mp4|webp|bmp|pdf)(\?[^/]*)*$/i.test(jQuery(this).attr('href'))
344
+ }).filter(function () {
345
+ return !/vimeo|youtube/i.test(jQuery(this).attr('href'))
346
+ });
347
+ iframeLinks.attr({"data-type": "iframe"}).getTitle();
348
 
349
  <?php if ( $mfbfw['galleryType'] == 'post' ) { ?>
350
 
351
+ // Gallery type BY POST and on post or page (so only one post or page is visible)
352
+ <?php if ( is_singular() ) { ?>
353
+ // Gallery by post
354
+ thumbnails.addClass("fancyboxforwp").attr("data-fancybox", "gallery").getTitle();
355
+ iframeLinks.attr({"data-fancybox": "gallery"}).getTitle();
356
 
357
+ <?php } else { ?>
358
+ // Gallery by post
359
+ var posts = jQuery(".post");
360
+ posts.each(function () {
361
+ jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox", "gallery" + posts.index(this)).attr("rel", "fancybox" + posts.index(this)).getTitle();
362
 
363
+ jQuery(this).find(iframeLinks).attr({"data-fancybox": "gallery" + posts.index(this)}).attr("rel", "fancybox" + posts.index(this)).getTitle();
364
 
365
+ });
366
 
367
+ <?php } ?>
368
 
369
  // Gallery type ALL
370
  <?php } elseif ( $mfbfw['galleryType'] == 'all' ) { ?>
371
  // Gallery All
372
+ thumbnails.addClass("fancyboxforwp").attr("data-fancybox", "gallery").getTitle();
373
+ iframeLinks.attr({"data-fancybox": "gallery"}).getTitle();
374
 
375
  // Gallery type NONE
376
  <?php } elseif ( $mfbfw['galleryType'] == 'none' ) { ?>
377
  // No Galleries
378
+ thumbnails.each(function () {
379
  var rel = jQuery(this).attr("rel");
380
  var imgTitle = jQuery(this).children("img").attr("title");
381
+ jQuery(this).addClass("fancyboxforwp").attr("data-fancybox", rel);
382
+ jQuery(this).attr("title", imgTitle);
383
  });
384
 
385
+ iframeLinks.each(function () {
386
+ var rel = jQuery(this).attr("rel");
387
+ var imgTitle = jQuery(this).children("img").attr("title");
388
+ jQuery(this).attr({"data-fancybox": rel});
389
+ jQuery(this).attr("title", imgTitle);
390
+ });
391
 
392
  // Else, gallery type is custom, so just print the custom expression
393
  <?php } else if( $mfbfw['galleryType'] == 'single_gutenberg_block'){
394
+ ?>
395
 
396
+ var gallery_block;
397
+ if (jQuery('ul.wp-block-gallery').length) {
398
+ var gallery_block = jQuery('ul.wp-block-gallery');
399
+ } else if (jQuery('ul.blocks-gallery-grid')) {
400
+ var gallery_block = jQuery('ul.blocks-gallery-grid');
401
+ }
402
+ gallery_block.each(function () {
403
+ jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox", "gallery" + gallery_block.index(this)).attr("rel", "fancybox" + gallery_block.index(this)).getTitle();
404
 
405
+ jQuery(this).find(iframeLinks).attr({"data-fancybox": "gallery" + gallery_block.index(this)}).attr("rel", "fancybox" + gallery_block.index(this)).getTitle();
406
 
407
+ });
408
+ <?php
409
  } else { ?>
410
+ /* Custom Expression */
411
+ <?php echo $mfbfw['customExpression']; ?>
412
  <?php } ?>
413
 
 
 
414
  // Call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
415
  jQuery("a.fancyboxforwp").fancyboxforwp({
416
+ loop: <?php echo(isset( $mfbfw['cyclic'] ) && $mfbfw['cyclic'] ? 'true' : 'false') ?>,
417
+ smallBtn: <?php echo(isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false') ?>,
418
+ zoomOpacity: <?php echo(isset( $mfbfw['zoomOpacity'] ) && $mfbfw['zoomOpacity'] ? '"auto"' : 'false') ?>,
419
  animationEffect: "<?php echo $mfbfw['transitionIn'] ?>",
420
  animationDuration: <?php echo $mfbfw['zoomSpeedIn'] ?>,
421
  transitionEffect: "<?php echo $mfbfw['transitionEffect'] ?>",
422
+ transitionDuration: "<?php echo $mfbfw['zoomSpeedChange'] ?>",
423
+ overlayShow: <?php echo(isset( $mfbfw['overlayShow'] ) && $mfbfw['overlayShow'] ? 'true' : 'false') ?>,
424
  overlayOpacity: "<?php echo $mfbfw['overlayOpacity'] ?>",
425
+ titleShow: <?php echo(isset( $mfbfw['titleShow'] ) && $mfbfw['titleShow'] ? 'true' : 'false') ?>,
426
  titlePosition: "<?php echo $mfbfw['titlePosition'] ?>",
427
+ keyboard: <?php echo(isset( $mfbfw['enableEscapeButton'] ) && $mfbfw['enableEscapeButton'] ? 'true' : 'false') ?>,
428
+ showCloseButton: <?php echo(isset( $mfbfw['showCloseButton'] ) && $mfbfw['showCloseButton'] ? 'true' : 'false') ?>,
429
+ arrows: <?php echo(isset( $mfbfw['showNavArrows'] ) && $mfbfw['showNavArrows'] ? 'true' : 'false') ?>,
430
+ clickContent:<?php echo(isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : 'false') ?>,
431
+ clickSlide: <?php echo(isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? '"close"' : 'false') ?>,
432
+ mobile: {
433
+ clickContent: function (current, event) {
434
+ return current.type === "image" ? <?php echo(isset( $mfbfw['hideOnContentClick'] ) && $mfbfw['hideOnContentClick'] ? '"close"' : '"toggleControls"') ?> : false;
435
+ },
436
+ clickSlide: function (current, event) {
437
+ return current.type === "image" ? <?php echo(isset( $mfbfw['hideOnOverlayClick'] ) && $mfbfw['hideOnOverlayClick'] ? '"close"' : '"toggleControls"') ?> : "close";
438
+ },
439
+ },
440
+ wheel: <?php echo(isset( $mfbfw['mouseWheel'] ) && $mfbfw['mouseWheel'] ? 'true' : 'false') ?>,
441
+ toolbar: <?php echo(isset( $mfbfw['showToolbar'] ) && $mfbfw['showToolbar'] ? 'true' : 'false') ?>,
442
  preventCaptionOverlap: true,
443
+ onInit: <?php echo(isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnStart'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnStart'] ? $mfbfw['callbackOnStart'] . ',' : 'function() { },') ?>
444
+ onDeactivate
445
+ : <?php echo(isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCancel'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCancel'] ? $mfbfw['callbackOnCancel'] . ',' : 'function() { },') ?>
446
+ beforeClose: <?php echo(isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnCleanup'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnCleanup'] ? $mfbfw['callbackOnCleanup'] . ',' : 'function() { },') ?>
447
+ afterShow: <?php echo(isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnComplete'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnComplete'] ? $mfbfw['callbackOnComplete'] . ',' : 'function() { },') ?>
448
+ afterClose: <?php echo(isset( $mfbfw['callbackEnable'], $mfbfw['callbackOnClose'] ) && $mfbfw['callbackEnable'] && $mfbfw['callbackOnClose'] ? $mfbfw['callbackOnClose'] . ',' : 'function() { },') ?>
449
+ caption : <?php echo $caption ?>,
450
+ afterLoad : <?php echo $afterLoad ?>,
451
+ <?php echo $frameSize ?>
452
+ })
453
+ ;
 
 
454
 
455
+ <?php if ( isset( $mfbfw['extraCallsEnable'] ) && $mfbfw['extraCallsEnable'] ) {
456
+ echo "/* Extra Calls */";
457
+ echo $mfbfw['extraCallsData'];
458
+ } ?>
459
  })
460
  </script>
461
  <!-- END Fancybox for WordPress -->
592
  } else {
593
  return 'true';
594
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  }
lib/admin-tab-behaviour.php CHANGED
@@ -200,5 +200,32 @@
200
  </fieldset>
201
  </td>
202
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  </tbody>
204
  </table>
200
  </fieldset>
201
  </td>
202
  </tr>
203
+ <tr valign="top">
204
+ <th scope="row"><?php _e( 'Disable FancyBox on mobile', 'mfbfw' ); ?>
205
+ <span class="tooltip-right"
206
+ data-tooltip="<?php _e( 'Disables FancyBox on mobile view (default: off)', 'mfbfw' ); ?>">
207
+ <i class="dashicons dashicons-editor-help"></i>
208
+ </span>
209
+ </th>
210
+ <td>
211
+ <fieldset>
212
+ <div class="epsilon-toggle">
213
+ <input class="epsilon-toggle__input" type="checkbox" id="disableOnMobile" name="mfbfw[disableOnMobile]" <?php checked( 1, isset( $settings['disableOnMobile'] ) && 'on' == $settings['disableOnMobile'] ); ?> >
214
+ <div class="epsilon-toggle__items">
215
+ <span class="epsilon-toggle__track"></span>
216
+ <span class="epsilon-toggle__thumb"></span>
217
+ <svg class="epsilon-toggle__off" width="6" height="6" aria-hidden="true" role="img" focusable="false" viewBox="0 0 6 6">
218
+ <path d="M3 1.5c.8 0 1.5.7 1.5 1.5S3.8 4.5 3 4.5 1.5 3.8 1.5 3 2.2 1.5 3 1.5M3 0C1.3 0 0 1.3 0 3s1.3 3 3 3 3-1.3 3-3-1.3-3-3-3z"></path>
219
+ </svg>
220
+ <svg class="epsilon-toggle__on" width="2" height="6" aria-hidden="true" role="img" focusable="false" viewBox="0 0 2 6">
221
+ <path d="M0 0h2v6H0z"></path>
222
+ </svg>
223
+ </div>
224
+ </div>
225
+
226
+ <div class="cf"></div>
227
+ </fieldset>
228
+ </td>
229
+ </tr>
230
  </tbody>
231
  </table>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: silkalns
3
  Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
4
  Requires at least: 4.6
5
- Tested up to: 5.4
6
- Stable tag: 3.2.7
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -31,6 +31,10 @@ If you enjoy using FancyBox lightbox for WordPress please leave a [positive feed
31
 
32
  == Changelog ==
33
 
 
 
 
 
34
  = 3.2.7 =
35
  * Fix for separate gutenberg blocks
36
  * Personalize script handles
2
  Contributors: silkalns
3
  Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
4
  Requires at least: 4.6
5
+ Tested up to: 5.5
6
+ Stable tag: 3.2.8
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
31
 
32
  == Changelog ==
33
 
34
+ = 3.2.8 =
35
+ * Fix property ‘title’ of undefined when using newer versions of jQuery
36
+ * Add option to disable FancyBox on mobile view
37
+
38
  = 3.2.7 =
39
  * Fix for separate gutenberg blocks
40
  * Personalize script handles