Version Description
Download this release
Release Info
Developer | shazahm1@hotmail.com |
Plugin | Easy Table of Contents |
Version | 2.0-rc12 |
Comparing to | |
See all releases |
Code changes from version 2.0-rc11 to 2.0-rc12
- README.txt +2 -1
- easy-table-of-contents.php +9 -8
- includes/inc.plugin-compatibility.php +57 -0
README.txt
CHANGED
@@ -19,7 +19,7 @@ A user friendly, featured focused plugin which allows you to insert a table of c
|
|
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, WPBakery Page Builder 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.
|
@@ -120,6 +120,7 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
|
|
120 |
* TWEAK: Utilize the `ez_toc_exclude_by_selector` filter the exclude the JetPack share buttons from eligible headings.
|
121 |
* TWEAK: Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
|
122 |
* TWEAK: Add compatibility filter for the Visual Composer plugin.
|
|
|
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.
|
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, Divi, Elementor, WPBakery Page Builder 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.
|
120 |
* TWEAK: Utilize the `ez_toc_exclude_by_selector` filter the exclude the JetPack share buttons from eligible headings.
|
121 |
* TWEAK: Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
|
122 |
* TWEAK: Add compatibility filter for the Visual Composer plugin.
|
123 |
+
* TWEAK: Utilize the `ez_toc_exclude_by_selector` filter the exclude the Starbox author heading from eligible headings.
|
124 |
* I18N: Add wpml-config.xml file.
|
125 |
* BUG: Correct option misspelling.
|
126 |
* 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-
|
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-
|
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-
|
51 |
|
52 |
/**
|
53 |
* Stores the instance of this class.
|
@@ -366,17 +366,18 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
366 |
*/
|
367 |
public static function is_eligible( $post ) {
|
368 |
|
369 |
-
global $wp_current_filter;
|
370 |
|
371 |
if ( empty( $post ) || ! $post instanceof WP_Post ) {
|
372 |
return false;
|
373 |
}
|
374 |
|
|
|
375 |
// Do not execute if root filter is one of those in the array.
|
376 |
-
if ( in_array( $wp_current_filter[0], array( 'get_the_excerpt', 'wp_head' ), true ) ) {
|
377 |
-
|
378 |
-
|
379 |
-
}
|
380 |
|
381 |
if ( has_shortcode( $post->post_content, apply_filters( 'ez_toc_shortcode', 'toc' ) ) ||
|
382 |
has_shortcode( $post->post_content, 'ez-toc' ) ) {
|
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-rc12
|
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-rc12
|
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-rc12';
|
51 |
|
52 |
/**
|
53 |
* Stores the instance of this class.
|
366 |
*/
|
367 |
public static function is_eligible( $post ) {
|
368 |
|
369 |
+
//global $wp_current_filter;
|
370 |
|
371 |
if ( empty( $post ) || ! $post instanceof WP_Post ) {
|
372 |
return false;
|
373 |
}
|
374 |
|
375 |
+
// This can likely be removed since it is checked in maybeApplyTheContentFilter().
|
376 |
// Do not execute if root filter is one of those in the array.
|
377 |
+
//if ( in_array( $wp_current_filter[0], array( 'get_the_excerpt', 'wp_head' ), true ) ) {
|
378 |
+
//
|
379 |
+
// return false;
|
380 |
+
//}
|
381 |
|
382 |
if ( has_shortcode( $post->post_content, apply_filters( 'ez_toc_shortcode', 'toc' ) ) ||
|
383 |
has_shortcode( $post->post_content, 'ez-toc' ) ) {
|
includes/inc.plugin-compatibility.php
CHANGED
@@ -190,3 +190,60 @@ add_action(
|
|
190 |
return $shortcodes;
|
191 |
}
|
192 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
return $shortcodes;
|
191 |
}
|
192 |
);
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Disabled for now as it does not appear to be required.
|
196 |
+
*
|
197 |
+
* Do not allow `the_content` TOC callback to run when rendering a Divi layout.
|
198 |
+
*
|
199 |
+
* @since 2.0
|
200 |
+
*/
|
201 |
+
//add_filter(
|
202 |
+
// 'ez_toc_maybe_apply_the_content_filter',
|
203 |
+
// function( $apply ) {
|
204 |
+
//
|
205 |
+
// global $wp_current_filter;
|
206 |
+
//
|
207 |
+
// // Do not execute if root current filter is one of those in the array.
|
208 |
+
// if ( in_array( $wp_current_filter[0], array( 'et_builder_render_layout' ), true ) ) {
|
209 |
+
//
|
210 |
+
// $apply = false;
|
211 |
+
// }
|
212 |
+
//
|
213 |
+
// return $apply;
|
214 |
+
// }
|
215 |
+
//);
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Callback the for `et_builder_render_layout`.
|
219 |
+
*
|
220 |
+
* Attaches the ezTOC `the_content` filter callback to the Divi layout content filter so the in page anchors will be
|
221 |
+
* added the post content.
|
222 |
+
*
|
223 |
+
* NOTE: Set priority 12 to run after Divi runs the `do_shortcode` filter on its layout content.
|
224 |
+
*
|
225 |
+
* @link https://wordpress.org/support/topic/anchor-links-not-being-added-with-divi/
|
226 |
+
*
|
227 |
+
* @since 2.0
|
228 |
+
*/
|
229 |
+
add_filter(
|
230 |
+
'et_builder_render_layout',
|
231 |
+
array( 'ezTOC', 'the_content' ),
|
232 |
+
12,
|
233 |
+
1
|
234 |
+
);
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Remove the Starbox plugin node from the post content before extracting headings.
|
238 |
+
* @link https://wordpress.org/plugins/starbox/
|
239 |
+
* @since 2.0
|
240 |
+
*/
|
241 |
+
add_filter(
|
242 |
+
'ez_toc_exclude_by_selector',
|
243 |
+
function( $selectors ) {
|
244 |
+
|
245 |
+
$selectors['starbox'] = '.abh_box';
|
246 |
+
|
247 |
+
return $selectors;
|
248 |
+
}
|
249 |
+
);
|