Easy Table of Contents - Version 2.0.31.1

Version Description

08/03/2022 * BUG: TOC not working with the SEOWP theme #230 * BUG: TOC rendering areas height is always changing in sidebar #244 * BUG: The colon is getting removed from anchor links #248 * BUG: After 2.0.27 version updates making conflict with Avada theme #229 * BUG: Need to fix Easy table of content in sidebar #232 * BUG: TOC causes problems after updating my latest post #234 * BUG: TOC showing issue with video implemented posts/pages. #236 * BUG: When using TOC with Elementor then the animation content is not showing #237

Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Easy Table of Contents
Version 2.0.31.1
Comparing to
See all releases

Code changes from version 2.0.29 to 2.0.31.1

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table of contents, toc
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.29
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -97,6 +97,28 @@ Easy Table Contents is a fork of the excellent [Table of Contents Plus](https://
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  = 2.0.29 07/19/2022 =
101
  * TWEAK: Added Oxygen pagebulider compatibility #198
102
  * TWEAK: Added toggle state class to container #129
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.31.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
97
 
98
  == Changelog ==
99
 
100
+ = 2.0.31.1 08/03/2022
101
+ * BUG: TOC not working with the SEOWP theme #230
102
+ * BUG: TOC rendering area’s height is always changing in sidebar #244
103
+ * BUG: The colon is getting removed from anchor links #248
104
+ * BUG: After 2.0.27 version updates making conflict with Avada theme #229
105
+ * BUG: Need to fix Easy table of content in sidebar #232
106
+ * BUG: TOC causes problems after updating my latest post #234
107
+ * BUG: TOC showing issue with video implemented posts/pages. #236
108
+ * BUG: When using TOC with Elementor then the animation content is not showing #237
109
+
110
+ = 2.0.31 07/29/2022
111
+ BUG: Elementor editor is not accessible after latest update. #235
112
+
113
+ = 2.0.30 07/28/2022 =
114
+ * NEW: Added Hook Before/After Widget Container #119
115
+ * NEW: Added wysiwyg button to Wordpress visual editor #140
116
+ * TWEAK: Sticky Sidebar TOC improvements #226
117
+ * TWEAK: Incorrect prefix in one function #227
118
+ * BUG: Conflicts with WP-Typography #135
119
+ * BUG: TOC does not show up in woocommerce product description #224
120
+
121
+
122
  = 2.0.29 07/19/2022 =
123
  * TWEAK: Added Oxygen pagebulider compatibility #198
124
  * TWEAK: Added toggle state class to container #129
assets/css/screen.css CHANGED
@@ -200,7 +200,7 @@ div.ez-toc-widget-container li {
200
  z-index: -1;
201
  }
202
 
203
- .ez-toc-widget-container ul.ez-toc-list li.active::before {
204
  background-color: #EDEDED;
205
  }
206
 
@@ -402,4 +402,10 @@ label.cssiconcheckbox {
402
 
403
  div#ez-toc-container.afterpara + p {
404
  display: none;
 
 
 
 
 
 
405
  }
200
  z-index: -1;
201
  }
202
 
203
+ .ez-toc-widget-container ul.ez-toc-list li.active {
204
  background-color: #EDEDED;
205
  }
206
 
402
 
403
  div#ez-toc-container.afterpara + p {
404
  display: none;
405
+ }
406
+ .ez-toc-widget-container ul li a {
407
+ padding-left: 10px;
408
+ }
409
+ .ez-toc-widget-container ul.ez-toc-list li.active {
410
+ height: auto!important;
411
  }
assets/css/screen.min.css CHANGED
@@ -1,4 +1,4 @@
1
- #ez-toc-container {background: #F9F9F9;border: 1px solid #AAAAAA;border-radius: 4px;-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);display: table;margin-bottom: 1em;padding: 10px;position: relative;width: auto;}div.ez-toc-widget-container {padding: 0;position: relative;}#ez-toc-container.ez-toc-light-blue {background: #EDF6FF;}#ez-toc-container.ez-toc-white {background: #FFFFFF;}#ez-toc-container.ez-toc-black {background: #000000;}#ez-toc-container.ez-toc-transparent {background: none transparent;}div.ez-toc-widget-container ul {display: block;}div.ez-toc-widget-container li {border: none;padding: 0;}div.ez-toc-widget-container ul.ez-toc-list {padding: 10px;}#ez-toc-container ul ul, .ez-toc div.ez-toc-widget-container ul ul {margin-left: 1.5em;}#ez-toc-container ul, #ez-toc-container li {margin: 0;padding: 0;}#ez-toc-container ul, #ez-toc-container li, #ez-toc-container ul li, div.ez-toc-widget-container, div.ez-toc-widget-container li {background: none;list-style: none none;line-height: 1.6;margin: 0;overflow: hidden;z-index: 1;}#ez-toc-container p.ez-toc-title {text-align: left;line-height: 1.45;margin: 0;padding: 0;}.ez-toc-title-container {display: table;width: 100%;}.ez-toc-title, .ez-toc-title-toggle {display: table-cell;text-align: left;vertical-align: middle;}#ez-toc-container.ez-toc-black p.ez-toc-title {color: #FFF;}#ez-toc-container div.ez-toc-title-container + ul.ez-toc-list {margin-top: 1em;}.ez-toc-wrap-left {float: left;margin-right: 10px;}.ez-toc-wrap-right {float: right;margin-left: 10px;}#ez-toc-container a {color: #444444;box-shadow: none;text-decoration: none;text-shadow: none;}#ez-toc-container a:visited {color: #9f9f9f;}#ez-toc-container a:hover {text-decoration: underline;}#ez-toc-container.ez-toc-black a {color: #FFF;}#ez-toc-container.ez-toc-black a:visited {color: #FFF;}#ez-toc-container a.ez-toc-toggle {color: #444444;}#ez-toc-container.counter-hierarchy ul, .ez-toc-widget-container.counter-hierarchy ul, #ez-toc-container.counter-flat ul, .ez-toc-widget-container.counter-flat ul {counter-reset: item;}#ez-toc-container.counter-numeric li, .ez-toc-widget-container.counter-numeric li {list-style-type: decimal;list-style-position: inside;}#ez-toc-container.counter-decimal ul.ez-toc-list li a::before, .ez-toc-widget-container.counter-decimal ul.ez-toc-list li a::before {content: counters(item, ".") ". ";display: inline-block;counter-increment: item;margin-right: .2em;}#ez-toc-container.counter-roman li a::before, .ez-toc-widget-container.counter-roman ul.ez-toc-list li a::before {content: counters(item, ".", upper-roman) ". ";counter-increment: item;}.ez-toc-widget-container ul.ez-toc-list li::before {content: ' ';position: absolute;left: 0;right: 0;height: 30px;line-height: 30px;z-index: -1;}.ez-toc-widget-container ul.ez-toc-list li.active::before {background-color: #EDEDED;}.ez-toc-widget-container li.active > a {font-weight: 900;}.ez-toc-btn {display: inline-block;padding: 6px 12px;margin-bottom: 0;font-size: 14px;font-weight: normal;line-height: 1.428571429;text-align: center;white-space: nowrap;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid transparent;border-radius: 4px;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none }.ez-toc-btn:focus {outline: thin dotted #333;outline: 5px auto -webkit-focus-ring-color;outline-offset: -2px }.ez-toc-btn:hover,.ez-toc-btn:focus {color: #333;text-decoration: none }.ez-toc-btn:active,.ez-toc-btn.active {background-image: none;outline: 0;-webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,0.125);box-shadow: inset 0 3px 5px rgba(0,0,0,0.125) }.ez-toc-btn-default {color: #333;background-color: #fff;border-color: #ccc }.ez-toc-btn-default:hover,.ez-toc-btn-default:focus,.ez-toc-btn-default:active,.ez-toc-btn-default.active {color: #333;background-color: #ebebeb;border-color: #adadad }.ez-toc-btn-default:active,.ez-toc-btn-default.active {background-image: none }.ez-toc-btn-sm,.ez-toc-btn-xs {padding: 5px 10px;font-size: 12px;line-height: 1.5;border-radius: 3px }.ez-toc-btn-xs {padding: 1px 5px }.ez-toc-btn-default {text-shadow: 0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow: inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075) }.ez-toc-btn-default:active {-webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,0.125);box-shadow: inset 0 3px 5px rgba(0,0,0,0.125) }.ez-toc-btn:active,.btn.active {background-image: none }.ez-toc-btn-default {text-shadow: 0 1px 0 #fff;background-image: -webkit-gradient(linear,left 0,left 100%,from(#fff),to(#e0e0e0));background-image: -webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image: -moz-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image: linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat: repeat-x;border-color: #dbdbdb;border-color: #ccc;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter: progid:DXImageTransform.Microsoft.gradient(enabled=false) }.ez-toc-btn-default:hover,.ez-toc-btn-default:focus {background-color: #e0e0e0;background-position: 0 -15px }.ez-toc-btn-default:active,.ez-toc-btn-default.active {background-color: #e0e0e0;border-color: #dbdbdb }.ez-toc-pull-right {float: right !important;margin-left: 10px;}.ez-toc-glyphicon {position: relative;top: 1px;display: inline-block;font-family: 'Glyphicons Halflings';-webkit-font-smoothing: antialiased;font-style: normal;font-weight: normal;line-height: 1;-moz-osx-font-smoothing: grayscale }.ez-toc-glyphicon:empty {width: 1em }.ez-toc-toggle i.ez-toc-glyphicon {font-size: 16px;margin-left: 2px;}[class*="ez-toc-icon-"] {font-family: 'ez-toc-icomoon' !important;speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}.ez-toc-icon-toggle:before {content: "\e87a";}#ez-toc-container input {position: absolute;left: -999em;}#ez-toc-container input[type="checkbox"]:checked + nav {opacity: 0;max-height: 0;border: none;display: none;}#ez-toc-container label {float: right;position: relative;left: 3px;font-size: 16px;/* background: #f9efef; */padding: 0px 4px 0px 5px;border: 1px solid #999191;border-radius: 5px;cursor: pointer;}div#ez-toc-container p.ez-toc-title {display: contents;}div#ez-toc-container {padding-right: 20px;}#ez-toc-container label {left: 10px;}.ez-toc-wrap-center {margin: 0 auto;}
2
  #ez-toc-container.counter-hyphen ul.ez-toc-list li a::before,
