| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: SimpleTOC - Table of Contents Block |
| 4 | 4 | * Plugin URI: https://marc.tv/simpletoc-wordpress-inhaltsverzeichnis-plugin-gutenberg/ |
| 5 | 5 | * Description: SEO-friendly Table of Contents Gutenberg block. No JavaScript or CSS by default. |
| 6 | - * Version: 7.2.0 | |
| 6 | + * Version: 7.3.1 | |
| 7 | 7 | * Requires at least: 6.2 |
| 8 | 8 | * Requires PHP: 7.3 |
| 9 | 9 | * Author: Marc Tönsing |
| 10 | 10 | * Author URI: https://toensing.com |
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | require_once __DIR__ . '/simpletoc-admin-settings.php'; |
| 21 | 21 | require_once __DIR__ . '/simpletoc-class-headline-ids.php'; |
| 22 | 22 | |
| 23 | 23 | const DEFAULT_BOX_COLOR = '#ebebeb'; |
| 24 | -const SIMPLETOC_VERSION = '7.2.0'; | |
| 24 | +const SIMPLETOC_VERSION = '7.3.1'; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Prevents direct execution of the plugin file. |
| 28 | 28 | * If a WordPress function does not exist, it means that the file has not been run by WordPress. |
| @@ -246,9 +246,9 @@ | ||
| 246 | 246 | $title_text = $attributes['title_text'] ? esc_html( trim( $attributes['title_text'] ) ) : __( 'Table of Contents', 'simpletoc' ); |
| 247 | 247 | $alignclass = ! empty( $attributes['align'] ) ? 'align' . $attributes['align'] : ''; |
| 248 | 248 | $title_level = $attributes['title_level']; |
| 249 | 249 | $global_box_style_enabled = apply_filters( 'simpletoc_box_style_enabled', false ) || true === (bool) get_option( 'simpletoc_box_style_enabled', false ); |
| 250 | - $box_style_enabled = $global_box_style_enabled || ! empty( $attributes['box_style'] ); | |
| 250 | + $legacy_box_style_enabled = ! empty( $attributes['box_style'] ); | |
| 251 | 251 | $typography_enabled = ! empty( $attributes['fontSize'] ) || ! empty( $attributes['style']['typography'] ); |
| 252 | 252 | $wrapper_classes = array( 'simpletoc' ); |
| 253 | 253 | $wrapper_style = ''; |
| 254 | 254 | |
| @@ -255,14 +255,15 @@ | ||
| 255 | 255 | if ( $typography_enabled ) { |
| 256 | 256 | $wrapper_classes[] = 'has-simpletoc-typography'; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( $box_style_enabled ) { | |
| 259 | + if ( $global_box_style_enabled || $legacy_box_style_enabled ) { | |
| 260 | + $wrapper_classes[] = 'is-style-boxed'; | |
| 260 | 261 | $wrapper_classes[] = 'has-simpletoc-box-style'; |
| 261 | 262 | |
| 262 | 263 | if ( $global_box_style_enabled ) { |
| 263 | 264 | $wrapper_classes[] = 'has-background'; |
| 264 | - $wrapper_style = safecss_filter_attr( 'background-color:' . DEFAULT_BOX_COLOR . ';' ); | |
| 265 | + $wrapper_style = safecss_filter_attr( 'background-color:' . DEFAULT_BOX_COLOR . ';' ); | |
| 265 | 266 | } elseif ( ! empty( $attributes['box_color'] ) ) { |
| 266 | 267 | $wrapper_classes[] = 'has-background'; |
| 267 | 268 | $wrapper_style = safecss_filter_attr( 'background-color:' . $attributes['box_color'] . ';' ); |
| 268 | 269 | } else { |
| @@ -474,12 +475,11 @@ | ||
| 474 | 475 | $html_wo_nbs = str_replace( ' ', ' ', $zero_punctuation ); |
| 475 | 476 | // remove umlauts and accents. |
| 476 | 477 | $string_without_accents = remove_accents( $html_wo_nbs ); |
| 477 | 478 | // Sanitizes a title, replacing whitespace and a few other characters with dashes. |
| 478 | - $sanitized_string = sanitize_title_with_dashes( $string_without_accents ); | |
| 479 | - // Encode for use in an url. | |
| 480 | - $urlencoded = rawurlencode( $sanitized_string ); | |
| 481 | - return $urlencoded; | |
| 479 | + // Already returns a URL-safe, percent-encoded slug for non-ASCII input, so no | |
| 480 | + // further rawurlencode() is needed (that would double-encode the string). | |
| 481 | + return sanitize_title_with_dashes( $string_without_accents ); | |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | 485 | * Add additional plugin meta links to the SimpleTOC plugin page. |