Version Description
2020-01-08 = * Fixed: in some cases headings processing incorrectly.
Download this release
Release Info
Developer | theluckywp |
Plugin | LuckyWP Table of Contents |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.9.11 to 2.0.1
- admin/Admin.php +3 -0
- admin/SiteHealth.php +42 -0
- config/plugin.php +0 -1
- core/base/BasePlugin.php +7 -0
- core/wp/Settings.php +15 -0
- front/Front.php +51 -25
- front/Toc.php +3 -0
- front/assets/main.min.css +1 -1
- front/assets/main.min.js +1 -1
- front/views/body.php +1 -1
- languages/luckywp-table-of-contents-ru_RU.mo +0 -0
- languages/luckywp-table-of-contents.pot +159 -138
- luckywp-table-of-contents.php +20 -2
- plugin/Dom.php +72 -0
- plugin/contentHandling/ContentHandling.php +34 -12
- readme.txt +12 -1
admin/Admin.php
CHANGED
@@ -41,6 +41,9 @@ class Admin extends BaseObject
|
|
41 |
EditorBlockController::getInstance();
|
42 |
WidgetController::getInstance();
|
43 |
RateController::getInstance();
|
|
|
|
|
|
|
44 |
}
|
45 |
}
|
46 |
|
41 |
EditorBlockController::getInstance();
|
42 |
WidgetController::getInstance();
|
43 |
RateController::getInstance();
|
44 |
+
|
45 |
+
// Здоровье сайта
|
46 |
+
new SiteHealth();
|
47 |
}
|
48 |
}
|
49 |
|
admin/SiteHealth.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace luckywp\tableOfContents\admin;
|
4 |
+
|
5 |
+
use luckywp\tableOfContents\core\base\BaseObject;
|
6 |
+
use luckywp\tableOfContents\core\Core;
|
7 |
+
|
8 |
+
class SiteHealth extends BaseObject
|
9 |
+
{
|
10 |
+
|
11 |
+
public function init()
|
12 |
+
{
|
13 |
+
add_filter('debug_information', [$this, 'debugInfo']);
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @param array $info
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function debugInfo($info)
|
21 |
+
{
|
22 |
+
$info[Core::$plugin->slug] = [
|
23 |
+
'label' => Core::$plugin->getName(),
|
24 |
+
'fields' => [
|
25 |
+
'domVersion' => [
|
26 |
+
'label' => __('DOM/XML Version', 'luckywp-table-of-contents'),
|
27 |
+
'value' => extension_loaded('dom') ? phpversion('dom') : __('not loaded', 'luckywp-table-of-contents'),
|
28 |
+
],
|
29 |
+
'libxmlVersion' => [
|
30 |
+
'label' => __('libXML Version', 'luckywp-table-of-contents'),
|
31 |
+
'value' => extension_loaded('libxml') ? LIBXML_DOTTED_VERSION : __('not loaded', 'luckywp-table-of-contents'),
|
32 |
+
],
|
33 |
+
'settings' => [
|
34 |
+
'label' => __('Settings', 'luckywp-table-of-contents'),
|
35 |
+
'value' => __('encoded data to copy', 'luckywp-table-of-contents'),
|
36 |
+
'debug' => Core::$plugin->settings->toJson(),
|
37 |
+
],
|
38 |
+
],
|
39 |
+
];
|
40 |
+
return $info;
|
41 |
+
}
|
42 |
+
}
|
config/plugin.php
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<?php
|
2 |
return [
|
3 |
-
'textDomain' => 'luckywp-table-of-contents',
|
4 |
'bootstrap' => [
|
5 |
'activation',
|
6 |
'admin',
|
1 |
<?php
|
2 |
return [
|
|
|
3 |
'bootstrap' => [
|
4 |
'activation',
|
5 |
'admin',
|
core/base/BasePlugin.php
CHANGED
@@ -10,6 +10,11 @@ use luckywp\tableOfContents\core\Core;
|
|
10 |
abstract class BasePlugin extends ServiceLocator
|
11 |
{
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* @var string
|
15 |
*/
|
@@ -78,6 +83,8 @@ abstract class BasePlugin extends ServiceLocator
|
|
78 |
|
79 |
public function run($version, $fileName, $prefix)
|
80 |
{
|
|
|
|
|
81 |
$this->version = $version;
|
82 |
$this->fileName = $fileName;
|
83 |
$this->dir = dirname($fileName);
|
10 |
abstract class BasePlugin extends ServiceLocator
|
11 |
{
|
12 |
|
13 |
+
/**
|
14 |
+
* @var string
|
15 |
+
*/
|
16 |
+
public $slug;
|
17 |
+
|
18 |
/**
|
19 |
* @var string
|
20 |
*/
|
83 |
|
84 |
public function run($version, $fileName, $prefix)
|
85 |
{
|
86 |
+
$this->slug = basename($fileName, '.php');
|
87 |
+
$this->textDomain = $this->slug;
|
88 |
$this->version = $version;
|
89 |
$this->fileName = $fileName;
|
90 |
$this->dir = dirname($fileName);
|
core/wp/Settings.php
CHANGED
@@ -7,6 +7,7 @@ use luckywp\tableOfContents\core\base\BaseObject;
|
|
7 |
use luckywp\tableOfContents\core\Core;
|
8 |
use luckywp\tableOfContents\core\helpers\ArrayHelper;
|
9 |
use luckywp\tableOfContents\core\helpers\Html;
|
|
|
10 |
|
11 |
class Settings extends BaseObject
|
12 |
{
|
@@ -353,6 +354,20 @@ class Settings extends BaseObject
|
|
353 |
update_option($this->prefix . $groupId, $values);
|
354 |
}
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
/**
|
358 |
* ---------------------------------------------------------------------------
|
7 |
use luckywp\tableOfContents\core\Core;
|
8 |
use luckywp\tableOfContents\core\helpers\ArrayHelper;
|
9 |
use luckywp\tableOfContents\core\helpers\Html;
|
10 |
+
use luckywp\tableOfContents\core\helpers\Json;
|
11 |
|
12 |
class Settings extends BaseObject
|
13 |
{
|
354 |
update_option($this->prefix . $groupId, $values);
|
355 |
}
|
356 |
|
357 |
+
/**
|
358 |
+
* @return string
|
359 |
+
*/
|
360 |
+
public function toJson()
|
361 |
+
{
|
362 |
+
$data = [];
|
363 |
+
foreach ($this->fields as $configs) {
|
364 |
+
foreach ($configs as $config) {
|
365 |
+
$data[$config['group']][$config['id']] = $this->getValue($config['group'], $config['id'], null, false);
|
366 |
+
}
|
367 |
+
}
|
368 |
+
return Json::encode($data);
|
369 |
+
}
|
370 |
+
|
371 |
|
372 |
/**
|
373 |
* ---------------------------------------------------------------------------
|
front/Front.php
CHANGED
@@ -2,9 +2,11 @@
|
|
2 |
|
3 |
namespace luckywp\tableOfContents\front;
|
4 |
|
|
|
5 |
use luckywp\tableOfContents\core\Core;
|
6 |
use luckywp\tableOfContents\core\front\BaseFront;
|
7 |
use luckywp\tableOfContents\core\helpers\ArrayHelper;
|
|
|
8 |
use luckywp\tableOfContents\plugin\PostSettings;
|
9 |
|
10 |
class Front extends BaseFront
|
@@ -16,25 +18,34 @@ class Front extends BaseFront
|
|
16 |
{
|
17 |
parent::init();
|
18 |
if (Core::isFront()) {
|
19 |
-
add_action('wp_enqueue_scripts', [$this, '
|
20 |
add_action('init', function () {
|
21 |
if (Core::$plugin->settings->getPostTypesForProcessingHeadings()) {
|
22 |
add_filter('the_content', [$this, 'autoInsert'], 998);
|
23 |
}
|
24 |
});
|
25 |
-
add_action('wp_footer', [$this, 'overrideColors']);
|
26 |
}
|
27 |
}
|
28 |
|
29 |
-
public function
|
30 |
{
|
31 |
wp_register_style('lwptoc-main', Core::$plugin->url . '/front/assets/main.min.css', [], Core::$plugin->version);
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
|
@@ -138,17 +149,41 @@ class Front extends BaseFront
|
|
138 |
$position = $settings->position ? $settings->position : Core::$plugin->settings->autoInsertPosition;
|
139 |
switch ($position) {
|
140 |
case 'beforefirstheading':
|
|
|
141 |
default:
|
142 |
-
$
|
143 |
-
|
|
|
|
|
144 |
|
145 |
-
|
146 |
-
$
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
case 'afterfirstblock':
|
150 |
-
$
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
case 'bottom':
|
154 |
return $content . $shortcode;
|
@@ -157,13 +192,4 @@ class Front extends BaseFront
|
|
157 |
return $shortcode . $content;
|
158 |
}
|
159 |
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* @param string $tagsRe
|
163 |
-
* @return string
|
164 |
-
*/
|
165 |
-
protected function generateRegexp($tagsRe)
|
166 |
-
{
|
167 |
-
return '#(<(' . $tagsRe . ')[^>]*>.*?</\2>)#imsu';
|
168 |
-
}
|
169 |
}
|
2 |
|
3 |
namespace luckywp\tableOfContents\front;
|
4 |
|
5 |
+
use DOMXPath;
|
6 |
use luckywp\tableOfContents\core\Core;
|
7 |
use luckywp\tableOfContents\core\front\BaseFront;
|
8 |
use luckywp\tableOfContents\core\helpers\ArrayHelper;
|
9 |
+
use luckywp\tableOfContents\plugin\Dom;
|
10 |
use luckywp\tableOfContents\plugin\PostSettings;
|
11 |
|
12 |
class Front extends BaseFront
|
18 |
{
|
19 |
parent::init();
|
20 |
if (Core::isFront()) {
|
21 |
+
add_action('wp_enqueue_scripts', [$this, 'registerAssets']);
|
22 |
add_action('init', function () {
|
23 |
if (Core::$plugin->settings->getPostTypesForProcessingHeadings()) {
|
24 |
add_filter('the_content', [$this, 'autoInsert'], 998);
|
25 |
}
|
26 |
});
|
27 |
+
add_action('wp_footer', [$this, 'overrideColors'], 21);
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
public function registerAssets()
|
32 |
{
|
33 |
wp_register_style('lwptoc-main', Core::$plugin->url . '/front/assets/main.min.css', [], Core::$plugin->version);
|
34 |
+
wp_register_script('lwptoc-main', Core::$plugin->url . '/front/assets/main.min.js', [], Core::$plugin->version);
|
35 |
+
}
|
36 |
+
|
37 |
+
private $_assetsEnqueued = false;
|
38 |
+
|
39 |
+
public function enqueueAssets()
|
40 |
+
{
|
41 |
+
if (!$this->_assetsEnqueued) {
|
42 |
+
if (apply_filters('lwptoc_enqueue_style', true)) {
|
43 |
+
wp_enqueue_style('lwptoc-main');
|
44 |
+
}
|
45 |
+
if (apply_filters('lwptoc_enqueue_script', true)) {
|
46 |
+
wp_enqueue_script('lwptoc-main');
|
47 |
+
}
|
48 |
+
$this->_assetsEnqueued = true;
|
49 |
}
|
50 |
}
|
51 |
|
149 |
$position = $settings->position ? $settings->position : Core::$plugin->settings->autoInsertPosition;
|
150 |
switch ($position) {
|
151 |
case 'beforefirstheading':
|
152 |
+
case 'afterfirstheading':
|
153 |
default:
|
154 |
+
$dom = Dom::make($content);
|
155 |
+
if ($dom === false) {
|
156 |
+
return $shortcode . $content;
|
157 |
+
}
|
158 |
|
159 |
+
$xpath = new DOMXPath($dom);
|
160 |
+
$nodes = $xpath->query('//h1|//h2|//h3|//h4|//h5|//h6');
|
161 |
+
if (!$nodes) {
|
162 |
+
return $shortcode . $content;
|
163 |
+
}
|
164 |
+
|
165 |
+
if ($position == 'afterfirstheading') {
|
166 |
+
Dom::afterNodeInsertHtml($nodes->item(0), $shortcode);
|
167 |
+
} else {
|
168 |
+
Dom::beforeNodeInsertHtml($nodes->item(0), $shortcode);
|
169 |
+
}
|
170 |
+
|
171 |
+
return Dom::getBody($dom);
|
172 |
|
173 |
case 'afterfirstblock':
|
174 |
+
$dom = Dom::make($content);
|
175 |
+
if ($dom === false) {
|
176 |
+
return $shortcode . $content;
|
177 |
+
}
|
178 |
+
|
179 |
+
$node = $dom->getElementById(Dom::BODY_ID)->firstChild;
|
180 |
+
if (!$node) {
|
181 |
+
return $shortcode . $content;
|
182 |
+
}
|
183 |
+
|
184 |
+
Dom::afterNodeInsertHtml($node, $shortcode);
|
185 |
+
|
186 |
+
return Dom::getBody($dom);
|
187 |
|
188 |
case 'bottom':
|
189 |
return $content . $shortcode;
|
192 |
return $shortcode . $content;
|
193 |
}
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
front/Toc.php
CHANGED
@@ -295,6 +295,9 @@ class Toc
|
|
295 |
$after = $after . '<!--/noindex-->';
|
296 |
}
|
297 |
|
|
|
|
|
|
|
298 |
// Вывод
|
299 |
static::$currentOutputDepth = -1;
|
300 |
return Core::$plugin->front->render('body', [
|
295 |
$after = $after . '<!--/noindex-->';
|
296 |
}
|
297 |
|
298 |
+
// Подключаем CSS/JS
|
299 |
+
Core::$plugin->front->enqueueAssets();
|
300 |
+
|
301 |
// Вывод
|
302 |
static::$currentOutputDepth = -1;
|
303 |
return Core::$plugin->front->render('body', [
|
front/assets/main.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.lwptoc{margin:32px 0}.lwptoc:first-child{margin-top:16px}.lwptoc_i{padding:14px 18px 18px;text-align:left}.lwptoc_header{margin-bottom:6px}.rtl .lwptoc_header{text-align:right}.lwptoc_toggle{margin-left:4px;font-size:80%}.rtl .lwptoc_toggle{margin-left:0;margin-right:4px}.lwptoc_toggle:before{content:'['}.lwptoc_toggle:after{content:']'}.lwptoc_toggle_label{margin:0 1px}.lwptoc_item{margin-top:2px}.rtl .lwptoc_item{text-align:right}LI.lwptoc_item{margin:2px 0 0 0!important;padding:0!important;list-style:none!important}.lwptoc_item:first-child{margin-top:0}LI.lwptoc_item:first-child{margin-top:0!important}.lwptoc_item_number{margin-right:2px}.rtl .lwptoc_item_number{margin-right:0;margin-left:2px}.lwptoc_itemWrap .lwptoc_itemWrap{margin:2px 0 0 14px}.rtl .lwptoc_itemWrap .lwptoc_itemWrap{margin-left:0;margin-right:14px}UL.lwptoc_itemWrap{margin:0!important;padding:0!important;list-style:none!important}UL.lwptoc_itemWrap UL.lwptoc_itemWrap{margin:2px 0 0 14px!important}.rtl UL.lwptoc_itemWrap UL.lwptoc_itemWrap{margin-left:0!important;margin-right:14px!important}.lwptoc-autoWidth .lwptoc_i{display:inline-block}.lwptoc-left{float:left;margin-top:0;margin-right:32px}.lwptoc-right{float:right;margin-top:0;margin-left:32px}.lwptoc-rightwithoutflow{text-align:right}.lwptoc-rightwithoutflow .lwptoc_i{display:inline-block}.lwptoc-center{text-align:center}.lwptoc-center .lwptoc_i{margin-left:auto;margin-right:auto}.lwptoc-baseItems .lwptoc_items{font-size:90%}.lwptoc-notInherit .lwptoc_i DIV A{box-shadow:none!important;border:none!important;text-decoration:none!important}.lwptoc-notInherit .lwptoc_i DIV A:active,.lwptoc-notInherit .lwptoc_i DIV A:focus,.lwptoc-notInherit .lwptoc_i DIV A:hover{box-shadow:none!important;border:none!important;text-decoration:none!important}.lwptoc-notInherit .lwptoc_i DIV A:hover{border-bottom:1px dotted!important}.lwptoc-light .lwptoc_i{color:#333;background:#fafafa}.lwptoc-light .lwptoc_i A{color:#3175e4}.lwptoc-light .lwptoc_i A:active,.lwptoc-light .lwptoc_i A:focus,.lwptoc-light .lwptoc_i A:hover{color:#3175e4;border-color:#3175e4}.lwptoc-light .lwptoc_items A:visited{color:#000394}.lwptoc-dark .lwptoc_i{color:#d3d5d8;background:#2b2b2b}.lwptoc-dark .lwptoc_i A{color:#96c6ff}.lwptoc-dark .lwptoc_i A:active,.lwptoc-dark .lwptoc_i A:focus,.lwptoc-dark .lwptoc_i A:hover{color:#96c6ff;border-color:#71b2ff}.lwptoc-dark .lwptoc_items A:visited{color:#53a1ff}.lwptoc-white .lwptoc_i{color:#333;background:#fff}.lwptoc-white .lwptoc_i A{color:#3175e4}.lwptoc-white .lwptoc_i A:active,.lwptoc-white .lwptoc_i A:focus,.lwptoc-white .lwptoc_i A:hover{color:#3175e4;border-color:#3175e4}.lwptoc-white .lwptoc_items A:visited{color:#000394}.lwptoc-transparent .lwptoc_i{border:1px solid #eee}
|
1 |
+
.lwptoc{margin:32px 0}.lwptoc:first-child{margin-top:16px}.lwptoc_i{padding:14px 18px 18px;text-align:left}.lwptoc_header{margin-bottom:6px}.rtl .lwptoc_header{text-align:right}.lwptoc_toggle{white-space:nowrap;margin-left:4px;font-size:80%}.rtl .lwptoc_toggle{margin-left:0;margin-right:4px}.lwptoc_toggle:before{content:'['}.lwptoc_toggle:after{content:']'}.lwptoc_toggle_label{margin:0 1px}.lwptoc_item{margin-top:2px}.rtl .lwptoc_item{text-align:right}LI.lwptoc_item{margin:2px 0 0 0!important;padding:0!important;list-style:none!important}.lwptoc_item:first-child{margin-top:0}LI.lwptoc_item:first-child{margin-top:0!important}.lwptoc_item_number{margin-right:2px}.rtl .lwptoc_item_number{margin-right:0;margin-left:2px}.lwptoc_itemWrap .lwptoc_itemWrap{margin:2px 0 0 14px}.rtl .lwptoc_itemWrap .lwptoc_itemWrap{margin-left:0;margin-right:14px}UL.lwptoc_itemWrap{margin:0!important;padding:0!important;list-style:none!important}UL.lwptoc_itemWrap UL.lwptoc_itemWrap{margin:2px 0 0 14px!important}.rtl UL.lwptoc_itemWrap UL.lwptoc_itemWrap{margin-left:0!important;margin-right:14px!important}.lwptoc-autoWidth .lwptoc_i{display:inline-block}.lwptoc-left{float:left;margin-top:0;margin-right:32px}.lwptoc-right{float:right;margin-top:0;margin-left:32px}.lwptoc-rightwithoutflow{text-align:right}.lwptoc-rightwithoutflow .lwptoc_i{display:inline-block}.lwptoc-center{text-align:center}.lwptoc-center .lwptoc_i{margin-left:auto;margin-right:auto}.lwptoc-baseItems .lwptoc_items{font-size:90%}.lwptoc-notInherit .lwptoc_i DIV A{box-shadow:none!important;border:none!important;text-decoration:none!important}.lwptoc-notInherit .lwptoc_i DIV A:active,.lwptoc-notInherit .lwptoc_i DIV A:focus,.lwptoc-notInherit .lwptoc_i DIV A:hover{box-shadow:none!important;border:none!important;text-decoration:none!important}.lwptoc-notInherit .lwptoc_i DIV A:hover{border-bottom:1px dotted!important}.lwptoc-light .lwptoc_i{color:#333;background:#fafafa}.lwptoc-light .lwptoc_i A{color:#3175e4}.lwptoc-light .lwptoc_i A:active,.lwptoc-light .lwptoc_i A:focus,.lwptoc-light .lwptoc_i A:hover{color:#3175e4;border-color:#3175e4}.lwptoc-light .lwptoc_items A:visited{color:#000394}.lwptoc-dark .lwptoc_i{color:#d3d5d8;background:#2b2b2b}.lwptoc-dark .lwptoc_i A{color:#96c6ff}.lwptoc-dark .lwptoc_i A:active,.lwptoc-dark .lwptoc_i A:focus,.lwptoc-dark .lwptoc_i A:hover{color:#96c6ff;border-color:#71b2ff}.lwptoc-dark .lwptoc_items A:visited{color:#53a1ff}.lwptoc-white .lwptoc_i{color:#333;background:#fff}.lwptoc-white .lwptoc_i A{color:#3175e4}.lwptoc-white .lwptoc_i A:active,.lwptoc-white .lwptoc_i A:focus,.lwptoc-white .lwptoc_i A:hover{color:#3175e4;border-color:#3175e4}.lwptoc-white .lwptoc_items A:visited{color:#000394}.lwptoc-transparent .lwptoc_i{border:1px solid #eee}
|
front/assets/main.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(){function n(t,e){var i,n={};for(i in t)n[i]=t[i];for(i in e)n[i]=e[i];return n}function t(t){return t}var o,l,a=(o={duration:300,action:"close",startTime:null,startHeight:null,endHeight:null,easing:t},l=function(t,e,i){e.startTime||(e.startTime=i);var n=i-e.startTime;n<e.duration?(t.style.height=((e.endHeight-e.startingHeight)*e.easing(n/e.duration)+e.startingHeight).toFixed(2)+"px",r(t,e)):("close"===e.action&&(t.style.display="none"),"open"===e.action&&(t.style.display="block"),function(t){t.style.height=null,t.style.overflow=null}(t))},function(t,e){if(window.requestAnimationFrame){var i=n(o,{});i.action=e,t.style.height?i.startingHeight=parseFloat(t.style.height):i.startingHeight="close"===e?t.scrollHeight:0,function(t){t.style.display="block",t.style.overflow="hidden"}(t),"close"===e?i.endHeight=0:(t.style.height="0px",i.endHeight=t.scrollHeight),r(t,i)}else t.style.display="close"===e?"none":"block"});function r(e,i){cancelAnimationFrame(e.getAttribute("data-lwptoc-animation-request-id")),e.setAttribute("data-lwptoc-animation-request-id",window.requestAnimationFrame(function(t){l(e,i,t)}))}function s(t){for(var e,i=document.querySelectorAll('[id="'+t+'"]'),n=0;n<i.length;n++)if((e=i[n]).offsetWidth||e.offsetHeight||e.getClientRects().length)return i[n];return null}var e,i=(e={offset:0,duration:500,easing:t},function(o,t){var l=n(e,t);if(window.requestAnimationFrame){var a,r,s,c=window.pageYOffset,u=null,d=function(t){a=f(o,l.offset),r=a-c;var e=window.pageYOffset;if(!s||!(0<r&&e<s||r<0&&s<e)){s=e;var i=t-(u=u||t-1),n=((a-c)*l.easing(i/l.duration)+c).toFixed();window.scroll(0,n),i<l.duration?window.requestAnimationFrame(d):window.scroll(0,a)}};window.requestAnimationFrame(d)}else window.scroll(0,f(o,l.offset))});function f(t,e){var i=t.getBoundingClientRect().top+window.pageYOffset-e;return i<0?0:i}var c={scrollTo:function(t,e){i(t,e)},registerScrollTrigger:function(t,a){for(var e=0;e<t.length;e++)t[e].addEventListener("click",function(t){t.preventDefault();var e,i,n=this.getAttribute("href"),o=n.substring(1),l=s(o);l&&(n!==document.location.hash&&(l.setAttribute("id",""),e=o,(i=document.createElement("a")).setAttribute("id",e),i.setAttribute("style","position:absolute;visibility:hidden;left:"+window.pageXOffset+"px;top:"+window.pageYOffset+"px;"),function(t,e){t.prepend?t.prepend(e):t.insertBefore(e,t.firstChild)}(document.body,i),document.location.hash=e,function(t){t.remove?t.remove():t.parentNode.removeChild(t)}(i),l.setAttribute("id",o)),c.scrollTo(l,a))})},init:function(t){if("1"!==t.getAttribute("data-lwptoc-initialized")){var e,i=t.getElementsByClassName("lwptoc_toggle_label")[0],n=t.getElementsByClassName("lwptoc_items")[0];i.addEventListener("click",function(t){t.preventDefault(),e=i.getAttribute("data-label"),i.setAttribute("data-label",i.innerHTML),i.innerHTML=e,function(t,e){return-1<(" "+t.className+" ").indexOf(" "+e+" ")}(n,"lwptoc_items-visible")?(function(t,e){t.className=(" "+t.className+" ").replace(" "+e+" ","").trim()}(n,"lwptoc_items-visible"),a(n,"close")):(function(t,e){t.className=t.className.trim()+" "+e}(n,"lwptoc_items-visible"),a(n,"open"))}),"1"===t.getAttribute("data-smooth-scroll")&&c.registerScrollTrigger(n.getElementsByTagName("A"),{offset:t.getAttribute("data-smooth-scroll-offset")}),t.setAttribute("data-lwptoc-initialized","1")}}};window.lwptoc=c,document.addEventListener("DOMContentLoaded",function(){for(var t=document.getElementsByClassName("lwptoc"),e=0;e<t.length;e++)c.init(t[e])})}();
|
front/views/body.php
CHANGED
@@ -29,7 +29,7 @@ echo $before . Html::beginTag('div', $containerOptions) . Html::beginTag('div',
|
|
29 |
<?php } ?>
|
30 |
</div>
|
31 |
<?php } ?>
|
32 |
-
<div class="lwptoc_items"<?= $itemsStyles ? ' style="' . implode('', $itemsStyles) . '"' : '' ?>>
|
33 |
<?php lwptoc_items($items) ?>
|
34 |
</div>
|
35 |
<?= '</div></div>' . $after ?>
|
29 |
<?php } ?>
|
30 |
</div>
|
31 |
<?php } ?>
|
32 |
+
<div class="lwptoc_items<?= $hideItems ? '' : ' lwptoc_items-visible'?>"<?= $itemsStyles ? ' style="' . implode('', $itemsStyles) . '"' : '' ?>>
|
33 |
<?php lwptoc_items($items) ?>
|
34 |
</div>
|
35 |
<?= '</div></div>' . $after ?>
|
languages/luckywp-table-of-contents-ru_RU.mo
CHANGED
Binary file
|
languages/luckywp-table-of-contents.pot
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: \n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: ru_RU\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 2.2.
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
15 |
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
|
@@ -17,155 +17,171 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPathExcluded-0: plugin/editorBlock/src\n"
|
19 |
|
20 |
-
#: admin/Admin.php:34
|
21 |
msgid "Settings"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: admin/Admin.php:
|
25 |
#: admin/controllers/EditorBlockController.php:65
|
26 |
-
#: admin/controllers/ShortcodeController.php:68 plugin/Plugin.php:
|
27 |
-
#: plugin/WpWidget.php:
|
28 |
msgid "Table of Contents"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: admin/Admin.php:
|
32 |
msgid "Edit"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: admin/Admin.php:
|
36 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
37 |
msgid "Position"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: admin/Admin.php:
|
41 |
#: config/settings.php:22
|
42 |
msgid "Minimal Count of Headings"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: admin/Admin.php:
|
46 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
47 |
msgid "Depth"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: admin/Admin.php:
|
51 |
#: config/settings.php:43
|
52 |
msgid "Hierarchical View"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: admin/Admin.php:
|
56 |
-
#: admin/Admin.php:
|
57 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
58 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
59 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
60 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
61 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
62 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
63 |
msgid "Enabled"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: admin/Admin.php:
|
67 |
-
#: admin/Admin.php:
|
68 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
69 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
70 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
71 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
72 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
73 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
74 |
msgid "Disabled"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: admin/Admin.php:
|
78 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
79 |
msgid "Numeration"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: admin/Admin.php:
|
83 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
84 |
msgid "Numeration Suffix"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: admin/Admin.php:
|
88 |
#: config/settings.php:89
|
89 |
msgid "Title"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: admin/Admin.php:
|
93 |
#: config/settings.php:95
|
94 |
msgid "Toggle Show/Hide"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: admin/Admin.php:
|
98 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
99 |
msgid "Label Show"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: admin/Admin.php:
|
103 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
104 |
msgid "Label Hide"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: admin/Admin.php:
|
108 |
msgid "Hide Items"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: admin/Admin.php:
|
112 |
#: config/settings.php:146
|
113 |
msgid "Smooth Scroll"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: admin/Admin.php:
|
117 |
msgid "Smooth Scroll Offset Top"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: admin/Admin.php:
|
121 |
#: config/settings.php:182
|
122 |
msgid "Width"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: admin/Admin.php:
|
126 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
127 |
msgid "Float"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: admin/Admin.php:
|
131 |
#: config/settings.php:203
|
132 |
msgid "Title Font Size"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: admin/Admin.php:
|
136 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
137 |
msgid "Title Font Weight"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: admin/Admin.php:
|
141 |
#: config/settings.php:225
|
142 |
msgid "Items Font Size"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: admin/Admin.php:
|
146 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
147 |
msgid "Color Scheme"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: admin/Admin.php:
|
151 |
#: config/settings.php:447
|
152 |
#, php-format
|
153 |
msgid "Wrap table of contents with %s tag"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: admin/Admin.php:
|
157 |
#: config/settings.php:462
|
158 |
#, php-format
|
159 |
msgid "Use %s for links"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: admin/Admin.php:
|
163 |
msgid "Skip headings"
|
164 |
msgstr ""
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
#: admin/controllers/EditorBlockController.php:71
|
167 |
#: admin/controllers/ShortcodeController.php:74
|
168 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
169 |
#: admin/widgets/metabox/views/box.php:33
|
170 |
#: admin/widgets/widget/views/_override.php:18
|
171 |
msgid "empty"
|
@@ -214,101 +230,101 @@ msgstr ""
|
|
214 |
msgid "from scheme"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
218 |
msgid "Click to override default value"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
222 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
223 |
msgid "Cancel"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
227 |
msgid "Customize Table of Contents"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
231 |
msgid "General"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
235 |
msgid "Appearance"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
239 |
msgid "Misc."
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
243 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
244 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
245 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
246 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
247 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
248 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
249 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
250 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
251 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
252 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
253 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
254 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
255 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
256 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
257 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
258 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
259 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
260 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
261 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
262 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
263 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
264 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
265 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
266 |
msgid "default"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
270 |
msgid ""
|
271 |
"If the count of headings in the post is less, then table of contents is not "
|
272 |
"displayed."
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
276 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
277 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
278 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
279 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
280 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
281 |
#: config/settings.php:99 config/settings.php:150 config/settings.php:297
|
282 |
msgid "Enable"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
286 |
msgid "Without title"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
290 |
msgid "By default, items of contents will be hidden"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
294 |
msgid "Skip heading by level"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
298 |
msgid "Skip heading by text"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
302 |
msgid ""
|
303 |
"Specify headings (one per line) to be excluded from the table of contents."
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
307 |
#, php-format
|
308 |
msgid "Use an asterisk %s as a wildcard to match any text."
|
309 |
msgstr ""
|
310 |
|
311 |
-
#: admin/widgets/customizeModal/views/modal.php:
|
312 |
msgid "Save"
|
313 |
msgstr ""
|
314 |
|
@@ -316,11 +332,11 @@ msgstr ""
|
|
316 |
msgid "Saved!"
|
317 |
msgstr ""
|
318 |
|
319 |
-
#: admin/widgets/fontSizeField/views/widget.php:16 plugin/Plugin.php:
|
320 |
msgid "Default"
|
321 |
msgstr ""
|
322 |
|
323 |
-
#: admin/widgets/fontSizeField/views/widget.php:17 plugin/Plugin.php:
|
324 |
msgid "Custom Value"
|
325 |
msgstr ""
|
326 |
|
@@ -509,144 +525,149 @@ msgstr ""
|
|
509 |
msgid "%s cannot be blank."
|
510 |
msgstr ""
|
511 |
|
512 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
513 |
msgid "Without numeration"
|
514 |
msgstr ""
|
515 |
|
516 |
-
#: plugin/Plugin.php:
|
517 |
msgid "Decimal numbers (nested)"
|
518 |
msgstr ""
|
519 |
|
520 |
-
#: plugin/Plugin.php:
|
521 |
msgid "Decimal numbers"
|
522 |
msgstr ""
|
523 |
|
524 |
-
#: plugin/Plugin.php:
|
525 |
msgid "Roman numbers (nested)"
|
526 |
msgstr ""
|
527 |
|
528 |
-
#: plugin/Plugin.php:
|
529 |
msgid "Roman numbers"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#: plugin/Plugin.php:
|
533 |
msgid "None"
|
534 |
msgstr ""
|
535 |
|
536 |
-
#: plugin/Plugin.php:
|
537 |
msgid "Before first heading"
|
538 |
msgstr ""
|
539 |
|
540 |
-
#: plugin/Plugin.php:
|
541 |
msgid "After first heading"
|
542 |
msgstr ""
|
543 |
|
544 |
-
#: plugin/Plugin.php:
|
545 |
msgid "After first block (paragraph or heading)"
|
546 |
msgstr ""
|
547 |
|
548 |
-
#: plugin/Plugin.php:
|
549 |
msgid "Top"
|
550 |
msgstr ""
|
551 |
|
552 |
-
#: plugin/Plugin.php:
|
553 |
msgid "Bottom"
|
554 |
msgstr ""
|
555 |
|
556 |
-
#: plugin/Plugin.php:
|
557 |
msgid "Thin"
|
558 |
msgstr ""
|
559 |
|
560 |
-
#: plugin/Plugin.php:
|
561 |
msgid "Extra Light"
|
562 |
msgstr ""
|
563 |
|
564 |
-
#: plugin/Plugin.php:
|
565 |
msgid "Light"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#: plugin/Plugin.php:
|
569 |
msgid "Normal"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#: plugin/Plugin.php:
|
573 |
msgid "Medium"
|
574 |
msgstr ""
|
575 |
|
576 |
-
#: plugin/Plugin.php:
|
577 |
msgid "Semi Bold"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: plugin/Plugin.php:
|
581 |
msgid "Bold"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: plugin/Plugin.php:
|
585 |
msgid "Extra Bold"
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: plugin/Plugin.php:
|
589 |
msgid "Heavy"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: plugin/Plugin.php:
|
593 |
msgid "Left"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: plugin/Plugin.php:
|
597 |
msgid "Right"
|
598 |
msgstr ""
|
599 |
|
600 |
-
#: plugin/Plugin.php:
|
601 |
msgid "Right without flow"
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: plugin/Plugin.php:
|
605 |
msgid "Center"
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: plugin/Plugin.php:
|
609 |
msgid "Light Colors"
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: plugin/Plugin.php:
|
613 |
msgid "Dark Colors"
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: plugin/Plugin.php:
|
617 |
msgid "White"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: plugin/Plugin.php:
|
621 |
msgid "Transparent"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: plugin/Plugin.php:
|
625 |
msgid "Inherit from theme"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: plugin/Plugin.php:
|
629 |
msgid "As heading (#Example_Heading_Text)"
|
630 |
msgstr ""
|
631 |
|
632 |
-
#: plugin/Plugin.php:
|
633 |
msgid "As heading without transliterate (#Example_Heading_Text)"
|
634 |
msgstr ""
|
635 |
|
636 |
-
#: plugin/Plugin.php:
|
637 |
#, php-format
|
638 |
msgid "Counter %s"
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: plugin/Plugin.php:
|
642 |
msgid "Auto"
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: plugin/Plugin.php:
|
646 |
msgid "Full Width"
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: plugin/Plugin.php:
|
650 |
msgid ""
|
651 |
"Creates a table of contents for your posts/pages. Works automatically or "
|
652 |
"manually (via shortcode, Gutenberg block or widget)."
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: \n"
|
4 |
+
"POT-Creation-Date: 2020-01-07 22:29+0300\n"
|
5 |
+
"PO-Revision-Date: 2020-01-07 22:29+0300\n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: ru_RU\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 2.2.4\n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
15 |
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPathExcluded-0: plugin/editorBlock/src\n"
|
19 |
|
20 |
+
#: admin/Admin.php:34 admin/SiteHealth.php:34
|
21 |
msgid "Settings"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: admin/Admin.php:54 admin/Admin.php:55 admin/Admin.php:75 admin/Admin.php:113
|
25 |
#: admin/controllers/EditorBlockController.php:65
|
26 |
+
#: admin/controllers/ShortcodeController.php:68 plugin/Plugin.php:464
|
27 |
+
#: plugin/WpWidget.php:22
|
28 |
msgid "Table of Contents"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: admin/Admin.php:115
|
32 |
msgid "Edit"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: admin/Admin.php:142 admin/forms/CustomizeForm.php:246
|
36 |
+
#: admin/widgets/customizeModal/views/modal.php:53 config/settings.php:305
|
37 |
msgid "Position"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: admin/Admin.php:145 admin/widgets/customizeModal/views/modal.php:76
|
41 |
#: config/settings.php:22
|
42 |
msgid "Minimal Count of Headings"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: admin/Admin.php:148 admin/forms/CustomizeForm.php:241
|
46 |
+
#: admin/widgets/customizeModal/views/modal.php:99 config/settings.php:34
|
47 |
msgid "Depth"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: admin/Admin.php:151 admin/widgets/customizeModal/views/modal.php:121
|
51 |
#: config/settings.php:43
|
52 |
msgid "Hierarchical View"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: admin/Admin.php:151 admin/Admin.php:163 admin/Admin.php:172
|
56 |
+
#: admin/Admin.php:175 admin/Admin.php:217 admin/Admin.php:227
|
57 |
+
#: admin/widgets/customizeModal/views/modal.php:137
|
58 |
+
#: admin/widgets/customizeModal/views/modal.php:230
|
59 |
+
#: admin/widgets/customizeModal/views/modal.php:293
|
60 |
+
#: admin/widgets/customizeModal/views/modal.php:316
|
61 |
+
#: admin/widgets/customizeModal/views/modal.php:601
|
62 |
+
#: admin/widgets/customizeModal/views/modal.php:628
|
63 |
msgid "Enabled"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: admin/Admin.php:151 admin/Admin.php:163 admin/Admin.php:172
|
67 |
+
#: admin/Admin.php:175 admin/Admin.php:217 admin/Admin.php:227
|
68 |
+
#: admin/widgets/customizeModal/views/modal.php:137
|
69 |
+
#: admin/widgets/customizeModal/views/modal.php:230
|
70 |
+
#: admin/widgets/customizeModal/views/modal.php:293
|
71 |
+
#: admin/widgets/customizeModal/views/modal.php:316
|
72 |
+
#: admin/widgets/customizeModal/views/modal.php:601
|
73 |
+
#: admin/widgets/customizeModal/views/modal.php:628
|
74 |
msgid "Disabled"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: admin/Admin.php:154 admin/forms/CustomizeForm.php:242
|
78 |
+
#: admin/widgets/customizeModal/views/modal.php:144 config/settings.php:54
|
79 |
msgid "Numeration"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: admin/Admin.php:157 admin/forms/CustomizeForm.php:243
|
83 |
+
#: admin/widgets/customizeModal/views/modal.php:166 config/settings.php:66
|
84 |
msgid "Numeration Suffix"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: admin/Admin.php:160 admin/widgets/customizeModal/views/modal.php:188
|
88 |
#: config/settings.php:89
|
89 |
msgid "Title"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: admin/Admin.php:163 admin/widgets/customizeModal/views/modal.php:214
|
93 |
#: config/settings.php:95
|
94 |
msgid "Toggle Show/Hide"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: admin/Admin.php:166 admin/forms/CustomizeForm.php:244
|
98 |
+
#: admin/widgets/customizeModal/views/modal.php:237 config/settings.php:107
|
99 |
msgid "Label Show"
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: admin/Admin.php:169 admin/forms/CustomizeForm.php:245
|
103 |
+
#: admin/widgets/customizeModal/views/modal.php:257 config/settings.php:118
|
104 |
msgid "Label Hide"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: admin/Admin.php:172
|
108 |
msgid "Hide Items"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: admin/Admin.php:175 admin/widgets/customizeModal/views/modal.php:300
|
112 |
#: config/settings.php:146
|
113 |
msgid "Smooth Scroll"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: admin/Admin.php:178 admin/widgets/customizeModal/views/modal.php:323
|
117 |
msgid "Smooth Scroll Offset Top"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: admin/Admin.php:181 admin/widgets/customizeModal/views/modal.php:347
|
121 |
#: config/settings.php:182
|
122 |
msgid "Width"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: admin/Admin.php:184 admin/forms/CustomizeForm.php:247
|
126 |
+
#: admin/widgets/customizeModal/views/modal.php:370 config/settings.php:194
|
127 |
msgid "Float"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: admin/Admin.php:187 admin/widgets/customizeModal/views/modal.php:392
|
131 |
#: config/settings.php:203
|
132 |
msgid "Title Font Size"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: admin/Admin.php:190 admin/forms/CustomizeForm.php:248
|
136 |
+
#: admin/widgets/customizeModal/views/modal.php:416 config/settings.php:216
|
137 |
msgid "Title Font Weight"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: admin/Admin.php:193 admin/widgets/customizeModal/views/modal.php:438
|
141 |
#: config/settings.php:225
|
142 |
msgid "Items Font Size"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: admin/Admin.php:196 admin/forms/CustomizeForm.php:249
|
146 |
+
#: admin/widgets/customizeModal/views/modal.php:462 config/settings.php:238
|
147 |
msgid "Color Scheme"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: admin/Admin.php:214 admin/widgets/customizeModal/views/modal.php:583
|
151 |
#: config/settings.php:447
|
152 |
#, php-format
|
153 |
msgid "Wrap table of contents with %s tag"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: admin/Admin.php:224 admin/widgets/customizeModal/views/modal.php:610
|
157 |
#: config/settings.php:462
|
158 |
#, php-format
|
159 |
msgid "Use %s for links"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: admin/Admin.php:231 admin/Admin.php:234
|
163 |
msgid "Skip headings"
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: admin/SiteHealth.php:26
|
167 |
+
msgid "DOM/XML Version"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: admin/SiteHealth.php:27 admin/SiteHealth.php:31
|
171 |
+
msgid "not loaded"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: admin/SiteHealth.php:30
|
175 |
+
msgid "libXML Version"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: admin/SiteHealth.php:35
|
179 |
+
msgid "encoded data to copy"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
#: admin/controllers/EditorBlockController.php:71
|
183 |
#: admin/controllers/ShortcodeController.php:74
|
184 |
+
#: admin/widgets/customizeModal/views/modal.php:570
|
185 |
#: admin/widgets/metabox/views/box.php:33
|
186 |
#: admin/widgets/widget/views/_override.php:18
|
187 |
msgid "empty"
|
230 |
msgid "from scheme"
|
231 |
msgstr ""
|
232 |
|
233 |
+
#: admin/widgets/customizeModal/views/modal.php:19
|
234 |
msgid "Click to override default value"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: admin/widgets/customizeModal/views/modal.php:28
|
238 |
+
#: admin/widgets/customizeModal/views/modal.php:637
|
239 |
msgid "Cancel"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: admin/widgets/customizeModal/views/modal.php:29
|
243 |
msgid "Customize Table of Contents"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: admin/widgets/customizeModal/views/modal.php:43 config/settings.php:16
|
247 |
msgid "General"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: admin/widgets/customizeModal/views/modal.php:44 config/settings.php:176
|
251 |
msgid "Appearance"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: admin/widgets/customizeModal/views/modal.php:45 config/settings.php:354
|
255 |
msgid "Misc."
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: admin/widgets/customizeModal/views/modal.php:54
|
259 |
+
#: admin/widgets/customizeModal/views/modal.php:77
|
260 |
+
#: admin/widgets/customizeModal/views/modal.php:100
|
261 |
+
#: admin/widgets/customizeModal/views/modal.php:122
|
262 |
+
#: admin/widgets/customizeModal/views/modal.php:145
|
263 |
+
#: admin/widgets/customizeModal/views/modal.php:167
|
264 |
+
#: admin/widgets/customizeModal/views/modal.php:189
|
265 |
+
#: admin/widgets/customizeModal/views/modal.php:215
|
266 |
+
#: admin/widgets/customizeModal/views/modal.php:238
|
267 |
+
#: admin/widgets/customizeModal/views/modal.php:258
|
268 |
+
#: admin/widgets/customizeModal/views/modal.php:278
|
269 |
+
#: admin/widgets/customizeModal/views/modal.php:301
|
270 |
+
#: admin/widgets/customizeModal/views/modal.php:324
|
271 |
+
#: admin/widgets/customizeModal/views/modal.php:348
|
272 |
+
#: admin/widgets/customizeModal/views/modal.php:371
|
273 |
+
#: admin/widgets/customizeModal/views/modal.php:393
|
274 |
+
#: admin/widgets/customizeModal/views/modal.php:417
|
275 |
+
#: admin/widgets/customizeModal/views/modal.php:439
|
276 |
+
#: admin/widgets/customizeModal/views/modal.php:463
|
277 |
+
#: admin/widgets/customizeModal/views/modal.php:493
|
278 |
+
#: admin/widgets/customizeModal/views/modal.php:518
|
279 |
+
#: admin/widgets/customizeModal/views/modal.php:541
|
280 |
+
#: admin/widgets/customizeModal/views/modal.php:586
|
281 |
+
#: admin/widgets/customizeModal/views/modal.php:613
|
282 |
msgid "default"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: admin/widgets/customizeModal/views/modal.php:89 config/settings.php:30
|
286 |
msgid ""
|
287 |
"If the count of headings in the post is less, then table of contents is not "
|
288 |
"displayed."
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: admin/widgets/customizeModal/views/modal.php:130
|
292 |
+
#: admin/widgets/customizeModal/views/modal.php:223
|
293 |
+
#: admin/widgets/customizeModal/views/modal.php:286
|
294 |
+
#: admin/widgets/customizeModal/views/modal.php:309
|
295 |
+
#: admin/widgets/customizeModal/views/modal.php:594
|
296 |
+
#: admin/widgets/customizeModal/views/modal.php:621 config/settings.php:47
|
297 |
#: config/settings.php:99 config/settings.php:150 config/settings.php:297
|
298 |
msgid "Enable"
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: admin/widgets/customizeModal/views/modal.php:203
|
302 |
msgid "Without title"
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: admin/widgets/customizeModal/views/modal.php:277 config/settings.php:133
|
306 |
msgid "By default, items of contents will be hidden"
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: admin/widgets/customizeModal/views/modal.php:517
|
310 |
msgid "Skip heading by level"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: admin/widgets/customizeModal/views/modal.php:540
|
314 |
msgid "Skip heading by text"
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: admin/widgets/customizeModal/views/modal.php:554 config/settings.php:378
|
318 |
msgid ""
|
319 |
"Specify headings (one per line) to be excluded from the table of contents."
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: admin/widgets/customizeModal/views/modal.php:558 config/settings.php:382
|
323 |
#, php-format
|
324 |
msgid "Use an asterisk %s as a wildcard to match any text."
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: admin/widgets/customizeModal/views/modal.php:641
|
328 |
msgid "Save"
|
329 |
msgstr ""
|
330 |
|
332 |
msgid "Saved!"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: admin/widgets/fontSizeField/views/widget.php:16 plugin/Plugin.php:323
|
336 |
msgid "Default"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: admin/widgets/fontSizeField/views/widget.php:17 plugin/Plugin.php:288
|
340 |
msgid "Custom Value"
|
341 |
msgstr ""
|
342 |
|
525 |
msgid "%s cannot be blank."
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: luckywp-table-of-contents.php:33
|
529 |
+
#, php-format
|
530 |
+
msgid "%1$s plugin require PHP extension %2$s to work."
|
531 |
+
msgstr ""
|
532 |
+
|
533 |
+
#: plugin/Plugin.php:140
|
534 |
msgid "Without numeration"
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: plugin/Plugin.php:141
|
538 |
msgid "Decimal numbers (nested)"
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: plugin/Plugin.php:142
|
542 |
msgid "Decimal numbers"
|
543 |
msgstr ""
|
544 |
|
545 |
+
#: plugin/Plugin.php:143
|
546 |
msgid "Roman numbers (nested)"
|
547 |
msgstr ""
|
548 |
|
549 |
+
#: plugin/Plugin.php:144
|
550 |
msgid "Roman numbers"
|
551 |
msgstr ""
|
552 |
|
553 |
+
#: plugin/Plugin.php:154 plugin/Plugin.php:241 plugin/Plugin.php:385
|
554 |
msgid "None"
|
555 |
msgstr ""
|
556 |
|
557 |
+
#: plugin/Plugin.php:166
|
558 |
msgid "Before first heading"
|
559 |
msgstr ""
|
560 |
|
561 |
+
#: plugin/Plugin.php:167
|
562 |
msgid "After first heading"
|
563 |
msgstr ""
|
564 |
|
565 |
+
#: plugin/Plugin.php:168
|
566 |
msgid "After first block (paragraph or heading)"
|
567 |
msgstr ""
|
568 |
|
569 |
+
#: plugin/Plugin.php:169
|
570 |
msgid "Top"
|
571 |
msgstr ""
|
572 |
|
573 |
+
#: plugin/Plugin.php:170
|
574 |
msgid "Bottom"
|
575 |
msgstr ""
|
576 |
|
577 |
+
#: plugin/Plugin.php:204
|
578 |
msgid "Thin"
|
579 |
msgstr ""
|
580 |
|
581 |
+
#: plugin/Plugin.php:205
|
582 |
msgid "Extra Light"
|
583 |
msgstr ""
|
584 |
|
585 |
+
#: plugin/Plugin.php:206
|
586 |
msgid "Light"
|
587 |
msgstr ""
|
588 |
|
589 |
+
#: plugin/Plugin.php:207
|
590 |
msgid "Normal"
|
591 |
msgstr ""
|
592 |
|
593 |
+
#: plugin/Plugin.php:208
|
594 |
msgid "Medium"
|
595 |
msgstr ""
|
596 |
|
597 |
+
#: plugin/Plugin.php:209
|
598 |
msgid "Semi Bold"
|
599 |
msgstr ""
|
600 |
|
601 |
+
#: plugin/Plugin.php:210
|
602 |
msgid "Bold"
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: plugin/Plugin.php:211
|
606 |
msgid "Extra Bold"
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: plugin/Plugin.php:212
|
610 |
msgid "Heavy"
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: plugin/Plugin.php:242
|
614 |
msgid "Left"
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: plugin/Plugin.php:243
|
618 |
msgid "Right"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: plugin/Plugin.php:244
|
622 |
msgid "Right without flow"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: plugin/Plugin.php:245
|
626 |
msgid "Center"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: plugin/Plugin.php:255
|
630 |
msgid "Light Colors"
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: plugin/Plugin.php:256
|
634 |
msgid "Dark Colors"
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: plugin/Plugin.php:257
|
638 |
msgid "White"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: plugin/Plugin.php:258
|
642 |
msgid "Transparent"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: plugin/Plugin.php:259
|
646 |
msgid "Inherit from theme"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: plugin/Plugin.php:269
|
650 |
msgid "As heading (#Example_Heading_Text)"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: plugin/Plugin.php:270
|
654 |
msgid "As heading without transliterate (#Example_Heading_Text)"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: plugin/Plugin.php:273
|
658 |
#, php-format
|
659 |
msgid "Counter %s"
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: plugin/Plugin.php:286
|
663 |
msgid "Auto"
|
664 |
msgstr ""
|
665 |
|
666 |
+
#: plugin/Plugin.php:287
|
667 |
msgid "Full Width"
|
668 |
msgstr ""
|
669 |
|
670 |
+
#: plugin/Plugin.php:469
|
671 |
msgid ""
|
672 |
"Creates a table of contents for your posts/pages. Works automatically or "
|
673 |
"manually (via shortcode, Gutenberg block or widget)."
|
luckywp-table-of-contents.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: LuckyWP Table of Contents
|
4 |
Plugin URI: https://theluckywp.com/product/table-of-contents/
|
5 |
Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
|
6 |
-
Version:
|
7 |
Author: LuckyWP
|
8 |
Author URI: https://theluckywp.com/
|
9 |
Text Domain: luckywp-table-of-contents
|
@@ -23,12 +23,30 @@ You should have received a copy of the GNU General Public License
|
|
23 |
along with LuckyWP Table of Contents. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
|
24 |
*/
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
require 'lwptocAutoloader.php';
|
27 |
$lwptocAutoloader = new lwptocAutoloader();
|
28 |
$lwptocAutoloader->register();
|
29 |
$lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
|
30 |
|
31 |
$config = require(__DIR__ . '/config/plugin.php');
|
32 |
-
(new \luckywp\tableOfContents\plugin\Plugin($config))->run('
|
33 |
|
34 |
require_once __DIR__ . '/functions.php';
|
3 |
Plugin Name: LuckyWP Table of Contents
|
4 |
Plugin URI: https://theluckywp.com/product/table-of-contents/
|
5 |
Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
|
6 |
+
Version: 2.0.1
|
7 |
Author: LuckyWP
|
8 |
Author URI: https://theluckywp.com/
|
9 |
Text Domain: luckywp-table-of-contents
|
23 |
along with LuckyWP Table of Contents. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
|
24 |
*/
|
25 |
|
26 |
+
if (!extension_loaded('dom')) {
|
27 |
+
add_action('admin_notices', function () {
|
28 |
+
?>
|
29 |
+
<div class="notice notice-error">
|
30 |
+
<p>
|
31 |
+
<?= sprintf(
|
32 |
+
/* translators: 1: LuckyWP Table of Contents 2: DOM (Document Object Model) */
|
33 |
+
esc_html__('%1$s plugin require PHP extension %2$s to work.', 'luckywp-table-of-contents'),
|
34 |
+
'LuckyWP Table of Contents',
|
35 |
+
' <b>DOM (Document Object Model)</b>'
|
36 |
+
) ?>
|
37 |
+
</p>
|
38 |
+
</div>
|
39 |
+
<?php
|
40 |
+
});
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
require 'lwptocAutoloader.php';
|
45 |
$lwptocAutoloader = new lwptocAutoloader();
|
46 |
$lwptocAutoloader->register();
|
47 |
$lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
|
48 |
|
49 |
$config = require(__DIR__ . '/config/plugin.php');
|
50 |
+
(new \luckywp\tableOfContents\plugin\Plugin($config))->run('2.0.1', __FILE__, 'lwptoc_');
|
51 |
|
52 |
require_once __DIR__ . '/functions.php';
|
plugin/Dom.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace luckywp\tableOfContents\plugin;
|
4 |
+
|
5 |
+
use DOMDocument;
|
6 |
+
|
7 |
+
class Dom
|
8 |
+
{
|
9 |
+
|
10 |
+
const BODY_ID = 'LuckyWPDomDocumentTableOfContentsBody';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @param string $content
|
14 |
+
* @return DOMDocument|false
|
15 |
+
*/
|
16 |
+
public static function make($content)
|
17 |
+
{
|
18 |
+
$dom = new DOMDocument();
|
19 |
+
libxml_use_internal_errors(true);
|
20 |
+
if (!$dom->loadHTML('<!DOCTYPE html><html><head><meta charset="' . get_bloginfo('charset') . '"></head><body id="' . static::BODY_ID . '">' . $content . '</body></html>')) {
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
libxml_clear_errors();
|
24 |
+
return $dom;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param DOMDocument $dom
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
public static function getBody($dom)
|
32 |
+
{
|
33 |
+
$content = '';
|
34 |
+
foreach ($dom->getElementById(static::BODY_ID)->childNodes as $node) {
|
35 |
+
$content .= $dom->saveHTML($node);
|
36 |
+
}
|
37 |
+
return $content;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @param \DOMNode $node
|
42 |
+
* @param string $html
|
43 |
+
*/
|
44 |
+
public static function beforeNodeInsertHtml($node, $html)
|
45 |
+
{
|
46 |
+
static::nodeInsertHtml($node, $html, true);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param \DOMNode $node
|
51 |
+
* @param string $html
|
52 |
+
*/
|
53 |
+
public static function afterNodeInsertHtml($node, $html)
|
54 |
+
{
|
55 |
+
static::nodeInsertHtml($node, $html, false);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param \DOMNode $node
|
60 |
+
* @param string $html
|
61 |
+
* @param bool $before
|
62 |
+
*/
|
63 |
+
protected static function nodeInsertHtml($node, $html, $before)
|
64 |
+
{
|
65 |
+
$dom = static::make($html);
|
66 |
+
if ($dom !== false) {
|
67 |
+
foreach ($dom->getElementById(static::BODY_ID)->childNodes as $newNode) {
|
68 |
+
$node->parentNode->insertBefore($node->ownerDocument->importNode($newNode, true), $before ? $node : $node->nextSibling);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
plugin/contentHandling/ContentHandling.php
CHANGED
@@ -2,8 +2,9 @@
|
|
2 |
|
3 |
namespace luckywp\tableOfContents\plugin\contentHandling;
|
4 |
|
|
|
5 |
use luckywp\tableOfContents\core\Core;
|
6 |
-
use luckywp\tableOfContents\
|
7 |
|
8 |
class ContentHandling
|
9 |
{
|
@@ -21,30 +22,51 @@ class ContentHandling
|
|
21 |
|
22 |
static::$headingIdCounter = 0;
|
23 |
static::$headingIds = [];
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
if ($label == '') {
|
27 |
-
|
28 |
}
|
29 |
|
30 |
-
$
|
31 |
-
|
|
|
32 |
|
33 |
$result->headings[] = [
|
34 |
-
'id' => $
|
35 |
-
'index' => $
|
36 |
'label' => $label,
|
37 |
];
|
38 |
|
39 |
if (!$dto->modify ||
|
40 |
-
in_array('h' . $
|
41 |
($skipRegex && preg_match($skipRegex, $label))
|
42 |
) {
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
}, $dto->content);
|
48 |
|
49 |
return $result;
|
50 |
}
|
2 |
|
3 |
namespace luckywp\tableOfContents\plugin\contentHandling;
|
4 |
|
5 |
+
use DOMXPath;
|
6 |
use luckywp\tableOfContents\core\Core;
|
7 |
+
use luckywp\tableOfContents\plugin\Dom;
|
8 |
|
9 |
class ContentHandling
|
10 |
{
|
22 |
|
23 |
static::$headingIdCounter = 0;
|
24 |
static::$headingIds = [];
|
25 |
+
|
26 |
+
$dom = Dom::make($dto->content);
|
27 |
+
if ($dom === false) {
|
28 |
+
return $result;
|
29 |
+
}
|
30 |
+
|
31 |
+
$xpath = new DOMXPath($dom);
|
32 |
+
$headingNodes = $xpath->query('//h1|//h2|//h3|//h4|//h5|//h6');
|
33 |
+
|
34 |
+
// Собираем все заголовки
|
35 |
+
foreach ($headingNodes as $node) {
|
36 |
+
/** @var $node \DOMElement */
|
37 |
+
|
38 |
+
$label = trim($node->nodeValue);
|
39 |
if ($label == '') {
|
40 |
+
continue;
|
41 |
}
|
42 |
|
43 |
+
$id = static::makeHeadingId($label, $dto);
|
44 |
+
|
45 |
+
$index = (int)mb_substr($node->nodeName, 1, 1);
|
46 |
|
47 |
$result->headings[] = [
|
48 |
+
'id' => $id,
|
49 |
+
'index' => $index,
|
50 |
'label' => $label,
|
51 |
];
|
52 |
|
53 |
if (!$dto->modify ||
|
54 |
+
in_array('h' . $index, $dto->skipLevels) ||
|
55 |
($skipRegex && preg_match($skipRegex, $label))
|
56 |
) {
|
57 |
+
continue;
|
58 |
+
}
|
59 |
+
|
60 |
+
$span = $dom->createElement('span');
|
61 |
+
$span->setAttribute('id', $id);
|
62 |
+
while ($node->childNodes->length) {
|
63 |
+
$span->appendChild($node->firstChild);
|
64 |
}
|
65 |
+
$node->nodeValue = '';
|
66 |
+
$node->appendChild($span);
|
67 |
+
}
|
68 |
|
69 |
+
$result->content = Dom::getBody($dom);
|
|
|
70 |
|
71 |
return $result;
|
72 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: theluckywp
|
|
3 |
Donate link: https://theluckywp.com/product/table-of-contents/
|
4 |
Tags: table of contents, toc, navigation, links, seo
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.3
|
7 |
Stable tag: 1.9.11
|
8 |
Requires PHP: 5.6.20
|
9 |
License: GPLv2 or later
|
@@ -151,6 +151,17 @@ For non-English websites it is recommended to enable the `Intl` PHP extension.
|
|
151 |
|
152 |
== Changelog ==
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
= 1.9.11 — 2019-11-18 =
|
155 |
+ Added hook filters `lwptoc_force_wp_transliterate` and `lwptoc_transliterator`.
|
156 |
* Fixed: in some cases for table of contents used a non-current post.
|
3 |
Donate link: https://theluckywp.com/product/table-of-contents/
|
4 |
Tags: table of contents, toc, navigation, links, seo
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.3.2
|
7 |
Stable tag: 1.9.11
|
8 |
Requires PHP: 5.6.20
|
9 |
License: GPLv2 or later
|
151 |
|
152 |
== Changelog ==
|
153 |
|
154 |
+
= 2.0.1 — 2020-01-08 =
|
155 |
+
* Fixed: in some cases headings processing incorrectly.
|
156 |
+
|
157 |
+
= 2.0 — 2020-01-07 =
|
158 |
+
+ Added debugging information for "Site Health" tool.
|
159 |
+
* CSS and JS are included only when table of content is displayed.
|
160 |
+
* Removed dependency to jQuery on frontend.
|
161 |
+
* Redesigned automatic insertion of table of contents using the PHP extension DOM (Document Object Model).
|
162 |
+
* Redesigned processing headings using the PHP extension DOM (Document Object Model).
|
163 |
+
* Minor enhancements in CSS.
|
164 |
+
|
165 |
= 1.9.11 — 2019-11-18 =
|
166 |
+ Added hook filters `lwptoc_force_wp_transliterate` and `lwptoc_transliterator`.
|
167 |
* Fixed: in some cases for table of contents used a non-current post.
|