Easy Table of Contents - Version 2.0.33.2

Version Description

09/08/2022 = * BUG: Default settings set in options for ltr/rtl text direction - The numbering of the titles has disappeared after latest update. #281

Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Easy Table of Contents
Version 2.0.33.2
Comparing to
See all releases

Code changes from version 2.0.33.1 to 2.0.33.2

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.33.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -106,10 +106,13 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
106
 
107
  == Changelog ==
108
 
109
- = 2.0.33.1 08/07/2022 =
 
 
 
110
  * BUG: The numbering of the titles has disappeared after latest update. #281
111
 
112
- = 2.0.33 08/06/2022 =
113
  * BUG: Sticky Toggle JS issue when disabled Auto Insert & not added manual Shortcode #272
114
  * BUG: Ad Invalid Click Protector plugin is having conflicted #267
115
  * TWEAK: Trailing equal signs in changelog area of readme.txt are missing #264
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.33.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
106
 
107
  == Changelog ==
108
 
109
+ = 2.0.33.2 09/08/2022 =
110
+ * BUG: Default settings set in options for ltr/rtl text direction - The numbering of the titles has disappeared after latest update. #281
111
+
112
+ = 2.0.33.1 09/07/2022 =
113
  * BUG: The numbering of the titles has disappeared after latest update. #281
114
 
115
+ = 2.0.33 09/06/2022 =
116
  * BUG: Sticky Toggle JS issue when disabled Auto Insert & not added manual Shortcode #272
117
  * BUG: Ad Invalid Click Protector plugin is having conflicted #267
118
  * TWEAK: Trailing equal signs in changelog area of readme.txt are missing #264
