fix: textausrichtung-option + hover-fixes (link/badge) + remember-farbe (v1.5.2)
- Darstellung: neue option "Textausrichtung" (mittig/links/rechts). Setzt --cb-align (text-align) und --cb-justify (remember-zeile) inline. - "Diesen Dienst kuenftig immer laden" nutzt jetzt die textfarbe (var(--cb-text), ohne dimming). - Datenschutz-link: schriftgroesse/-gewicht/laufweite/transform/decoration in allen zustaenden festgenagelt -> keine theme-a:hover-aenderung mehr. - Werbe-badge: dito -> wird beim hover nicht mehr riesig (theme-scaling/ font-size gesperrt). + i18n DE/EN (138 strings). version 1.5.2. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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'] ) !== '' ) {
|
||||
|
||||
@@ -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 '<tr><th scope="row"><label>' . esc_html( $label ) . '</label></th>';
|
||||
echo '<td><input type="text" class="cb-color-picker" name="' . esc_attr( CB_STYLE_OPTION . '[' . $key . ']' ) . '" value="' . $val . '" data-default-color="' . $val . '"></td></tr>';
|
||||
}
|
||||
// Text alignment of the placeholder content.
|
||||
$align = in_array( $style['text_align'] ?? 'center', [ 'left', 'center', 'right' ], true ) ? $style['text_align'] : 'center';
|
||||
$options = [
|
||||
'center' => __( 'Mittig', 'gdpr-content-blocker' ),
|
||||
'left' => __( 'Linksbündig', 'gdpr-content-blocker' ),
|
||||
'right' => __( 'Rechtsbündig', 'gdpr-content-blocker' ),
|
||||
];
|
||||
echo '<tr><th scope="row"><label>' . esc_html__( 'Textausrichtung', 'gdpr-content-blocker' ) . '</label></th><td>';
|
||||
echo '<select name="' . esc_attr( CB_STYLE_OPTION . '[text_align]' ) . '">';
|
||||
foreach ( $options as $val => $label ) {
|
||||
echo '<option value="' . esc_attr( $val ) . '"' . selected( $align, $val, false ) . '>' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
echo '</select></td></tr>';
|
||||
|
||||
// Promo-badge toggle — only effective with an active unlimited licence.
|
||||
$unlimited = CB_License::is_unlimited();
|
||||
echo '<tr><th scope="row">' . esc_html__( 'Werbe-Badge', 'gdpr-content-blocker' ) . '</th><td>';
|
||||
|
||||
Reference in New Issue
Block a user