kollapsminoriteten/wp-content/plugins/jetpack/modules/widgets/eu-cookie-law/widget.php

44 lines
1.3 KiB
PHP
Raw Normal View History

2025-02-28 08:42:11 +01:00
<?php
2020-10-20 18:05:12 +02:00
/**
* Widget for Cookies and Consent.
*
2025-02-28 08:42:11 +01:00
* @html-template Jetpack_EU_Cookie_Law_Widget::widget
2021-04-27 08:32:47 +02:00
* @package automattic/jetpack
2020-10-20 18:05:12 +02:00
*/
2025-02-28 08:42:11 +01:00
2025-12-12 13:13:07 +01:00
if ( ! defined( 'ABSPATH' ) ) {
exit( 0 );
}
2025-02-28 08:42:11 +01:00
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- HTML template, let Phan handle it.
2020-10-20 18:05:12 +02:00
?>
2019-11-15 23:26:29 +01:00
<div
2022-04-02 10:26:41 +02:00
class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"
2020-11-18 09:10:44 +01:00
data-hide-timeout="<?php echo (int) $instance['hide-timeout']; ?>"
data-consent-expiration="<?php echo (int) $instance['consent-expiration']; ?>"
2019-11-15 23:26:29 +01:00
id="eu-cookie-law"
>
2025-02-28 08:42:11 +01:00
<form method="post" id="jetpack-eu-cookie-law-form">
2019-11-15 23:26:29 +01:00
<input type="submit" value="<?php echo esc_attr( $instance['button'] ); ?>" class="accept" />
</form>
2022-04-02 10:26:41 +02:00
<?php
if ( 'default' === $instance['text'] || empty( $instance['customtext'] ) ) {
echo nl2br( esc_html( $instance['default-text'] ) );
2019-11-15 23:26:29 +01:00
} else {
echo nl2br( esc_html( $instance['customtext'] ) );
2022-04-02 10:26:41 +02:00
}
?>
2019-11-15 23:26:29 +01:00
2020-10-20 18:05:12 +02:00
<?php
$is_default_policy = 'default' === $instance['policy-url'] || empty( $instance['custom-policy-url'] );
$policy_link_url = $is_default_policy ? $instance['default-policy-url'] : $instance['custom-policy-url'];
$policy_link_rel = $is_default_policy ? 'nofollow' : '';
?>
<a href="<?php echo esc_url( $policy_link_url ); ?>" rel="<?php echo esc_attr( $policy_link_rel ); ?>">
2019-11-15 23:26:29 +01:00
<?php echo esc_html( $instance['policy-link-text'] ); ?>
</a>
</div>