diff --git a/gdpr-content-blocker/assets/frontend.css b/gdpr-content-blocker/assets/frontend.css index af867d8..556cb2f 100644 --- a/gdpr-content-blocker/assets/frontend.css +++ b/gdpr-content-blocker/assets/frontend.css @@ -34,19 +34,28 @@ /* No reserved height: the placeholder is exactly as tall as its content. */ } -/* ── Promo badge (bottom-right) ── */ -.cb-blocker .cb-blocker__badge { +/* ── Promo badge (bottom-right) ── (locked against theme a:hover scaling) */ +.cb-blocker .cb-blocker__badge, +.cb-blocker .cb-blocker__badge:hover, +.cb-blocker .cb-blocker__badge:focus { position: absolute; right: 8px; bottom: 5px; font-size: 0.6875rem; line-height: 1; + font-weight: 400; + letter-spacing: normal; color: var(--cb-text); + background: none; + white-space: nowrap; + transform: none; +} +.cb-blocker .cb-blocker__badge { opacity: 0.55; text-decoration: none; - white-space: nowrap; } -.cb-blocker .cb-blocker__badge:hover { +.cb-blocker .cb-blocker__badge:hover, +.cb-blocker .cb-blocker__badge:focus { opacity: 1; text-decoration: underline; } @@ -55,7 +64,7 @@ .cb-blocker .cb-blocker__inner { width: 100%; max-width: 520px; - text-align: center; + text-align: var(--cb-align, center); /* set in Appearance: center|left|right */ } /* ── Text elements ── */ @@ -79,23 +88,22 @@ color: var(--cb-text); /* same colour as the rest of the text */ } -/* ── Privacy link ── */ -.cb-blocker .cb-blocker__privacy-link { +/* ── Privacy link ── (locked so the theme's a:hover can't restyle/resize it) */ +.cb-blocker .cb-blocker__privacy-link, +.cb-blocker .cb-blocker__privacy-link:hover, +.cb-blocker .cb-blocker__privacy-link:focus { display: inline-block; margin-bottom: 0.75em; font-size: 0.8125rem; line-height: 1.5; + font-weight: 400; + letter-spacing: normal; color: var(--cb-btn-bg); + background: none; text-decoration: underline; + text-decoration-thickness: 1px; text-underline-offset: 3px; - transform: none; /* neutralise theme hover scaling */ -} - -.cb-blocker .cb-blocker__privacy-link:hover, -.cb-blocker .cb-blocker__privacy-link:focus { - color: var(--cb-btn-hover-bg); - transform: none; /* link must not grow on hover */ - font-size: 0.8125rem; + transform: none; } /* ── Button ── */ @@ -137,11 +145,11 @@ .cb-blocker .cb-blocker__remember { display: flex; align-items: center; - justify-content: center; + justify-content: var(--cb-justify, center); /* follows the text alignment */ gap: 6px; margin-top: 0.8em; font-size: 0.8rem; - opacity: 0.85; + color: var(--cb-text); /* same colour as the rest of the text */ cursor: pointer; } .cb-blocker .cb-blocker__remember input { diff --git a/gdpr-content-blocker/assets/icon.png b/gdpr-content-blocker/assets/icon.png new file mode 100644 index 0000000..393110b Binary files /dev/null and b/gdpr-content-blocker/assets/icon.png differ diff --git a/gdpr-content-blocker/gdpr-content-blocker.php b/gdpr-content-blocker/gdpr-content-blocker.php index 6c7a30c..b509d5e 100644 --- a/gdpr-content-blocker/gdpr-content-blocker.php +++ b/gdpr-content-blocker/gdpr-content-blocker.php @@ -3,7 +3,7 @@ * Plugin Name: GDPR Content Blocker * Plugin URI: https://lucas-orth.de/wp-plugins/gdpr-content-blocker/ * Description: DSGVO-konformer Consent-Blocker für externe iframes. Lädt Drittinhalte erst nach aktiver Einwilligung. - * Version: 1.5.1 + * Version: 1.5.2 * Author: Lucas Orth * Author URI: https://lucas-orth.de * Text Domain: gdpr-content-blocker @@ -15,7 +15,7 @@ defined( 'ABSPATH' ) || exit; -define( 'CB_VERSION', '1.5.1' ); +define( 'CB_VERSION', '1.5.2' ); define( 'CB_FILE', __FILE__ ); define( 'CB_DIR', plugin_dir_path( __FILE__ ) ); define( 'CB_URL', plugin_dir_url( __FILE__ ) ); diff --git a/gdpr-content-blocker/includes/class-renderer.php b/gdpr-content-blocker/includes/class-renderer.php index d5c6027..2a47133 100644 --- a/gdpr-content-blocker/includes/class-renderer.php +++ b/gdpr-content-blocker/includes/class-renderer.php @@ -80,14 +80,19 @@ class CB_Renderer { // Build one inline block: CSS variables first, the user's Custom-CSS LAST // so it always overrides. Emitted as a single wp_add_inline_style call. + $align = in_array( $style['text_align'] ?? 'center', [ 'left', 'center', 'right' ], true ) ? $style['text_align'] : 'center'; + $justify = [ 'left' => 'flex-start', 'center' => 'center', 'right' => 'flex-end' ][ $align ]; + $inline = sprintf( - ':root{--cb-text:%s;--cb-bg:%s;--cb-btn-bg:%s;--cb-btn-text:%s;--cb-btn-hover-bg:%s;--cb-btn-hover-text:%s;}', + ':root{--cb-text:%s;--cb-bg:%s;--cb-btn-bg:%s;--cb-btn-text:%s;--cb-btn-hover-bg:%s;--cb-btn-hover-text:%s;--cb-align:%s;--cb-justify:%s;}', esc_attr( $style['text_color'] ), esc_attr( $style['bg_color'] ), esc_attr( $style['button_bg'] ), esc_attr( $style['button_text'] ), esc_attr( $style['button_hover_bg'] ), - esc_attr( $style['button_hover_text'] ) + esc_attr( $style['button_hover_text'] ), + esc_attr( $align ), + esc_attr( $justify ) ); if ( trim( (string) $style['custom_css'] ) !== '' ) { diff --git a/gdpr-content-blocker/includes/class-settings.php b/gdpr-content-blocker/includes/class-settings.php index 244e0a8..ba31145 100644 --- a/gdpr-content-blocker/includes/class-settings.php +++ b/gdpr-content-blocker/includes/class-settings.php @@ -47,6 +47,9 @@ class CB_Settings { $val = isset( $input[ $key ] ) ? sanitize_text_field( $input[ $key ] ) : ''; $clean[ $key ] = self::sanitize_hex_color( $val ) ?? $defaults[ $key ]; } + $align = $input['text_align'] ?? 'center'; + $clean['text_align'] = in_array( $align, [ 'left', 'center', 'right' ], true ) ? $align : 'center'; + $clean['custom_css'] = isset( $input['custom_css'] ) ? wp_strip_all_tags( $input['custom_css'] ) : ''; @@ -71,6 +74,7 @@ class CB_Settings { 'button_text' => '#ffffff', 'button_hover_bg' => '#1a369a', 'button_hover_text' => '#ffffff', + 'text_align' => 'center', 'custom_css' => '', 'hide_badge' => false, ]; @@ -670,6 +674,20 @@ class CB_Settings { echo '