| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Tell the consent API we're following the api |
| 5 |
*/ |
| 6 |
$plugin = 'ibamu/ibamu.php'; |
| 7 |
add_filter( "wp_consent_api_registered_$plugin", function () { |
| 8 |
return true; |
| 9 |
}); |
| 10 |
|
| 11 |
|
| 12 |
/** |
| 13 |
* Tell plugins to wait for the consenttype to be set |
| 14 |
*/ |
| 15 |
function lawwwing_wp_waitfor_consenttype( $waitfor ) { |
| 16 |
return $waitfor; |
| 17 |
} |
| 18 |
add_filter( 'wp_consent_api_waitfor_consent_hook', 'lawwwing_wp_waitfor_consenttype' ); |
| 19 |
|
| 20 |
/** |
| 21 |
* WP Consent API |
| 22 |
*/ |
| 23 |
function lawwwing_consent_api_add_consent_types( $consenttypes ) { |
| 24 |
return []; // Don't add any new consent types by now. |
| 25 |
} |
| 26 |
add_filter( 'wp_consent_types', 'lawwwing_consent_api_add_consent_types' ); |
| 27 |
|
| 28 |
|
| 29 |
function lawwwing_consent_api_get_consenttype( $consenttype ) {; |
| 30 |
return "optin"; // Set the consent type to "optin" |
| 31 |
} |
| 32 |
add_filter( 'wp_get_consent_type', 'lawwwing_consent_api_get_consenttype' ); |
| 33 |
|
| 34 |
|
| 35 |
//--------------------- |
| 36 |
|
| 37 |
// add_filter('wp_footer', 'lawwwing_consent_api_footer', 10, 1); |
| 38 |
// function lawwwing_consent_api_footer( $content ) { |
| 39 |
// // Output debug information in HTML format |
| 40 |
// echo '<div style="background-color: #f9f9f9; border: 1px solid #ddd; padding: 10px; margin: 10px 0;">'; |
| 41 |
// echo '<strong>Consent Debug Information:</strong><br>'; |
| 42 |
// echo 'Consent Type: ' . wp_get_consent_type() . '<br>'; |
| 43 |
// echo 'Expiration cookie: ' . wp_consent_api_cookie_expiration() . '<br>'; |
| 44 |
// echo 'Check if a plugin is registered for the WP Consent API: ' . consent_api_registered(LW_PLUGIN_REFERENCE) . '<br>'; |
| 45 |
// echo 'Marketing: ' . (wp_has_consent('marketing') ? 'Yes' : 'No') . '<br>'; |
| 46 |
// echo 'Statistics: ' . (wp_has_consent('statistics') ? 'Yes' : 'No') . '<br>'; |
| 47 |
// echo 'Statistics-anonymous: ' . (wp_has_consent('statistics-anonymous') ? 'Yes' : 'No') . '<br>'; |
| 48 |
// echo 'Functional: ' . (wp_has_consent('functional') ? 'Yes' : 'No') . '<br>'; |
| 49 |
// echo 'Preferences: ' . (wp_has_consent('preferences') ? 'Yes' : 'No') . '<br>'; |
| 50 |
// echo '</div>'; |
| 51 |
// return $content; |
| 52 |
// } |
| 53 |
|
| 54 |
?> |
| 55 |
|