Version Description
Requires WordPress >
Download this release
Release Info
Developer | shazahm1@hotmail.com |
Plugin | Easy Table of Contents |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- README.txt +11 -2
- easy-table-of-contents.php +6 -4
- includes/class.post.php +29 -28
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
|
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.3
|
7 |
Requires PHP: 5.6.20
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -89,7 +89,13 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
-
= 2.0.
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
* TWEAK: Slightly tighten heading matching, last update made it a little too loose.
|
94 |
* BUG: Correct logic required to place TOC before first heading which is required for the more lax heading matching required for page builders.
|
95 |
|
@@ -337,3 +343,6 @@ Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
|
|
337 |
|
338 |
= 2.0.3 =
|
339 |
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.3
|
7 |
Requires PHP: 5.6.20
|
8 |
+
Stable tag: 2.0.4
|
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.4 03/16/2020 =
|
93 |
+
* NEW: Introduce the `ez_toc_container_class` filter.
|
94 |
+
* TWEAK: Slight rework to ezTOC container classes logic.
|
95 |
+
* BUG: `sprintf()` was eating `%` in the TOC heading item.
|
96 |
+
* BUG: Do not insert TOC at top of post if before first heading option is selected even if first heading can not be found. Some page builders cause the TOC to insert twice or on blog pages.
|
97 |
+
|
98 |
+
= 2.0.3 03/12/2020 =
|
99 |
* TWEAK: Slightly tighten heading matching, last update made it a little too loose.
|
100 |
* BUG: Correct logic required to place TOC before first heading which is required for the more lax heading matching required for page builders.
|
101 |
|
343 |
|
344 |
= 2.0.3 =
|
345 |
Requires WordPress >= 5.0 and PHP version >= 5.6.20 (>= 7.1 is recommended).
|
346 |
+
|
347 |
+
= 2.0.4 =
|
348 |
+
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.
|
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.
|
@@ -618,7 +618,9 @@ if ( ! class_exists( 'ezTOC' ) ) {
|
|
618 |
|
619 |
} else {
|
620 |
|
621 |
-
|
|
|
|
|
622 |
}
|
623 |
}
|
624 |
|
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.4
|
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.4
|
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.4';
|
51 |
|
52 |
/**
|
53 |
* Stores the instance of this class.
|
618 |
|
619 |
} else {
|
620 |
|
621 |
+
// Somehow, there are scenarios where the processing get this far and
|
622 |
+
// the TOC is being added to pages where it should not. Disable for now.
|
623 |
+
//$content = $html . $content;
|
624 |
}
|
625 |
}
|
626 |
|
includes/class.post.php
CHANGED
@@ -1003,8 +1003,8 @@ class ezTOC_Post {
|
|
1003 |
*/
|
1004 |
public function getTOC() {
|
1005 |
|
1006 |
-
$
|
1007 |
-
$html
|
1008 |
|
1009 |
if ( $this->hasTOCItems() ) {
|
1010 |
|
@@ -1012,11 +1012,11 @@ class ezTOC_Post {
|
|
1012 |
switch ( ezTOC_Option::get( 'wrapping' ) ) {
|
1013 |
|
1014 |
case 'left':
|
1015 |
-
$
|
1016 |
break;
|
1017 |
|
1018 |
case 'right':
|
1019 |
-
$
|
1020 |
break;
|
1021 |
|
1022 |
case 'none':
|
@@ -1026,25 +1026,25 @@ class ezTOC_Post {
|
|
1026 |
|
1027 |
if ( ezTOC_Option::get( 'show_hierarchy' ) ) {
|
1028 |
|
1029 |
-
$
|
1030 |
|
1031 |
} else {
|
1032 |
|
1033 |
-
$
|
1034 |
}
|
1035 |
|
1036 |
switch ( ezTOC_Option::get( 'counter' ) ) {
|
1037 |
|
1038 |
case 'numeric':
|
1039 |
-
$
|
1040 |
break;
|
1041 |
|
1042 |
case 'roman':
|
1043 |
-
$
|
1044 |
break;
|
1045 |
|
1046 |
case 'decimal':
|
1047 |
-
$
|
1048 |
break;
|
1049 |
}
|
1050 |
|
@@ -1052,44 +1052,44 @@ class ezTOC_Post {
|
|
1052 |
switch ( ezTOC_Option::get( 'theme' ) ) {
|
1053 |
|
1054 |
case 'light-blue':
|
1055 |
-
$
|
1056 |
break;
|
1057 |
|
1058 |
case 'white':
|
1059 |
-
$
|
1060 |
break;
|
1061 |
|
1062 |
case 'black':
|
1063 |
-
$
|
1064 |
break;
|
1065 |
|
1066 |
case 'transparent':
|
1067 |
-
$
|
1068 |
break;
|
1069 |
|
1070 |
case 'grey':
|
1071 |
-
$
|
1072 |
break;
|
1073 |
-
|
1074 |
-
default:
|
1075 |
-
// do nothing
|
1076 |
}
|
1077 |
|
1078 |
-
|
1079 |
|
1080 |
-
|
1081 |
-
}
|
1082 |
|
1083 |
-
|
|
|
1084 |
|
1085 |
-
|
1086 |
-
if ( ! $css_classes ) {
|
1087 |
|
1088 |
-
|
|
|
1089 |
}
|
1090 |
|
1091 |
-
|
1092 |
-
$
|
|
|
|
|
|
|
1093 |
|
1094 |
if ( ezTOC_Option::get( 'show_heading_text' ) ) {
|
1095 |
|
@@ -1278,9 +1278,10 @@ class ezTOC_Post {
|
|
1278 |
private function createTOCItemAnchor( $page, $id, $title, $count ) {
|
1279 |
|
1280 |
return sprintf(
|
1281 |
-
'<a class="ez-toc-link ez-toc-heading-' . $count . '" href="%1$s" title="%2$s"
|
1282 |
esc_url( $this->createTOCItemURL( $id, $page ) ),
|
1283 |
-
esc_attr( strip_tags( $title ) )
|
|
|
1284 |
);
|
1285 |
}
|
1286 |
|
1003 |
*/
|
1004 |
public function getTOC() {
|
1005 |
|
1006 |
+
$class = array( 'ez-toc-v' . str_replace( '.', '_', ezTOC::VERSION ) );
|
1007 |
+
$html = '';
|
1008 |
|
1009 |
if ( $this->hasTOCItems() ) {
|
1010 |
|
1012 |
switch ( ezTOC_Option::get( 'wrapping' ) ) {
|
1013 |
|
1014 |
case 'left':
|
1015 |
+
$class[] = 'ez-toc-wrap-left';
|
1016 |
break;
|
1017 |
|
1018 |
case 'right':
|
1019 |
+
$class[] = 'ez-toc-wrap-right';
|
1020 |
break;
|
1021 |
|
1022 |
case 'none':
|
1026 |
|
1027 |
if ( ezTOC_Option::get( 'show_hierarchy' ) ) {
|
1028 |
|
1029 |
+
$class[] = 'counter-hierarchy';
|
1030 |
|
1031 |
} else {
|
1032 |
|
1033 |
+
$class[] .= 'counter-flat';
|
1034 |
}
|
1035 |
|
1036 |
switch ( ezTOC_Option::get( 'counter' ) ) {
|
1037 |
|
1038 |
case 'numeric':
|
1039 |
+
$class[] .= 'counter-numeric';
|
1040 |
break;
|
1041 |
|
1042 |
case 'roman':
|
1043 |
+
$class[] = 'counter-roman';
|
1044 |
break;
|
1045 |
|
1046 |
case 'decimal':
|
1047 |
+
$class[] = 'counter-decimal';
|
1048 |
break;
|
1049 |
}
|
1050 |
|
1052 |
switch ( ezTOC_Option::get( 'theme' ) ) {
|
1053 |
|
1054 |
case 'light-blue':
|
1055 |
+
$class[] = 'ez-toc-light-blue';
|
1056 |
break;
|
1057 |
|
1058 |
case 'white':
|
1059 |
+
$class[] = 'ez-toc-white';
|
1060 |
break;
|
1061 |
|
1062 |
case 'black':
|
1063 |
+
$class[] = 'ez-toc-black';
|
1064 |
break;
|
1065 |
|
1066 |
case 'transparent':
|
1067 |
+
$class[] .= 'ez-toc-transparent';
|
1068 |
break;
|
1069 |
|
1070 |
case 'grey':
|
1071 |
+
$class[] = 'ez-toc-grey';
|
1072 |
break;
|
|
|
|
|
|
|
1073 |
}
|
1074 |
|
1075 |
+
$custom_classes = ezTOC_Option::get( 'css_container_class', '' );
|
1076 |
|
1077 |
+
if ( 0 < strlen( $custom_classes ) ) {
|
|
|
1078 |
|
1079 |
+
$custom_classes = explode( ' ', $custom_classes );
|
1080 |
+
$custom_classes = apply_filters( 'ez_toc_container_class', $custom_classes, $this );
|
1081 |
|
1082 |
+
if ( is_array( $custom_classes ) ) {
|
|
|
1083 |
|
1084 |
+
$class = array_merge( $class, $custom_classes );
|
1085 |
+
}
|
1086 |
}
|
1087 |
|
1088 |
+
$class = array_filter( $class );
|
1089 |
+
$class = array_map( 'trim', $class );
|
1090 |
+
$class = array_map( 'sanitize_html_class', $class );
|
1091 |
+
|
1092 |
+
$html .= '<div id="ez-toc-container" class="' . implode( ' ', $class ) . '">' . PHP_EOL;
|
1093 |
|
1094 |
if ( ezTOC_Option::get( 'show_heading_text' ) ) {
|
1095 |
|
1278 |
private function createTOCItemAnchor( $page, $id, $title, $count ) {
|
1279 |
|
1280 |
return sprintf(
|
1281 |
+
'<a class="ez-toc-link ez-toc-heading-' . $count . '" href="%1$s" title="%2$s">%3$s</a>',
|
1282 |
esc_url( $this->createTOCItemURL( $id, $page ) ),
|
1283 |
+
esc_attr( strip_tags( $title ) ),
|
1284 |
+
$title
|
1285 |
);
|
1286 |
}
|
1287 |
|