LuckyWP Table of Contents - Version 1.6.1

Version Description

2019-07-14 = + For hash format added option "As heading w/o transliterate". + Added hebrew translate, thanks to @cdk-comp and @0enaro. + Added spanish translate, thanks to @fernandot, @sanbec and @nobnob. * Improved generate hash with option "As heading".

Download this release

Release Info

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

Code changes from version 1.6 to 1.6.1

front/assets/main.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var s={calcScrollOffset:function(t,l){var o=t.offset().top-l;return o<0?0:o},init:function(t){t.each(function(){var c=e(this);c.data("smoothScroll")&&c.find(".lwptoc_items").on("click",'A[href^="#"]',function(t){t.preventDefault();var l=this.hash,i=e('[id="'+l.slice(1)+'"]:visible');if(i.length){if(l!=location.hash){var o=i.attr("id"),a=e("<a> </a>").attr("id",o).css({position:"absolute",top:e(window).scrollTop(),left:e(window).scrollLeft(),visibility:"hidden"});i.attr("id",""),e("body").prepend(a),location.hash=l,a.remove(),i.attr("id",o)}var n=c.data("smoothScrollOffset");e("html, body").animate({scrollTop:s.calcScrollOffset(i,n)},{duration:500,step:function(t,l){var o=s.calcScrollOffset(i,n);l.end!==o&&(l.end=o)}})}})}),t.find(".lwptoc_toggle_label").click(function(){var t=e(this),l=t.closest(".lwptoc").find(".lwptoc_items"),o=t.data("label");return"none"==l.css("display")?(l.stop(!0).slideDown(300),t.data("label",t.html()).html(o)):l.stop(!0).slideUp(300,function(){t.data("label",t.html()).html(o)}),!1})}};e(function(){s.init(e(".lwptoc"))})}(jQuery);
1
+ !function(c){var s={calcScrollOffset:function(t,l){var o=t.offset().top-l;return o<0?0:o},init:function(t){t.each(function(){var e=c(this);e.data("smoothScroll")&&e.find(".lwptoc_items").on("click",'A[href^="#"]',function(t){t.preventDefault();var l=c(this).attr("href"),i=c('[id="'+l.slice(1)+'"]:visible');if(i.length){if(l!=location.hash){var o=i.attr("id"),a=c("<a> </a>").attr("id",o).css({position:"absolute",top:c(window).scrollTop(),left:c(window).scrollLeft(),visibility:"hidden"});i.attr("id",""),c("body").prepend(a),location.hash=l,a.remove(),i.attr("id",o)}var n=e.data("smoothScrollOffset");c("html, body").animate({scrollTop:s.calcScrollOffset(i,n)},{duration:500,step:function(t,l){var o=s.calcScrollOffset(i,n);l.end!==o&&(l.end=o)}})}})}),t.find(".lwptoc_toggle_label").click(function(){var t=c(this),l=t.closest(".lwptoc").find(".lwptoc_items"),o=t.data("label");return"none"==l.css("display")?(l.stop(!0).slideDown(300),t.data("label",t.html()).html(o)):l.stop(!0).slideUp(300,function(){t.data("label",t.html()).html(o)}),!1})}};c(function(){s.init(c(".lwptoc"))})}(jQuery);
languages/luckywp-table-of-contents-es_ES.mo ADDED
Binary file
languages/luckywp-table-of-contents-he_IL.mo ADDED
Binary file
languages/luckywp-table-of-contents-ru_RU.mo CHANGED
Binary file
languages/luckywp-table-of-contents.pot CHANGED
@@ -1,18 +1,17 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2019-07-13 10:48+0300\n"
5
- "PO-Revision-Date: 2019-07-13 10:54+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
- "Language: ru_RU\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Generator: Poedit 2.2.3\n"
13
  "X-Poedit-Basepath: ..\n"
14
- "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15
- "%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
16
  "X-Poedit-KeywordsList: __;_;esc_html__\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
  "X-Poedit-SearchPathExcluded-0: plugin/editorBlock/src\n"
@@ -325,11 +324,11 @@ msgstr ""
325
  msgid "Saved!"
326
  msgstr ""
327
 
328
- #: admin/widgets/fontSizeField/views/widget.php:16 plugin/Plugin.php:301
329
  msgid "Default"
330
  msgstr ""
331
 
332
- #: admin/widgets/fontSizeField/views/widget.php:17 plugin/Plugin.php:266
333
  msgid "Custom Value"
334
  msgstr ""
335
 
@@ -514,7 +513,7 @@ msgstr ""
514
  msgid "Roman numbers"
515
  msgstr ""
516
 
517
- #: plugin/Plugin.php:138 plugin/Plugin.php:225 plugin/Plugin.php:352
518
  msgid "None"
519
  msgstr ""
520
 
@@ -611,18 +610,22 @@ msgid "As heading (#Example_Heading_Text)"
611
  msgstr ""
612
 
613
  #: plugin/Plugin.php:253
614
- msgid "Counter (#lpwtoc1, #lwptoc2, …)"
615
  msgstr ""
616
 
617
- #: plugin/Plugin.php:264
618
- msgid "Auto"
619
  msgstr ""
620
 
621
  #: plugin/Plugin.php:265
 
 
 
 
622
  msgid "Full Width"
623
  msgstr ""
624
 
625
- #: plugin/Plugin.php:428
626
  msgid ""
627
  "Creates a table of contents for your posts/pages. Works automatically or "
628
  "manually (via shortcode, Gutenberg block or widget)."
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2019-07-14 12:55+0300\n"
5
+ "PO-Revision-Date: 2019-07-14 12:56+0300\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
+ "Language: es_ES\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Generator: Poedit 2.2.3\n"
13
  "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
