Skip to content

Commit 58b7a49

Browse files
committed
Added negative color scheme, tweaked styles a bit.
1 parent 2f3dcbf commit 58b7a49

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

eu-cookie-law.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function __construct() {
3232
'hide-timeout' => 30,
3333
'text' => 'default',
3434
'customtext' => '',
35+
'color-scheme' => 'default',
3536
'policy-url' => 'default',
3637
'default-policy-url' => 'https://en.support.wordpress.com/cookies',
3738
'custom-policy-url' => '',
@@ -86,6 +87,12 @@ public function update( $new_instance, $old_instance ) {
8687
$instance['text'] = 'default';
8788
}
8889

90+
if ( isset( $new_instance['color-scheme'] ) ) {
91+
$instance['color-scheme'] = 'negative' === $new_instance['color-scheme'] ? 'negative' : 'default';
92+
} else {
93+
$instance['color-scheme'] = 'default';
94+
}
95+
8996
if ( in_array( $new_instance['policy-url'], array( 'default', 'custom' ) ) ) {
9097
$instance['policy-url'] = $new_instance['policy-url'];
9198
}

templates/footer.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
<div id="eu-cookie-law" class="hide-on-<?php echo esc_attr( $instance['hide'] ); ?>" data-hide-timeout="<?php echo intval( $instance['hide-timeout'] ) ; ?>">
1+
<div
2+
id="eu-cookie-law"
3+
class="<?php
4+
echo 'negative' === $instance['color-scheme'] ? 'negative ' : ''
5+
?>hide-on-<?php echo esc_attr( $instance['hide'] ); ?>"
6+
data-hide-timeout="<?php echo intval( $instance['hide-timeout'] ) ; ?>"
7+
>
28
<form action="<?php echo esc_attr( $blog_url ); ?>" method="post">
39
<?php wp_nonce_field( 'eucookielaw' ); ?>
410
<input type="hidden" name="eucookielaw" value="accept" />
@@ -73,13 +79,19 @@ function accept() {
7379
left: 1em;
7480
right: 1em;
7581
z-index: 1000;
76-
font-size: 90%;
82+
font-size: 80%;
7783
line-height: 1.4;
7884
border: 1px solid #dedede;
79-
padding: 10px 20px;
85+
padding: 6px 6px 6px 15px;
8086
background-color: #fff;
8187
}
8288

89+
#eu-cookie-law.negative {
90+
background-color: #000;
91+
color: #fff;
92+
border: none;
93+
}
94+
8395
#eu-cookie-law input.accept {
8496
float: right;
8597
margin-left: 5%;

templates/form.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@
2626
<textarea class="widefat" name="<?php echo $this->get_field_name( 'customtext' ); ?>" placeholder="<?php echo esc_attr( $instance['default-text'] ); ?>"><?php echo esc_html( $instance['customtext'] ); ?></textarea>
2727
</p>
2828
<hr />
29+
<p>
30+
<strong><?php _e( 'Color scheme', 'eucookielaw' ); ?></strong>
31+
<ul>
32+
<li>
33+
<label><input type="radio" name="<?php echo $this->get_field_name( 'color-scheme' ); ?>" value="default" <?php checked( $instance['color-scheme'], 'default' ); ?> /> <?php _e( 'Default' ); ?></label>
34+
</li>
35+
<li>
36+
<label><input type="radio" name="<?php echo $this->get_field_name( 'color-scheme' ); ?>" value="negative" <?php checked( $instance['color-scheme'], 'negative' ); ?> /> <?php _e( 'Inverted' ); ?></label>
37+
</li>
38+
</ul>
39+
</p>
40+
<hr />
2941
<p>
3042
<strong><?php _e( 'Policy URL', 'eucookielaw' ); ?></strong>
3143
<ul>

0 commit comments

Comments
 (0)