assets/js/admin.js CHANGED
@@ -6,10 +6,14 @@ jQuery(document).ready(function ($) {
6
  ez_toc_color_picker.wpColorPicker();
7
  }
8
 
 
9
  var ezTocSettingsCustomWidth = document.getElementById('ez-toc-settings[width_custom]');
 
10
  if(ezTocSettingsCustomWidth) {
11
- ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "none";
12
- document.getElementById('ez-toc-settings[width]').addEventListener('change', function () {
 
 
13
  if (document.getElementById('ez-toc-settings[width]').value == 'custom') {
14
  ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "revert";
15
  } else {
@@ -17,6 +21,7 @@ jQuery(document).ready(function ($) {
17
  }
18
  });
19
  }
 
20
  $("#subscribe-newsletter-form").on('submit', function (e) {
21
  e.preventDefault();
22
  var $form = $("#subscribe-newsletter-form");
6
  ez_toc_color_picker.wpColorPicker();
7
  }
8
 
9
+ var ezTocSettingsWidth = document.getElementById('ez-toc-settings[width]');
10
  var ezTocSettingsCustomWidth = document.getElementById('ez-toc-settings[width_custom]');
11
+
12
  if(ezTocSettingsCustomWidth) {
13
+ if(ezTocSettingsWidth.value != 'custom')
14
+ ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "none";
15
+
16
+ ezTocSettingsWidth.addEventListener('change', function () {
17
  if (document.getElementById('ez-toc-settings[width]').value == 'custom') {
18
  ezTocSettingsCustomWidth.parentNode.parentNode.style.display = "revert";
19
  } else {
21
  }
22
  });
23
  }
24
+
25
  $("#subscribe-newsletter-form").on('submit', function (e) {
26
  e.preventDefault();
27
  var $form = $("#subscribe-newsletter-form");
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- function disableScrolling(){var e=window.scrollX,n=window.scrollY;window.onscroll=function(){window.scrollTo(e,n)}}function enableScrolling(){window.onscroll=function(){}}jQuery(document).ready((function(e){var n=e(".ez-toc-color-picker");n.length&&n.wpColorPicker();var t=document.getElementById("ez-toc-settings[width_custom]");t&&(t.parentNode.parentNode.style.display="none",document.getElementById("ez-toc-settings[width]").addEventListener("change",(function(){"custom"==document.getElementById("ez-toc-settings[width]").value?t.parentNode.parentNode.style.display="revert":t.parentNode.parentNode.style.display="none"}))),e("#subscribe-newsletter-form").on("submit",(function(n){n.preventDefault();var t=e("#subscribe-newsletter-form"),o=t.find('input[name="name"]').val(),c=t.find('input[name="email"]').val(),l=t.find('input[name="company"]').val();e.post(ajaxurl,{action:"eztoc_subscribe_newsletter",name:o,email:c,website:l,eztoc_security_nonce:cn_toc_admin_data.eztoc_security_nonce},(function(e){}))}))}));const unsecuredCopyToClipboard=e=>{const n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}catch(e){console.error("Unable to copy to clipboard",e)}document.body.removeChild(n)};function ez_toc_clipboard(e,n,t,o){o.preventDefault(),disableScrolling();var c=t.parentNode.parentNode.querySelectorAll("#"+e)[0];c.select(),c.setSelectionRange(0,99999),unsecuredCopyToClipboard(c.value),t.querySelectorAll("span."+n)[0].innerHTML="Copied: "+c.value}function ez_toc_outFunc(e,n,t){t.preventDefault(),n.querySelectorAll("span."+e)[0].innerHTML="Copy to clipboard",enableScrolling()}
1
+ function disableScrolling(){var e=window.scrollX,n=window.scrollY;window.onscroll=function(){window.scrollTo(e,n)}}function enableScrolling(){window.onscroll=function(){}}jQuery(document).ready((function(e){var n=e(".ez-toc-color-picker");n.length&&n.wpColorPicker();var t=document.getElementById("ez-toc-settings[width]"),o=document.getElementById("ez-toc-settings[width_custom]");o&&("custom"!=t.value&&(o.parentNode.parentNode.style.display="none"),t.addEventListener("change",(function(){"custom"==document.getElementById("ez-toc-settings[width]").value?o.parentNode.parentNode.style.display="revert":o.parentNode.parentNode.style.display="none"}))),e("#subscribe-newsletter-form").on("submit",(function(n){n.preventDefault();var t=e("#subscribe-newsletter-form"),o=t.find('input[name="name"]').val(),c=t.find('input[name="email"]').val(),l=t.find('input[name="company"]').val();e.post(ajaxurl,{action:"eztoc_subscribe_newsletter",name:o,email:c,website:l,eztoc_security_nonce:cn_toc_admin_data.eztoc_security_nonce},(function(e){}))}))}));const unsecuredCopyToClipboard=e=>{const n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.focus(),n.select();try{document.execCommand("copy")}catch(e){console.error("Unable to copy to clipboard",e)}document.body.removeChild(n)};function ez_toc_clipboard(e,n,t,o){o.preventDefault(),disableScrolling();var c=t.parentNode.parentNode.querySelectorAll("#"+e)[0];c.select(),c.setSelectionRange(0,99999),unsecuredCopyToClipboard(c.value),t.querySelectorAll("span."+n)[0].innerHTML="Copied: "+c.value}function ez_toc_outFunc(e,n,t){t.preventDefault(),n.querySelectorAll("span."+e)[0].innerHTML="Copy to clipboard",enableScrolling()}
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://magazine3.company/
5
  * Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
6
- * Version: 2.0.33.1
7
  * Author: Magazine3
8
  * Author URI: https://magazine3.company/
9
  * Text Domain: easy-table-of-contents
@@ -26,7 +26,7 @@
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
- * @version 2.0.33.1
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
@@ -48,7 +48,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
48
  * @since 1.0
49
  * @var string
50
  */
51
- const VERSION = '2.0.33.1';
52
 
53
  /**
54
  * Stores the instance of this class.
@@ -369,11 +369,11 @@ if ( ! class_exists( 'ezTOC' ) ) {
369
  * RTL Direction
370
  * @since 2.0.33
371
  */
372
- self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction' ) );
373
- self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction' ),'ez-toc-widget-direction','ez-toc-widget-container' );
374
 
375
  if( ezTOC_Option::get( 'sticky-toggle' ) ) {
376
- self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction' ), 'ez-toc-sticky-toggle-direction', 'ez-toc-sticky-toggle-counter' );
377
  }
378
  /* End rtl direction */
379
  }
@@ -387,11 +387,12 @@ if ( ! class_exists( 'ezTOC' ) ) {
387
  * @param string $directionClass
388
  * @param string $class
389
  * @param string $counter
 
390
  * @return void
391
  */
392
- private static function InlineCountingCSS( $direction = 'ltr', $directionClass = 'ez-toc-container-direction', $class = 'ez-toc-counter', $counter = 'counter' )
393
  {
394
- $list_type = ezTOC_Option::get( $counter );
395
  wp_enqueue_style('ez-toc');
396
  $inlineCSS = '';
397
  $counterListAll = array_merge(ezTOC_Option::getCounterListDecimal(), ezTOC_Option::getCounterList_i18n());
@@ -403,18 +404,18 @@ if ( ! class_exists( 'ezTOC' ) ) {
403
  INLINECSS;
404
  $listAnchorPosition = 'before';
405
  $marginCSS = 'margin-right: .2em;';
 
406
  if( $direction == 'rtl' )
407
  {
408
  $class .= '-rtl';
409
- if($list_type == 'cjk-earthly-branch')
410
- $listAnchorPosition = 'after';
411
 
412
  $marginCSS = 'margin-left: .2em;';
 
413
  }
414
 
415
  if( $list_type == '- ' ) {
416
  $inlineCSS .= <<<INLINECSS
417
- .$class nav ul li {
418
  list-style-type: '- ' !important;
419
  list-style-position: inside !important;
420
  }\n\n
@@ -441,7 +442,8 @@ INLINECSS;
441
  content: counters(item, ".", $list_type) ". ";
442
  display: inline-block;
443
  counter-increment: item;
444
- $marginCSS
 
445
  }\n\n
446
  INLINECSS;
447
  }
@@ -457,6 +459,7 @@ INLINECSS;
457
  content: counter(item, $list_type) " ";
458
  $marginCSS
459
  counter-increment: item;
 
460
  }\n\n
461
  INLINECSS;
462
 
@@ -563,7 +566,9 @@ COUNTERINCREMENTCSS;
563
  $items = implode(' "." ', $items);
564
  $counterContentCSS .= <<<COUNTERINCREMENTCSS
565
  .$class nav $ul li a::before {
566
- content: $items " ";
 
 
567
  }\n\n
568
  COUNTERINCREMENTCSS;
569
  }
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://magazine3.company/
5
  * Description: Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.
6
+ * Version: 2.0.33.2
7
  * Author: Magazine3
8
  * Author URI: https://magazine3.company/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
+ * @version 2.0.33.2
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
48
  * @since 1.0
49
  * @var string
50
  */
51
+ const VERSION = '2.0.33.2';
52
 
53
  /**
54
  * Stores the instance of this class.
369
  * RTL Direction
370
  * @since 2.0.33
371
  */
372
+ self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) );
373
+ self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ),'ez-toc-widget-direction','ez-toc-widget-container', 'counter', 'ez-toc-widget-container' );
374
 