3
 
4
  #ez-toc-container.counter-disc li,
@@ -30,4 +30,8 @@ label.cssiconcheckbox {
30
  }
31
  div#ez-toc-container.afterpara + p {
32
  display: none;
 
 
 
 
33
  }
1
+ #ez-toc-container {background: #F9F9F9;border: 1px solid #AAAAAA;border-radius: 4px;-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);display: table;margin-bottom: 1em;padding: 10px;position: relative;width: auto;}div.ez-toc-widget-container {padding: 0;position: relative;}#ez-toc-container.ez-toc-light-blue {background: #EDF6FF;}#ez-toc-container.ez-toc-white {background: #FFFFFF;}#ez-toc-container.ez-toc-black {background: #000000;}#ez-toc-container.ez-toc-transparent {background: none transparent;}div.ez-toc-widget-container ul {display: block;}div.ez-toc-widget-container li {border: none;padding: 0;}div.ez-toc-widget-container ul.ez-toc-list {padding: 10px;}#ez-toc-container ul ul, .ez-toc div.ez-toc-widget-container ul ul {margin-left: 1.5em;}#ez-toc-container ul, #ez-toc-container li {margin: 0;padding: 0;}#ez-toc-container ul, #ez-toc-container li, #ez-toc-container ul li, div.ez-toc-widget-container, div.ez-toc-widget-container li {background: none;list-style: none none;line-height: 1.6;margin: 0;overflow: hidden;z-index: 1;}#ez-toc-container p.ez-toc-title {text-align: left;line-height: 1.45;margin: 0;padding: 0;}.ez-toc-title-container {display: table;width: 100%;}.ez-toc-title, .ez-toc-title-toggle {display: table-cell;text-align: left;vertical-align: middle;}#ez-toc-container.ez-toc-black p.ez-toc-title {color: #FFF;}#ez-toc-container div.ez-toc-title-container + ul.ez-toc-list {margin-top: 1em;}.ez-toc-wrap-left {float: left;margin-right: 10px;}.ez-toc-wrap-right {float: right;margin-left: 10px;}#ez-toc-container a {color: #444444;box-shadow: none;text-decoration: none;text-shadow: none;}#ez-toc-container a:visited {color: #9f9f9f;}#ez-toc-container a:hover {text-decoration: underline;}#ez-toc-container.ez-toc-black a {color: #FFF;}#ez-toc-container.ez-toc-black a:visited {color: #FFF;}#ez-toc-container a.ez-toc-toggle {color: #444444;}#ez-toc-container.counter-hierarchy ul, .ez-toc-widget-container.counter-hierarchy ul, #ez-toc-container.counter-flat ul, .ez-toc-widget-container.counter-flat ul {counter-reset: item;}#ez-toc-container.counter-numeric li, .ez-toc-widget-container.counter-numeric li {list-style-type: decimal;list-style-position: inside;}#ez-toc-container.counter-decimal ul.ez-toc-list li a::before, .ez-toc-widget-container.counter-decimal ul.ez-toc-list li a::before {content: counters(item, ".") ". ";display: inline-block;counter-increment: item;margin-right: .2em;}#ez-toc-container.counter-roman li a::before, .ez-toc-widget-container.counter-roman ul.ez-toc-list li a::before {content: counters(item, ".", upper-roman) ". ";counter-increment: item;}.ez-toc-widget-container ul.ez-toc-list li::before {content: ' ';position: absolute;left: 0;right: 0;height: 30px;line-height: 30px;z-index: -1;}.ez-toc-widget-container ul.ez-toc-list li.active {background-color: #EDEDED;}.ez-toc-widget-container li.active > a {font-weight: 900;}.ez-toc-btn {display: inline-block;padding: 6px 12px;margin-bottom: 0;font-size: 14px;font-weight: normal;line-height: 1.428571429;text-align: center;white-space: nowrap;vertical-align: middle;cursor: pointer;background-image: none;border: 1px solid transparent;border-radius: 4px;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none }.ez-toc-btn:focus {outline: thin dotted #333;outline: 5px auto -webkit-focus-ring-color;outline-offset: -2px }.ez-toc-btn:hover,.ez-toc-btn:focus {color: #333;text-decoration: none }.ez-toc-btn:active,.ez-toc-btn.active {background-image: none;outline: 0;-webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,0.125);box-shadow: inset 0 3px 5px rgba(0,0,0,0.125) }.ez-toc-btn-default {color: #333;background-color: #fff;border-color: #ccc }.ez-toc-btn-default:hover,.ez-toc-btn-default:focus,.ez-toc-btn-default:active,.ez-toc-btn-default.active {color: #333;background-color: #ebebeb;border-color: #adadad }.ez-toc-btn-default:active,.ez-toc-btn-default.active {background-image: none }.ez-toc-btn-sm,.ez-toc-btn-xs {padding: 5px 10px;font-size: 12px;line-height: 1.5;border-radius: 3px }.ez-toc-btn-xs {padding: 1px 5px }.ez-toc-btn-default {text-shadow: 0 -1px 0 rgba(0,0,0,0.2);-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075);box-shadow: inset 0 1px 0 rgba(255,255,255,0.15),0 1px 1px rgba(0,0,0,0.075) }.ez-toc-btn-default:active {-webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,0.125);box-shadow: inset 0 3px 5px rgba(0,0,0,0.125) }.ez-toc-btn:active,.btn.active {background-image: none }.ez-toc-btn-default {text-shadow: 0 1px 0 #fff;background-image: -webkit-gradient(linear,left 0,left 100%,from(#fff),to(#e0e0e0));background-image: -webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image: -moz-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image: linear-gradient(to bottom,#fff 0,#e0e0e0 100%);background-repeat: repeat-x;border-color: #dbdbdb;border-color: #ccc;filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe0e0e0',GradientType=0);filter: progid:DXImageTransform.Microsoft.gradient(enabled=false) }.ez-toc-btn-default:hover,.ez-toc-btn-default:focus {background-color: #e0e0e0;background-position: 0 -15px }.ez-toc-btn-default:active,.ez-toc-btn-default.active {background-color: #e0e0e0;border-color: #dbdbdb }.ez-toc-pull-right {float: right !important;margin-left: 10px;}.ez-toc-glyphicon {position: relative;top: 1px;display: inline-block;font-family: 'Glyphicons Halflings';-webkit-font-smoothing: antialiased;font-style: normal;font-weight: normal;line-height: 1;-moz-osx-font-smoothing: grayscale }.ez-toc-glyphicon:empty {width: 1em }.ez-toc-toggle i.ez-toc-glyphicon {font-size: 16px;margin-left: 2px;}[class*="ez-toc-icon-"] {font-family: 'ez-toc-icomoon' !important;speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}.ez-toc-icon-toggle:before {content: "\e87a";}#ez-toc-container input {position: absolute;left: -999em;}#ez-toc-container input[type="checkbox"]:checked + nav {opacity: 0;max-height: 0;border: none;display: none;}#ez-toc-container label {float: right;position: relative;left: 3px;font-size: 16px;/* background: #f9efef; */padding: 0px 4px 0px 5px;border: 1px solid #999191;border-radius: 5px;cursor: pointer;}div#ez-toc-container p.ez-toc-title {display: contents;}div#ez-toc-container {padding-right: 20px;}#ez-toc-container label {left: 10px;}.ez-toc-wrap-center {margin: 0 auto;}
2
  #ez-toc-container.counter-hyphen ul.ez-toc-list li a::before,
3
 
4
  #ez-toc-container.counter-disc li,
30
  }
31
  div#ez-toc-container.afterpara + p {
32
  display: none;
33
+ }
34
+ .ez-toc-widget-container ul li a{padding-left:10px}
35
+ .ez-toc-widget-container ul.ez-toc-list li.active {
36
+ height: auto!important;
37
  }
