Skip to content

Commit f05032c

Browse files
authored
Merge pull request #63 from MachoThemes/master
update to 3.2.2
2 parents cac97e3 + 15522c1 commit f05032c

File tree

8 files changed

+164
-28
lines changed

8 files changed

+164
-28
lines changed

assets/css/fancybox-admin.css

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,18 @@ a.modula-link:hover {
511511

512512
.epsilon-toggle {
513513
position: relative;
514+
float: left;
514515
user-select: none;
515-
display:inline-block;
516-
vertical-align: middle;
517516
}
518517

519518
.epsilon-toggle__items {
520519
box-sizing: border-box;
521520
}
522521

522+
.epsilon-toggle__items > * {
523+
box-sizing: inherit;
524+
}
525+
523526
.epsilon-toggle__input[type=checkbox] {
524527
border-radius: 2px;
525528
border: 2px solid #6c7781;
@@ -549,47 +552,45 @@ a.modula-link:hover {
549552

550553
.epsilon-toggle__thumb {
551554
background-color: #6c7781;
555+
border: 5px solid #6c7781;
552556
border-radius: 50%;
553557
display: block;
554558
height: 10px;
555559
width: 10px;
556560
position: absolute;
557-
left: 7px;
558-
top: 5px;
561+
left: 4px;
562+
top: 4px;
559563
transition: transform .2s ease;
560564
}
561565

562566
.epsilon-toggle__off {
563567
position: absolute;
564-
right: 7px;
565-
top: 7px;
566-
width:7px;
567-
height:7px;
568+
right: 6px;
569+
top: 6px;
568570
color: #6c7781;
569571
fill: currentColor;
570572
}
571573

572574
.epsilon-toggle__on {
573575
position: absolute;
574-
top: 7px;
576+
top: 6px;
575577
left: 8px;
578+
border: 1px solid #fff;
576579
outline: 1px solid transparent;
577580
outline-offset: -1px;
578581
display: none;
579-
fill:#fff;
580582
}
581583

584+
582585
.epsilon-toggle__input[type=checkbox]:checked + .epsilon-toggle__items .epsilon-toggle__track {
583586
background-color: #11a0d2;
584-
border: 2px solid transparent;
587+
border: 9px solid transparent;
585588
}
586589

587590
.epsilon-toggle__input[type=checkbox]:checked + .epsilon-toggle__items .epsilon-toggle__thumb {
588591
background-color: #fff;
589592
border-width: 0;
590593
transform: translateX(18px);
591-
width: 10px;
592-
height: 10px;
593594
}
594595

595596
.epsilon-toggle__input[type=checkbox]:checked + .epsilon-toggle__items .epsilon-toggle__off {

assets/css/fancybox.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@ body.compensate-for-scrollbar {
239239
background: transparent;
240240
border: 0;
241241
height: 100%;
242-
left: 0;
242+
/*left: 0;*/
243243
/* Fix images beeing distorted */
244244
object-fit: contain;
245245
margin: 0;
246246
max-height: none;
247247
max-width: none;
248248
padding: 0;
249-
position: absolute;
250-
top: 0;
249+
/*position: absolute;
250+
top: 0;*/
251251
-webkit-user-select: none;
252252
-moz-user-select: none;
253253
-ms-user-select: none;

assets/js/admin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ jQuery(function () {
100100
case "all":
101101
case "none":
102102
case "post":
103+
case "single_gutenberg_block" :
103104
jQuery("#customExpressionBlock").css("display", "none");
104105
}
105106

106-
jQuery("#galleryTypeAll, #galleryTypeNone, #galleryTypePost").click(function () {
107+
jQuery("#galleryTypeAll, #galleryTypeNone, #galleryTypePost, #galleryTypeGutenbergBlock").click(function () {
107108
jQuery("#customExpressionBlock").hide("slow");
108109
});
109110

assets/js/jquery.fancybox.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3178,8 +3178,31 @@
31783178
css.width = props.width;
31793179
}
31803180

3181+
var custom_caption_outerHeight = 0;
3182+
3183+
if($('.fancybox-custom-caption.inside-caption').length ){
3184+
custom_caption_outerHeight = $el.find('.fancybox-custom-caption').outerHeight();
3185+
if(custom_caption_outerHeight == 0){
3186+
custom_caption_outerHeight = 10;
3187+
}
3188+
} else {
3189+
custom_caption_outerHeight = ($el.find('.fancybox-image').outerHeight() - $el.find('.fancybox-image').height())/2;
3190+
// Seems like different border width for image requires a little trimming
3191+
if(custom_caption_outerHeight > 20 && custom_caption_outerHeight < 25 ){
3192+
custom_caption_outerHeight -= 2;
3193+
}
3194+
3195+
if(custom_caption_outerHeight >= 25 && custom_caption_outerHeight <= 30){
3196+
custom_caption_outerHeight -= 4;
3197+
}
3198+
3199+
if(custom_caption_outerHeight > 30){
3200+
custom_caption_outerHeight -= 6;
3201+
}
3202+
}
3203+
31813204
if (props.height !== undefined) {
3182-
css.height = props.height;
3205+
css.height = props.height + custom_caption_outerHeight;
31833206
}
31843207

31853208
return $el.css(css);

fancybox.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: FancyBox for WordPress
44
* Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
55
* Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
6-
* Version: 3.2.0
6+
* Version: 3.2.2
77
* Author: Colorlib
88
* Author URI: https://colorlib.com/wp/
99
* Tested up to: 5.1
@@ -36,7 +36,7 @@
3636
* Plugin Init
3737
*/
3838
// Constants
39-
define( 'FBFW_VERSION', '3.2.0' );
39+
define( 'FBFW_VERSION', '3.2.2' );
4040
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
4141
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
4242
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
@@ -221,10 +221,10 @@ function mfbfw_init() {
221221
if(caption && title){jQuery(this).attr("title",title+" " + caption)}else if(title){ jQuery(this).attr("title",title);}else if(caption){jQuery(this).attr("title",caption);}
222222
}); ';
223223

224-
224+
$afterLoad = '';
225225
if ( $mfbfw['titlePosition'] == 'inside' ) {
226226
$afterLoad = 'function( instance, current ) {';
227-
$afterLoad .= 'current.$content.append(\'<div class=\"fancybox-custom-caption\" style=\" position: absolute;left:0;right:0;color:#000;padding-top:10px;bottom:-50px;margin:0 auto;text-align:center; \">\' + current.opts.caption + \'</div>\');';
227+
$afterLoad .= 'current.$content.append(\'<div class=\"fancybox-custom-caption inside-caption\" style=\" position: absolute;left:0;right:0;color:#000;margin:0 auto;bottom:0;text-align:center;background-color:'.$mfbfw['paddingColor'].' \">\' + current.opts.caption + \'</div>\');';
228228
$afterLoad .= '}';
229229
$hideCaption = 'div.fancybox-caption{display:none !important;}';
230230
} else if ( $mfbfw['titlePosition'] == 'over' ) {
@@ -251,7 +251,7 @@ function mfbfw_init() {
251251
//title position settings
252252
if ( isset( $mfbfw['titlePosition'] ) ) {
253253
if ( $mfbfw['titlePosition'] == 'inside' ) {
254-
$captionPosition = 'div.fancybox-caption p.caption-title {background:#fff; width:auto;padding:10px 30px;}';
254+
$captionPosition = 'div.fancybox-caption p.caption-title {background:#fff; width:auto;padding:10px 30px;}div.fancybox-content p.caption-title{color:'.$mfbfw['titleColor'].';margin: 0;padding: 5px 0;}';
255255
} elseif ( $mfbfw['titlePosition'] == 'float' ) {
256256
$captionPosition = 'div.fancybox-caption p.caption-title {background:#fff;color:#000;padding:10px 30px;width:auto;}';
257257
} else {
@@ -267,7 +267,7 @@ function mfbfw_init() {
267267
echo '
268268
<!-- Fancybox for WordPress v' . $mfbfw_version . ' -->
269269
<style type="text/css">
270-
'.$hideCaption.'
270+
.fancybox-slide--image .fancybox-content{background-color: ' . $mfbfw['paddingColor'] . '}'.$hideCaption.'
271271
' . ( isset( $mfbfw['overlayShow'] ) ? '' : 'div.fancybox-bg{background:transparent !important;}' ) . '
272272
' . 'img.fancybox-image{border-width:' . $mfbfw['padding'] . 'px;border-color:' . $mfbfw['paddingColor'] . ';border-style:solid;height:auto;}' . '
273273
' . ( isset( $mfbfw['overlayColor'] ) && $mfbfw['overlayColor'] ? 'div.fancybox-bg{background-color:' . hexTorgba( $mfbfw['overlayColor'], $mfbfw['overlayOpacity'] ) . ';opacity:1 !important;}' : '' ) . ( isset( $mfbfw['paddingColor'] ) && $mfbfw['paddingColor'] ? 'div.fancybox-content{border-color:' . $mfbfw['paddingColor'] . '}' : '' ) . '
@@ -357,7 +357,18 @@ function mfbfw_init() {
357357
});
358358

359359
// Else, gallery type is custom, so just print the custom expression
360-
<?php } else { ?>
360+
<?php } else if( $mfbfw['galleryType'] == 'single_gutenberg_block'){
361+
?>
362+
363+
var gallery_block = jQuery('ul.wp-block-gallery');
364+
gallery_block.each(function() {
365+
jQuery(this).find(thumbnails).addClass("fancyboxforwp").attr("data-fancybox","gallery"+gallery_block.index(this)).attr("rel","fancybox"+gallery_block.index(this)).getTitle();
366+
367+
jQuery(this).find(iframeLinks).attr({ "data-fancybox":"gallery"+gallery_block.index(this) }).attr("rel","fancybox"+gallery_block.index(this)).getTitle();
368+
369+
});
370+
<?php
371+
} else { ?>
361372
/* Custom Expression */
362373
<?php echo $mfbfw['customExpression']; ?>
363374
<?php } ?>
@@ -563,3 +574,5 @@ function mfbfw_get_activate_link() {
563574
);
564575

565576
}
577+
578+
require_once 'lib/class-colorlib-dashboard-widget-extend-feed.php';

lib/admin-tab-galleries.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<?php _e( 'Make a gallery for all images on the page (default)', 'mfbfw' ); ?>
1616
</label><br /><br />
1717

18-
<input id="galleryTypeNone" class="galleryType" type="radio" value="none" name="mfbfw[galleryType]"<?php if ( $settings[ 'galleryType' ] == 'none' ) echo ' checked="yes"'; ?> />
18+
<input id="galleryTypeGutenbergBlock" class="galleryType" type="radio" value="single_gutenberg_block" name="mfbfw[galleryType]"<?php if ( $settings[ 'galleryType' ] == 'single_gutenberg_block' ) echo ' checked="yes"'; ?> />
1919
<label for="galleryTypeNone">
20-
<?php _e( 'Do not group images in gallery automatically (use this if you want to make galleries manually with the <code>REL</code> attribute)', 'mfbfw' ); ?>
20+
<?php _e( 'Make a gallery for each gutenberg gallery block', 'mfbfw' ); ?>
2121
</label><br /><br />
2222

2323
<input id="galleryTypePost" class="galleryType" type="radio" value="post" name="mfbfw[galleryType]"<?php if ( $settings[ 'galleryType' ] == 'post' ) echo ' checked="yes"'; ?> />
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
3+
if ( ! class_exists( 'Colorlib_Dashboard_Widget_Extend_Feed' ) ) {
4+
5+
class Colorlib_Dashboard_Widget_Extend_Feed {
6+
7+
public function __construct() {
8+
9+
// Actions.
10+
add_action( 'wp_feed_options', array( $this, 'dashboard_update_feed_urls' ), 10, 2 );
11+
12+
// Filters.
13+
add_filter( 'dashboard_secondary_items', array( $this, 'dashboard_items_count' ) );
14+
15+
}
16+
17+
public function dashboard_items_count() {
18+
19+
/**
20+
* Apply the filters am_dashboard_feed_count for letting an admin
21+
* override this count.
22+
*/
23+
return (int) apply_filters( 'colorlib_dashboard_feed_count', 6 );
24+
}
25+
26+
public function dashboard_update_feed_urls( $feed, $url ) {
27+
28+
global $pagenow;
29+
30+
// Return early if not on the right page.
31+
if ( 'admin-ajax.php' !== $pagenow ) {
32+
return;
33+
}
34+
35+
/**
36+
* Return early if not on the right feed.
37+
* We want to modify the feed URLs only for the
38+
* WordPress Events & News Dashboard Widget
39+
*/
40+
if ( is_array( $url ) ) {
41+
if ( ! in_array( 'https://planet.wordpress.org/feed/', $url ) ) {
42+
return;
43+
}
44+
}else{
45+
if ( strpos( $url, 'planet.wordpress.org' ) === false ) {
46+
return;
47+
}
48+
}
49+
50+
// Build the feed sources.
51+
$all_feed_urls = $this->get_feed_urls( $url );
52+
53+
// Update the feed sources.
54+
$feed->set_feed_url( $all_feed_urls );
55+
}
56+
57+
public function get_feed_urls( $url ) {
58+
59+
// Initialize the feeds array.
60+
$feed_urls = array( $url );
61+
62+
$check = get_transient( 'colorlib_dashboard_feed' );
63+
$feeds = array();
64+
if ( ! $check ) {
65+
66+
$feed_working = 'not-working';
67+
68+
// Load SimplePie Instance
69+
$feed = fetch_feed( array( 'https://colorlib.com/wp/feed/' ) );
70+
71+
// TODO report error when is an error loading the feed
72+
if ( ! is_wp_error( $feed ) ) {
73+
$feed_urls[] = 'https://colorlib.com/wp/feed/';
74+
$feed_working = 'working';
75+
}
76+
77+
set_transient( 'colorlib_dashboard_feed', $feed_working, 12 * HOUR_IN_SECONDS );
78+
79+
}elseif ( 'working' == $check ) {
80+
$feed_urls[] = 'https://colorlib.com/wp/feed/';
81+
}
82+
83+
// Return the feed URLs.
84+
return array_unique( $feed_urls );
85+
}
86+
}
87+
88+
// Create an instance.
89+
new Colorlib_Dashboard_Widget_Extend_Feed();
90+
}

readme.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: silkalns
33
Tags: fancybox, lightbox, jquery, gallery, image, images, photo, photos, picture, pictures, zoom
44
Requires at least: 4.6
55
Tested up to: 5.1
6-
Stable tag: 3.2.0
6+
Stable tag: 3.2.2
77
License: GPLv3 or later
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -31,6 +31,14 @@ If you enjoy using FancyBox lightbox for WordPress please leave a [positive feed
3131

3232
== Changelog ==
3333

34+
= 3.2.2 =
35+
* Fix for padding issue when title inside position
36+
* Fix for title color when title is set to inside position
37+
38+
= 3.2.1 =
39+
* Update toggles
40+
* Added new option to make a gallery for each gutenberg gallery block
41+
3442
= 3.2.0 =
3543
* Admin UI minor update
3644
* Removed unneeded ie css file

0 commit comments

Comments
 (0)