375
  if( ezTOC_Option::get( 'sticky-toggle' ) ) {
376
+ self::InlineCountingCSS( ezTOC_Option::get( 'heading-text-direction', 'ltr' ), 'ez-toc-sticky-toggle-direction', 'ez-toc-sticky-toggle-counter', 'counter', 'ez-toc-sticky-container' );
377
  }
378
  /* End rtl direction */
379
  }
387
  * @param string $directionClass
388
  * @param string $class
389
  * @param string $counter
390
+ * @param string $containerId
391
  * @return void
392
  */
393
+ private static function InlineCountingCSS( $direction = 'ltr', $directionClass = 'ez-toc-container-direction', $class = 'ez-toc-counter', $counter = 'counter', $containerId = 'ez-toc-container' )
394
  {
395
+ $list_type = ezTOC_Option::get( $counter, 'decimal' );
396
  wp_enqueue_style('ez-toc');
397
  $inlineCSS = '';
398
  $counterListAll = array_merge(ezTOC_Option::getCounterListDecimal(), ezTOC_Option::getCounterList_i18n());
404
  INLINECSS;
405
  $listAnchorPosition = 'before';
406
  $marginCSS = 'margin-right: .2em;';
407
+ $floatPosition = 'float: left;';
408
  if( $direction == 'rtl' )
409
  {
410
  $class .= '-rtl';
 
 
411
 
412
  $marginCSS = 'margin-left: .2em;';
413
+ $floatPosition = 'float: right;';
414
  }
415
 
416
  if( $list_type == '- ' ) {
417
  $inlineCSS .= <<<INLINECSS
418
+ #$containerId.$class nav ul li {
419
  list-style-type: '- ' !important;
420
  list-style-position: inside !important;
421
  }\n\n
442
  content: counters(item, ".", $list_type) ". ";
443
  display: inline-block;
444
  counter-increment: item;
445
+ $marginCSS \n
446
+ $floatPosition
447
  }\n\n
