Slide Anything – Responsive Content / HTML Slider and Carousel - Version 2.3.25

Version Description

  • Small Bug Fix: If the 'lazy load images' option was enabled and a slide content was blank then a PHP warning message was being displayed.

=

Download this release

Release Info

Developer simonpedge
Plugin Icon 128x128 Slide Anything – Responsive Content / HTML Slider and Carousel
Version 2.3.25
Comparing to
See all releases

Code changes from version 2.3.24 to 2.3.25

php/slide-anything-frontend.php CHANGED
@@ -1137,25 +1137,28 @@ function remove_javascript_from_content($slide_content) {
1137
 
1138
  // ### MODIFY IMAGES (<img> tag) WITHIN STRING PASSED (SLIDE CONTENT) TO ENABLE OWL CAROUSEL LAZY LOAD ###
1139
  function set_slide_images_to_lazy_load($slide_content) {
1140
- // 1) REPLACE 'src=' WITH 'data-src=' WITHIN <IMG> TAGS
1141
- $slide_content = preg_replace('~<img[^>]*\K(?=src)~i','data-', $slide_content);
 
1142
 
1143
- // 2) FOR EACH <IMG> TAG WITHIN THE SLIDE CONTENT, ADD THE 'owl-lazy' CLASS
1144
- $dom = new DOMDocument();
1145
- $dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'));
1146
- //$dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
1147
- $imgs = $dom->getElementsByTagName('img');
1148
- foreach ($imgs as $img) {
1149
- $curr_class = $img->getAttribute('class');
1150
- if ($curr_class != '') {
1151
- $img->setAttribute('class', $curr_class.' owl-lazy');
1152
- } else {
1153
- $img->setAttribute('class', 'owl-lazy');
 
1154
  }
1155
- }
1156
 
1157
- //$slide_content = $dom->saveHTML();
1158
- $slide_content = preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());
 
 
1159
  return $slide_content;
1160
  }
1161
  ?>
1137
 
1138
  // ### MODIFY IMAGES (<img> tag) WITHIN STRING PASSED (SLIDE CONTENT) TO ENABLE OWL CAROUSEL LAZY LOAD ###
1139
  function set_slide_images_to_lazy_load($slide_content) {
1140
+ if (trim($slide_content) != '') {
1141
+ // 1) REPLACE 'src=' WITH 'data-src=' WITHIN <IMG> TAGS
1142
+ $slide_content = preg_replace('~<img[^>]*\K(?=src)~i','data-', $slide_content);
1143
 
1144
+ // 2) FOR EACH <IMG> TAG WITHIN THE SLIDE CONTENT, ADD THE 'owl-lazy' CLASS
1145
+ $dom = new DOMDocument();
1146
+ $dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'));
1147
+ //$dom->loadHTML(mb_convert_encoding($slide_content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
1148
+ $imgs = $dom->getElementsByTagName('img');
1149
+ foreach ($imgs as $img) {
1150
+ $curr_class = $img->getAttribute('class');
1151
+ if ($curr_class != '') {
1152
+ $img->setAttribute('class', $curr_class.' owl-lazy');
1153
+ } else {
1154
+ $img->setAttribute('class', 'owl-lazy');
1155
+ }
1156
  }
 
1157
 
1158
+ //$slide_content = $dom->saveHTML();
1159
+ $slide_content = preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\s*~i', '', $dom->saveHTML());
1160
+ }
1161
+
1162
  return $slide_content;
1163
  }
1164
  ?>
readme.txt CHANGED
@@ -368,6 +368,9 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
368
  = 2.3.24 =
369
  * Small Bug Fix to fix a conflict with the 'Photonic Gallery & Lightbox' plugin. The slide 'Add Media' button was not working when this plugin is installed.
370
 
 
 
 
371
  == Upgrade Notice ==
372
 
373
  = 1.0 =
@@ -637,4 +640,7 @@ Adding a SLIDE ANYTHING slider using the WordPress 5.0 'Block Editor' is pretty
637
  * Small Bug Fix: The Re-Order slides page was displaying a PHP warning notice on sites with PHP 7.4.
638
 
639
  = 2.3.24 =
640
- * Small Bug Fix to fix a conflict with the 'Photonic Gallery & Lightbox' plugin. The slide 'Add Media' button was not working when this plugin is installed.
 
 
 
368
  = 2.3.24 =
369
  * Small Bug Fix to fix a conflict with the 'Photonic Gallery & Lightbox' plugin. The slide 'Add Media' button was not working when this plugin is installed.
370
 
371
+ = 2.3.25 =
372
+ * Small Bug Fix: If the 'lazy load images' option was enabled and a slide content was blank then a PHP warning message was being displayed.
373
+
374
  == Upgrade Notice ==
375
 
376
  = 1.0 =
640
  * Small Bug Fix: The Re-Order slides page was displaying a PHP warning notice on sites with PHP 7.4.
641
 
642
  = 2.3.24 =
643
+ * Small Bug Fix to fix a conflict with the 'Photonic Gallery & Lightbox' plugin. The slide 'Add Media' button was not working when this plugin is installed.
644
+
645
+ = 2.3.25 =
646
+ * Small Bug Fix: If the 'lazy load images' option was enabled and a slide content was blank then a PHP warning message was being displayed.
slide-anything.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
  * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
  * Author: Simon Edge
7
- * Version: 2.3.24
8
  * License: GPLv2 or later
9
  */
10
 
4
  * Plugin URI: https://wordpress.org/plugins/slide-anything/
5
  * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
  * Author: Simon Edge
7
+ * Version: 2.3.25
8
  * License: GPLv2 or later
9
  */
10