LuckyWP Table of Contents - Version 1.5.6

Version Description

  • Fix: in some cases, incorrectly worked option "Minimal Count of Headers".
Download this release

Release Info

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

Code changes from version 1.5.5 to 1.5.6

Files changed (3) hide show
  1. front/Toc.php +12 -5
  2. luckywp-table-of-contents.php +2 -2
  3. readme.txt +4 -1
front/Toc.php CHANGED
@@ -43,15 +43,22 @@ class Toc
43
 
44
  $skipHeadingLevels = Core::$plugin->skipHeadingLevelToArray(ArrayHelper::getValue($attrs, 'skipheadinglevel', Core::$plugin->settings->getMiscSkipHeadingLevel()));
45
  $skipHeadingRegex = Core::$plugin->skipHeadingTextToRegex(ArrayHelper::getValue($attrs, 'skipheadingtext', Core::$plugin->settings->getMiscSkipHeadingText()));
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  $items = [];
48
  $tree = [];
49
  foreach ($headings as $heading) {
50
- if (in_array('h' . $heading['index'], $skipHeadingLevels) ||
51
- ($skipHeadingRegex && preg_match($skipHeadingRegex, $heading['label']))
52
- ) {
53
- continue;
54
- }
55
  $node = null;
56
  while (count($tree) && ($node === null)) {
57
  end($tree);
43
 
44
  $skipHeadingLevels = Core::$plugin->skipHeadingLevelToArray(ArrayHelper::getValue($attrs, 'skipheadinglevel', Core::$plugin->settings->getMiscSkipHeadingLevel()));
45
  $skipHeadingRegex = Core::$plugin->skipHeadingTextToRegex(ArrayHelper::getValue($attrs, 'skipheadingtext', Core::$plugin->settings->getMiscSkipHeadingText()));
46
+ $headings = array_filter($headings, function ($heading) use ($skipHeadingLevels, $skipHeadingRegex) {
47
+ if (in_array('h' . $heading['index'], $skipHeadingLevels)) {
48
+ return false;
49
+ }
50
+ if ($skipHeadingRegex && preg_match($skipHeadingRegex, $heading['label'])) {
51
+ return false;
52
+ }
53
+ return true;
54
+ });
55
+ if (count($headings) < $min) {
56
+ return '';
57
+ }
58
 
59
  $items = [];
60
  $tree = [];
61
  foreach ($headings as $heading) {
 
 
 
 
 
62
  $node = null;
63
  while (count($tree) && ($node === null)) {
64
  end($tree);
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: 1.5.5
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: lwptoc
@@ -29,6 +29,6 @@ $lwptocAutoloader->register();
29
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
30
 
31
  $config = require(__DIR__ . '/config/plugin.php');
32
- (new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.5.5', __FILE__, 'lwptoc_');
33
 
34
  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: 1.5.6
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: lwptoc
29
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
30
 
31
  $config = require(__DIR__ . '/config/plugin.php');
32
+ (new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.5.6', __FILE__, 'lwptoc_');
33
 
34
  require_once __DIR__ . '/functions.php';
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.2.2
7
- Stable tag: 1.5.5
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -138,6 +138,9 @@ For non-English websites it is recommended to enable the `Intl` PHP extension.
138
 
139
  == Changelog ==
140
 
 
 
 
141
  = 1.5.5 =
142
  * Modified code for compatibility with Toolset Access plugin.
143
 
4
  Tags: table of contents, toc, navigation, links, seo
5
  Requires at least: 4.7
6
  Tested up to: 5.2.2
7
+ Stable tag: 1.5.6
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
138
 
139
  == Changelog ==
140
 
141
+ = 1.5.6 =
142
+ * Fix: in some cases, incorrectly worked option "Minimal Count of Headers".
143
+
144
  = 1.5.5 =
145
  * Modified code for compatibility with Toolset Access plugin.
146