448
  INLINECSS;
449
  }
459
  content: counter(item, $list_type) " ";
460
  $marginCSS
461
  counter-increment: item;
462
+ $floatPosition
463
  }\n\n
464
  INLINECSS;
465
 
566
  $items = implode(' "." ', $items);
567
  $counterContentCSS .= <<<COUNTERINCREMENTCSS
568
  .$class nav $ul li a::before {
569
+ content: $items ". ";
570
+ float: right;
571
+ margin-left: 0.2rem;
572
  }\n\n
573
  COUNTERINCREMENTCSS;
574
  }
includes/class.options.php CHANGED
@@ -923,6 +923,7 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
923
  //'show_toc_in_widget_only' => false,
924
  //'show_toc_in_widget_only_post_types' => array(),
925
  'widget_affix_selector' => '',
 
926
  );
927
 
928
  return apply_filters( 'ez_toc_get_default_options', $defaults );
923
  //'show_toc_in_widget_only' => false,
924
  //'show_toc_in_widget_only_post_types' => array(),
925
  'widget_affix_selector' => '',
926
+ 'heading-text-direction' => 'ltr',
927
  );
928
 
929
  return apply_filters( 'ez_toc_get_default_options', $defaults );
includes/class.post.php CHANGED
@@ -1097,10 +1097,10 @@ class ezTOC_Post {
1097
  $htmlSticky = '';
1098
  if ( $this->hasTOCItems() ) {
1099
  $classSticky[] = 'counter-flat';
1100
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'ltr' ) {
1101
  $classSticky[] = 'ez-toc-sticky-toggle-counter';
1102
  }
1103
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'rtl' ) {
1104
  $classSticky[] = 'ez-toc-sticky-toggle-counter-rtl';
1105
  }
1106
 
@@ -1192,10 +1192,10 @@ class ezTOC_Post {
1192
  $class[] .= 'counter-flat';
1193
  }
1194
 
1195
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'ltr' ) {
1196
  $class[] = 'ez-toc-counter';
1197
  }
1198
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'rtl' ) {
1199
  $class[] = 'ez-toc-counter-rtl';
1200
  }
1201
  // colour themes
1097
  $htmlSticky = '';
1098
  if ( $this->hasTOCItems() ) {
1099
  $classSticky[] = 'counter-flat';
1100
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'ltr' ) {
1101
  $classSticky[] = 'ez-toc-sticky-toggle-counter';
1102
  }
1103
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'rtl' ) {
1104
  $classSticky[] = 'ez-toc-sticky-toggle-counter-rtl';
1105
  }
1106
 
1192
  $class[] .= 'counter-flat';
1193
  }
1194
 
1195
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'ltr' ) {
1196
  $class[] = 'ez-toc-counter';
1197
  }
1198
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'rtl' ) {
1199
  $class[] = 'ez-toc-counter-rtl';
1200
  }
1201
  // colour themes
includes/class.widget-toc.php CHANGED
@@ -189,10 +189,10 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
189
  $class[] = 'counter-flat';
190
  }
191
 
192
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'ltr' ) {
193
  $class[] = 'ez-toc-widget-container';
194
  }
195
- if( ezTOC_Option::get( 'heading-text-direction' ) == 'rtl' ) {
196
  $class[] = 'ez-toc-widget-container-rtl';
197
  }
198
 
@@ -224,7 +224,7 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
224
  echo $before_widget;
225
  do_action( 'ez_toc_before_widget_container');
226
 
227
- echo '<div class="ez-toc-widget-container ' . implode( ' ', $class ) . '">' . PHP_EOL;
228
 
229
  do_action( 'ez_toc_before_widget' );
230
 
189
  $class[] = 'counter-flat';
190
  }
191
 
192
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'ltr' ) {
193
  $class[] = 'ez-toc-widget-container';
194
  }
195
+ if( ezTOC_Option::get( 'heading-text-direction', 'ltr' ) == 'rtl' ) {
196
  $class[] = 'ez-toc-widget-container-rtl';
197
  }
198
 
224
  echo $before_widget;
225
  do_action( 'ez_toc_before_widget_container');
226
 
227
+ echo '<div id="ez-toc-widget-container" class="ez-toc-widget-container ' . implode( ' ', $class ) . '">' . PHP_EOL;
228
 
229
  do_action( 'ez_toc_before_widget' );
230