Easy Table of Contents - Version 2.0.35.2

Version Description

11/02/2022 = * BUG: Jump anchors on new headings not working after the update of last version 2.0.35 * BUG: The TOC is not showing on the sidebar of all posts with the latest update 2.0.35

Download this release

Release Info

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

Code changes from version 2.0.35.1 to 2.0.35.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.35.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,6 +105,10 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
105
  4. Activate the plugin on the Plugins admin page.
106
 
107
  == Changelog ==
 
 
 
 
108
  = 2.0.35.1 10/31/2022 =
109
  * BUG: Last version removed sidebar & some other contents #329
110
  * BUG: Apostrophes removed from content #328
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.35.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
105
  4. Activate the plugin on the Plugins admin page.
106
 
107
  == Changelog ==
108
+ = 2.0.35.2 11/02/2022 =
109
+ * BUG: Jump anchors on new headings not working after the update of last version 2.0.35
110
+ * BUG: The TOC is not showing on the sidebar of all posts with the latest update 2.0.35
111
+
112
  = 2.0.35.1 10/31/2022 =
113
  * BUG: Last version removed sidebar & some other contents #329
114
  * BUG: Apostrophes removed from content #328
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://tocwp.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.35.1
7
  * Author: Magazine3
8
  * Author URI: https://tocwp.com/
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.35.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.35.1';
52
 
53
  /**
54
  * Stores the instance of this class.
@@ -1044,7 +1044,7 @@ INLINESTICKYTOGGLEJS;
1044
  // static $run = true;
1045
  $html = '';
1046
 
1047
- if ( 'ez-toc' == $tag ) {
1048
 
1049
  $post = self::get( get_the_ID() );
1050
 
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://tocwp.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.35.2
7
  * Author: Magazine3
8
  * Author URI: https://tocwp.com/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
+ * @version 2.0.35.2
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
48
  * @since 1.0
49
  * @var string
50
  */
51
+ const VERSION = '2.0.35.2';
52
 
53
  /**
54
  * Stores the instance of this class.
1044
  // static $run = true;
1045
  $html = '';
1046
 
1047
+ if ( 'ez-toc' == $tag || 'toc' == $tag ) {
1048
 
1049
  $post = self::get( get_the_ID() );
1050
 
includes/class.post.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
 
3
  use function Easy_Plugins\Table_Of_Contents\String\br2;
4
- use function Easy_Plugins\Table_Of_Contents\String\ezTOC_FilterString;
5
 
6
  class ezTOC_Post {
7
 
@@ -1005,18 +1004,18 @@ class ezTOC_Post {
1005
  foreach ( $matches as $i => $match ) {
1006
 
1007
  //$anchor = $matches[ $i ]['id'];
1008
- // $headings[] = str_replace(
1009
- // array(
1010
- // $match[1], // start of heading
1011
- // '</h' . $match[2] . '>' // end of heading
1012
- // ),
1013
- // array(
1014
- // '>',
1015
- // '</h' . $match[2] . '>'
1016
- // ),
1017
- // $str
1018
- // );
1019
- $headings[] = '>' . ezTOC_FilterString( $match[3] ) . '</h' . $match[2] . '>';
1020
  }
1021
  }
1022
 
1
  <?php
2
 
3
  use function Easy_Plugins\Table_Of_Contents\String\br2;
 
4
 
5
  class ezTOC_Post {
6
 
1004
  foreach ( $matches as $i => $match ) {
1005
 
1006
  //$anchor = $matches[ $i ]['id'];
1007
+ $headings[] = str_replace(
1008
+ array(
1009
+ $matches[ $i ][1], // start of heading
1010
+ '</h' . $matches[ $i ][2] . '>' // end of heading
1011
+ ),
1012
+ array(
1013
+ '>',
1014
+ '</h' . $matches[ $i ][2] . '>'
1015
+ ),
1016
+ $matches[ $i ][0]
1017
+ );
1018
+
1019
  }
1020
  }
1021
 
includes/inc.string-functions.php CHANGED
@@ -294,8 +294,6 @@ function mb_find_replace( &$find = false, &$replace = false, &$string = '' ) {
294
  // ;
295
  //}
296
 
297
- $string = ezTOC_FilterString( $string );
298
-
299
  for ( $i = 0; $i < count( $find ); $i ++ ) {
300
 
301
  $needle = $find[ $i ];
@@ -322,7 +320,7 @@ function mb_find_replace( &$find = false, &$replace = false, &$string = '' ) {
322
 
323
  $needle = str_replace(array('’','“','”'), array('\'','"','"'), $needle);
324
 
325
- $start = mb_stripos( $string, $needle, 0, get_option( 'blog_charset' ) );
326
  }
327
 
328
  /*
@@ -356,60 +354,4 @@ function mb_find_replace( &$find = false, &$replace = false, &$string = '' ) {
356
 
357
  return $string;
358
  }
359
- endif;
360
- /**
361
- * ezTOC_FilterString Function
362
- * for removing unlike character and convert some encoding character from headings.
363
- * @access public
364
- * @since 2.0.35
365
- * @param string|mixed $string
366
- *
367
- * @return string
368
- */
369
- if( ! function_exists('ezTOC_FilterString') ):
370
- function ezTOC_FilterString( $string ) {
371
-
372
- $return = html_entity_decode( $string, ENT_QUOTES, get_option( 'blog_charset' ) );
373
-
374
- // $return = br2( $return, ' ' );
375
- // $return = trim( strip_tags( $return ) );
376
-
377
- // Convert accented characters to ASCII.
378
- // $return = remove_accents( $return );
379
-
380
- // replace newlines with spaces (eg when headings are split over multiple lines)
381
- // $return = str_replace( array( "\r", "\n", "\n\r", "\r\n" ), ' ', $return );
382
-
383
- // Remove `&amp;` and `&nbsp;` NOTE: in order to strip "hidden" `&nbsp;`,
384
- // title needs to be converted to HTML entities.
385
- // @link https://stackoverflow.com/a/21801444/5351316
386
- // $return = htmlentities2( $return );
387
- // $return = str_replace( array( '&amp;', '&nbsp;'), ' ', $return );
388
- // $return = str_replace( array( '&shy;' ),' ', $return ); // removed silent hypen
389
-
390
- // $return = html_entity_decode( $string, ENT_QUOTES, get_option( 'blog_charset' ) );
391
-
392
- // remove non alphanumeric chars
393
- //$return = preg_replace( '/[^a-zA-Z0-9 \-_]*/', '', $return );
394
- // $return = preg_replace( '/[\x00-\x1F\x7F]*/u', '', $return );
395
-
396
- // Dashes
397
- // Special Characters.
398
- // - (minus) - (dash) – (en dash) — (em dash)
399
- // $return = str_replace(
400
- // array( '-', '-', '–', '—' ),
401
- // '-',
402
- // $return
403
- // );
404
-
405
- // Curley quotes.
406
- // ‘ (curly single open quote) ’ (curly single close quote) “ (curly double open quote) ” (curly double close quote)
407
- // $return = str_replace(
408
- // array( '‘', '’', '“', '”' ),
409
- // '',
410
- // $return
411
- // );
412
-
413
- return $return;
414
- }
415
  endif;
294
  // ;
295
  //}
296
 
 
 
297
  for ( $i = 0; $i < count( $find ); $i ++ ) {
298
 
299
  $needle = $find[ $i ];
320
 
321
  $needle = str_replace(array('’','“','”'), array('\'','"','"'), $needle);
322
 
323
+ $start = mb_strpos( $string, $needle );
324
  }
325
 
326
  /*
354
 
355
  return $string;
356
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  endif;