Easy Table of Contents - Version 2.0-rc4

Version Description

Requires WordPress >

Download this release

Release Info

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

Code changes from version 2.0-rc3 to 2.0-rc4

README.txt CHANGED
@@ -90,6 +90,42 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  = 1.7 05/09/2018 =
94
  * NEW: Introduce the `ez_toc_shortcode` filter.
95
  * TWEAK: Fix notices due to late eligibility check. props unixtam
@@ -269,3 +305,6 @@ Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
269
 
270
  = 1.7 =
271
  Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
 
 
 
90
 
91
  == Changelog ==
92
 
93
+ = 2.0 02/01/2020 =
94
+ * NEW: Major rewrite of all code and processing logic to make it faster and more reliable.
95
+ * NEW: Support for the <!--nextpage--> tag.
96
+ * NEW: Introduce helper functions for devs.
97
+ * NEW: Support WPML.
98
+ * NEW: Support Polylang.
99
+ * NEW: Add filter to support the Rank Math plugin.
100
+ * NEW: Introduce the `ez_toc_maybe_apply_the_content_filter` filter.
101
+ * TWEAK: Improve translation compatibility.
102
+ * TWEAK: Rework widget logic to allow multi-line TOC items, improve active item highlighting while removing the use of the jQuery Waypoints library.
103
+ * TWEAK Add additional classes to TOC list items.
104
+ * TWEAK: Add WOFF2 format for icon format and change font references in CSS.
105
+ * TWEAK: Add font-display: swap for toggle icon.
106
+ * TWEAK: Update JS Cookie to 2.2.1.
107
+ * TWEAK: Update jQuery Smooth Scroll to 2.2.0.
108
+ * TWEAK: Allow forward slash and angle brackets in headings and alternate headings.
109
+ * TWEAK: Allow forward slash in excluded headings.
110
+ * TWEAK: Remove new line/returns when matching excluded headings.
111
+ * TWEAK: Simple transient cache to ensure a post is only processed once per request for a TOC.
112
+ * TWEAK: Improve sanitization of alternate headings field value.
113
+ * TWEAK: Deal with non-breaking-spaces in alternate headings.
114
+ * TWEAK: Add the ability to exclude by selector content eligible to be included in the TOC.
115
+ * TWEAK: Change the shortcode priority to a higher value.
116
+ * TWEAK: Add filter to remove shortcodes from the content prior to the `the_content` filter being run to exclude shortcode content from being eligible as TOC items.
117
+ * TWEAK: Add compatibility filters to remove shortcodes for Connections and Striking theme to remove them from eligible TOC item content.
118
+ * TWEAK: Do not execute if root current filter is the `wp_head` or `get_the_excerpt` filters.
119
+ * TWEAK: Add filter to exclude content by selector.
120
+ * TWEAK: Move in-page anchor to after the heading instead of wrapping the heading to prevent conflicts with theme styling.
121
+ * TWEAK: Utilize the `ez_toc_exclude_by_selector` filter the exclude the JetPack share buttons from eligible headings.
122
+ * I18N: Add wpml-config.xml file.
123
+ * BUG: Correct option misspelling.
124
+ * BUG: Do not need to run values for alternate and exclude headings thru `wp_unslash()` because `update_post_meta()` already does.
125
+ * BUG: Do not need to run `stripslashes()` when escaping the alternate heading value.
126
+ * DEV: Change PHP keywords to comply with PSR2.
127
+ * DEV:Bump minimum PHP version to 5.6.20 which matches WP core.
128
+
129
  = 1.7 05/09/2018 =
130
  * NEW: Introduce the `ez_toc_shortcode` filter.
131
  * TWEAK: Fix notices due to late eligibility check. props unixtam
305
 
306
  = 1.7 =
307
  Requires WordPress >= 4.4 and PHP >= 5.3. PHP version >= 7.1 recommended.
308
+
309
+ = 2.0-rc4 =
310
+ Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
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-rc3
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
@@ -26,7 +26,7 @@
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
- * @version 2.0-rc3
30
  */
31
 
32
  // Exit if accessed directly
@@ -45,7 +45,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
45
  * @since 1.0
46
  * @var string
47
  */
48
- const VERSION = '2.0-rc3';
49
 
50
  /**
51
  * Stores the instance of this class.
@@ -571,7 +571,16 @@ if ( ! class_exists( 'ezTOC' ) ) {
571
  $apply = false;
572
  }
573
 
574
- return $apply;
 
 
 
 
 
 
 
 
 
575
  }
576
 
577
  /**
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-rc4
7
  * Author: Steven A. Zahm
8
  * Author URI: http://connections-pro.com/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Steven A. Zahm
29
+ * @version 2.0-rc4
30
  */
31
 
32
  // Exit if accessed directly
45
  * @since 1.0
46
  * @var string
47
  */
48
+ const VERSION = '2.0-rc4';
49
 
50
  /**
51
  * Stores the instance of this class.
571
  $apply = false;
572
  }
573
 
574
+ /**
575
+ * Whether or not to apply `the_content` filter callback.
576
+ *
577
+ * @see ezTOC::the_content()
578
+ *
579
+ * @since 2.0
580
+ *
581
+ * @param bool $apply
582
+ */
583
+ return apply_filters( 'ez_toc_maybe_apply_the_content_filter', $apply );
584
  }
585
 
586
  /**
includes/class.post.php CHANGED
@@ -269,19 +269,13 @@ class ezTOC_Post {
269
 
270
  $html = TagFilter::Explode( $content, $tagFilterOptions );
271
 
272
- /*
273
- * Find and remove nodes which are not eligible for TOC.
274
- * Example: JetPack Social Share.
275
- */
276
- $selectors = array( '.sharedaddy' );
277
-
278
  /**
279
  * @since 2.0
280
  *
281
  * @param $selectors array Array of classes/id selector to exclude from TOC.
282
  * @param $content string Post content.
283
  */
284
- $selectors = apply_filters( 'ez_toc_exclude_by_selector', $selectors, $content );
285
 
286
  $nodes = $html->Find( implode( ',', $selectors ) );
287
 
269
 
270
  $html = TagFilter::Explode( $content, $tagFilterOptions );
271
 
 
 
 
 
 
 
272
  /**
273
  * @since 2.0
274
  *
275
  * @param $selectors array Array of classes/id selector to exclude from TOC.
276
  * @param $content string Post content.
277
  */
278
+ $selectors = apply_filters( 'ez_toc_exclude_by_selector', array(), $content );
279
 
280
  $nodes = $html->Find( implode( ',', $selectors ) );
281
 
includes/inc.plugin-compatibility.php CHANGED
@@ -72,3 +72,18 @@ add_filter(
72
  return $tags_to_remove;
73
  }
74
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  return $tags_to_remove;
73
  }
74
  );
75
+
76
+ /**
77
+ * Remove the JetPack share buttons node from the post content before extracting headings.
78
+ *
79
+ * @since 2.0
80
+ */
81
+ add_filter(
82
+ 'ez_toc_exclude_by_selector',
83
+ function( $selectors ) {
84
+
85
+ $selectors['jetpack-sharedaddy'] = '.sharedaddy';
86
+
87
+ return $selectors;
88
+ }
89
+ );