PluginProbe
Live Chat & AI Chatbot – onWebChat / 3.5.1
Live Chat & AI Chatbot – onWebChat v3.5.1
3.9.2 3.9.3 3.9.1 3.9.0 3.8.4 3.8.2 3.8.1 3.8.0 3.7.2 3.7.1 3.7.0 3.6.0 3.5.5 trunk 1.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 48 releases
onwebchat / admin / settings-page.php

settings-page.php in Live Chat & AI Chatbot – onWebChat 3.5.1, at admin/settings-page.php

95 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * onWebChat Settings Page with Tabs
4 */
5
6 if (!defined('ABSPATH')) {
7 exit;
8 }
9
10 function onwebchat_settings_page() {
11 // Note: Form submissions are handled in admin_init hook (see onwebchat.php)
12 // This ensures redirects happen before any output is sent
13
14 // Get current tab
15 $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'general';
16
17 // Check connection status
18 $options = get_option('onwebchat_plugin_option');
19 $chatId = isset($options['text_string']) ? $options['text_string'] : '';
20 $isConnected = !empty($chatId);
21
22 ?>
23 <div class="wrap">
24 <h1 style="font-weight: 400; margin-top: 34px;">
25 onWebChat <?php echo $isConnected ? 'Settings' : 'Activation'; ?>
26 </h1>
27
28 <?php if ($isConnected): ?>
29 <!-- Tab Navigation (only show when connected) -->
30 <h2 class="nav-tab-wrapper">
31 <a href="?page=onwebchat_settings&tab=general"
32 class="nav-tab <?php echo $active_tab === 'general' ? 'nav-tab-active' : ''; ?>">
33 General
34 </a>
35
36 <a href="?page=onwebchat_settings&tab=chat"
37 class="nav-tab <?php echo $active_tab === 'chat' ? 'nav-tab-active' : ''; ?>">
38 Chat Widget
39 </a>
40
41 <?php if (class_exists('WooCommerce')): ?>
42 <a href="?page=onwebchat_settings&tab=woocommerce"
43 class="nav-tab <?php echo $active_tab === 'woocommerce' ? 'nav-tab-active' : ''; ?>">
44 WooCommerce
45 </a>
46 <?php endif; ?>
47
48 <a href="?page=onwebchat_settings&tab=advanced"
49 class="nav-tab <?php echo $active_tab === 'advanced' ? 'nav-tab-active' : ''; ?>">
50 Advanced
51 </a>
52 </h2>
53 <?php endif; ?>
54
55 <!-- Tab Content -->
56 <div class="tab-content" style="margin-top: 20px;">
57 <?php
58 if (!$isConnected) {
59 // Show connection tab if not connected
60 require_once __DIR__ . '/tabs/general.php';
61 onwebchat_general_tab($isConnected);
62 } else {
63 // Show appropriate tab based on selection
64 switch ($active_tab) {
65 case 'chat':
66 require_once __DIR__ . '/tabs/chat.php';
67 onwebchat_chat_tab();
68 break;
69
70 case 'woocommerce':
71 if (class_exists('WooCommerce')) {
72 require_once __DIR__ . '/tabs/woocommerce.php';
73 onwebchat_woocommerce_tab();
74 } else {
75 echo '<div class="notice notice-warning"><p>WooCommerce is not installed.</p></div>';
76 }
77 break;
78
79 case 'advanced':
80 require_once __DIR__ . '/tabs/advanced.php';
81 onwebchat_advanced_tab();
82 break;
83
84 default:
85 require_once __DIR__ . '/tabs/general.php';
86 onwebchat_general_tab($isConnected);
87 }
88 }
89 ?>
90 </div>
91 </div>
92 <?php
93 }
94
95