Easy Table of Contents - Version 2.0-rc6

Version Description

Download this release

Release Info

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

Code changes from version 2.0-rc5 to 2.0-rc6

README.txt CHANGED
@@ -17,6 +17,9 @@ A user friendly, featured focused plugin which allows you to insert a table of c
17
 
18
  = Features =
19
  * Automatically generate a table of contents for your posts, pages and custom post types by parsing its contents for headers.
 
 
 
20
  * Optionally enable for pages and/or posts. Custom post types are supported, as long as their content is output with the `the_content()` template tag.
21
  * Optionally auto insert the table of contents into the page, selectable by enabled post type.
22
  * Provides many easy to understand options to configure when and where to insert the table of contents.
@@ -43,14 +46,8 @@ Here are links to documentation pages for several of the premium templates for t
43
 
44
  = Roadmap =
45
  * Fragment caching for improved performance.
46
- * Support for `<!--nextpage-->`.
47
  * Customizer support.
48
 
49
- = Requirements =
50
-
51
- * **WordPress version:** >= 3.2
52
- * **PHP version:** >= 5.2.4
53
-
54
  = Credit =
55
 
56
  Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://wordpress.org/plugins/table-of-contents-plus/) plugin by [Michael Tran](http://dublue.com/plugins/toc/).
@@ -120,6 +117,7 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
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
  * TWEAK: Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
 
123
  * I18N: Add wpml-config.xml file.
124
  * BUG: Correct option misspelling.
125
  * BUG: Do not need to run values for alternate and exclude headings thru `wp_unslash()` because `update_post_meta()` already does.
17
 
18
  = Features =
19
  * Automatically generate a table of contents for your posts, pages and custom post types by parsing its contents for headers.
20
+ * Supports the `<!--nextpage-->` tag.
21
+ * Supports the Rank Math plugin.
22
+ * Supports the Classic Editor, Gutenberg, Elementor and Visual Composer page editors.
23
  * Optionally enable for pages and/or posts. Custom post types are supported, as long as their content is output with the `the_content()` template tag.
24
  * Optionally auto insert the table of contents into the page, selectable by enabled post type.
25
  * Provides many easy to understand options to configure when and where to insert the table of contents.
46
 
47
  = Roadmap =
48
  * Fragment caching for improved performance.
 
49
  * Customizer support.
50
 
 
 
 
 
 
51
  = Credit =
52
 
53
  Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://wordpress.org/plugins/table-of-contents-plus/) plugin by [Michael Tran](http://dublue.com/plugins/toc/).
117
  * TWEAK: Move in-page anchor to after the heading instead of wrapping the heading to prevent conflicts with theme styling.
118
  * TWEAK: Utilize the `ez_toc_exclude_by_selector` filter the exclude the JetPack share buttons from eligible headings.
119
  * TWEAK: Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
120
+ * TWEAK: Add compatibility filter for the Visual Composer plugin.
121
  * I18N: Add wpml-config.xml file.
122
  * BUG: Correct option misspelling.
123
  * BUG: Do not need to run values for alternate and exclude headings thru `wp_unslash()` because `update_post_meta()` already does.
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-rc5
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-rc5
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-rc5';
49
 
50
  /**
51
  * Stores the instance of this class.
@@ -537,10 +537,13 @@ if ( ! class_exists( 'ezTOC' ) ) {
537
 
538
  if ( $run ) {
539
 
540
- $post = self::get( get_the_ID() );
541
- $html = $post->getTOC();
 
 
542
 
543
- $run = false;
 
544
  }
545
 
546
  return $html;
@@ -559,8 +562,8 @@ if ( ! class_exists( 'ezTOC' ) ) {
559
 
560
  global $wp_current_filter;
561
 
562
- // Do not execute if root filter is one of those in the array.
563
- if ( in_array( $wp_current_filter[0], array( 'get_the_excerpt', 'wp_head' ), true ) ) {
564
 
565
  $apply = false;
566
  }
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-rc6
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-rc6
30
  */
31
 
32
  // Exit if accessed directly
45
  * @since 1.0
46
  * @var string
47
  */
48
+ const VERSION = '2.0-rc6';
49
 
50
  /**
51
  * Stores the instance of this class.
537
 
538
  if ( $run ) {
539
 
540
+ if ( is_null( $post = self::get( get_the_ID() ) ) ) {
541
+
542
+ return $content;
543
+ }
544
 
545
+ $html = $post->getTOC();
546
+ $run = false;
547
  }
548
 
549
  return $html;
562
 
563
  global $wp_current_filter;
564
 
565
+ // Do not execute if root current filter is one of those in the array.
566
+ if ( in_array( $wp_current_filter[0], array( 'get_the_excerpt', 'init', 'wp_head' ), true ) ) {
567
 
568
  $apply = false;
569
  }
includes/inc.plugin-compatibility.php CHANGED
@@ -102,3 +102,33 @@ add_filter(
102
  return $selectors;
103
  }
104
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  return $selectors;
103
  }
104
  );
105
+
106
+ /**
107
+ * Do not allow `the_content` TOC callback to run when editing a page in Visual Composer.
108
+ *
109
+ * @link https://wordpress.org/support/topic/correct-method-to-determine-if-using-frontend-editor/#post-12404679
110
+ *
111
+ * @since 2.0
112
+ */
113
+ add_filter(
114
+ 'ez_toc_maybe_apply_the_content_filter',
115
+ function( $apply ) {
116
+
117
+ if ( function_exists( 'vchelper' ) ) {
118
+
119
+ //$sourceId = intval( vchelper( "Request" )->input( 'vcv-source-id' ) );
120
+ //
121
+ //if ( $sourceId === get_the_ID() ) {
122
+ //
123
+ // $apply = false;
124
+ //}
125
+
126
+ if ( vchelper( 'Frontend' )->isPageEditable() ) {
127
+
128
+ $apply = false;
129
+ }
130
+ }
131
+
132
+ return $apply;
133
+ }
134
+ );