| 1 |
<?php |
| 2 |
/** |
| 3 |
* @var bool $is_wp_consent_api_active |
| 4 |
* @var array $m_default |
| 5 |
* @var array $m |
| 6 |
*/ |
| 7 |
?> |
| 8 |
<div class="cb-addons__tab__header"> |
| 9 |
<div class="cb-addons__header__column--inner"> |
| 10 |
<div class="cb-addons__header__column submit-column"> |
| 11 |
<h2 class="cb-addons__tab__subtitle"><?php esc_html_e( 'Remember to save your changes before switching tabs', 'cookiebot' ); ?></h2> |
| 12 |
</div> |
| 13 |
</div> |
| 14 |
</div> |
| 15 |
|
| 16 |
|
| 17 |
<?php if ( $is_wp_consent_api_active ) { ?> |
| 18 |
<h3 id="consent_level_api_settings_title" class="cookiebot_fieldset_header"> |
| 19 |
<?php |
| 20 |
esc_html_e( |
| 21 |
'Consent Level API Settings', |
| 22 |
'cookiebot' |
| 23 |
); |
| 24 |
?> |
| 25 |
</h3> |
| 26 |
<div id="consent_level_api_settings"> |
| 27 |
<p> |
| 28 |
<?php |
| 29 |
esc_html_e( |
| 30 |
'WP Consent Level API and Cookiebot™ categorize cookies a bit differently. The default settings should fit most needs, but if you need to change the mapping you can do so below.', |
| 31 |
'cookiebot' |
| 32 |
); |
| 33 |
?> |
| 34 |
</p> |
| 35 |
|
| 36 |
<?php |
| 37 |
$consent_types = array( 'preferences', 'statistics', 'marketing' ); |
| 38 |
$states = array_reduce( |
| 39 |
$consent_types, |
| 40 |
function ( $t, $v ) { |
| 41 |
$newt = array(); |
| 42 |
if ( empty( $t ) ) { |
| 43 |
$newt = array( |
| 44 |
array( $v => true ), |
| 45 |
array( $v => false ), |
| 46 |
); |
| 47 |
} else { |
| 48 |
foreach ( $t as $item ) { |
| 49 |
$newt[] = array_merge( $item, array( $v => true ) ); |
| 50 |
$newt[] = array_merge( $item, array( $v => false ) ); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
return $newt; |
| 55 |
}, |
| 56 |
array() |
| 57 |
); |
| 58 |
|
| 59 |
?> |
| 60 |
<table class="cb-settings__consent__mapping-table" aria-describedby="consent_level_api_settings_title"> |
| 61 |
<thead> |
| 62 |
<tr> |
| 63 |
<th></th> |
| 64 |
<th></th> |
| 65 |
</tr> |
| 66 |
</thead> |
| 67 |
<?php |
| 68 |
foreach ( $states as $state ) { |
| 69 |
$key = array(); |
| 70 |
$key[] = 'n=1'; |
| 71 |
$key[] = 'p=' . ( $state['preferences'] ? '1' : '0' ); |
| 72 |
$key[] = 's=' . ( $state['statistics'] ? '1' : '0' ); |
| 73 |
$key[] = 'm=' . ( $state['marketing'] ? '1' : '0' ); |
| 74 |
$key = implode( ';', $key ); |
| 75 |
?> |
| 76 |
|
| 77 |
<tr> |
| 78 |
<td> |
| 79 |
<h3 class="cb-settings__data__subtitle"><?php esc_html_e( 'Cookiebot™ cookie categories', 'cookiebot' ); ?></h3> |
| 80 |
<div class="cb_consent"> |
| 81 |
<span class="forceconsent"> |
| 82 |
<?php esc_html_e( 'necessary', 'cookiebot' ); ?> |
| 83 |
</span> |
| 84 |
<span class="<?php echo $state['preferences'] ? 'consent' : 'noconsent'; ?>"> |
| 85 |
<?php esc_html_e( 'preferences', 'cookiebot' ); ?> |
| 86 |
</span> |
| 87 |
<span class="<?php echo $state['statistics'] ? 'consent' : 'noconsent'; ?>"> |
| 88 |
<?php esc_html_e( 'statistics', 'cookiebot' ); ?> |
| 89 |
</span> |
| 90 |
<span class="<?php echo $state['marketing'] ? 'consent' : 'noconsent'; ?>"> |
| 91 |
<?php esc_html_e( 'marketing', 'cookiebot' ); ?> |
| 92 |
</span> |
| 93 |
</div> |
| 94 |
</td> |
| 95 |
<td> |
| 96 |
<h3 class="cb-settings__data__subtitle"><?php esc_html_e( 'WP Consent API cookies categories equivalent', 'cookiebot' ); ?></h3> |
| 97 |
<div class="consent_mapping"> |
| 98 |
<label><input |
| 99 |
type="checkbox" |
| 100 |
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][functional]" |
| 101 |
data-default-value="1" value="1" checked disabled |
| 102 |
> <?php esc_html_e( 'Functional', 'cookiebot' ); ?> </label> |
| 103 |
<label><input |
| 104 |
type="checkbox" |
| 105 |
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][preferences]" |
| 106 |
data-default-value="<?php echo esc_attr( $m_default[ $key ]['preferences'] ); ?>" |
| 107 |
value="1" |
| 108 |
<?php |
| 109 |
if ( ! empty( $m[ $key ]['preferences'] ) ) { |
| 110 |
echo 'checked'; |
| 111 |
} |
| 112 |
?> |
| 113 |
<?php |
| 114 |
if ( $m_default[ $key ]['preferences'] ) { |
| 115 |
echo 'disabled'; |
| 116 |
} |
| 117 |
?> |
| 118 |
> <?php esc_html_e( 'preferences', 'cookiebot' ); ?> </label> |
| 119 |
<label><input |
| 120 |
type="checkbox" |
| 121 |
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics]" |
| 122 |
data-default-value="<?php echo esc_attr( $m_default[ $key ]['statistics'] ); ?>" |
| 123 |
value="1" |
| 124 |
<?php |
| 125 |
if ( ! empty( $m[ $key ]['statistics'] ) ) { |
| 126 |
echo 'checked'; |
| 127 |
} |
| 128 |
?> |
| 129 |
<?php |
| 130 |
if ( $m_default[ $key ]['statistics'] ) { |
| 131 |
echo 'disabled'; |
| 132 |
} |
| 133 |
?> |
| 134 |
> <?php esc_html_e( 'statistics', 'cookiebot' ); ?> </label> |
| 135 |
<label><input |
| 136 |
type="checkbox" |
| 137 |
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][statistics-anonymous]" |
| 138 |
data-default-value="<?php echo esc_attr( $m_default[ $key ]['statistics-anonymous'] ); ?>" |
| 139 |
value="1" |
| 140 |
<?php |
| 141 |
if ( ! empty( $m[ $key ]['statistics-anonymous'] ) ) { |
| 142 |
echo 'checked'; |
| 143 |
} |
| 144 |
?> |
| 145 |
<?php |
| 146 |
if ( $m_default[ $key ]['statistics-anonymous'] ) { |
| 147 |
echo 'disabled'; |
| 148 |
} |
| 149 |
?> |
| 150 |
> <?php esc_html_e( 'Statistics Anonymous', 'cookiebot' ); ?> |
| 151 |
</label> |
| 152 |
<label><input |
| 153 |
type="checkbox" |
| 154 |
name="cookiebot-consent-mapping[<?php echo esc_attr( $key ); ?>][marketing]" |
| 155 |
data-default-value="<?php echo esc_attr( $m_default[ $key ]['marketing'] ); ?>" |
| 156 |
value="1" |
| 157 |
<?php |
| 158 |
if ( ! empty( $m[ $key ]['marketing'] ) ) { |
| 159 |
echo 'checked'; |
| 160 |
} |
| 161 |
?> |
| 162 |
<?php |
| 163 |
if ( $m_default[ $key ]['marketing'] ) { |
| 164 |
echo 'disabled'; |
| 165 |
} |
| 166 |
?> |
| 167 |
> <?php esc_html_e( 'marketing', 'cookiebot' ); ?></label> |
| 168 |
</div> |
| 169 |
</td> |
| 170 |
</tr> |
| 171 |
<?php |
| 172 |
} |
| 173 |
?> |
| 174 |
<tfoot> |
| 175 |
<tr> |
| 176 |
<td> |
| 177 |
<div id="cb-consent-api-reset-defaults" class="cb-btn cb-main-btn"> |
| 178 |
<?php |
| 179 |
esc_html_e( |
| 180 |
'Reset to default mapping', |
| 181 |
'cookiebot' |
| 182 |
); |
| 183 |
?> |
| 184 |
</div> |
| 185 |
</td> |
| 186 |
</tr> |
| 187 |
</tfoot> |
| 188 |
</table> |
| 189 |
</div> |
| 190 |
<?php } ?> |
| 191 |
|