Easy Table of Contents - Version 2.0.11

Version Description

Requires WordPress >

Download this release

Release Info

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

Code changes from version 2.0.10 to 2.0.11

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
5
  Requires at least: 5.2
6
  Tested up to: 5.4
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.10
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -89,6 +89,11 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
92
  = 2.0.10 04/20/2020 =
93
  * TWEAK: Add trailing `span` to heading, to prepare for `#` option and to fix duplicate heading title matching.
94
  * TWEAK: Add second heading search/replace function to search for heading in content with heading html entities decoded. May help Beaver Builder users as it seems like it does not encode HTML entities as WP core does.
@@ -407,3 +412,6 @@ Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
407
 
408
  = 2.0.10 =
409
  Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
 
 
 
5
  Requires at least: 5.2
6
  Tested up to: 5.4
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
89
 
90
  == Changelog ==
91
 
92
+ = 2.0.11 05/01/2020 =
93
+ * COMPATIBILITY: Add support for the Uncode theme.
94
+ * COMPATIBILITY: Do not run on WooCommerce pages.
95
+ * DEV: Correct typo in phpDoc.
96
+
97
  = 2.0.10 04/20/2020 =
98
  * TWEAK: Add trailing `span` to heading, to prepare for `#` option and to fix duplicate heading title matching.
99
  * TWEAK: Add second heading search/replace function to search for heading in content with heading html entities decoded. May help Beaver Builder users as it seems like it does not encode HTML entities as WP core does.
412
 
413
  = 2.0.10 =
414
  Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
415
+
416
+ = 2.0.11 =
417
+ 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.10
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.10
30
  */
31
 
32
  use function Easy_Plugins\Table_Of_Contents\String\mb_find_replace;
@@ -47,7 +47,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
47
  * @since 1.0
48
  * @var string
49
  */
50
- const VERSION = '2.0.10';
51
 
52
  /**
53
  * 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.11
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.11
30
  */
31
 
32
  use function Easy_Plugins\Table_Of_Contents\String\mb_find_replace;
47
  * @since 1.0
48
  * @var string
49
  */
50
+ const VERSION = '2.0.11';
51
 
52
  /**
53
  * Stores the instance of this class.
includes/inc.plugin-compatibility.php CHANGED
@@ -216,7 +216,7 @@ add_action(
216
  //);
217
 
218
  /**
219
- * Callback the for `et_builder_render_layout`.
220
  *
221
  * Attaches the ezTOC `the_content` filter callback to the Divi layout content filter so the in page anchors will be
222
  * added the post content.
@@ -234,6 +234,68 @@ add_filter(
234
  1
235
  );
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  /**
238
  * Remove the Starbox plugin node from the post content before extracting headings.
239
  * @link https://wordpress.org/plugins/starbox/
@@ -455,3 +517,48 @@ class ezTOC_Elementor {
455
  }
456
  //new ezTOC_Elementor();
457
  add_action( 'elementor/init', array( 'ezTOC_Elementor', 'start' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  //);
217
 
218
  /**
219
+ * Callback the for `et_builder_render_layout` filter.
220
  *
221
  * Attaches the ezTOC `the_content` filter callback to the Divi layout content filter so the in page anchors will be
222
  * added the post content.
234
  1
235
  );
236
 
237
+ /**
238
+ * Add support for the Uncode Theme.
239
+ *
240
+ * @link http://www.undsgn.com/
241
+ *
242
+ * @since 2.0.11
243
+ */
244
+ add_action(
245
+ 'after_setup_theme',
246
+ function() {
247
+
248
+ if ( function_exists( 'uncode_setup' ) ) {
249
+
250
+ /**
251
+ * Callback the for `the_content` filter.
252
+ *
253
+ * Trick the theme into applying its content filter.
254
+ *
255
+ * In its page/post templates it applies `the_content` filter passing an empty string.
256
+ * If the value passed pack is `null` or an empty string, the theme will not run its content filter.
257
+ *
258
+ * This simply wraps the page/post content in comment tags that way it is not possible to return empty
259
+ * and its content filter will be run. Now ezTOC can hook into the theme's content filter to insert the TOC.
260
+ *
261
+ * @since 2.0.11
262
+ */
263
+ add_filter(
264
+ 'the_content',
265
+ function( $content ) {
266
+ return '<!-- <ezTOC> -->' . $content . '<!-- </ezTOC> -->';
267
+ },
268
+ 9,
269
+ 1
270
+ );
271
+
272
+ /**
273
+ * Callback the for `uncode_single_content` filter.
274
+ *
275
+ * Need to texturize the page/post content first.
276
+ *
277
+ * @since 2.0.11
278
+ */
279
+ add_filter(
280
+ 'uncode_single_content',
281
+ function( $content ) {
282
+ return wptexturize( $content );
283
+ },
284
+ 10,
285
+ 1
286
+ );
287
+ add_filter(
288
+ 'uncode_single_content',
289
+ array( 'ezTOC', 'the_content' ),
290
+ 11,
291
+ 1
292
+ );
293
+ }
294
+
295
+ },
296
+ 11
297
+ );
298
+
299
  /**
300
  * Remove the Starbox plugin node from the post content before extracting headings.
301
  * @link https://wordpress.org/plugins/starbox/
517
  }
518
  //new ezTOC_Elementor();
519
  add_action( 'elementor/init', array( 'ezTOC_Elementor', 'start' ) );
520
+
521
+
522
+ /**
523
+ * Do not allow `the_content` TOC callback to run when on WooCommerce pages.
524
+ *
525
+ * @link https://docs.woocommerce.com/document/conditional-tags/
526
+ * @link https://wordpress.stackexchange.com/a/246525/59053
527
+ *
528
+ * @since 2.0.11
529
+ */
530
+ add_filter(
531
+ 'ez_toc_maybe_apply_the_content_filter',
532
+ function( $apply ) {
533
+
534
+ $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
535
+
536
+ // Just in case an array is not returned.
537
+ if ( ! is_array( $active_plugins ) ) {
538
+
539
+ $active_plugins = array();
540
+ }
541
+
542
+ $string = implode( '|', $active_plugins );
543
+
544
+ if ( FALSE !== stripos( $string, 'woocommerce.php' ) ) {
545
+
546
+ /** @noinspection PhpUndefinedFunctionInspection */
547
+ if ( is_woocommerce() ||
548
+ is_shop() ||
549
+ is_product_category() ||
550
+ is_product_tag() ||
551
+ is_cart() ||
552
+ is_checkout() ||
553
+ is_account_page() ||
554
+ is_wc_endpoint_url()
555
+ ) {
556
+
557
+ $apply = false;
558
+ }
559
+
560
+ }
561
+
562
+ return $apply;
563
+ }
564
+ );