| 1 |
<?php |
| 2 |
/** |
| 3 |
* Header HTML |
| 4 |
* |
| 5 |
* @package Header |
| 6 |
*/ |
| 7 |
|
| 8 |
use LassoLite\Admin\Constant; |
| 9 |
|
| 10 |
use LassoLite\Classes\Enum; |
| 11 |
use LassoLite\Classes\Helper; |
| 12 |
use LassoLite\Classes\Page; |
| 13 |
use LassoLite\Classes\Setting; |
| 14 |
|
| 15 |
$lasso_account_email = Helper::get_option( Constant::LASSO_ACCOUNT_EMAIL, '' ); |
| 16 |
$lasso_account_user_id = intval( Helper::get_option( Constant::LASSO_ACCOUNT_USER_ID, 0 ) ); |
| 17 |
// App account only (synced email/user from hub/signup). Excludes is_connected_aff from license API; that flag is not a Lasso app login. |
| 18 |
$is_lasso_app_account_connected = ! empty( $lasso_account_email ) || $lasso_account_user_id > 0; |
| 19 |
|
| 20 |
$lasso_options_prefill = Setting::get_settings(); |
| 21 |
$email_support_prefill = $lasso_options_prefill[ Enum::EMAIL_SUPPORT ] ?? ''; |
| 22 |
$admin_email_prefill = get_option( 'admin_email' ); |
| 23 |
$prefill_email_header = ! empty( $email_support_prefill ) ? $email_support_prefill : $admin_email_prefill; |
| 24 |
|
| 25 |
$available_pages = Helper::available_pages(); |
| 26 |
$header_menu = array( Enum::PAGE_DASHBOARD ); |
| 27 |
$should_show_import_step = Helper::should_show_import_page(); |
| 28 |
if ( $should_show_import_step ) { |
| 29 |
$header_menu[] = Enum::PAGE_IMPORT; |
| 30 |
} |
| 31 |
$header_menu = array_merge( $header_menu, array( Enum::PAGE_OPPORTUNITIES, Enum::PAGE_GROUPS, Enum::PAGE_TABLES ) ); |
| 32 |
|
| 33 |
if ( Setting::get_setting( 'general_disable_tooltip' ) ) { |
| 34 |
echo ' |
| 35 |
<style> |
| 36 |
[data-tooltip]:hover:before, [data-tooltip]:hover:after {visibility: hidden;} |
| 37 |
i.far.fa-info-circle {display: none;} |
| 38 |
</style> |
| 39 |
'; |
| 40 |
} |
| 41 |
|
| 42 |
?> |
| 43 |
|
| 44 |
<script src="https://kit.fontawesome.com/21b80bd767.js" crossorigin="anonymous"></script> |
| 45 |
|
| 46 |
<!-- REQUEST REVIEW --> |
| 47 |
<?php |
| 48 |
if ( Helper::show_request_review() ) { |
| 49 |
echo Helper::include_with_variables( SIMPLE_URLS_DIR . '/admin/views/notifications/request-review.php' ); |
| 50 |
} |
| 51 |
?> |
| 52 |
|
| 53 |
<!-- HEADER --> |
| 54 |
<div class="container-fluid"> |
| 55 |
<header class="row align-items-center purple-bg p-3 shadow"> |
| 56 |
|
| 57 |
<!-- LASSO LOGO --> |
| 58 |
<div class="col-lg-2"> |
| 59 |
<a href="<?php echo Page::get_page_url( $available_pages[ Enum::PAGE_DASHBOARD ]->slug ); ?>" class="logo mx-auto mx-lg-0"> |
| 60 |
<img src="<?php echo SIMPLE_URLS_URL; ?>/admin/assets/images/lasso-logo.svg"> |
| 61 |
</a> |
| 62 |
</div> |
| 63 |
|
| 64 |
<!-- NAVIGATION --> |
| 65 |
<div class="col-lg py-lg-0 py-3 ml-5"> |
| 66 |
<ul class="nav justify-content-center font-weight-bold"> |
| 67 |
<?php foreach ( $header_menu as $menu ) : ?> |
| 68 |
<?php $page = $available_pages[ $menu ]; ?> |
| 69 |
<li class="nav-item mx-3"> |
| 70 |
<a class="nav-link px-0 white <?php echo $page->active_class; ?>" |
| 71 |
href="<?php echo Page::get_page_url( $page->slug ); ?>"> |
| 72 |
<?php echo $page->title; ?> |
| 73 |
</a> |
| 74 |
</li> |
| 75 |
<?php endforeach; ?> |
| 76 |
<li class="nav-item mx-3"> |
| 77 |
<a class="nav-link px-0 white" href="<?php echo Constant::LASSO_ANALYTICS_URL; ?>" target="_blank"> |
| 78 |
Analytics |
| 79 |
</a> |
| 80 |
</li> |
| 81 |
<li class="nav-item mx-3"> |
| 82 |
<a class="nav-link px-0 white" href="<?php echo Constant::LASSO_AFFILIATE_PLUS_URL; ?>" target="_blank"> |
| 83 |
Marketplace |
| 84 |
</a> |
| 85 |
</li> |
| 86 |
</ul> |
| 87 |
</div> |
| 88 |
<div class="col-lg-1 text-lg-right text-center pb-lg-0 pb-3 pl-1"> |
| 89 |
<div id="wrapper-circle"></div> |
| 90 |
</div> |
| 91 |
<div class="col-lg-3 d-flex flex-column flex-lg-row align-items-center justify-content-lg-end justify-content-center pb-lg-0 pb-3 pl-1 lasso-header-actions"> |
| 92 |
<?php if ( ! $is_lasso_app_account_connected ) : ?> |
| 93 |
<button type="button" class="lasso-header-account-status lasso-header-account-status--inactive mb-2 mb-lg-0 mr-lg-3 order-lg-1 order-2" data-toggle="modal" data-target="#lasso-lite-analytics-modal" title="<?php echo esc_attr( __( 'Create your free Lasso account', 'simple-urls' ) ); ?>" aria-label="<?php echo esc_attr( __( 'Account status: inactive. Create your free Lasso account.', 'simple-urls' ) ); ?>"> |
| 94 |
<span class="lasso-header-account-status__label"><?php echo esc_html( __( 'Account status', 'simple-urls' ) ); ?></span> |
| 95 |
<span class="lasso-header-account-status__badge"><?php echo esc_html( __( 'Inactive', 'simple-urls' ) ); ?></span> |
| 96 |
</button> |
| 97 |
<?php endif; ?> |
| 98 |
<button class="btn order-lg-2 order-1 mb-2 mb-lg-0" data-toggle="modal" data-target="#url-add"> |
| 99 |
<i class="far fa-plus-circle large-screen-only"></i> Add New Link |
| 100 |
</button> |
| 101 |
</div> |
| 102 |
|
| 103 |
</header> |
| 104 |
|
| 105 |
<!-- ALERTS --> |
| 106 |
<div id="lasso_lite_notifications"> |
| 107 |
</div> |
| 108 |
|
| 109 |
<!-- URL ADD MODAL --> |
| 110 |
<?php require SIMPLE_URLS_DIR . '/admin/views/modals/url-add.php'; ?> |
| 111 |
<!-- Enable support modal --> |
| 112 |
<?php require SIMPLE_URLS_DIR . '/admin/views/modals/enable-support.php'; ?> |
| 113 |
<?php |
| 114 |
if ( ! $is_lasso_app_account_connected ) { |
| 115 |
echo Helper::include_with_variables( |
| 116 |
SIMPLE_URLS_DIR . '/admin/views/modals/lasso-lite-analytics-modal.php', |
| 117 |
array( |
| 118 |
'prefill_email_header' => $prefill_email_header, |
| 119 |
) |
| 120 |
); |
| 121 |
} |
| 122 |
?> |
| 123 |
</div> |
| 124 |
|