header.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @var string $cookiebot_logo |
| 5 | * @var string $subscription_status |
| 6 | * @var int $days_left |
| 7 | */ |
| 8 | |
| 9 | use cybot\cookiebot\settings\pages\Settings_Page; |
| 10 | use cybot\cookiebot\settings\pages\Support_Page; |
| 11 | use cybot\cookiebot\settings\pages\Plugins_Page; |
| 12 | use cybot\cookiebot\lib\Cookiebot_WP; |
| 13 | use cybot\cookiebot\settings\templates\Main_Tabs; |
| 14 | |
| 15 | /** |
| 16 | * @var array $template_args Array containing all template variables |
| 17 | */ |
| 18 | |
| 19 | $main_tabs = new Main_Tabs(); |
| 20 | |
| 21 | $cbid = Cookiebot_WP::get_cbid(); |
| 22 | $user_data = Cookiebot_WP::get_user_data(); |
| 23 | $trial_expired = Cookiebot_WP::is_trial_expired(); |
| 24 | $upgraded = Cookiebot_WP::has_upgraded(); |
| 25 | $days_left = Cookiebot_WP::get_trial_days_left(); |
| 26 | $is_authenticated = ! empty( Cookiebot_WP::get_auth_token() ); |
| 27 | |
| 28 | ?> |
| 29 | <?php |
| 30 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 31 | if ( ! empty( $_GET['settings-updated'] ) ) : |
| 32 | ?> |
| 33 | <div class="cb-submit__msg"><?php esc_html_e( 'Changes have been saved', 'cookiebot' ); ?></div> |
| 34 | <?php endif; ?> |
| 35 | <?php |
| 36 | |
| 37 | if ( Cookiebot_WP::is_in_trial() && ! $trial_expired && $is_authenticated ) : |
| 38 | ?> |
| 39 | <div class="trial-banner"> |
| 40 | <div class="trial-info"> |
| 41 | <span class="trial-icon"></span> |
| 42 | <span class="trial-text"> |
| 43 | <span class="trial-label"><?php echo esc_html__( 'Premium Trial:', 'cookiebot' ); ?></span> |
| 44 | <span class="days-left"><?php /* translators: %d is replaced with "integer" */ echo sprintf( esc_html__( '%d days left', 'cookiebot' ), absint( $days_left ) ); ?></span> |
| 45 | </span> |
| 46 | </div> |
| 47 | <?php if ( isset( $user_data['subscriptions']['active']['subscription_id'] ) ) : ?> |
| 48 | <a href="https://account.usercentrics.eu/subscription/<?php echo esc_attr( $user_data['subscriptions']['active']['subscription_id'] ); ?>/manage" target="_blank" class="upgrade-button" onclick="/* window.trackAmplitudeEvent('Header Upgrade now button clicked', { trial_start_date: '<?php echo esc_js( $user_data['subscriptions']['active']['trial_start_date'] ? $user_data['subscriptions']['active']['trial_start_date'] : '' ); ?>', trial_end_date: '<?php echo esc_js( $user_data['subscriptions']['active']['trial_end_date'] ? $user_data['subscriptions']['active']['trial_start_date'] : '' ); ?>', account_id: '<?php echo esc_js( $cbid ); ?>' }); */"> |
| 49 | <?php else : ?> |
| 50 | <a href="https://account.usercentrics.eu/subscription/manage" target="_blank" class="upgrade-button" onclick="/* window.trackAmplitudeEvent('Header Upgrade now button clicked', { trial_start_date: '<?php echo esc_js( $user_data['subscriptions']['active']['trial_start_date'] ? $user_data['subscriptions']['active']['trial_start_date'] : '' ); ?>', trial_end_date: '<?php echo esc_js( $user_data['subscriptions']['active']['trial_end_date'] ? $user_data['subscriptions']['active']['trial_start_date'] : '' ); ?>', account_id: '<?php echo esc_js( $cbid ); ?>' }); */"> |
| 51 | <?php endif; ?> |
| 52 | <?php echo esc_html__( 'Upgrade now', 'cookiebot' ); ?> |
| 53 | <span class="arrow-icon">→</span> |
| 54 | </a> |
| 55 | </div> |
| 56 | <?php endif; ?> |
| 57 | <div class="cb-header"> |
| 58 | <div class="cb-wrapper"> |
| 59 | <a href="https://www.cookiebot.com/?utm_source=wordpress&utm_medium=referral&utm_campaign=banner"> |
| 60 | <img |
| 61 | src="<?php echo esc_url( $cookiebot_logo ); ?>" |
| 62 | alt="Cookiebot logo"> |
| 63 | </a> |
| 64 | </div> |
| 65 | </div> |
| 66 |