assets/js/front.js CHANGED
@@ -157,7 +157,14 @@ jQuery( function( $ ) {
157
  event.preventDefault();
158
 
159
  const main = document.querySelector("#ez-toc-container");
160
- main.classList.toggle("toc_close");
 
 
 
 
 
 
 
161
 
162
  if ( $( this ).data( 'visible' ) ) {
163
 
@@ -301,7 +308,7 @@ jQuery( function( $ ) {
301
  // jQuery(..).css(..) doesn't work, because ::before is a pseudo element and not part of the DOM
302
  // Workaround is to add it to head
303
  $( '<style id="ez-toc-active-height">' +
304
- '.ez-toc-widget-container ul.ez-toc-list li.active::before {' +
305
  // 'line-heigh:' + listElementHeight + 'px; ' +
306
  'height:' + listElementHeight + 'px;' +
307
  '} </style>' )
157
  event.preventDefault();
158
 
159
  const main = document.querySelector("#ez-toc-container");
160
+ if(main){
161
+ main.classList.toggle("toc_close");
162
+ }
163
+ else
164
+ {
165
+ const side = document.querySelector(".ez-toc-widget-container");
166
+ side.classList.toggle("toc_close");
167
+ }
168
 
169
  if ( $( this ).data( 'visible' ) ) {
170
 
308
  // jQuery(..).css(..) doesn't work, because ::before is a pseudo element and not part of the DOM
309
  // Workaround is to add it to head
310
  $( '<style id="ez-toc-active-height">' +
311
+ '.ez-toc-widget-container ul.ez-toc-list li.active {' +
312
  // 'line-heigh:' + listElementHeight + 'px; ' +
313
  'height:' + listElementHeight + 'px;' +
314
  '} </style>' )
assets/js/front.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){if("undefined"!=typeof ezTOC){function a(){if(0!==$(".ez-toc-widget-container.ez-toc-affix").length){var c=30;void 0!==ezTOC.scroll_offset&&(c=parseInt(ezTOC.scroll_offset)),$(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:c})}if($.fn.shrinkTOCWidth=function(){$(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&$(this).css("width","")},1===parseInt(ezTOC.smooth_scroll)&&$("a.ez-toc-link").on("click",function(){var c=$(this),a="",g=c.prop("hostname"),b=c.prop("pathname"),h=c.prop("search"),d=c.prop("hash");if(b.length>0&&"/"!==b.charAt(0)&&(b="/"+b),window.location.hostname===g&&window.location.pathname===b&&window.location.search===h&&""!==d){if(0===$(a='[id="'+d.replace("#","")+'"]').length&&(console.log("ezTOC scrollTarget Not Found: "+a),a=""),void 0!==ezTOC.scroll_offset)var e=-1*ezTOC.scroll_offset;else{var f=$("#wpadminbar");e=f.length>0&&f.is(":visible")?-30:0}a&&$.smoothScroll({scrollTarget:a,offset:e,beforeScroll:n,afterScroll:function(){m(),j()}})}}),void 0!==ezTOC.visibility_hide_by_default){var e=$("ul.ez-toc-list"),a=$("a.ez-toc-toggle"),f=ezTOC.visibility_hide_by_default;a.css("display","inline"),Cookies?(1==Cookies.get("ezTOC_hidetoc")?a.data("visible",!1):a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")):(a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")),f&&a.data("visible",!1),a.data("visible")||e.hide(),a.on("click",function(a){a.preventDefault();let b=document.querySelector("#ez-toc-container");b.classList.toggle("toc_close"),$(this).data("visible")?($(this).data("visible",!1),Cookies&&(f?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),e.hide("fast")):($(this).data("visible",!0),Cookies&&(f?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),e.show("fast"))})}var g,b,d,h=$("span.ez-toc-section").toArray(),i=(g=h).reduce(function(a,b){var c;return a[b.id]=$('.ez-toc-widget-container .ez-toc-list a[href="#'+$(b).attr("id")+'"]'),a},{}),k=$.map(i,function(a,b){return a}),l=(b=5,void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(b=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),(d=$("#wpadminbar")).length&&(b+=d.height()),b);function m(){var a=o(l,h);if(a){var b=i[a.id];p(b,k),q(b)}}function j(){h.length>0&&$(".ez-toc-widget-container").length&&$(window).on("load resize scroll",m)}function n(){$(window).off("load resize scroll",m)}function o(c,a){var d=$(window).scrollTop()+c+1,b=a[0],e=d-$(b).offset().top;return a.forEach(function(c){var a=d-$(c).offset().top;a>0&&a<e&&(e=a,b=c)}),b}function p(b,a){a.forEach(function(a){b!==a&&a.parent().hasClass("active")&&a.parent().removeClass("active")})}function q(g){var i,h,a,d,b,e,f,c=g.parent();c.hasClass("active")||c.addClass("active"),f=(d=(a=$(h=c)).html(),a.parent().append('<li id="ez-toc-height-test" class="active">'+d+"</li>"),b=$("#ez-toc-height-test"),e=b.height(),b.remove(),e-a.children("ul").first().height()),$("#ez-toc-active-height").remove(),$('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active::before {height:'+f+"px;} </style>").appendTo("head")}j()}ezTOC.init=function(){a()},a()}})
1
+ jQuery(function($){if("undefined"!=typeof ezTOC){function a(){if(0!==$(".ez-toc-widget-container.ez-toc-affix").length){var c=30;void 0!==ezTOC.scroll_offset&&(c=parseInt(ezTOC.scroll_offset)),$(ezTOC.affixSelector).stick_in_parent({inner_scrolling:!1,offset_top:c})}if($.fn.shrinkTOCWidth=function(){$(this).css({width:"auto",display:"table"}),/MSIE 7\./.test(navigator.userAgent)&&$(this).css("width","")},1===parseInt(ezTOC.smooth_scroll)&&$("a.ez-toc-link").on("click",function(){var c=$(this),a="",g=c.prop("hostname"),b=c.prop("pathname"),h=c.prop("search"),d=c.prop("hash");if(b.length>0&&"/"!==b.charAt(0)&&(b="/"+b),window.location.hostname===g&&window.location.pathname===b&&window.location.search===h&&""!==d){if(0===$(a='[id="'+d.replace("#","")+'"]').length&&(console.log("ezTOC scrollTarget Not Found: "+a),a=""),void 0!==ezTOC.scroll_offset)var e=-1*ezTOC.scroll_offset;else{var f=$("#wpadminbar");e=f.length>0&&f.is(":visible")?-30:0}a&&$.smoothScroll({scrollTarget:a,offset:e,beforeScroll:n,afterScroll:function(){m(),j()}})}}),void 0!==ezTOC.visibility_hide_by_default){var e=$("ul.ez-toc-list"),a=$("a.ez-toc-toggle"),f=ezTOC.visibility_hide_by_default;a.css("display","inline"),Cookies?(1==Cookies.get("ezTOC_hidetoc")?a.data("visible",!1):a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")):(a.data("visible",!0),Cookies.remove("ezTOC_hidetoc")),f&&a.data("visible",!1),a.data("visible")||e.hide(),a.on("click",function(b){b.preventDefault();let a=document.querySelector("#ez-toc-container");if(a)a.classList.toggle("toc_close");else{let c=document.querySelector(".ez-toc-widget-container");c.classList.toggle("toc_close")}$(this).data("visible")?($(this).data("visible",!1),Cookies&&(f?Cookies.set("ezTOC_hidetoc",null,{path:"/"}):Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"})),e.hide("fast")):($(this).data("visible",!0),Cookies&&(f?Cookies.set("ezTOC_hidetoc","1",{expires:30,path:"/"}):Cookies.set("ezTOC_hidetoc",null,{path:"/"})),e.show("fast"))})}var g,b,d,h=$("span.ez-toc-section").toArray(),i=(g=h).reduce(function(a,b){var c;return a[b.id]=$('.ez-toc-widget-container .ez-toc-list a[href="#'+$(b).attr("id")+'"]'),a},{}),k=$.map(i,function(a,b){return a}),l=(b=5,void 0!==ezTOC.smooth_scroll&&1===parseInt(ezTOC.smooth_scroll)&&(b=void 0!==ezTOC.scroll_offset?parseInt(ezTOC.scroll_offset):30),(d=$("#wpadminbar")).length&&(b+=d.height()),b);function m(){var a=o(l,h);if(a){var b=i[a.id];p(b,k),q(b)}}function j(){h.length>0&&$(".ez-toc-widget-container").length&&$(window).on("load resize scroll",m)}function n(){$(window).off("load resize scroll",m)}function o(c,a){var d=$(window).scrollTop()+c+1,b=a[0],e=d-$(b).offset().top;return a.forEach(function(c){var a=d-$(c).offset().top;a>0&&a<e&&(e=a,b=c)}),b}function p(b,a){a.forEach(function(a){b!==a&&a.parent().hasClass("active")&&a.parent().removeClass("active")})}function q(g){var i,h,a,d,b,e,f,c=g.parent();c.hasClass("active")||c.addClass("active"),f=(d=(a=$(h=c)).html(),a.parent().append('<li id="ez-toc-height-test" class="active">'+d+"</li>"),b=$("#ez-toc-height-test"),e=b.height(),b.remove(),e-a.children("ul").first().height()),$("#ez-toc-active-height").remove(),$('<style id="ez-toc-active-height">.ez-toc-widget-container ul.ez-toc-list li.active {height:'+f+"px;} </style>").appendTo("head")}j()}ezTOC.init=function(){a()},a()}})
assets/js/toc-mce-button.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ tinymce.PluginManager.add('toc_mce_button', function( editor, url ) {
3
+ editor.addButton('toc_mce_button', {
4
+ text: 'TOC',
5
+ icon: false,
6
+ onclick: function() {
7
+ // change the shortcode as per your requirement
8
+ editor.insertContent('[ez-toc]');
9
+ }
10
+ });
11
+ });
12
+ })();
easy-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://magazine3.company/
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.29
7
  * Author: Magazine3
8
  * Author URI: https://magazine3.company/
9
  * Text Domain: easy-table-of-contents
@@ -26,7 +26,7 @@
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
- * @version 2.0.29
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
@@ -48,7 +48,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
48
  * @since 1.0
49
  * @var string
50
  */
51
- const VERSION = '2.0.29';
52
 
53
  /**
54
  * Stores the instance of this class.
@@ -152,7 +152,7 @@ if ( ! class_exists( 'ezTOC' ) ) {
152
 
153
  //add_action( 'plugins_loaded', array( __CLASS__, 'loadTextdomain' ) );
154
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueueScripts' ) );
155
-
156
  // Run after shortcodes are interpreted (priority 10).
157
  add_filter( 'the_content', array( __CLASS__, 'the_content' ), 100 );
158
  add_shortcode( 'ez-toc', array( __CLASS__, 'shortcode' ) );
@@ -732,6 +732,60 @@ if ( ! class_exists( 'ezTOC' ) ) {
732
 
733
  return Debug::log()->appendTo( $content );
734
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
735
 
736
  }
737
 
3
  * Plugin Name: Easy Table of Contents
4
  * Plugin URI: https://magazine3.company/
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.31.1
7
  * Author: Magazine3
8
  * Author URI: https://magazine3.company/
9
  * Text Domain: easy-table-of-contents
26
  * @package Easy Table of Contents
27
  * @category Plugin
28
  * @author Magazine3
29
+ * @version 2.0.31.1
30
  */
31
 
32
  use Easy_Plugins\Table_Of_Contents\Debug;
48
  * @since 1.0
49
  * @var string
50
  */
51
+ const VERSION = '2.0.31.1';
52
 
53
  /**
54
  * Stores the instance of this class.
152
 
153
  //add_action( 'plugins_loaded', array( __CLASS__, 'loadTextdomain' ) );
154
  add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueueScripts' ) );
155
+ add_action('admin_head', array( __CLASS__, 'addEditorButton' ));
156
  // Run after shortcodes are interpreted (priority 10).
157
  add_filter( 'the_content', array( __CLASS__, 'the_content' ), 100 );
158
  add_shortcode( 'ez-toc', array( __CLASS__, 'shortcode' ) );
732
 
733
  return Debug::log()->appendTo( $content );
734
  }
735
+
736
+ /**
737
+ * Call back for the `wp_head` action.
738
+ *
739
+ * Add add button for shortcode in wysisyg editor .
740
+ *
741
+ * @access private
742
+ * @since 1.0
743
+ * @static
744
+ */
745
+ public static function addEditorButton() {
746
+
747
+ if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
748
+ return;
749
+ }
750
+
751
+
752
+ if ( 'true' == get_user_option( 'rich_editing' ) ) {
753
+ add_filter( 'mce_external_plugins', array( __CLASS__, 'toc_add_tinymce_plugin'));
754
+ add_filter( 'mce_buttons', array( __CLASS__, 'toc_register_mce_button' ));
755
+ }
756
+
757
+ }
758
+
759
+ /**
760
+ * Call back for the `mce_external_plugins` action.
761
+ *
762
+ * Register new button in the editor.
763
+ *
764
+ * @access private
765
+ * @since 1.0
766
+ * @static
767
+ */
768
+
769
+ public static function toc_register_mce_button( $buttons ) {
770
+
771
+ array_push( $buttons, 'toc_mce_button' );
772
+ return $buttons;
773
+ }
774
+
775
+ /**
776
+ * Call back for the `mce_buttons` action.
777
+ *
778
+ * Add js to insert the shortcode on the click event.
779
+ *
780
+ * @access private
781
+ * @since 1.0
782
+ * @static
783
+ */
784
+ public static function toc_add_tinymce_plugin( $plugin_array ) {
785
+
786
+ $plugin_array['toc_mce_button'] = EZ_TOC_URL .'assets/js/toc-mce-button.js';
787
+ return $plugin_array;
788
+ }
789
 
790
  }
791
 
includes/class.options.php CHANGED
@@ -611,6 +611,20 @@ if ( ! class_exists( 'ezTOC_Option' ) ) {
611
  'type' => 'checkbox',
612
  'default' => false,
613
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  )
615
  ),
616
  );
611
  'type' => 'checkbox',
612
  'default' => false,
613
  ),
614
+ 'highlightheadings' => array(
615
+ 'id' => 'highlightheadings',
616
+ 'name' => __( 'Highlight TOC Headings ', 'easy-table-of-contents' ),
617
+ 'desc' => __( 'Highlight TOC headings while scrolling ', 'easy-table-of-contents' ),
618
+ 'type' => 'checkbox',
619
+ 'default' => false,
620
+ ),
621
+ 'shrinkthewidth' => array(
622
+ 'id' => 'shrinkthewidth',
623
+ 'name' => __( 'Shrink the width', 'easy-table-of-contents' ),
624
+ 'desc' => __( 'Shrink the width to the size of the title' ),
625
+ 'type' => 'checkbox',
626
+ 'default' => false,
627
+ ),
628
  )
629
  ),
