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

Version Description

  • Added the new feature (checkbox) 'Remove JavaScript Content'. When checked, JavaScript content (
Download this release

Release Info

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

Code changes from version 2.1.11 to 2.1.12

php/slide-anything-admin.php CHANGED
@@ -1669,7 +1669,7 @@ function cpt_slider_style_content($post) {
1669
  $tooltip = 'Use window.onload event (not document.ready). Use this option if your slider is ';
1670
  $tooltip .= 'not being sized correctly within your page container (sometimes occurs with Visual Composer full-width sections).';
1671
  echo "<div id='sa_window_onload_line'>";
1672
- echo "<span class='sa_tooltip' title='".$tooltip."'></span>Use 'window.onload' event:";
1673
  if ($window_onload == '1') {
1674
  echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1' checked/>";
1675
  } else {
@@ -1677,6 +1677,21 @@ function cpt_slider_style_content($post) {
1677
  }
1678
  echo "</div>\n";
1679
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1680
  echo "</div>\n";
1681
  }
1682
 
@@ -2058,6 +2073,11 @@ function cpt_slider_save_postdata() {
2058
  } else {
2059
  update_post_meta($post->ID, 'sa_window_onload', '0');
2060
  }
 
 
 
 
 
2061
  }
2062
  }
2063
 
1669
  $tooltip = 'Use window.onload event (not document.ready). Use this option if your slider is ';
1670
  $tooltip .= 'not being sized correctly within your page container (sometimes occurs with Visual Composer full-width sections).';
1671
  echo "<div id='sa_window_onload_line'>";
1672
+ echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Use 'window.onload' event:</span>";
1673
  if ($window_onload == '1') {
1674
  echo "<input type='checkbox' id='sa_window_onload' name='sa_window_onload' value='1' checked/>";
1675
  } else {
1677
  }
1678
  echo "</div>\n";
1679
 
1680
+ // Strip JavaScript from Content
1681
+ $strip_javascript = get_post_meta($post->ID, 'sa_strip_javascript', true);
1682
+ if ($strip_javascript == '') {
1683
+ $strip_javascript = '0';
1684
+ }
1685
+ $tooltip = 'Remove JavaScript (<script> tags) from slide content for extra security.';
1686
+ echo "<div id='sa_window_onload_line'>";
1687
+ echo "<span class='sa_tooltip' title='".$tooltip."'></span><span style='min-width:160px;'>Remove JavaScript Content:</span>";
1688
+ if ($strip_javascript == '1') {
1689
+ echo "<input type='checkbox' id='sa_strip_javascript' name='sa_strip_javascript' value='1' checked/>";
1690
+ } else {
1691
+ echo "<input type='checkbox' id='sa_strip_javascript' name='sa_strip_javascript' value='1'/>";
1692
+ }
1693
+ echo "</div>\n";
1694
+
1695
  echo "</div>\n";
1696
  }
1697
 
2073
  } else {
2074
  update_post_meta($post->ID, 'sa_window_onload', '0');
2075
  }
2076
+ if (isset($_POST['sa_strip_javascript']) && ($_POST['sa_strip_javascript'] == '1')) {
2077
+ update_post_meta($post->ID, 'sa_strip_javascript', '1');
2078
+ } else {
2079
+ update_post_meta($post->ID, 'sa_strip_javascript', '0');
2080
+ }
2081
  }
2082
  }
2083
 
php/slide-anything-frontend.php CHANGED
@@ -218,6 +218,13 @@ function slide_anything_shortcode($atts) {
218
  $slide_data['sa_window_onload'] = '0';
219
  }
220
  }
 
 
 
 
 
 
 
221
 
222
  // REVERSE THE ORDER OF THE SLIDES IF 'Random Order' CHECKBOX IS CHECKED OR
223
  // RE-ORDER SLIDES IN A RANDOM ORDER IF 'Random Order' CHECKBOX IS CHECKED
@@ -406,6 +413,10 @@ function slide_anything_shortcode($atts) {
406
  }
407
  $output .= "</div>\n"; // .sa_hover_buttons
408
  }
 
 
 
 
409
  $output .= $slide_content."</div>\n"; // .sa_hover_container