15
  "X-Poedit-KeywordsList: __;_;esc_html__\n"
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPathExcluded-0: plugin/editorBlock/src\n"
324
  msgid "Saved!"
325
  msgstr ""
326
 
327
+ #: admin/widgets/fontSizeField/views/widget.php:16 plugin/Plugin.php:302
328
  msgid "Default"
329
  msgstr ""
330
 
331
+ #: admin/widgets/fontSizeField/views/widget.php:17 plugin/Plugin.php:267
332
  msgid "Custom Value"
333
  msgstr ""
334
 
513
  msgid "Roman numbers"
514
  msgstr ""
515
 
516
+ #: plugin/Plugin.php:138 plugin/Plugin.php:225 plugin/Plugin.php:353
517
  msgid "None"
518
  msgstr ""
519
 
610
  msgstr ""
611
 
612
  #: plugin/Plugin.php:253
613
+ msgid "As heading w/o transliterate (#Example_Heading_Text)"
614
  msgstr ""
615
 
616
+ #: plugin/Plugin.php:254
617
+ msgid "Counter (#lwptoc1, #lwptoc2, …)"
618
  msgstr ""
619
 
620
  #: plugin/Plugin.php:265
621
+ msgid "Auto"
622
+ msgstr ""
623
+
624
+ #: plugin/Plugin.php:266
625
  msgid "Full Width"
626
  msgstr ""
627
 
628
+ #: plugin/Plugin.php:429
629
  msgid ""
630
  "Creates a table of contents for your posts/pages. Works automatically or "
631
  "manually (via shortcode, Gutenberg block or widget)."
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.6
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
@@ -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.6', __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.6.1
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
29
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
30
 
31
  $config = require(__DIR__ . '/config/plugin.php');
32
+ (new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.6.1', __FILE__, 'lwptoc_');
33
 
34
  require_once __DIR__ . '/functions.php';
plugin/Plugin.php CHANGED
@@ -250,7 +250,8 @@ class Plugin extends BasePlugin
250
  {
251
  return [
252
  'asheading' => esc_html__('As heading (#Example_Heading_Text)', 'luckywp-table-of-contents'),
253
- 'counter' => esc_html__('Counter (#lpwtoc1, #lwptoc2, …)', 'luckywp-table-of-contents'),
 
254
  ];
255
  }
256
 
250
  {
251
  return [
252
  'asheading' => esc_html__('As heading (#Example_Heading_Text)', 'luckywp-table-of-contents'),
253
+ 'asheadingwotransliterate' => esc_html__('As heading w/o transliterate (#Example_Heading_Text)', 'luckywp-table-of-contents'),
254
+ 'counter' => esc_html__('Counter (#lwptoc1, #lwptoc2, …)', 'luckywp-table-of-contents'),
255
  ];
256
  }
257
 
plugin/contentHandling/ContentHandling.php CHANGED
@@ -68,16 +68,25 @@ class ContentHandling
68
  break;
69
 
70
  case 'asheading':
 
71
  default:
72
  $id = html_entity_decode($label, ENT_QUOTES, get_option('blog_charset'));
73
- if (function_exists('transliterator_transliterate')) {
74
- $id = transliterator_transliterate('Any-Latin; Latin-ASCII;', $id);
 
 
 
 
 
 
 
 
75
  }
76
- $id = preg_replace('/[^\d\-_A-Za-z ]+/', '', $id);
77
  $id = preg_replace('/ +/', ' ', $id);
78
  $id = trim($id);
79
  $id = str_replace(' ', '_', $id);
80
  $id = preg_replace('/__+/', '_', $id);
 
81
  if (!$id) {
82
  $id = 'lwptoc';
83
  }
68
  break;
69
 
70
  case 'asheading':
71
+ case 'asheadingwotransliterate':
72
  default:
73
  $id = html_entity_decode($label, ENT_QUOTES, get_option('blog_charset'));
74
+ if ($hashFormat == 'asheadingwotransliterate') {
75
+ $id = htmlentities2($id);
76
+ $id = str_replace(['&amp;', '&nbsp;', '#', "\n\r", "\r\n", "\r", "\n"], '_', $id);
77
+ } else {
78
+ if (function_exists('transliterator_transliterate')) {
79
+ $id = transliterator_transliterate('Any-Latin; Latin-ASCII;', $id);
80
+ } else {
81
+ $id = remove_accents($id);
82
+ }
83
+ $id = preg_replace('/[^\d\-_A-Za-z ]+/', '', $id);
84
  }
 
85
  $id = preg_replace('/ +/', ' ', $id);
86
  $id = trim($id);
87
  $id = str_replace(' ', '_', $id);
88
  $id = preg_replace('/__+/', '_', $id);
89
+ $id = trim($id, '_');
90
  if (!$id) {
91
  $id = 'lwptoc';
92
  }
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.6
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -139,6 +139,12 @@ For non-English websites it is recommended to enable the `Intl` PHP extension.
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
 
142
  = 1.6 — 2019-07-13 =
143
  + Added RTL support.
144
  + Added option "Numeration Suffix".
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.6.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
139
 
140
  == Changelog ==
141
 
142
+ = 1.6.1 — 2019-07-14 =
143
+ + For hash format added option "As heading w/o transliterate".
144
+ + Added hebrew translate, thanks to @cdk-comp and @0enaro.
145
+ + Added spanish translate, thanks to @fernandot, @sanbec and @nobnob.
146
+ * Improved generate hash with option "As heading".
147
+
148
  = 1.6 — 2019-07-13 =
149
  + Added RTL support.
150
  + Added option "Numeration Suffix".