-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththrivedesk.php
More file actions
executable file
·185 lines (159 loc) · 5.29 KB
/
thrivedesk.php
File metadata and controls
executable file
·185 lines (159 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
/**
* Plugin Name: Agentic Help Desk Plugin for WordPress - Live Chat, AI Chatbot & Ticketing - ThriveDesk
* Description: ThriveDesk is a help desk plugin for WordPress that brings live chat, AI chatbot, support ticketing, and a knowledge base into one place. Built for WooCommerce stores and eCommerce businesses. Resolve customer support tickets faster with shared inbox, automation, and AI-powered replies.
* Plugin URI: https://www.thrivedesk.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
* Tags: live chat, helpdesk, free live chat, knowledge base, thrivedesk
* Version: 2.2.0
* Author: ThriveDesk
* Author URI: https://profiles.wordpress.org/thrivedesk/
* Text Domain: thrivedesk
* Domain Path: /languages
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* Requires PHP: 7.4
* Requires at least: 4.9
* Tested up to: 6.9.4
*
* ThriveDesk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* ThriveDesk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
use ThriveDesk\Admin;
use ThriveDesk\Api;
use ThriveDesk\Assistants\Assistant;
use ThriveDesk\Inboxes\Inbox;
use ThriveDesk\FluentCrmHooks;
use ThriveDesk\Portal\UserAccountPages;
use ThriveDesk\RestRoute;
use ThriveDesk\Conversations\Conversation;
use ThriveDesk\KnowledgeBase\KnowledgeBase;
use ThriveDesk\Services\PortalService;
use ThriveDeskDBMigrations\Scripts\MigrationScript;
// Exit if accessed directly.
if (! defined('ABSPATH'))
exit;
// Includes vendor files.
require_once __DIR__ . '/vendor/autoload.php';
final class ThriveDesk
{
/**
* Plugin version
*
* @var string
*/
public $version = '2.2.0';
/**
* The single instance of this class
*/
private static $instance = null;
/**
* The API class
*/
public $api = null;
/**
* The FluentCRM hooks class
*/
public $hooks = null;
/**
* The REST route class
*/
public $restroute = null;
/**
* The admin class
*/
public $admin = null;
/**
* Construct ThriveDesk class.
*
* @since 0.0.1
* @access private
*/
private function __construct()
{
// Define constants.
$this->define_constants();
}
/**
* Main ThriveDesk Instance.
*
* Ensures that only one instance of ThriveDesk exists in memory at any one
* time. Also prevents needing to define globals all over the place.
*
* @return object|ThriveDesk
* @access public
* @since 0.0.1
*/
public static function instance() : object
{
if (! isset(self::$instance) && ! (self::$instance instanceof ThriveDesk)) {
self::$instance = new self();
self::$instance->api = Api::instance();
self::$instance->hooks = FluentCrmHooks::instance();
self::$instance->restroute = RestRoute::instance();
if (is_admin()) {
self::$instance->admin = Admin::instance();
}
require_once(THRIVEDESK_DIR . '/database/Scripts/MigrationScript.php');
MigrationScript::instance();
Conversation::instance();
Assistant::instance();
Inbox::instance();
PortalService::instance();
UserAccountPages::instance();
KnowledgeBase::instance();
}
return self::$instance;
}
/**
* Define the necessary constants.
*
* @return void
* @since 0.0.1
* @access private
*/
private function define_constants() : void
{
$this->define('THRIVEDESK_VERSION', $this->version);
$this->define('THRIVEDESK_FILE', __FILE__);
$this->define('THRIVEDESK_DIR', dirname(__FILE__));
$this->define('THRIVEDESK_INC_DIR', dirname(__FILE__) . '/includes');
$this->define('THRIVEDESK_PLUGIN_ASSETS', plugins_url('assets', __FILE__));
$this->define('THRIVEDESK_PLUGIN_ASSETS_PATH', plugin_dir_path(__FILE__) . 'assets');
// Url with no ending /
$this->define('THRIVEDESK_APP_URL', 'https://app.thrivedesk.com');
$this->define('THRIVEDESK_API_URL', 'https://api.thrivedesk.com');
$this->define('THRIVEDESK_KB_API_ENDPOINT', 'https://thrivedeskdocs.com');
$this->define('THRIVEDESK_DB_TABLE_CONVERSATION', 'td_conversations');
$this->define('THRIVEDESK_DB_VERSION', 1.2);
$this->define('OPTION_THRIVEDESK_DB_VERSION', 'td_db_version');
}
/**
* Define constant if not already defined
*
* @param string $name
* @param string|bool $value
*
* @return void
* @since 0.0.1
*/
private function define($name, $value)
{
if (! defined($name)) {
define($name, $value);
}
}
}
// Initialize ThriveDesk.
function ThriveDesk()
{
return ThriveDesk::instance();
}
ThriveDesk();