main-tabs.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | use cybot\cookiebot\lib\Cookiebot_WP; |
| 4 | use cybot\cookiebot\lib\Cookiebot_Frame; |
| 5 | use cybot\cookiebot\settings\pages\Dashboard_Page; |
| 6 | use cybot\cookiebot\settings\pages\Settings_Page; |
| 7 | use cybot\cookiebot\addons\config\Settings_Config; |
| 8 | use cybot\cookiebot\settings\pages\Support_Page; |
| 9 | |
| 10 | /** |
| 11 | * @var string $active_tab |
| 12 | */ |
| 13 | |
| 14 | $isnw = is_network_admin(); |
| 15 | |
| 16 | $cbid = Cookiebot_WP::get_cbid(); |
| 17 | $auth_token = get_option( 'cookiebot-auth-token' ); |
| 18 | $user_data = Cookiebot_WP::get_user_data(); |
| 19 | $show_settings = true; |
| 20 | $show_plugins = ! $isnw && Cookiebot_Frame::is_cb_frame_type() !== 'empty'; |
| 21 | $feedback_url = 'https://form.typeform.com/to/n6ZlunZP'; |
| 22 | |
| 23 | ?> |
| 24 | <div class="cb-main__tabs"> |
| 25 | <?php if ( ! $isnw ) : ?> |
| 26 | <div class="cb-main__tabs_item <?php echo $active_tab === 'dashboard' ? 'active-item' : ''; ?>"> |
| 27 | <a href="<?php echo esc_url( add_query_arg( 'page', Dashboard_Page::ADMIN_SLUG, admin_url( 'admin.php' ) ) ); ?>" |
| 28 | class="cb-main__tabs__link"> |
| 29 | <div class="cb-main__tabs__icon dashboard-icon"></div> |
| 30 | <span><?php esc_html_e( 'View dashboard', 'cookiebot' ); ?></span> |
| 31 | </a> |
| 32 | </div> |
| 33 | <?php endif; ?> |
| 34 | |
| 35 | <?php if ( ! empty( $cbid ) && ! empty( $auth_token ) ) : ?> |
| 36 | <div class="cb-main__tabs_item <?php echo $active_tab === 'customize' ? 'active-item' : ''; ?>"> |
| 37 | <a href="https://admin.usercentrics.eu/#/v3/appearance/styling?settingsId=<?php echo esc_attr( $cbid ); ?>" |
| 38 | class="cb-main__tabs__link" target="_blank"> |
| 39 | <div class="cb-main__tabs__icon customize-icon"></div> |
| 40 | <span><?php esc_html_e( 'Customize banner', 'cookiebot' ); ?></span> |
| 41 | </a> |
| 42 | </div> |
| 43 | <?php endif; ?> |
| 44 | |
| 45 | <div class="cb-main__tabs_item <?php echo $active_tab === 'support' ? 'active-item' : ''; ?>"> |
| 46 | <?php if ( $isnw ) : ?> |
| 47 | <a href="<?php echo esc_url( add_query_arg( 'page', Support_Page::ADMIN_SLUG, network_admin_url( 'admin.php' ) ) ); ?>" |
| 48 | class="cb-main__tabs__link"> |
| 49 | <?php else : ?> |
| 50 | <a href="<?php echo esc_url( add_query_arg( 'page', Support_Page::ADMIN_SLUG, admin_url( 'admin.php' ) ) ); ?>" |
| 51 | class="cb-main__tabs__link"> |
| 52 | <?php endif; ?> |
| 53 | <div class="cb-main__tabs__icon support-icon"></div> |
| 54 | <span><?php esc_html_e( 'Get support', 'cookiebot' ); ?></span> |
| 55 | </a> |
| 56 | </div> |
| 57 | <?php if ( $show_plugins ) : ?> |
| 58 | <div class="cb-main__tabs_item <?php echo $active_tab === 'addons' ? 'active-item' : ''; ?>"> |
| 59 | <a href="<?php echo esc_url( add_query_arg( 'page', Settings_Config::ADMIN_SLUG, admin_url( 'admin.php' ) ) ); ?>" |
| 60 | class="cb-main__tabs__link"> |
| 61 | <div class="cb-main__tabs__icon plugins-icon"></div> |
| 62 | <span><?php esc_html_e( 'Manage add-ons', 'cookiebot' ); ?></span> |
| 63 | </a> |
| 64 | </div> |
| 65 | <?php endif; ?> |
| 66 | |
| 67 | <?php if ( $show_settings ) : ?> |
| 68 | <div class="cb-main__tabs_item <?php echo $active_tab === 'settings' ? 'active-item' : ''; ?>"> |
| 69 | <?php if ( $isnw ) : ?> |
| 70 | <a href="<?php echo esc_url( add_query_arg( 'page', 'cookiebot_network', network_admin_url( 'admin.php' ) ) ); ?>" |
| 71 | class="cb-main__tabs__link"> |
| 72 | <?php else : ?> |
| 73 | <a href="<?php echo esc_url( add_query_arg( 'page', Settings_Page::ADMIN_SLUG, admin_url( 'admin.php' ) ) ); ?>" |
| 74 | class="cb-main__tabs__link"> |
| 75 | <?php endif; ?> |
| 76 | <div class="cb-main__tabs__icon settings-icon"></div> |
| 77 | <span><?php esc_html_e( 'Configure settings', 'cookiebot' ); ?></span> |
| 78 | </a> |
| 79 | </div> |
| 80 | <?php endif; ?> |
| 81 | |
| 82 | <div class="cb-feedback_link"> |
| 83 | <a href="<?php echo esc_url( $feedback_url ); ?>" target="_blank"><?php echo esc_html__( 'Help us improve', 'cookiebot' ); ?></a> |
| 84 | </div> |
| 85 | |
| 86 | </div> |
| 87 |