| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$tabs = ['welcome', 'buttons', 'customer-notifications', 'seller-notifications', 'abandoned-carts', 'settings', 'news', 'use-your-phone', 'invite-a-friend']; |
| 7 |
$GLOBALS['current_tab'] = isset($_GET['tab']) && in_array($_GET['tab'], $tabs) ? $_GET['tab'] : $tabs[0]; |
| 8 |
$has_telephone = isset($this->options['telephone']) && $this->options['telephone'] != ''; |
| 9 |
$has_wc = spoki_has_woocommerce(); |
| 10 |
$account_info = $this->options['account_info'] ?? null; |
| 11 |
$is_free = (!isset($account_info['plan']['slug']) || (isset($account_info['plan']['slug']) && $account_info['plan']['slug'] == 'flex-10')); |
| 12 |
$is_pro = isset($account_info['plan']['is_pro']) && $account_info['plan']['is_pro'] == true; |
| 13 |
$is_credit_based = isset($account_info['plan']['is_credit_based']) && $account_info['plan']['is_credit_based'] == true; |
| 14 |
$has_abandoned_carts = isset($this->options['abandoned_carts']['enable_tracking']) && $this->options['abandoned_carts']['enable_tracking'] == 1; |
| 15 |
$has_seller_notifications = isset($this->options['woocommerce']['order_created_to_seller']) && $this->options['woocommerce']['order_created_to_seller'] == 1; |
| 16 |
$has_spoki_settings = isset($this->options['secret']) && $this->options['secret'] != '' && isset($this->options['delivery_url']) && $this->options['delivery_url'] != ''; |
| 17 |
|
| 18 |
|
| 19 |
if ($has_wc && !$has_abandoned_carts): ?> |
| 20 |
<div class="notice notice-warning"> |
| 21 |
<p> |
| 22 |
<?php |
| 23 |
$link = "?page=" . urlencode(SPOKI_PLUGIN_NAME) . "&tab=abandoned-carts"; |
| 24 |
/* translators: %1$s: Abandoned Carts link. */ |
| 25 |
printf(__('<strong>Warning!</strong> Visitors may have abandoned their cart! Discover the new <a href="%1$s">Abandoned Carts</a> feature and reduce dropout rates.', "spoki"), $link) ?> |
| 26 |
</p> |
| 27 |
</div> |
| 28 |
<?php endif ?> |
| 29 |
|
| 30 |
<div class="wrap spoki-admin"> |
| 31 |
<h1 class="title"> |
| 32 |
<b><?php _e('Spoki', "spoki") ?></b> |
| 33 |
<img src="<?php echo plugins_url() . '/' . SPOKI_PLUGIN_NAME . '/assets/images/logo.svg' ?>" alt="spoki logo"> |
| 34 |
</h1> |
| 35 |
|
| 36 |
<?php if (!$has_telephone) { ?> |
| 37 |
<div class="notice notice-error"> |
| 38 |
<p> |
| 39 |
<?php _e('Please insert a valid telephone number!', "spoki"); ?> |
| 40 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=settings"> |
| 41 |
<?php _e('Settings', "spoki") ?> |
| 42 |
</a> |
| 43 |
</p> |
| 44 |
</div> |
| 45 |
<?php } ?> |
| 46 |
|
| 47 |
<h2 class="nav-tab-wrapper"> |
| 48 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=welcome" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'welcome') ? 'nav-tab-active' : ''; ?>"> |
| 49 |
<?php _e((!$has_wc || !$has_spoki_settings) ? 'Welcome' : 'Statistics', "spoki"); ?> |
| 50 |
</a> |
| 51 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=buttons" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'buttons') ? 'nav-tab-active' : ''; ?>"> |
| 52 |
<?php _e('Buttons', "spoki"); ?> |
| 53 |
</a> |
| 54 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=customer-notifications" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'customer-notifications') ? 'nav-tab-active' : ''; ?>"> |
| 55 |
<?php _e('Customer Notifications', "spoki"); ?> |
| 56 |
</a> |
| 57 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=seller-notifications" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'seller-notifications') ? 'nav-tab-active' : ''; ?>"> |
| 58 |
<div class="nav-tab-content"> |
| 59 |
<?php _e('Seller Notifications', "spoki"); ?> |
| 60 |
</div> |
| 61 |
</a> |
| 62 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=abandoned-carts" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'abandoned-carts') ? 'nav-tab-active' : ''; ?>"> |
| 63 |
<?php _e('Abandoned Carts', "spoki"); ?> |
| 64 |
</a> |
| 65 |
<a style="margin-right: 1rem;" href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=settings" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'settings') ? 'nav-tab-active' : ''; ?>"> |
| 66 |
<?php _e('Settings', "spoki"); ?> |
| 67 |
</a> |
| 68 |
<?php if (!$is_pro): ?> |
| 69 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=use-your-phone" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'use-your-phone') ? 'nav-tab-active' : ''; ?>"> |
| 70 |
<?php _e('Send from your phone number', "spoki"); ?> |
| 71 |
</a> |
| 72 |
<?php endif; ?> |
| 73 |
<?php if (!$is_credit_based): ?> |
| 74 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=invite-a-friend" class="nav-tab <?php echo esc_attr($GLOBALS['current_tab'] == 'invite-a-friend') ? 'nav-tab-active' : ''; ?>"> |
| 75 |
<?php _e('Invite a friend', "spoki"); ?> |
| 76 |
</a> |
| 77 |
<?php endif; ?> |
| 78 |
</h2> |
| 79 |
|
| 80 |
<form name="spoki-options-form" method="post" action="options.php"> |
| 81 |
<?php settings_fields('wp-spoki-option'); |
| 82 |
require_once SPOKI_DIR . 'views/html-welcome.php'; |
| 83 |
require_once SPOKI_DIR . 'views/html-settings.php'; |
| 84 |
require_once SPOKI_DIR . 'views/html-buttons.php'; |
| 85 |
require_once SPOKI_DIR . 'views/html-customer-notifications.php'; |
| 86 |
require_once SPOKI_DIR . 'views/html-seller-notifications.php'; |
| 87 |
require_once SPOKI_DIR . 'views/html-abandoned-carts.php'; |
| 88 |
require_once SPOKI_DIR . 'views/html-news.php'; |
| 89 |
require_once SPOKI_DIR . 'views/html-use-your-phone.php'; |
| 90 |
require_once SPOKI_DIR . 'views/html-invite-friend.php'; |
| 91 |
?> |
| 92 |
</form> |
| 93 |
|
| 94 |
<div id="spoki-bottom-badges"> |
| 95 |
<div id="spoki-feedback"> |
| 96 |
<a href="?page=<?php echo urlencode(SPOKI_PLUGIN_NAME) ?>&tab=news"> |
| 97 |
✩ <?php _e('What\'s New?', "spoki") ?> |
| 98 |
</a> |
| 99 |
</div> |
| 100 |
|
| 101 |
<div id="spoki-support"> |
| 102 |
<a href="https://api.whatsapp.com/send/?phone=447782375016&text=Hi%20Spoki,%20I%20need%20support%20about%20Spoki%20Plugin" target="_blank"> |
| 103 |
<?php echo spoki_get_wa_logo() ?> |
| 104 |
<?php _e('Need Support?', "spoki") ?> |
| 105 |
</a> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
|