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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 );
|
||||
} );
|
||||
|
||||
|
||||
@@ -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__ ) );
|
||||
|
||||
@@ -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 {
|
||||
<div class="cb-service-box" data-cb-index="<?php echo $idx; ?>">
|
||||
<div class="cb-service-head">
|
||||
<button type="button" class="cb-service-toggle" aria-expanded="false" aria-label="<?php esc_attr_e( 'Details anzeigen/ausblenden', 'gdpr-content-blocker' ); ?>">▸</button>
|
||||
<span class="cb-service-title"><?php echo esc_html( $headname ); ?></span>
|
||||
<span class="cb-service-headmain">
|
||||
<span class="cb-service-title"><?php echo esc_html( $headname ); ?></span>
|
||||
<span class="cb-service-idline"><?php esc_html_e( 'ID:', 'gdpr-content-blocker' ); ?> <code class="cb-service-id"><?php echo esc_html( $id ); ?></code></span>
|
||||
</span>
|
||||
|
||||
<label class="cb-switch" title="<?php esc_attr_e( 'Blocker aktiv/inaktiv', 'gdpr-content-blocker' ); ?>">
|
||||
<input type="checkbox" class="cb-input-enabled" name="cb_services[<?php echo $idx; ?>][enabled]"
|
||||
@@ -676,8 +700,13 @@ class CB_Settings {
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top;"><strong><?php esc_html_e( 'Einwilligungs-Button (für reine Skript-Dienste)', 'gdpr-content-blocker' ); ?></strong><br>
|
||||
<?php echo $code( '[content_blocker_consent id="youtube" text="…"]' ); ?></td>
|
||||
<td><?php esc_html_e( 'Erteilt die Einwilligung für einen Dienst und lädt die Seite neu. Gedacht für Dienste, die nur Skripte blockieren und keinen sichtbaren Platzhalter haben. Optionen: id="…" (Dienst-ID, Pflicht), text="…", style="button|link".', 'gdpr-content-blocker' ); ?></td>
|
||||
<?php echo $code( '[content_blocker_consent id="eigenes-matomo" text="Statistik aktivieren"]' ); ?><br>
|
||||
<?php echo $code( '[content_blocker_consent id="eigenes-matomo" text="Aktivieren" style="link"]' ); ?></td>
|
||||
<td><?php esc_html_e( 'Erteilt die Einwilligung für einen Dienst (z. B. einen reinen Skript-Blocker ohne sichtbaren Platzhalter) und lädt die Seite neu, sodass das Skript freigegeben wird.', 'gdpr-content-blocker' ); ?>
|
||||
<br><br>
|
||||
<strong><?php echo esc_html( 'id' ); ?></strong> – <?php esc_html_e( 'Pflicht. Die ID des Dienstes (siehe Tab „Dienste", klein unter dem Namen), z. B. eigenes-matomo.', 'gdpr-content-blocker' ); ?><br>
|
||||
<strong><?php echo esc_html( 'text' ); ?></strong> – <?php esc_html_e( 'Die Beschriftung der Schaltfläche bzw. des Links, z. B. text="Statistik aktivieren".', 'gdpr-content-blocker' ); ?><br>
|
||||
<strong><?php echo esc_html( 'style' ); ?></strong> – <?php esc_html_e( 'style="button" zeigt eine Schaltfläche (Standard), style="link" einen schlichten Textlink.', 'gdpr-content-blocker' ); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Binary file not shown.
@@ -258,6 +258,9 @@ msgstr "Save appearance"
|
||||
msgid "Details anzeigen/ausblenden"
|
||||
msgstr "Show/hide details"
|
||||
|
||||
msgid "ID:"
|
||||
msgstr "ID:"
|
||||
|
||||
msgid "Blocker aktiv/inaktiv"
|
||||
msgstr "Blocker on/off"
|
||||
|
||||
@@ -339,8 +342,17 @@ msgstr "Lists all configured services with recipient, third-country note, purpos
|
||||
msgid "Einwilligungs-Button (für reine Skript-Dienste)"
|
||||
msgstr "Consent button (for script-only services)"
|
||||
|
||||
msgid "Erteilt die Einwilligung für einen Dienst und lädt die Seite neu. Gedacht für Dienste, die nur Skripte blockieren und keinen sichtbaren Platzhalter haben. Optionen: id=\"…\" (Dienst-ID, Pflicht), text=\"…\", style=\"button|link\"."
|
||||
msgstr "Grants consent for a service and reloads the page. Intended for services that only block scripts and have no visible placeholder. Options: id=\"…\" (service ID, required), text=\"…\", style=\"button|link\"."
|
||||
msgid "Erteilt die Einwilligung für einen Dienst (z. B. einen reinen Skript-Blocker ohne sichtbaren Platzhalter) und lädt die Seite neu, sodass das Skript freigegeben wird."
|
||||
msgstr "Grants consent for a service (e.g. a script-only blocker with no visible placeholder) and reloads the page so the script is released."
|
||||
|
||||
msgid "Pflicht. Die ID des Dienstes (siehe Tab „Dienste\", klein unter dem Namen), z. B. eigenes-matomo."
|
||||
msgstr "Required. The service ID (see the \"Services\" tab, shown small under the name), e.g. eigenes-matomo."
|
||||
|
||||
msgid "Die Beschriftung der Schaltfläche bzw. des Links, z. B. text=\"Statistik aktivieren\"."
|
||||
msgstr "The label of the button or link, e.g. text=\"Enable statistics\"."
|
||||
|
||||
msgid "style=\"button\" zeigt eine Schaltfläche (Standard), style=\"link\" einen schlichten Textlink."
|
||||
msgstr "style=\"button\" shows a button (default), style=\"link\" a plain text link."
|
||||
|
||||
msgid "Version %s"
|
||||
msgstr "Version %s"
|
||||
|
||||
Reference in New Issue
Block a user