Version Description
- Fix: Gallery shortcode thumbnails not accepting size parameter
- Fix: Basic templates for WooCommerce gallery
Download this release
Release Info
Developer | dfactory |
Plugin | Responsive Lightbox & Gallery |
Version | 2.0.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.0.3
- includes/class-frontend.php +49 -23
- includes/class-galleries.php +8 -16
- readme.txt +8 -3
- responsive-lightbox.php +3 -3
includes/class-frontend.php
CHANGED
@@ -22,6 +22,7 @@ class Responsive_Lightbox_Frontend {
|
|
22 |
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 100 );
|
23 |
add_action( 'rl_before_gallery', array( $this, 'before_gallery' ), 10, 2 );
|
24 |
add_action( 'rl_after_gallery', array( $this, 'after_gallery' ), 10, 2 );
|
|
|
25 |
|
26 |
// filters
|
27 |
add_filter( 'rl_gallery_container_class', array( $this, 'gallery_container_class' ), 10, 3 );
|
@@ -331,7 +332,7 @@ class Responsive_Lightbox_Frontend {
|
|
331 |
else
|
332 |
$title = esc_attr( wp_strip_all_tags( trim ( nl2br( $args['title'] ) ), true ) );
|
333 |
|
334 |
-
// add title and rl_title
|
335 |
if ( preg_match( '/<a.*? title=(?:\'|").*?(?:\'|").*?>/is', $link ) === 1 )
|
336 |
$link = preg_replace( '/(<a.*? title=(?:\'|")).*?((?:\'|").*?>)/s', '$1' . $title . '" data-rl_title="'. $title .'$2', $link );
|
337 |
else
|
@@ -547,6 +548,7 @@ class Responsive_Lightbox_Frontend {
|
|
547 |
*/
|
548 |
public function get_default_gallery_fields() {
|
549 |
$sizes = get_intermediate_image_sizes();
|
|
|
550 |
|
551 |
return array(
|
552 |
'size' => array(
|
@@ -752,10 +754,9 @@ class Responsive_Lightbox_Frontend {
|
|
752 |
if ( ! empty( $ids ) ) {
|
753 |
foreach ( $ids as $attachment_id ) {
|
754 |
// get thumbnail image data
|
755 |
-
$images[] = Responsive_Lightbox()->galleries->get_gallery_image_src( $attachment_id, $shortcode_atts['size'] );
|
756 |
}
|
757 |
}
|
758 |
-
|
759 |
}
|
760 |
|
761 |
// apply adjustments, as per settings
|
@@ -787,41 +788,34 @@ class Responsive_Lightbox_Frontend {
|
|
787 |
// get gallery image link
|
788 |
$args['link'] = isset( $shortcode_atts['link'] ) ? $shortcode_atts['link'] : '';
|
789 |
|
|
|
|
|
|
|
790 |
// apply adjustments, according to gallery settings
|
791 |
-
foreach ( $
|
792 |
-
// set thumbnail data
|
793 |
-
$thumbnail_src = array( $image['thumbnail_url'], $image['thumbnail_width'], $image['thumbnail_height'] );
|
794 |
-
|
795 |
-
$images[$index]['thumbnail_url'] = $thumbnail_src[0];
|
796 |
-
$images[$index]['thumbnail_width'] = $thumbnail_src[1];
|
797 |
-
$images[$index]['thumbnail_height'] = $thumbnail_src[2];
|
798 |
-
|
799 |
// assign image
|
800 |
-
$
|
801 |
-
|
802 |
-
|
803 |
-
$
|
804 |
|
805 |
// set alt text
|
806 |
-
$images[$index]['alt'] = ! empty( $
|
807 |
|
808 |
// set lightbox image title
|
809 |
if ( $args['settings']['plugin']['gallery_image_title'] === 'default' )
|
810 |
$images[$index]['title'] = $args['title'] = '';
|
811 |
else
|
812 |
-
$images[$index]['title'] = $args['title'] = ! empty( $
|
813 |
|
814 |
// set lightbox image caption
|
815 |
if ( $args['settings']['plugin']['gallery_image_caption'] === 'default' )
|
816 |
$images[$index]['caption'] = $args['caption'] = '';
|
817 |
else
|
818 |
-
$images[$index]['caption'] = $args['caption'] = ! empty( $
|
819 |
-
|
820 |
-
// set image link
|
821 |
-
$image_link = $this->get_gallery_image_link( $image['id'], $image_src, $thumbnail_src, $shortcode_atts );
|
822 |
|
823 |
// set image gallery link
|
824 |
-
$images[$index]['link'] = $this->lightbox_gallery_link( $
|
825 |
|
826 |
// is lightbox active?
|
827 |
if ( isset( $shortcode_atts['lightbox_enable'] ) && $shortcode_atts['lightbox_enable'] === 0 )
|
@@ -1049,6 +1043,38 @@ class Responsive_Lightbox_Frontend {
|
|
1049 |
|
1050 |
return $html;
|
1051 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1052 |
|
1053 |
/**
|
1054 |
* Get attachment title function
|
@@ -1780,7 +1806,7 @@ class Responsive_Lightbox_Frontend {
|
|
1780 |
$atts = shortcode_atts( array_merge( $defaults, $field_atts ), $shortcode_atts, 'gallery' );
|
1781 |
|
1782 |
// sanitize gallery fields
|
1783 |
-
$atts =
|
1784 |
|
1785 |
// break if it is not basic masonry gallery
|
1786 |
if ( ! ( $atts['type'] === 'basicmasonry' || ( $atts['type'] === '' && ( ( $rl_gallery && Responsive_Lightbox()->options['settings']['builder_gallery'] === 'basicmasonry' ) || ( ! $rl_gallery && Responsive_Lightbox()->options['settings']['default_gallery'] === 'basicmasonry' ) ) ) ) )
|
22 |
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 100 );
|
23 |
add_action( 'rl_before_gallery', array( $this, 'before_gallery' ), 10, 2 );
|
24 |
add_action( 'rl_after_gallery', array( $this, 'after_gallery' ), 10, 2 );
|
25 |
+
add_action( 'after_setup_theme', array( $this, 'woocommerce_gallery_init' ), 1000 );
|
26 |
|
27 |
// filters
|
28 |
add_filter( 'rl_gallery_container_class', array( $this, 'gallery_container_class' ), 10, 3 );
|
332 |
else
|
333 |
$title = esc_attr( wp_strip_all_tags( trim ( nl2br( $args['title'] ) ), true ) );
|
334 |
|
335 |
+
// add title and rl_title if needed
|
336 |
if ( preg_match( '/<a.*? title=(?:\'|").*?(?:\'|").*?>/is', $link ) === 1 )
|
337 |
$link = preg_replace( '/(<a.*? title=(?:\'|")).*?((?:\'|").*?>)/s', '$1' . $title . '" data-rl_title="'. $title .'$2', $link );
|
338 |
else
|
548 |
*/
|
549 |
public function get_default_gallery_fields() {
|
550 |
$sizes = get_intermediate_image_sizes();
|
551 |
+
$sizes['full'] = 'full';
|
552 |
|
553 |
return array(
|
554 |
'size' => array(
|
754 |
if ( ! empty( $ids ) ) {
|
755 |
foreach ( $ids as $attachment_id ) {
|
756 |
// get thumbnail image data
|
757 |
+
$images[] = Responsive_Lightbox()->galleries->get_gallery_image_src( $attachment_id, $shortcode_atts['src_size'], $shortcode_atts['size'] );
|
758 |
}
|
759 |
}
|
|
|
760 |
}
|
761 |
|
762 |
// apply adjustments, as per settings
|
788 |
// get gallery image link
|
789 |
$args['link'] = isset( $shortcode_atts['link'] ) ? $shortcode_atts['link'] : '';
|
790 |
|
791 |
+
// copy images
|
792 |
+
$images_tmp = $images;
|
793 |
+
|
794 |
// apply adjustments, according to gallery settings
|
795 |
+
foreach ( $images_tmp as $index => $image ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
796 |
// assign image
|
797 |
+
$new_image = $images[$index] = array_merge( $image, Responsive_Lightbox()->galleries->get_gallery_image_src( $image, $shortcode_atts['src_size'], $shortcode_atts['size'] ) );
|
798 |
+
|
799 |
+
// create image source data
|
800 |
+
$args['src'] = array( $new_image['url'], $new_image['width'], $new_image['height'] );
|
801 |
|
802 |
// set alt text
|
803 |
+
$images[$index]['alt'] = ! empty( $new_image['alt'] ) ? esc_attr( $new_image['alt'] ) : ( ! empty( $new_image['id'] ) ? get_post_meta( $new_image['id'], '_wp_attachment_image_alt', true ) : '' );
|
804 |
|
805 |
// set lightbox image title
|
806 |
if ( $args['settings']['plugin']['gallery_image_title'] === 'default' )
|
807 |
$images[$index]['title'] = $args['title'] = '';
|
808 |
else
|
809 |
+
$images[$index]['title'] = $args['title'] = ! empty( $new_image['id'] ) ? $this->get_attachment_title( $new_image['id'], apply_filters( 'rl_lightbox_attachment_image_title_arg', $args['settings']['plugin']['gallery_image_title'], $new_image['id'], $images[$index]['link'] ) ) : $new_image['title'];
|
810 |
|
811 |
// set lightbox image caption
|
812 |
if ( $args['settings']['plugin']['gallery_image_caption'] === 'default' )
|
813 |
$images[$index]['caption'] = $args['caption'] = '';
|
814 |
else
|
815 |
+
$images[$index]['caption'] = $args['caption'] = ! empty( $new_image['id'] ) ? $this->get_attachment_title( $new_image['id'], apply_filters( 'rl_lightbox_attachment_image_title_arg', $args['settings']['plugin']['gallery_image_caption'], $images[$index]['link'] ) ) : $new_image['caption'];
|
|
|
|
|
|
|
816 |
|
817 |
// set image gallery link
|
818 |
+
$images[$index]['link'] = $this->lightbox_gallery_link( $this->get_gallery_image_link( $new_image['id'], $args['src'], array( $new_image['thumbnail_url'], $new_image['thumbnail_width'], $new_image['thumbnail_height'] ), $shortcode_atts ), $args );
|
819 |
|
820 |
// is lightbox active?
|
821 |
if ( isset( $shortcode_atts['lightbox_enable'] ) && $shortcode_atts['lightbox_enable'] === 0 )
|
1043 |
|
1044 |
return $html;
|
1045 |
}
|
1046 |
+
|
1047 |
+
/**
|
1048 |
+
* WooCommerce gallery init.
|
1049 |
+
*/
|
1050 |
+
public function woocommerce_gallery_init() {
|
1051 |
+
if ( ( $priority = has_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails' ) ) != false && ! empty( Responsive_Lightbox()->options['settings']['default_woocommerce_gallery'] ) ) {
|
1052 |
+
// remove default gallery
|
1053 |
+
remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', $priority );
|
1054 |
+
|
1055 |
+
// handle product gallery
|
1056 |
+
add_action( 'woocommerce_product_thumbnails', array( $this, 'woocommerce_gallery' ), $priority );
|
1057 |
+
}
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
/**
|
1061 |
+
* WooCommerce gallery support.
|
1062 |
+
*
|
1063 |
+
* @global object $post
|
1064 |
+
* @global object $product
|
1065 |
+
* @global object $woocommerce
|
1066 |
+
* @return mixed
|
1067 |
+
*/
|
1068 |
+
public function woocommerce_gallery() {
|
1069 |
+
global $post, $product, $woocommerce;
|
1070 |
+
|
1071 |
+
$attachment_ids = $product->get_gallery_image_ids();
|
1072 |
+
|
1073 |
+
$gallery_type = Responsive_Lightbox()->options['settings']['default_woocommerce_gallery'];
|
1074 |
+
|
1075 |
+
if ( $attachment_ids )
|
1076 |
+
echo do_shortcode( '[gallery type="' . $gallery_type . '" size="' . apply_filters( 'single_product_small_thumbnail_size', 'medium' ) . '" ids="' . implode( ',', $attachment_ids ) . '"]' );
|
1077 |
+
}
|
1078 |
|
1079 |
/**
|
1080 |
* Get attachment title function
|
1806 |
$atts = shortcode_atts( array_merge( $defaults, $field_atts ), $shortcode_atts, 'gallery' );
|
1807 |
|
1808 |
// sanitize gallery fields
|
1809 |
+
$atts = $this->sanitize_shortcode_args( $atts, $fields );
|
1810 |
|
1811 |
// break if it is not basic masonry gallery
|
1812 |
if ( ! ( $atts['type'] === 'basicmasonry' || ( $atts['type'] === '' && ( ( $rl_gallery && Responsive_Lightbox()->options['settings']['builder_gallery'] === 'basicmasonry' ) || ( ! $rl_gallery && Responsive_Lightbox()->options['settings']['default_gallery'] === 'basicmasonry' ) ) ) ) )
|
includes/class-galleries.php
CHANGED
@@ -1730,12 +1730,12 @@ class Responsive_Lightbox_Galleries {
|
|
1730 |
*/
|
1731 |
public function get_gallery_image( $image = array(), $size = 'thumbnail', $attr = '' ) {
|
1732 |
$html = '';
|
1733 |
-
|
1734 |
$image = $this->get_gallery_image_src( $image, $size );
|
1735 |
-
|
1736 |
if ( ! empty( $image['url'] ) || ! empty( $image['id'] ) ) {
|
1737 |
$size_class = $size;
|
1738 |
-
|
1739 |
if ( is_array( $size_class ) )
|
1740 |
$size_class = join( 'x', $size_class );
|
1741 |
|
@@ -1778,7 +1778,6 @@ class Responsive_Lightbox_Galleries {
|
|
1778 |
|
1779 |
// attachment id
|
1780 |
if ( is_int( $image ) ) {
|
1781 |
-
|
1782 |
$image_src = wp_get_attachment_image_src( $image, $image_size, false );
|
1783 |
|
1784 |
if ( $image && wp_attachment_is_image( $image ) ) {
|
@@ -1801,12 +1800,10 @@ class Responsive_Lightbox_Galleries {
|
|
1801 |
'thumbnail_height' => $thumbnail_src[2]
|
1802 |
);
|
1803 |
}
|
1804 |
-
|
1805 |
// image url
|
1806 |
} elseif ( is_string( $image ) ) {
|
1807 |
-
|
1808 |
$imagedata['url'] = $image;
|
1809 |
-
|
1810 |
@list( $imagedata['width'], $imagedata['height'] ) = getimagesize( $imagedata['url'] );
|
1811 |
|
1812 |
$imagedata = array(
|
@@ -1822,13 +1819,11 @@ class Responsive_Lightbox_Galleries {
|
|
1822 |
'thumbnail_width' => $imagedata['width'],
|
1823 |
'thumbnail_height' => $imagedata['height']
|
1824 |
);
|
1825 |
-
|
1826 |
} elseif ( is_array( $image ) ) {
|
1827 |
// set width and height from url, if not available
|
1828 |
-
if ( empty( $image['width'] ) || empty( $image['height'] ) )
|
1829 |
@list( $image['width'], $image['height'] ) = getimagesize( $image['url'] );
|
1830 |
-
|
1831 |
-
|
1832 |
// set thumbnail data, if not available
|
1833 |
if ( empty( $image['thumbnail_url'] ) ) {
|
1834 |
$image['thumbnail_url'] = $image['url'];
|
@@ -1836,11 +1831,10 @@ class Responsive_Lightbox_Galleries {
|
|
1836 |
$image['thumbnail_height'] = $image['height'];
|
1837 |
} else {
|
1838 |
// set thumbnail width and height from url, if not available
|
1839 |
-
if ( empty( $image['thumbnail_width'] ) || empty( $image['thumbnail_height'] ) )
|
1840 |
@list( $image['thumbnail_width'], $image['thumbnail_height'] ) = getimagesize( $image['thumbnail_url'] );
|
1841 |
-
}
|
1842 |
}
|
1843 |
-
|
1844 |
/* adjust thumbnail size ?
|
1845 |
$image_size_data = $this->get_image_size( $image_size );
|
1846 |
$thumbnail_size_data = $this->get_image_size( $thumbnail_size );
|
@@ -1866,8 +1860,6 @@ class Responsive_Lightbox_Galleries {
|
|
1866 |
'thumbnail_height' => ! empty( $image['thumbnail_height'] ) ? (int) $image['thumbnail_height'] : 0,
|
1867 |
);
|
1868 |
}
|
1869 |
-
|
1870 |
-
// print_r( $imagedata );
|
1871 |
|
1872 |
return apply_filters( 'rl_get_gallery_image_src', $imagedata, $image, $image_size, $thumbnail_size );
|
1873 |
}
|
1730 |
*/
|
1731 |
public function get_gallery_image( $image = array(), $size = 'thumbnail', $attr = '' ) {
|
1732 |
$html = '';
|
1733 |
+
|
1734 |
$image = $this->get_gallery_image_src( $image, $size );
|
1735 |
+
|
1736 |
if ( ! empty( $image['url'] ) || ! empty( $image['id'] ) ) {
|
1737 |
$size_class = $size;
|
1738 |
+
|
1739 |
if ( is_array( $size_class ) )
|
1740 |
$size_class = join( 'x', $size_class );
|
1741 |
|
1778 |
|
1779 |
// attachment id
|
1780 |
if ( is_int( $image ) ) {
|
|
|
1781 |
$image_src = wp_get_attachment_image_src( $image, $image_size, false );
|
1782 |
|
1783 |
if ( $image && wp_attachment_is_image( $image ) ) {
|
1800 |
'thumbnail_height' => $thumbnail_src[2]
|
1801 |
);
|
1802 |
}
|
|
|
1803 |
// image url
|
1804 |
} elseif ( is_string( $image ) ) {
|
|
|
1805 |
$imagedata['url'] = $image;
|
1806 |
+
|
1807 |
@list( $imagedata['width'], $imagedata['height'] ) = getimagesize( $imagedata['url'] );
|
1808 |
|
1809 |
$imagedata = array(
|
1819 |
'thumbnail_width' => $imagedata['width'],
|
1820 |
'thumbnail_height' => $imagedata['height']
|
1821 |
);
|
|
|
1822 |
} elseif ( is_array( $image ) ) {
|
1823 |
// set width and height from url, if not available
|
1824 |
+
if ( empty( $image['width'] ) || empty( $image['height'] ) )
|
1825 |
@list( $image['width'], $image['height'] ) = getimagesize( $image['url'] );
|
1826 |
+
|
|
|
1827 |
// set thumbnail data, if not available
|
1828 |
if ( empty( $image['thumbnail_url'] ) ) {
|
1829 |
$image['thumbnail_url'] = $image['url'];
|
1831 |
$image['thumbnail_height'] = $image['height'];
|
1832 |
} else {
|
1833 |
// set thumbnail width and height from url, if not available
|
1834 |
+
if ( empty( $image['thumbnail_width'] ) || empty( $image['thumbnail_height'] ) )
|
1835 |
@list( $image['thumbnail_width'], $image['thumbnail_height'] ) = getimagesize( $image['thumbnail_url'] );
|
|
|
1836 |
}
|
1837 |
+
|
1838 |
/* adjust thumbnail size ?
|
1839 |
$image_size_data = $this->get_image_size( $image_size );
|
1840 |
$thumbnail_size_data = $this->get_image_size( $thumbnail_size );
|
1860 |
'thumbnail_height' => ! empty( $image['thumbnail_height'] ) ? (int) $image['thumbnail_height'] : 0,
|
1861 |
);
|
1862 |
}
|
|
|
|
|
1863 |
|
1864 |
return apply_filters( 'rl_get_gallery_image_src', $imagedata, $image, $image_size, $thumbnail_size );
|
1865 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
|
|
4 |
Tags: gallery, images, lightbox, photos, theme, photo, image, picture, slideshow, modal, overlay, video
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9.5
|
7 |
-
Stable tag: 2.0.
|
8 |
Requires PHP: 5.2.4
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
@@ -78,6 +78,10 @@ No questions yet.
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
81 |
= 2.0.2 =
|
82 |
* Fix: Default WordPress gallery issue
|
83 |
|
@@ -340,5 +344,6 @@ Initial release
|
|
340 |
|
341 |
== Upgrade Notice ==
|
342 |
|
343 |
-
= 2.0.
|
344 |
-
* Fix:
|
|
4 |
Tags: gallery, images, lightbox, photos, theme, photo, image, picture, slideshow, modal, overlay, video
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.9.5
|
7 |
+
Stable tag: 2.0.3
|
8 |
Requires PHP: 5.2.4
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 2.0.3 =
|
82 |
+
* Fix: Gallery shortcode thumbnails not accepting size parameter
|
83 |
+
* Fix: Basic templates for WooCommerce gallery
|
84 |
+
|
85 |
= 2.0.2 =
|
86 |
* Fix: Default WordPress gallery issue
|
87 |
|
344 |
|
345 |
== Upgrade Notice ==
|
346 |
|
347 |
+
= 2.0.3 =
|
348 |
+
* Fix: Gallery shortcode thumbnails not accepting size parameter
|
349 |
+
* Fix: Basic templates for WooCommerce gallery
|
responsive-lightbox.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Responsive Lightbox & Gallery
|
4 |
Description: Responsive Lightbox & Gallery allows users to create galleries and view larger versions of images, galleries and videos in a lightbox (overlay) effect optimized for mobile devices.
|
5 |
-
Version: 2.0.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
|
@@ -41,7 +41,7 @@ include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes' . DIRECTORY_SEPARATOR . 'fun
|
|
41 |
* Responsive Lightbox class.
|
42 |
*
|
43 |
* @class Responsive_Lightbox
|
44 |
-
* @version 2.0.
|
45 |
*/
|
46 |
class Responsive_Lightbox {
|
47 |
|
@@ -237,7 +237,7 @@ class Responsive_Lightbox {
|
|
237 |
'origin_left' => true,
|
238 |
'origin_top' => true
|
239 |
),
|
240 |
-
'version' => '2.0.
|
241 |
'activation_date' => ''
|
242 |
);
|
243 |
public $options = array();
|
2 |
/*
|
3 |
Plugin Name: Responsive Lightbox & Gallery
|
4 |
Description: Responsive Lightbox & Gallery allows users to create galleries and view larger versions of images, galleries and videos in a lightbox (overlay) effect optimized for mobile devices.
|
5 |
+
Version: 2.0.3
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
|
41 |
* Responsive Lightbox class.
|
42 |
*
|
43 |
* @class Responsive_Lightbox
|
44 |
+
* @version 2.0.3
|
45 |
*/
|
46 |
class Responsive_Lightbox {
|
47 |
|
237 |
'origin_left' => true,
|
238 |
'origin_top' => true
|
239 |
),
|
240 |
+
'version' => '2.0.3',
|
241 |
'activation_date' => ''
|
242 |
);
|
243 |
public $options = array();
|