From c796400492e6f824e3ad5984d23046a3a33a138d Mon Sep 17 00:00:00 2001 From: s4luorth Date: Mon, 8 Jun 2026 14:00:22 +0200 Subject: [PATCH] feat: dienst-ID im Dienste-tab anzeigen + shortcode-hilfe fuer text/style (v1.4.9) - Unter jedem dienstnamen wird jetzt die auto-erzeugte ID angezeigt (z. B. "ID: eigenes-matomo") - kopierbar, fuer den consent-shortcode. Bei neuen diensten live-vorschau aus dem namen (slugify, spiegelt sanitize_title); bei gespeicherten die stabile ID. - Shortcode-tab: [content_blocker_consent] erklaert jetzt id/text/style einzeln mit beispielen (button vs. link). + i18n DE/EN ergaenzt (131 strings). version 1.4.9. Co-Authored-By: Claude Opus 4.8 --- gdpr-content-blocker/assets/admin.js | 22 +++++++++++ gdpr-content-blocker/gdpr-content-blocker.php | 4 +- .../includes/class-settings.php | 37 ++++++++++++++++-- .../languages/gdpr-content-blocker-en_US.mo | Bin 12868 -> 13319 bytes .../languages/gdpr-content-blocker-en_US.po | 16 +++++++- hilfsdaten/strings.txt | 8 +++- hilfsdaten/translations-en.json | 8 +++- 7 files changed, 83 insertions(+), 12 deletions(-) diff --git a/gdpr-content-blocker/assets/admin.js b/gdpr-content-blocker/assets/admin.js index 74a84b7..5523045 100644 --- a/gdpr-content-blocker/assets/admin.js +++ b/gdpr-content-blocker/assets/admin.js @@ -16,9 +16,29 @@ const name = ( $( '.cb-input-name', box ).val() || '' ).trim(); $( '.cb-service-title', box ).first().text( name || ( cbAdmin.newServiceLbl || 'Neuer Dienst' ) ); } + + /* ── Slugify a name to an id (mirrors PHP sanitize_title closely enough). ── */ + function slugify( s ) { + return ( s || '' ).toString().trim().toLowerCase() + .replace( /ä/g, 'a' ).replace( /ö/g, 'o' ).replace( /ü/g, 'u' ).replace( /ß/g, 'ss' ) + .replace( /[^a-z0-9]+/g, '-' ) + .replace( /^-+|-+$/g, '' ); + } + + /* ── Show the service id (stable for saved services, live preview for new). ── */ + function updateId( box ) { + let id = ( $( '.cb-input-id', box ).val() || '' ).trim(); + if ( ! id ) { + id = slugify( $( '.cb-input-name', box ).val() ); + } + $( '.cb-service-id', box ).text( id ); + $( '.cb-service-idline', box ).toggle( !! id ); + } + function bindNameSync( box ) { $( '.cb-input-name', box ).on( 'input', function () { syncTitle( box ); + updateId( box ); } ); } @@ -67,6 +87,7 @@ } setExpanded( $box, true ); // new rows start expanded for editing syncTitle( $box ); + updateId( $box ); return $box; } @@ -274,6 +295,7 @@ $( '#cb-services-list .cb-service-box' ).each( function () { bindNameSync( this ); bindToggle( this ); + updateId( this ); $( '.cb-remove-service', this ).on( 'click', handleRemove ); } ); diff --git a/gdpr-content-blocker/gdpr-content-blocker.php b/gdpr-content-blocker/gdpr-content-blocker.php index ac1e565..b067506 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 * Description: DSGVO-konformer Consent-Blocker für externe iframes. Lädt Drittinhalte erst nach aktiver Einwilligung. - * Version: 1.4.8 + * Version: 1.4.9 * 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.4.8' ); +define( 'CB_VERSION', '1.4.9' ); 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-settings.php b/gdpr-content-blocker/includes/class-settings.php index adeca90..03e6e60 100644 --- a/gdpr-content-blocker/includes/class-settings.php +++ b/gdpr-content-blocker/includes/class-settings.php @@ -384,12 +384,33 @@ class CB_Settings { padding: 4px 6px; color: #50575e; } - .cb-admin-wrap .cb-service-title { + .cb-admin-wrap .cb-service-headmain { flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 1px; + } + .cb-admin-wrap .cb-service-title { font-weight: 600; cursor: pointer; user-select: none; } + .cb-admin-wrap .cb-service-idline { + font-size: 11px; + color: #787c82; + user-select: text; + } + .cb-admin-wrap .cb-service-idline code { + font-size: 11px; + background: #f0f0f1; + padding: 1px 5px; + border-radius: 3px; + } + .cb-admin-wrap .cb-service-idline:empty, + .cb-admin-wrap .cb-service-id:empty::before { + content: ""; + } .cb-admin-wrap .cb-service-grid { display: grid; grid-template-columns: 1fr 1fr; @@ -556,7 +577,10 @@ class CB_Settings {
- + + + +