410
  }
411
  $output .= "</div>\n";
@@ -660,4 +671,19 @@ function slide_anything_shortcode($atts) {
660
  }
661
  return $output;
662
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
663
  ?>
218
  $slide_data['sa_window_onload'] = '0';
219
  }
220
  }
221
+ $slide_data['strip_javascript'] = '0';
222
+ if (isset($metadata['sa_strip_javascript'])) {
223
+ $slide_data['strip_javascript'] = $metadata['sa_strip_javascript'][0];
224
+ if ($slide_data['strip_javascript'] != '1') {
225
+ $slide_data['strip_javascript'] = '0';
226
+ }
227
+ }
228
 
229
  // REVERSE THE ORDER OF THE SLIDES IF 'Random Order' CHECKBOX IS CHECKED OR
230
  // RE-ORDER SLIDES IN A RANDOM ORDER IF 'Random Order' CHECKBOX IS CHECKED
413
  }
414
  $output .= "</div>\n"; // .sa_hover_buttons
415
  }
416
+ if ($slide_data['strip_javascript'] == '1') {
417
+ // strip JavaScript code (<script> tags) from slide content
418
+ $slide_content = remove_javascript_from_content($slide_content);
419
+ }
420
  $output .= $slide_content."</div>\n"; // .sa_hover_container
421
  }
422
  $output .= "</div>\n";
671
  }
672
  return $output;
673
  }
674
+
675
+
676
+
677
+ // ### STRIP JAVASCRIPT ('<script>' tags) FROM SUPPLIED STRING ARGUMENT ###
678
+ function remove_javascript_from_content($slide_content) {
679
+ $dom = new DOMDocument();
680
+ $dom->loadHTML($slide_content);
681
+ $script = $dom->getElementsByTagName('script');
682
+ $remove = [];
683
+ foreach($script as $item) {
684
+ $item->parentNode->removeChild($item);
685
+ }
686
+ $slide_content = $dom->saveHTML();
687
+ return $slide_content;
688
+ }
689
  ?>
readme.txt CHANGED
@@ -220,6 +220,9 @@ The `SLIDE STYLE` settings are the style settings for each individual slide with
220
  = 2.1.11 =
221
  * Fixed a bug that occurred when migrating a WP site to another domain location (e.g. transferring a staging/test WP site to a Live WP site). The SA slider would not work on the new domain unless it was re-saved in the back-end. This has now been fixed with this release.
222
 
 
 
 
223
  == Upgrade Notice ==
224
 
225
  = 1.0 =
@@ -354,4 +357,7 @@ The `SLIDE STYLE` settings are the style settings for each individual slide with
354
  * Minor bug fix for the new 'Use window.onload event' checkbox setting.
355
 
356
  = 2.1.11 =
357
- * Fixed a bug that occurred when migrating a WP site to another domain location (e.g. transferring a staging/test WP site to a Live WP site). The SA slider would not work on the new domain unless it was re-saved in the back-end. This has now been fixed with this release.
 
 
 
220
  = 2.1.11 =
221
  * Fixed a bug that occurred when migrating a WP site to another domain location (e.g. transferring a staging/test WP site to a Live WP site). The SA slider would not work on the new domain unless it was re-saved in the back-end. This has now been fixed with this release.
222
 
223
+ = 2.1.12 =
224
+ * Added the new feature (checkbox) 'Remove JavaScript Content'. When checked, JavaScript content (<script> tags) are removed from slide content.
225
+
226
  == Upgrade Notice ==
227
 
228
  = 1.0 =
357
  * Minor bug fix for the new 'Use window.onload event' checkbox setting.
358
 
359
  = 2.1.11 =
360
+ * Fixed a bug that occurred when migrating a WP site to another domain location (e.g. transferring a staging/test WP site to a Live WP site). The SA slider would not work on the new domain unless it was re-saved in the back-end. This has now been fixed with this release.
361
+
362
+ = 2.1.12 =
363
+ * Added the new feature (checkbox) 'Remove JavaScript Content'. When checked, JavaScript content (<script> tags) are removed from slide content.
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.1.11
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.1.12
8
  * License: GPLv2 or later
9
  */
10