630
  );
includes/class.post.php CHANGED
@@ -136,7 +136,7 @@ class ezTOC_Post {
136
 
137
  $this->post->post_content = apply_filters( 'the_content', strip_shortcodes( $this->post->post_content ) );
138
 
139
- add_filter( 'the_content', array( 'ezTOC', 'the_content' ), 100 );
140
 
141
  remove_filter( 'strip_shortcodes_tagnames', array( __CLASS__, 'stripShortcodes' ) );
142
 
@@ -802,7 +802,8 @@ class ezTOC_Post {
802
  // title needs to be converted to HTML entities.
803
  // @link https://stackoverflow.com/a/21801444/5351316
804
  $return = htmlentities2( $return );
805
- $return = str_replace( array( '&amp;', '&nbsp;' ), ' ', $return );
 
806
  $return = html_entity_decode( $return, ENT_QUOTES, get_option( 'blog_charset' ) );
807
 
808
  // remove non alphanumeric chars
@@ -1038,9 +1039,6 @@ class ezTOC_Post {
1038
  foreach ( $matches as $i => $match ) {
1039
 
1040
  $anchor = $matches[ $i ]['id'];
1041
- if (ezTOC_Option::get( 'remove_special_chars_from_title' )) {
1042
- $matches[ $i ][0] = str_replace(':', '', $matches[ $i ][0]);
1043
- }
1044
 
1045
  $headings[] = str_replace(
1046
  array(
@@ -1195,7 +1193,6 @@ class ezTOC_Post {
1195
  $class = array_filter( $class );
1196
  $class = array_map( 'trim', $class );
1197
  $class = array_map( 'sanitize_html_class', $class );
1198
-
1199
  $html .= '<div id="ez-toc-container" class="' . implode( ' ', $class ) . '">' . PHP_EOL;
1200
 
1201
  if ( ezTOC_Option::get( 'show_heading_text' ) ) {
@@ -1224,7 +1221,11 @@ class ezTOC_Post {
1224
 
1225
  if ( ezTOC_Option::get( 'visibility' ) ) {
1226
  if (ezTOC_Option::get( 'toc_loading' ) != 'css') {
1227
- $html .= '<a href="#" class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" style="display: none;"><label for="item" aria-label="'.__( 'Table of Content', 'easy-table-of-contents' ).'"><i class="ez-toc-glyphicon ez-toc-icon-toggle"></i></label><input type="checkbox" id="item"></a>';
 
 
 
 
1228
  }else{
1229
  $toggle_view='';
1230
  if(ezTOC_Option::get('visibility_hide_by_default')==true){
136
 
137
  $this->post->post_content = apply_filters( 'the_content', strip_shortcodes( $this->post->post_content ) );
138
 
139
+ add_filter( 'the_content', array( 'ezTOC', 'the_content' ), 100 ); // increased priority to fix other plugin filter overwriting our changes
140
 
141
  remove_filter( 'strip_shortcodes_tagnames', array( __CLASS__, 'stripShortcodes' ) );
142
 
802
  // title needs to be converted to HTML entities.
803
  // @link https://stackoverflow.com/a/21801444/5351316
804
  $return = htmlentities2( $return );
805
+ $return = str_replace( array( '&amp;', '&nbsp;'), ' ', $return );
806
+ $return = str_replace( array( '&shy;' ),'', $return ); // removed silent hypen
807
  $return = html_entity_decode( $return, ENT_QUOTES, get_option( 'blog_charset' ) );
808
 
809
  // remove non alphanumeric chars
1039
  foreach ( $matches as $i => $match ) {
1040
 
1041
  $anchor = $matches[ $i ]['id'];
 
 
 
1042
 
1043
  $headings[] = str_replace(
1044
  array(
1193
  $class = array_filter( $class );
1194
  $class = array_map( 'trim', $class );
1195
  $class = array_map( 'sanitize_html_class', $class );
 
1196
  $html .= '<div id="ez-toc-container" class="' . implode( ' ', $class ) . '">' . PHP_EOL;
1197
 
1198
  if ( ezTOC_Option::get( 'show_heading_text' ) ) {
1221
 
1222
  if ( ezTOC_Option::get( 'visibility' ) ) {
1223
  if (ezTOC_Option::get( 'toc_loading' ) != 'css') {
1224
+ $icon = '<i class="ez-toc-glyphicon ez-toc-icon-toggle"></i>';
1225
+ if(function_exists('ez_toc_pro_activation_link')){
1226
+ $icon = apply_filters('ez_toc_modify_icon',$icon);
1227
+ }
1228
+ $html .= '<a href="#" class="ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle" style="display: none;"><label for="item" aria-label="'.__( 'Table of Content', 'easy-table-of-contents' ).'">'.$icon.'</label><input type="checkbox" id="item"></a>';
1229
  }else{
1230
  $toggle_view='';
1231
  if(ezTOC_Option::get('visibility_hide_by_default')==true){
includes/class.widget-toc.php CHANGED
@@ -235,7 +235,8 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
235
  $class = array_map( 'trim', $class );
236
  $class = array_map( 'sanitize_html_class', $class );
237
 
238
- echo $before_widget;
 
239
 
240
  echo '<div class="ez-toc-widget-container ' . implode( ' ', $class ) . '">' . PHP_EOL;
241
 
@@ -258,7 +259,7 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
258
  <span class="ez-toc-title-container">
259
 
260
  <style type="text/css">
261
- #<?php echo $this->id ?> .ez-toc-widget-container ul.ez-toc-list li.active::before {
262
  background-color: <?php echo esc_attr( $instance['highlight_color'] ); ?>;
263
  }
264
  </style>
@@ -288,6 +289,7 @@ if ( ! class_exists( 'ezTOC_Widget' ) ) {
288
  do_action( 'ez_toc_after_widget' );
289
 
290
  echo '</div>' . PHP_EOL;
 
291
 
292
  echo $after_widget;
293
 
235
  $class = array_map( 'trim', $class );
236
  $class = array_map( 'sanitize_html_class', $class );
237
 
238
+ echo $before_widget;
239
+ do_action( 'ez_toc_before_widget_container');
240
 
241
  echo '<div class="ez-toc-widget-container ' . implode( ' ', $class ) . '">' . PHP_EOL;
242
 
259
  <span class="ez-toc-title-container">
260
 
261
  <style type="text/css">
262
+ #<?php echo $this->id ?> .ez-toc-widget-container ul.ez-toc-list li.active{
263
  background-color: <?php echo esc_attr( $instance['highlight_color'] ); ?>;
264
  }
265
  </style>
289
  do_action( 'ez_toc_after_widget' );
290
 
291
  echo '</div>' . PHP_EOL;
292
+ do_action( 'ez_toc_after_widget_container' );
293
 
294
  echo $after_widget;
295
 
includes/helper-function.php CHANGED
@@ -1,121 +1,121 @@
1
- <?php
2
-
3
- /**
4
- * Helper Functions
5
- *
6
- * @package saswp
7
- * @subpackage Helper/Templates
8
- * @copyright Copyright (c) 2016, René Hermenau
9
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
- * @since 1.4.0
11
- */
12
- // Exit if accessed directly
13
- if( !defined( 'ABSPATH' ) )
14
- exit;
15
-
16
- /**
17
- * Helper method to check if user is in the plugins page.
18
- *
19
- * @author René Hermenau
20
- * @since 1.4.0
21
- *
22
- * @return bool
23
- */
24
-
25
- /**
26
- * display deactivation logic on plugins page
27
- *
28
- * @since 1.4.0
29
- */
30
-
31
- add_filter('admin_footer', 'eztoc_add_deactivation_feedback_modal');
32
- function eztoc_add_deactivation_feedback_modal() {
33
-
34
- if( !is_admin()) {
35
- return;
36
- }
37
-
38
- $current_user = wp_get_current_user();
39
- if( !($current_user instanceof WP_User) ) {
40
- $email = '';
41
- } else {
42
- $email = trim( $current_user->user_email );
43
- }
44
- require_once EZ_TOC_PATH ."/includes/deactivate-feedback.php";
45
- }
46
-
47
- /**
48
- * send feedback via email
49
- *
50
- * @since 1.4.0
51
- */
52
- function eztoc_send_feedback() {
53
-
54
- if( isset( $_POST['data'] ) ) {
55
- parse_str( $_POST['data'], $form );
56
- }
57
-
58
- $text = '';
59
- if( isset( $form['eztoc_disable_text'] ) ) {
60
- $text = implode( "\n\r", $form['eztoc_disable_text'] );
61
- }
62
-
63
- $headers = array();
64
-
65
- $from = isset( $form['eztoc_disable_from'] ) ? $form['eztoc_disable_from'] : '';
66
- if( $from ) {
67
- $headers[] = "From: $from";
68
- $headers[] = "Reply-To: $from";
69
- }
70
-
71
- $subject = isset( $form['eztoc_disable_reason'] ) ? $form['eztoc_disable_reason'] : '(no reason given)';
72
-
73
- if($subject == 'technical issue'){
74
-
75
- $text = trim($text);
76
-
77
- if(!empty($text)){
78
-
79
- $text = 'technical issue description: '.$text;
80
-
81
- }else{
82
-
83
- $text = 'no description: '.$text;
84
- }
85
-
86
- }
87
-
88
- $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
89
-
90
- die();
91
- }
92
- add_action( 'wp_ajax_eztoc_send_feedback', 'eztoc_send_feedback' );
93
-
94
- function cwv_enqueue_makebetter_email_js(){
95
-
96
- if( !is_admin() ) {
97
- return;
98
- }
99
-
100
- wp_enqueue_script( 'cwv-make-better-js', EZ_TOC_URL . 'includes/feedback.js', array( 'jquery' ));
101
-
102
- wp_enqueue_style( 'cwv-make-better-css', EZ_TOC_URL . 'includes/feedback.css', false );
103
- }
104
- add_action( 'admin_enqueue_scripts', 'cwv_enqueue_makebetter_email_js' );
105
-
106
-
107
- add_action('wp_ajax_eztoc_subscribe_newsletter','eztoc_subscribe_for_newsletter');
108
- add_action('wp_ajax_nopriv_eztoc_subscribe_newsletter','eztoc_subscribe_for_newsletter');
109
- function eztoc_subscribe_for_newsletter(){
110
- $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
111
- $api_params = array(
112
- 'name' => sanitize_text_field($_POST['name']),
113
- 'email'=> sanitize_text_field($_POST['email']),
114
- 'website'=> sanitize_text_field($_POST['website']),
115
- 'type'=> 'eztoc'
116
- );
117
- $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
118
- $response = wp_remote_retrieve_body( $response );
119
- echo $response;
120
- die;
121
  }
1
+ <?php
2
+
3
+ /**
4
+ * Helper Functions
5
+ *
6
+ * @package saswp
7
+ * @subpackage Helper/Templates
8
+ * @copyright Copyright (c) 2016, René Hermenau
9
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
+ * @since 1.4.0
11
+ */
12
+ // Exit if accessed directly
13
+ if( !defined( 'ABSPATH' ) )
14
+ exit;
15
+
16
+ /**
17
+ * Helper method to check if user is in the plugins page.
18
+ *
19
+ * @author René Hermenau
20
+ * @since 1.4.0
21
+ *
22
+ * @return bool
23
+ */
24
+
25
+ /**
26
+ * display deactivation logic on plugins page
27
+ *
28
+ * @since 1.4.0
29
+ */
30
+
31
+ add_filter('admin_footer', 'eztoc_add_deactivation_feedback_modal');
32
+ function eztoc_add_deactivation_feedback_modal() {
33
+
34
+ if( !is_admin()) {
35
+ return;
36
+ }
37
+
38
+ $current_user = wp_get_current_user();
39
+ if( !($current_user instanceof WP_User) ) {
40
+ $email = '';
41
+ } else {
42
+ $email = trim( $current_user->user_email );
43
+ }
44
+ require_once EZ_TOC_PATH ."/includes/deactivate-feedback.php";
45
+ }
46
+
47
+ /**
48
+ * send feedback via email
49
+ *
50
+ * @since 1.4.0
51
+ */
52
+ function eztoc_send_feedback() {
53
+
54
+ if( isset( $_POST['data'] ) ) {
55
+ parse_str( $_POST['data'], $form );
56
+ }
57
+
58
+ $text = '';
59
+ if( isset( $form['eztoc_disable_text'] ) ) {
60
+ $text = implode( "\n\r", $form['eztoc_disable_text'] );
61
+ }
62
+
63
+ $headers = array();
64
+
65
+ $from = isset( $form['eztoc_disable_from'] ) ? $form['eztoc_disable_from'] : '';
66
+ if( $from ) {
67
+ $headers[] = "From: $from";
68
+ $headers[] = "Reply-To: $from";
69
+ }
70
+
71
+ $subject = isset( $form['eztoc_disable_reason'] ) ? $form['eztoc_disable_reason'] : '(no reason given)';
72
+
73
+ if($subject == 'technical issue'){
74
+
75
+ $text = trim($text);
76
+
77
+ if(!empty($text)){
78
+
79
+ $text = 'technical issue description: '.$text;
80
+
81
+ }else{
82
+
83
+ $text = 'no description: '.$text;
84
+ }
85
+
86
+ }
87
+
88
+ $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
89
+
90
+ die();
91
+ }
92
+ add_action( 'wp_ajax_eztoc_send_feedback', 'eztoc_send_feedback' );
93
+
94
+ function eztoc_enqueue_makebetter_email_js(){
95
+
96
+ if( !is_admin() ) {
97
+ return;
98
+ }
99
+
100
+ wp_enqueue_script( 'eztoc-make-better-js', EZ_TOC_URL . 'includes/feedback.js', array( 'jquery' ));
101
+
102
+ wp_enqueue_style( 'eztoc-make-better-css', EZ_TOC_URL . 'includes/feedback.css', false );
103
+ }
104
+ add_action( 'admin_enqueue_scripts', 'eztoc_enqueue_makebetter_email_js' );
105
+
106
+
107
+ add_action('wp_ajax_eztoc_subscribe_newsletter','eztoc_subscribe_for_newsletter');
108
+ add_action('wp_ajax_nopriv_eztoc_subscribe_newsletter','eztoc_subscribe_for_newsletter');
109
+ function eztoc_subscribe_for_newsletter(){
110
+ $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
111
+ $api_params = array(
112
+ 'name' => sanitize_text_field($_POST['name']),
113
+ 'email'=> sanitize_text_field($_POST['email']),
114
+ 'website'=> sanitize_text_field($_POST['website']),
115
+ 'type'=> 'eztoc'
116
+ );
117
+ $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
118
+ $response = wp_remote_retrieve_body( $response );
119
+ echo $response;
120
+ die;
121
  }
includes/inc.plugin-compatibility.php CHANGED
@@ -1,564 +1,563 @@
1
- <?php
2
- /**
3
- * Filter to add plugins to the TOC list.
4
- *
5
- * @link https://rankmath.com/kb/filters-hooks-api-developer/#add-toc-plugin
6
- *
7
- * @since 2.0
8
- *
9
- * @param array TOC plugins.
10
- */
11
- add_filter(
12
- 'rank_math/researches/toc_plugins',
13
- function( $toc_plugins ) {
14
-
15
- $toc_plugins[ EZ_TOC_BASE_NAME ] = 'Easy Table of Contents';
16
-
17
- return $toc_plugins;
18
- }
19
- );
20
-
21
- /**
22
- * Filter to remove Connections Business Directory related shortcodes from being processed as eligible TOC items.
23
- *
24
- * @since 2.0
25
- */
26
- add_filter(
27
- 'ez_toc_strip_shortcodes_tagnames',
28
- function( $tags_to_remove ) {
29
-
30
- $shortcodes = array (
31
- 'connections_form',
32
- 'cn_multi_category_search',
33
- 'cn_widget',
34
- 'cn_carousel',
35
- 'connections_categories',
36
- 'connections_link_view',
37
- 'connections_link_edit',
38
- 'connections_login',
39
- 'siteshot',
40
- 'connections',
41
- 'upcoming_list',
42
- 'cn-mapblock',
43
- 'connections_vcard',
44
- 'connections_qtip',
45
- 'cn_thumb',
46
- 'cn_thumbr',
47
- );
48
-
49
- $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
50
-
51
- return $tags_to_remove;
52
- }
53
- );
54
-
55
-
56
- /**
57
- * Filter to remove Striking theme related shortcodes from being processed as eligible TOC items.
58
- *
59
- * @since 2.0
60
- */
61
- add_filter(
62
- 'ez_toc_strip_shortcodes_tagnames',
63
- function( $tags_to_remove ) {
64
-
65
- $shortcodes = array (
66
- 'iconbox',
67
- 'toggle',
68
- );
69
-
70
- $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
71
-
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
- $selectors['jetpack-relatedposts'] = '.jp-relatedposts';
87
-
88
- return $selectors;
89
- }
90
- );
91
-
92
- /**
93
- * Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
94
- *
95
- * @since 2.0
96
- */
97
- add_filter(
98
- 'ez_toc_exclude_by_selector',
99
- function( $selectors ) {
100
-
101
- $selectors['elegant-themes-bloom'] = '.et_bloom_below_post';
102
-
103
- return $selectors;
104
- }
105
- );
106
-
107
- /**
108
- * Do not allow `the_content` TOC callback to run when editing a page in Visual Composer.
109
- *
110
- * @link https://wordpress.org/support/topic/correct-method-to-determine-if-using-frontend-editor/#post-12404679
111
- *
112
- * @since 2.0
113
- */
114
- add_filter(
115
- 'ez_toc_maybe_apply_the_content_filter',
116
- function( $apply ) {
117
-
118
- if ( function_exists( 'vchelper' ) ) {
119
-
120
- //$sourceId = intval( vchelper( "Request" )->input( 'vcv-source-id' ) );
121
- //
122
- //if ( $sourceId === get_the_ID() ) {
123
- //
124
- // $apply = false;
125
- //}
126
-
127
- if ( vchelper( 'Frontend' )->isPageEditable() ) {
128
-
129
- $apply = false;
130
- }
131
- }
132
-
133
- return $apply;
134
- }
135
- );
136
-
137
- /**
138
- * Do not allow `the_content` TOC callback to run when editing a page in WPBakery Page Builder.
139
- *
140
- * @link https://wordpress.org/support/topic/correct-method-to-determine-if-using-frontend-editor/#post-12404679
141
- *
142
- * @since 2.0
143
- */
144
- add_filter(
145
- 'ez_toc_maybe_apply_the_content_filter',
146
- function( $apply ) {
147
-
148
- if ( function_exists( 'vc_is_page_editable' ) ) {
149
-
150
- if ( vc_is_page_editable() ) {
151
-
152
- $apply = false;
153
- }
154
- }
155
-
156
- return $apply;
157
- }
158
- );
159
-
160
- /**
161
- * Filter to remove WPBakery Page Builder related shortcodes from being processed as eligible TOC items.
162
- *
163
- * @since 2.0
164
- */
165
- add_filter(
166
- 'ez_toc_strip_shortcodes_tagnames',
167
- function( $tags_to_remove ) {
168
-
169
- $shortcodes = array (
170
- 'vc_tta_section',
171
- );
172
-
173
- $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
174
-
175
- return $tags_to_remove;
176
- }
177
- );
178
-
179
- /**
180
- * Exclude the TOC shortcodes from being processed in the admin in the Divi Theme by Elegant Themes.
181
- *
182
- * @since 2.0
183
- */
184
- add_action(
185
- 'et_pb_admin_excluded_shortcodes',
186
- function( $shortcodes ) {
187
-
188
- $shortcodes[] = 'ez-toc';
189
- $shortcodes[] = apply_filters( 'ez_toc_shortcode', 'toc' );
190
-
191
- return $shortcodes;
192
- }
193
- );
194
-
195
- /**
196
- * Disabled for now as it does not appear to be required.
197
- *
198
- * Do not allow `the_content` TOC callback to run when rendering a Divi layout.
199
- *
200
- * @since 2.0
201
- */
202
- //add_filter(
203
- // 'ez_toc_maybe_apply_the_content_filter',
204
- // function( $apply ) {
205
- //
206
- // global $wp_current_filter;
207
- //
208
- // // Do not execute if root current filter is one of those in the array.
209
- // if ( in_array( $wp_current_filter[0], array( 'et_builder_render_layout' ), true ) ) {
210
- //
211
- // $apply = false;
212
- // }
213
- //
214
- // return $apply;
215
- // }
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.
223
- *
224
- * NOTE: Set priority 12 to run after Divi runs the `do_shortcode` filter on its layout content.
225
- *
226
- * @link https://wordpress.org/support/topic/anchor-links-not-being-added-with-divi/
227
- *
228
- * @since 2.0
229
- */
230
- add_filter(
231
- 'et_builder_render_layout',
232
- array( 'ezTOC', 'the_content' ),
233
- 12,
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/
302
- * @since 2.0
303
- */
304
- add_filter(
305
- 'ez_toc_exclude_by_selector',
306
- function( $selectors ) {
307
-
308
- $selectors['starbox'] = '.abh_box';
309
-
310
- return $selectors;
311
- }
312
- );
313
-
314
- /**
315
- * Remove the WordPress Related Posts plugin node from the post content before extracting headings.
316
- * @link
317
- * @since 2.0
318
- */
319
- add_filter(
320
- 'ez_toc_exclude_by_selector',
321
- function( $selectors ) {
322
-
323
- $selectors['wordpress-23-related-posts-plugin'] = '.wp_rp_content';
324
-
325
- return $selectors;
326
- }
327
- );
328
-
329
- /**
330
- * Remove the Atomic Blocks plugin node from the post content before extracting headings.
331
- * @link
332
- * @since 2.0
333
- */
334
- add_filter(
335
- 'ez_toc_exclude_by_selector',
336
- function( $selectors ) {
337
-
338
- $selectors['atomic-blocks-cta'] = '.ab-block-cta';
339
- $selectors['atomic-blocks-testimonial'] = '.ab-block-testimonial';
340
-
341
- return $selectors;
342
- }
343
- );
344
-
345
- /**
346
- * Remove the Ultimate Addons for VC Composer node from the post content before extracting headings.
347
- * @link
348
- * @since 2.0
349
- */
350
- add_filter(
351
- 'ez_toc_exclude_by_selector',
352
- function( $selectors ) {
353
-
354
- $selectors['ultimate-addons-for-vc-composer'] = '.ult_tabs';
355
-
356
- return $selectors;
357
- }
358
- );
359
-
360
- /**
361
- * Remove the WP Product Review node from the post content before extracting headings.
362
- * @link
363
- * @since 2.0
364
- */
365
- add_filter(
366
- 'ez_toc_exclude_by_selector',
367
- function( $selectors ) {
368
-
369
- $selectors['wp-product-review'] = '.wppr-review-container';
370
-
371
- return $selectors;
372
- }
373
- );
374
-
375
- /**
376
- * Remove the Create by Mediavine node from the post content before extracting headings.
377
- *
378
- * @link https://wordpress.org/plugins/mediavine-create/
379
- * @since 2.0.8
380
- */
381
- add_filter(
382
- 'ez_toc_exclude_by_selector',
383
- function( $selectors ) {
384
-
385
- $selectors['mediavine-create'] = '.mv-create-card';
386
-
387
- return $selectors;
388
- }
389
- );
390
-
391
- /**
392
- * Remove the Contextual Related Posts node from the post content before extracting headings.
393
- *
394
- * @link https://wordpress.org/plugins/contextual-related-posts/
395
- * @since 2.0.9
396
- */
397
- add_filter(
398
- 'ez_toc_exclude_by_selector',
399
- function( $selectors ) {
400
-
401
- $selectors['contextual-related-posts'] = '.crp_related';
402
-
403
- return $selectors;
404
- }
405
- );
406
-
407
- class ezTOC_Elementor {
408
-
409
- /**
410
- * Whether the excerpt is being called.
411
- *
412
- * Used to determine whether the call to `the_content()` came from `get_the_excerpt()`.
413
- *
414
- * @since 2.0.2
415
- *
416
- * @var bool Whether the excerpt is being used. Default is false.
417
- */
418
- private $_is_excerpt = false;
419
-
420
- /**
421
- * ezTOC_Elementor constructor.
422
- *
423
- * @since 2.0.2
424
- */
425
- public function __construct() {
426
-
427
- //add_filter( 'elementor/frontend/the_content', array( 'ezTOC', 'the_content' ), 100 );
428
-
429
- // Hack to avoid enqueue post CSS while it's a `the_excerpt` call.
430
- add_filter( 'get_the_excerpt', array( $this, 'start_excerpt_flag' ), 1 );
431
- add_filter( 'get_the_excerpt', array( $this, 'end_excerpt_flag' ), 20 );
432
- add_filter( 'ez_toc_maybe_apply_the_content_filter', array( $this, 'maybe_apply_the_content_filter' ) );
433
-
434
- add_filter(
435
- 'ez_toc_strip_shortcodes_tagnames',
436
- function( $tags_to_remove ) {
437
-
438
- $shortcodes = array (
439
- 'elementor-template',
440
- );
441
-
442
- $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
443
-
444
- return $tags_to_remove;
445
- }
446
- );
447
- }
448
-
449
- /**
450
- * Callback for the `elementor/init` action.
451
- *
452
- * Add the compatibility filters for Elementor.
453
- *
454
- * @since 2.0.2
455
- */
456
- public static function start() {
457
-
458
- new self();
459
- }
460
-
461
- /**
462
- * Callback for the `get_the_excerpt` filter.
463
- *
464
- * Start excerpt flag.
465
- *
466
- * Flags when `the_excerpt` is called. Used to avoid enqueueing CSS in the excerpt.
467
- *
468
- * @since 2.0.2
469
- *
470
- * @param string $excerpt The post excerpt.
471
- *
472
- * @return string The post excerpt.
473
- */
474
- public function start_excerpt_flag( $excerpt ) {
475
- $this->_is_excerpt = true;
476
- return $excerpt;
477
- }
478
-
479
- /**
480
- * Callback for the `get_the_excerpt` filter.
481
- *
482
- * End excerpt flag.
483
- *
484
- * Flags when `the_excerpt` call ended.
485
- *
486
- * @since 2.0.2
487
- *
488
- * @param string $excerpt The post excerpt.
489
- *
490
- * @return string The post excerpt.
491
- */
492
- public function end_excerpt_flag( $excerpt ) {
493
- $this->_is_excerpt = false;
494
- return $excerpt;
495
- }
496
-
497
- /**
498
- * Callback for the `ez_toc_maybe_apply_the_content_filter` filter.
499
- *
500
- * If doing Elementor excerpt, which calls `the_content` filter, do not apply the ezTOC `the_content` filter.
501
- *
502
- * @since 2.0.2
503
- *
504
- * @param bool $apply
505
- *
506
- * @return bool mixed
507
- */
508
- public function maybe_apply_the_content_filter( $apply ) {
509
-
510
- if ( $this->_is_excerpt ) {
511
-
512
- $apply = false;
513
- }
514
-
515
- return $apply;
516
- }
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 ( class_exists( 'WooCommerce' ) && 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
- );
1
+ <?php
2
+ /**
3
+ * Filter to add plugins to the TOC list.
4
+ *
5
+ * @link https://rankmath.com/kb/filters-hooks-api-developer/#add-toc-plugin
6
+ *
7
+ * @since 2.0
8
+ *
9
+ * @param array TOC plugins.
10
+ */
11
+ add_filter(
12
+ 'rank_math/researches/toc_plugins',
13
+ function( $toc_plugins ) {
14
+
15
+ $toc_plugins[ EZ_TOC_BASE_NAME ] = 'Easy Table of Contents';
16
+
17
+ return $toc_plugins;
18
+ }
19
+ );
20
+
21
+ /**
22
+ * Filter to remove Connections Business Directory related shortcodes from being processed as eligible TOC items.
23
+ *
24
+ * @since 2.0
25
+ */
26
+ add_filter(
27
+ 'ez_toc_strip_shortcodes_tagnames',
28
+ function( $tags_to_remove ) {
29
+
30
+ $shortcodes = array (
31
+ 'connections_form',
32
+ 'cn_multi_category_search',
33
+ 'cn_widget',
34
+ 'cn_carousel',
35
+ 'connections_categories',
36
+ 'connections_link_view',
37
+ 'connections_link_edit',
38
+ 'connections_login',
39
+ 'siteshot',
40
+ 'connections',
41
+ 'upcoming_list',
42
+ 'cn-mapblock',
43
+ 'connections_vcard',
44
+ 'connections_qtip',
45
+ 'cn_thumb',
46
+ 'cn_thumbr',
47
+ );
48
+
49
+ $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
50
+
51
+ return $tags_to_remove;
52
+ }
53
+ );
54
+
55
+
56
+ /**
57
+ * Filter to remove Striking theme related shortcodes from being processed as eligible TOC items.
58
+ *
59
+ * @since 2.0
60
+ */
61
+ add_filter(
62
+ 'ez_toc_strip_shortcodes_tagnames',
63
+ function( $tags_to_remove ) {
64
+
65
+ $shortcodes = array (
66
+ 'iconbox',
67
+ 'toggle',
68
+ );
69
+
70
+ $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
71
+
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
+ $selectors['jetpack-relatedposts'] = '.jp-relatedposts';
87
+
88
+ return $selectors;
89
+ }
90
+ );
91
+
92
+ /**
93
+ * Remove the Elegant Themes Bloom plugin node from the post content before extracting headings.
94
+ *
95
+ * @since 2.0
96
+ */
97
+ add_filter(
98
+ 'ez_toc_exclude_by_selector',
99
+ function( $selectors ) {
100
+
101
+ $selectors['elegant-themes-bloom'] = '.et_bloom_below_post';
102
+
103
+ return $selectors;
104
+ }
105
+ );
106
+
107
+ /**
108
+ * Do not allow `the_content` TOC callback to run when editing a page in Visual Composer.
109
+ *
110
+ * @link https://wordpress.org/support/topic/correct-method-to-determine-if-using-frontend-editor/#post-12404679
111
+ *
112
+ * @since 2.0
113
+ */
114
+ add_filter(
115
+ 'ez_toc_maybe_apply_the_content_filter',
116
+ function( $apply ) {
117
+
118
+ if ( function_exists( 'vchelper' ) ) {
119
+
120
+ //$sourceId = intval( vchelper( "Request" )->input( 'vcv-source-id' ) );
121
+ //
122
+ //if ( $sourceId === get_the_ID() ) {
123
+ //
124
+ // $apply = false;
125
+ //}
126
+
127
+ if ( vchelper( 'Frontend' )->isPageEditable() ) {
128
+
129
+ $apply = false;
130
+ }
131
+ }
132
+
133
+ return $apply;
134
+ }
135
+ );
136
+
137
+ /**
138
+ * Do not allow `the_content` TOC callback to run when editing a page in WPBakery Page Builder.
139
+ *
140
+ * @link https://wordpress.org/support/topic/correct-method-to-determine-if-using-frontend-editor/#post-12404679
141
+ *
142
+ * @since 2.0
143
+ */
144
+ add_filter(
145
+ 'ez_toc_maybe_apply_the_content_filter',
146
+ function( $apply ) {
147
+
148
+ if ( function_exists( 'vc_is_page_editable' ) ) {
149
+
150
+ if ( vc_is_page_editable() ) {
151
+
152
+ $apply = false;
153
+ }
154
+ }
155
+
156
+ return $apply;
157
+ }
158
+ );
159
+
160
+ /**
161
+ * Filter to remove WPBakery Page Builder related shortcodes from being processed as eligible TOC items.
162
+ *
163
+ * @since 2.0
164
+ */
165
+ add_filter(
166
+ 'ez_toc_strip_shortcodes_tagnames',
167
+ function( $tags_to_remove ) {
168
+
169
+ $shortcodes = array (
170
+ 'vc_tta_section',
171
+ );
172
+
173
+ $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
174
+
175
+ return $tags_to_remove;
176
+ }
177
+ );
178
+
179
+ /**
180
+ * Exclude the TOC shortcodes from being processed in the admin in the Divi Theme by Elegant Themes.
181
+ *
182
+ * @since 2.0
183
+ */
184
+ add_action(
185
+ 'et_pb_admin_excluded_shortcodes',
186
+ function( $shortcodes ) {
187
+
188
+ $shortcodes[] = 'ez-toc';
189
+ $shortcodes[] = apply_filters( 'ez_toc_shortcode', 'toc' );
190
+
191
+ return $shortcodes;
192
+ }
193
+ );
194
+
195
+ /**
196
+ * Disabled for now as it does not appear to be required.
197
+ *
198
+ * Do not allow `the_content` TOC callback to run when rendering a Divi layout.
199
+ *
200
+ * @since 2.0
201
+ */
202
+ //add_filter(
203
+ // 'ez_toc_maybe_apply_the_content_filter',
204
+ // function( $apply ) {
205
+ //
206
+ // global $wp_current_filter;
207
+ //
208
+ // // Do not execute if root current filter is one of those in the array.
209
+ // if ( in_array( $wp_current_filter[0], array( 'et_builder_render_layout' ), true ) ) {
210
+ //
211
+ // $apply = false;
212
+ // }
213
+ //
214
+ // return $apply;
215
+ // }
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.
223
+ *
224
+ * NOTE: Set priority 12 to run after Divi runs the `do_shortcode` filter on its layout content.
225
+ *
226
+ * @link https://wordpress.org/support/topic/anchor-links-not-being-added-with-divi/
227
+ *
228
+ * @since 2.0
229
+ */
230
+ add_filter(
231
+ 'et_builder_render_layout',
232
+ array( 'ezTOC', 'the_content' ),
233
+ 12,
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/
302
+ * @since 2.0
303
+ */
304
+ add_filter(
305
+ 'ez_toc_exclude_by_selector',
306
+ function( $selectors ) {
307
+
308
+ $selectors['starbox'] = '.abh_box';
309
+
310
+ return $selectors;
311
+ }
312
+ );
313
+
314
+ /**
315
+ * Remove the WordPress Related Posts plugin node from the post content before extracting headings.
316
+ * @link
317
+ * @since 2.0
318
+ */
319
+ add_filter(
320
+ 'ez_toc_exclude_by_selector',
321
+ function( $selectors ) {
322
+
323
+ $selectors['wordpress-23-related-posts-plugin'] = '.wp_rp_content';
324
+
325
+ return $selectors;
326
+ }
327
+ );
328
+
329
+ /**
330
+ * Remove the Atomic Blocks plugin node from the post content before extracting headings.
331
+ * @link
332
+ * @since 2.0
333
+ */
334
+ add_filter(
335
+ 'ez_toc_exclude_by_selector',
336
+ function( $selectors ) {
337
+
338
+ $selectors['atomic-blocks-cta'] = '.ab-block-cta';
339
+ $selectors['atomic-blocks-testimonial'] = '.ab-block-testimonial';
340
+
341
+ return $selectors;
342
+ }
343
+ );
344
+
345
+ /**
346
+ * Remove the Ultimate Addons for VC Composer node from the post content before extracting headings.
347
+ * @link
348
+ * @since 2.0
349
+ */
350
+ add_filter(
351
+ 'ez_toc_exclude_by_selector',
352
+ function( $selectors ) {
353
+
354
+ $selectors['ultimate-addons-for-vc-composer'] = '.ult_tabs';
355
+
356
+ return $selectors;
357
+ }
358
+ );
359
+
360
+ /**
361
+ * Remove the WP Product Review node from the post content before extracting headings.
362
+ * @link
363
+ * @since 2.0
364
+ */
365
+ add_filter(
366
+ 'ez_toc_exclude_by_selector',
367
+ function( $selectors ) {
368
+
369
+ $selectors['wp-product-review'] = '.wppr-review-container';
370
+
371
+ return $selectors;
372
+ }
373
+ );
374
+
375
+ /**
376
+ * Remove the Create by Mediavine node from the post content before extracting headings.
377
+ *
378
+ * @link https://wordpress.org/plugins/mediavine-create/
379
+ * @since 2.0.8
380
+ */
381
+ add_filter(
382
+ 'ez_toc_exclude_by_selector',
383
+ function( $selectors ) {
384
+
385
+ $selectors['mediavine-create'] = '.mv-create-card';
386
+
387
+ return $selectors;
388
+ }
389
+ );
390
+
391
+ /**
392
+ * Remove the Contextual Related Posts node from the post content before extracting headings.
393
+ *
394
+ * @link https://wordpress.org/plugins/contextual-related-posts/
395
+ * @since 2.0.9
396
+ */
397
+ add_filter(
398
+ 'ez_toc_exclude_by_selector',
399
+ function( $selectors ) {
400
+
401
+ $selectors['contextual-related-posts'] = '.crp_related';
402
+
403
+ return $selectors;
404
+ }
405
+ );
406
+
407
+ class ezTOC_Elementor {
408
+
409
+ /**
410
+ * Whether the excerpt is being called.
411
+ *
412
+ * Used to determine whether the call to `the_content()` came from `get_the_excerpt()`.
413
+ *
414
+ * @since 2.0.2
415
+ *
416
+ * @var bool Whether the excerpt is being used. Default is false.
417
+ */
418
+ private $_is_excerpt = false;
419
+
420
+ /**
421
+ * ezTOC_Elementor constructor.
422
+ *
423
+ * @since 2.0.2
424
+ */
425
+ public function __construct() {
426
+
427
+ //add_filter( 'elementor/frontend/the_content', array( 'ezTOC', 'the_content' ), 100 );
428
+
429
+ // Hack to avoid enqueue post CSS while it's a `the_excerpt` call.
430
+ add_filter( 'get_the_excerpt', array( $this, 'start_excerpt_flag' ), 1 );
431
+ add_filter( 'get_the_excerpt', array( $this, 'end_excerpt_flag' ), 20 );
432
+ add_filter( 'ez_toc_maybe_apply_the_content_filter', array( $this, 'maybe_apply_the_content_filter' ) );
433
+
434
+ add_filter(
435
+ 'ez_toc_strip_shortcodes_tagnames',
436
+ function( $tags_to_remove ) {
437
+
438
+ $shortcodes = array (
439
+ 'elementor-template',
440
+ );
441
+
442
+ $tags_to_remove = array_merge( $tags_to_remove, $shortcodes );
443
+
444
+ return $tags_to_remove;
445
+ }
446
+ );
447
+ }
448
+
449
+ /**
450
+ * Callback for the `elementor/init` action.
451
+ *
452
+ * Add the compatibility filters for Elementor.
453
+ *
454
+ * @since 2.0.2
455
+ */
456
+ public static function start() {
457
+
458
+ new self();
459
+ }
460
+
461
+ /**
462
+ * Callback for the `get_the_excerpt` filter.
463
+ *
464
+ * Start excerpt flag.
465
+ *
466
+ * Flags when `the_excerpt` is called. Used to avoid enqueueing CSS in the excerpt.
467
+ *
468
+ * @since 2.0.2
469
+ *
470
+ * @param string $excerpt The post excerpt.
471
+ *
472
+ * @return string The post excerpt.
473
+ */
474
+ public function start_excerpt_flag( $excerpt ) {
475
+ $this->_is_excerpt = true;
476
+ return $excerpt;
477
+ }
478
+
479
+ /**
480
+ * Callback for the `get_the_excerpt` filter.
481
+ *
482
+ * End excerpt flag.
483
+ *
484
+ * Flags when `the_excerpt` call ended.
485
+ *
486
+ * @since 2.0.2
487
+ *
488
+ * @param string $excerpt The post excerpt.
489
+ *
490
+ * @return string The post excerpt.
491
+ */
492
+ public function end_excerpt_flag( $excerpt ) {
493
+ $this->_is_excerpt = false;
494
+ return $excerpt;
495
+ }
496
+
497
+ /**
498
+ * Callback for the `ez_toc_maybe_apply_the_content_filter` filter.
499
+ *
500
+ * If doing Elementor excerpt, which calls `the_content` filter, do not apply the ezTOC `the_content` filter.
501
+ *
502
+ * @since 2.0.2
503
+ *
504
+ * @param bool $apply
505
+ *
506
+ * @return bool mixed
507
+ */
508
+ public function maybe_apply_the_content_filter( $apply ) {
509
+
510
+ if ( $this->_is_excerpt ) {
511
+
512
+ $apply = false;
513
+ }
514
+
515
+ return $apply;
516
+ }
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 ( class_exists( 'WooCommerce' ) && FALSE !== stripos( $string, 'woocommerce.php' ) ) {
545
+
546
+ /** @noinspection PhpUndefinedFunctionInspection */
547
+ if ( is_shop() ||
548
+ is_product_category() ||
549
+ is_product_tag() ||
550
+ is_cart() ||
551
+ is_checkout() ||
552
+ is_account_page() ||
553
+ is_wc_endpoint_url()
554
+ ) {
555
+
556
+ $apply = false;
557
+ }
558
+
559
+ }
560
+
561
+ return $apply;
562
+ }
563
+ );
 
includes/inc.string-functions.php CHANGED
@@ -308,11 +308,15 @@ function mb_find_replace( &$find = false, &$replace = false, &$string = '' ) {
308
  get_option( 'blog_charset' )
309
  );
310
 
311
- $string = html_entity_decode(
312
- $string,
313
- ENT_QUOTES,
314
- get_option( 'blog_charset' )
315
- );
 
 
 
 
316
 
317
  $needle = str_replace(array('’','“','”'), array('\'','"','"'), $needle);
318
 
308
  get_option( 'blog_charset' )
309
  );
310
 
311
+ $umlauts = false;
312
+ $umlauts = apply_filters( 'eztoc_modify_umlauts', $umlauts );
313
+ if($umlauts){
314
+ $string = html_entity_decode(
315
+ $string,
316
+ ENT_QUOTES,
317
+ get_option( 'blog_charset' )
318
+ );
319
+ }
320
 
321
  $needle = str_replace(array('’','“','”'), array('\'','"','"'), $needle);
322