LuckyWP Table of Contents - Version 1.0.1

Version Description

  • Bug fix
Download this release

Release Info

Developer theluckywp
Plugin Icon 128x128 LuckyWP Table of Contents
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

admin/widgets/fontSizeField/FontSizeField.php CHANGED
@@ -29,7 +29,7 @@ class FontSizeField extends Widget
29
  $size = $this->defaultSize;
30
  $unit = '%';
31
 
32
- $value = Core::$plugin->settings->sanitizeFontSize((string)$this->value, $matches);
33
  if ($value !== 'default') {
34
  $type = 'custom';
35
  $size = $matches[1];
29
  $size = $this->defaultSize;
30
  $unit = '%';
31
 
32
+ $value = Core::$plugin->settings->prepareFontSize((string)$this->value, $matches);
33
  if ($value !== 'default') {
34
  $type = 'custom';
35
  $size = $matches[1];
admin/widgets/widthField/WidthField.php CHANGED
@@ -23,7 +23,7 @@ class WidthField extends Widget
23
  $size = 75;
24
  $unit = '%';
25
 
26
- $value = Core::$plugin->settings->sanitizeWidth((string)$this->value, $matches);
27
  if (Core::$plugin->isCustomWidth($value)) {
28
  $type = 'custom';
29
  $size = $matches[1];
23
  $size = 75;
24
  $unit = '%';
25
 
26
+ $value = Core::$plugin->settings->prepareWidth((string)$this->value, $matches);
27
  if (Core::$plugin->isCustomWidth($value)) {
28
  $type = 'custom';
29
  $size = $matches[1];
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 or Gutenberg block).
6
- Version: 1.0.0
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: lwptoc
@@ -29,6 +29,6 @@ $lwptocAutoloader->register();
29
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
30
 
31
  $config = require(__DIR__ . '/config/plugin.php');
32
- (new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.0.0', __FILE__, 'lwptoc_');
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 or Gutenberg block).
6
+ Version: 1.0.1
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: lwptoc
29
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
30
 
31
  $config = require(__DIR__ . '/config/plugin.php');
32
+ (new \luckywp\tableOfContents\plugin\Plugin($config))->run('1.0.1', __FILE__, 'lwptoc_');
33
 
34
  require_once __DIR__ . '/functions.php';
plugin/Settings.php CHANGED
@@ -272,10 +272,19 @@ class Settings extends \luckywp\tableOfContents\core\wp\Settings
272
 
273
  /**
274
  * @param string $value
275
- * @param null $matches
276
  * @return string
277
  */
278
- public function sanitizeWidth($value, &$matches = null)
 
 
 
 
 
 
 
 
 
 
279
  {
280
  if (!Core::$plugin->isCustomWidth($value)) {
281
  return $value;
@@ -286,12 +295,21 @@ class Settings extends \luckywp\tableOfContents\core\wp\Settings
286
  return 'auto';
287
  }
288
 
 
 
 
 
 
 
 
 
 
289
  /**
290
  * @param string $value
291
  * @param null $matches
292
  * @return string
293
  */
294
- public function sanitizeFontSize($value, &$matches = null)
295
  {
296
  if (preg_match('/^(\d+|\d+\.\d+)(' . implode('|', array_keys(Core::$plugin->fontSizeUnitsList)) . ')$/', $value, $matches)) {
297
  return $value;
272
 
273
  /**
274
  * @param string $value
 
275
  * @return string
276
  */
277
+ public function sanitizeWidth($value)
278
+ {
279
+ return $this->prepareWidth($value, $matches);
280
+ }
281
+
282
+ /**
283
+ * @param string $value
284
+ * @param mixed $matches
285
+ * @return string
286
+ */
287
+ public function prepareWidth($value, &$matches)
288
  {
289
  if (!Core::$plugin->isCustomWidth($value)) {
290
  return $value;
295
  return 'auto';
296
  }
297
 
298
+ /**
299
+ * @param string $value
300
+ * @return string
301
+ */
302
+ public function sanitizeFontSize($value)
303
+ {
304
+ return $this->prepareFontSize($value, $matches);
305
+ }
306
+
307
  /**
308
  * @param string $value
309
  * @param null $matches
310
  * @return string
311
  */
312
+ public function prepareFontSize($value, &$matches)
313
  {
314
  if (preg_match('/^(\d+|\d+\.\d+)(' . implode('|', array_keys(Core::$plugin->fontSizeUnitsList)) . ')$/', $value, $matches)) {
315
  return $value;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://theluckywp.com/product/table-of-contents/
4
  Tags: table of contents, toc, navigation, links, heading
5
  Requires at least: 4.7
6
  Tested up to: 5.0
7
- Stable tag: 1.0.0
8
  Requires PHP: 5.4.45
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -85,4 +85,9 @@ The menu item "Table of Contents" will appear in the menu "Settings" of the Word
85
  5. Examples of Color Solutions
86
  6. General Settings
87
  7. Appearance Settings
88
- 8. Auto Insert Settings
 
 
 
 
 
4
  Tags: table of contents, toc, navigation, links, heading
5
  Requires at least: 4.7
6
  Tested up to: 5.0
7
+ Stable tag: 1.0.1
8
  Requires PHP: 5.4.45
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
85
  5. Examples of Color Solutions
86
  6. General Settings
87
  7. Appearance Settings
88
+ 8. Auto Insert Settings
89
+
90
+ == Changelog ==
91
+
92
+ = 1.0.1 =
93
+ * Bug fix