Easy Table of Contents - Version 2.0.16

Version Description

Requires WordPress >

Download this release

Release Info

Developer shazahm1@hotmail.com
Plugin Icon 128x128 Easy Table of Contents
Version 2.0.16
Comparing to
See all releases

Code changes from version 2.0.15 to 2.0.16

README.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: shazahm1@hotmail.com
3
  Donate link: https://connections-pro.com/
4
  Tags: table of contents, toc
5
  Requires at least: 5.3
6
- Tested up to: 5.6
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.15
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -89,6 +89,9 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
89
 
90
  == Changelog ==
91
 
 
 
 
92
  = 2.0.15 01/27/2021 =
93
  * TWEAK: Remove additional reserved characters when generating in-page anchor IDs.
94
 
@@ -452,3 +455,6 @@ Requires WordPress >= 5.3 and PHP version >= 5.6.20 (>= 7.4 is recommended).
452
 
453
  = 2.0.15 =
454
  Requires WordPress >= 5.3 and PHP version >= 5.6.20 (>= 7.4 is recommended).
 
 
 
3
  Donate link: https://connections-pro.com/
4
  Tags: table of contents, toc
5
  Requires at least: 5.3
6
+ Tested up to: 5.7
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.16
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
89
 
90
  == Changelog ==
91
 
92
+ = 2.0.16 02/01/2021 =
93
+ * TWEAK: Remove special characters such as fancy quotes, en and, em dashes when generating in-page anchor IDs.
94
+
95
  = 2.0.15 01/27/2021 =
96
  * TWEAK: Remove additional reserved characters when generating in-page anchor IDs.
97
 
455
 
456
  = 2.0.15 =
457
  Requires WordPress >= 5.3 and PHP version >= 5.6.20 (>= 7.4 is recommended).
458
+
459
+ = 2.0.16 =
460
+ Requires WordPress >= 5.3 and PHP version >= 5.6.20 (>= 7.4 is recommended).
easy-table-of-contents.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: http://connections-pro.com/
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.15
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
10
  * Domain Path: /languages
11
  *
12
- * Copyright 2020 Steven A. Zahm ( email : helpdesk@connections-pro.com )
13
  *
14
  * Easy Table of Contents is free software; you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License, version 2, as
@@ -26,7 +26,7 @@
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
- * @version 2.0.15
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.15';
52
 
53
  /**
54
  * Stores the instance of this class.
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: http://connections-pro.com/
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.16
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
10
  * Domain Path: /languages
11
  *
12
+ * Copyright 2021 Steven A. Zahm ( email : helpdesk@connections-pro.com )
13
  *
14
  * Easy Table of Contents is free software; you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License, version 2, as
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
+ * @version 2.0.16
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
48
  * @since 1.0
49
  * @var string
50
  */
51
+ const VERSION = '2.0.16';
52
 
53
  /**
54
  * Stores the instance of this class.
includes/class.post.php CHANGED
@@ -810,20 +810,55 @@ class ezTOC_Post {
810
  $return = preg_replace( '/[\x00-\x1F\x7F]*/u', '', $return );
811
 
812
  // Reserved Characters.
813
- //* ' ( ) ; : @ & = + $ , / ? # [ ]
814
  $return = str_replace(
815
  array( '*', '\'', '(', ')', ';', '@', '&', '=', '+', '$', ',', '/', '?', '#', '[', ']' ),
816
  '',
817
  $return
818
  );
819
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
820
  // AMP/Caching plugins seems to break URL with the following characters, so lets replace them.
821
  $return = str_replace( array( ':' ), '_', $return );
822
- $return = str_replace( array( '.' ), ' ', $return );
823
 
824
  // Convert space characters to an `_` (underscore).
825
  $return = preg_replace( '/\s+/', '_', $return );
826
 
 
 
 
827
  // Replace multiple `_` (underscore) with a single `_` (underscore).
828
  $return = preg_replace( '/_+/', '_', $return );
829
 
@@ -864,7 +899,7 @@ class ezTOC_Post {
864
  if ( ezTOC_Option::get( 'hyphenate' ) ) {
865
 
866
  $return = str_replace( '_', '-', $return );
867
- $return = str_replace( '--', '-', $return );
868
  }
869
  }
870
 
810
  $return = preg_replace( '/[\x00-\x1F\x7F]*/u', '', $return );
811
 
812
  // Reserved Characters.
813
+ // * ' ( ) ; : @ & = + $ , / ? # [ ]
814
  $return = str_replace(
815
  array( '*', '\'', '(', ')', ';', '@', '&', '=', '+', '$', ',', '/', '?', '#', '[', ']' ),
816
  '',
817
  $return
818
  );
819
 
820
+ // Unsafe Characters.
821
+ // % { } | \ ^ ~ [ ] `
822
+ $return = str_replace(
823
+ array( '%', '{', '}', '|', '\\', '^', '~', '[', ']', '`' ),
824
+ '',
825
+ $return
826
+ );
827
+
828
+ // Special Characters.
829
+ // $ - _ . + ! * ' ( ) ,
830
+ $return = str_replace(
831
+ array( '$', '.', '+', '!', '*', '\'', '(', ')', ',' ),
832
+ '',
833
+ $return
834
+ );
835
+
836
+ // Dashes
837
+ // Special Characters.
838
+ // - (minus) - (dash) – (en dash) — (em dash)
839
+ $return = str_replace(
840
+ array( '-', '-', '–', '—' ),
841
+ '-',
842
+ $return
843
+ );
844
+
845
+ // Curley quotes.
846
+ // ‘ (curly single open quote) ’ (curly single close quote) “ (curly double open quote) ” (curly double close quote)
847
+ $return = str_replace(
848
+ array( '‘', '’', '“', '”' ),
849
+ '',
850
+ $return
851
+ );
852
+
853
  // AMP/Caching plugins seems to break URL with the following characters, so lets replace them.
854
  $return = str_replace( array( ':' ), '_', $return );
 
855
 
856
  // Convert space characters to an `_` (underscore).
857
  $return = preg_replace( '/\s+/', '_', $return );
858
 
859
+ // Replace multiple `-` (hyphen) with a single `-` (hyphen).
860
+ $return = preg_replace( '/-+/', '-', $return );
861
+
862
  // Replace multiple `_` (underscore) with a single `_` (underscore).
863
  $return = preg_replace( '/_+/', '_', $return );
864
 
899
  if ( ezTOC_Option::get( 'hyphenate' ) ) {
900
 
901
  $return = str_replace( '_', '-', $return );
902
+ $return = preg_replace( '/-+/', '-', $return );
903
  }
904
  }
905