LuckyWP Table of Contents - Version 2.1.1

Version Description

2020-03-15 = * In heading ID duplicate hyphens are replaced with one. * Fixed: content of tags <style> and <script> was included in heading label.

Download this release

Release Info

Developer theluckywp
Plugin Icon 128x128 LuckyWP Table of Contents
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

luckywp-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: LuckyWP Table of Contents
4
  Plugin URI: https://theluckywp.com/product/table-of-contents/
5
  Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
6
- Version: 2.1
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
@@ -47,6 +47,6 @@ $lwptocAutoloader->register();
47
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
48
 
49
  $config = require(__DIR__ . '/config/plugin.php');
50
- (new \luckywp\tableOfContents\plugin\Plugin($config))->run('2.1', __FILE__, 'lwptoc_');
51
 
52
  require_once __DIR__ . '/functions.php';
3
  Plugin Name: LuckyWP Table of Contents
4
  Plugin URI: https://theluckywp.com/product/table-of-contents/
5
  Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
6
+ Version: 2.1.1
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
47
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
48
 
49
  $config = require(__DIR__ . '/config/plugin.php');
50
+ (new \luckywp\tableOfContents\plugin\Plugin($config))->run('2.1.1', __FILE__, 'lwptoc_');
51
 
52
  require_once __DIR__ . '/functions.php';
plugin/contentHandling/ContentHandling.php CHANGED
@@ -80,6 +80,9 @@ class ContentHandling
80
  $html = Dom::getInnerHtml($node);
81
  $html = apply_filters('lwptoc_heading_html', $html);
82
 
 
 
 
83
  $label = strip_tags($html);
84
  $label = html_entity_decode($label, ENT_HTML5, 'UTF-8');
85
  $label = apply_filters('lwptoc_heading_label', $label, $html);
@@ -149,6 +152,7 @@ class ContentHandling
149
 
150
  if ($dto->hashReplaceUnderlinesToDashes) {
151
  $id = str_replace('_', '-', $id);
 
152
  }
153
 
154
  if (!$id) {
80
  $html = Dom::getInnerHtml($node);
81
  $html = apply_filters('lwptoc_heading_html', $html);
82
 
83
+ $html = preg_replace('#<\s*script[^>]*>.*?</script\s*>#imsu', '', $html);
84
+ $html = preg_replace('#<\s*style[^>]*>.*?</style\s*>#imsu', '', $html);
85
+
86
  $label = strip_tags($html);
87
  $label = html_entity_decode($label, ENT_HTML5, 'UTF-8');
88
  $label = apply_filters('lwptoc_heading_label', $label, $html);
152
 
153
  if ($dto->hashReplaceUnderlinesToDashes) {
154
  $id = str_replace('_', '-', $id);
155
+ $id = preg_replace('/--+/', '-', $id);
156
  }
157
 
158
  if (!$id) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://theluckywp.com/product/table-of-contents/
4
  Tags: table of contents, toc, navigation, links, seo
5
  Requires at least: 4.7
6
  Tested up to: 5.4
7
- Stable tag: 2.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -160,6 +160,10 @@ For non-English websites it is recommended to enable the `Intl` PHP extension.
160
 
161
  == Changelog ==
162
 
 
 
 
 
163
  = 2.1 — 2020-03-12 =
164
  + Added option "Additional CSS Class(es)".
165
  + Added option "OL/LI" to "List Markup Tags".
4
  Tags: table of contents, toc, navigation, links, seo
5
  Requires at least: 4.7
6
  Tested up to: 5.4
7
+ Stable tag: 2.1.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
160
 
161
  == Changelog ==
162
 
163
+ = 2.1.1 — 2020-03-15 =
164
+ * In heading ID duplicate hyphens are replaced with one.
165
+ * Fixed: content of tags `<style>` and `<script>` was included in heading label.
166
+
167
  = 2.1 — 2020-03-12 =
168
  + Added option "Additional CSS Class(es)".
169
  + Added option "OL/LI" to "List Markup Tags".