PluginProbe
Listdom: AI-powered Business Directory with Classifieds Ads Listings / trunk
Listdom: AI-powered Business Directory with Classifieds Ads Listings vtrunk
6.0.0 5.9.0 5.8.1 5.8.0 5.7.0 5.6.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.2.1 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.8.0 1.9.0 All 75 releases
listdom / LSD.php

LSD.php in Listdom: AI-powered Business Directory with Classifieds Ads Listings trunk, at LSD.php

322 lines 7.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // No Direct Access
3 defined('ABSPATH') || die();
4
5 final class Listdom
6 {
7 public string $version = '6.0.0';
8 protected static ?Listdom $instance = null;
9
10 /**
11 * Main Listdom Instance.
12 *
13 * Ensures only one instance of Listdom is loaded or can be loaded.
14 *
15 * @return Listdom - Main instance.
16 * @see Listdom()
17 * @since 1.0.0
18 * @static
19 */
20 public static function instance(): Listdom
21 {
22 // Get an instance of Class
23 if (is_null(self::$instance)) self::$instance = new self();
24
25 // Return the instance
26 return self::$instance;
27 }
28
29 /**
30 * Listdom Constructor.
31 */
32 protected function __construct()
33 {
34 // Define Constants
35 $this->define_constants();
36
37 // Auto Loading
38 require LSD_ABSPATH . '/vendor/autoload.php';
39
40 // Auto Loader
41 spl_autoload_register([$this, 'autoload']);
42
43 // Initialize the Listdom
44 $this->init();
45
46 // Include Helper Functions
47 $this->helpers();
48
49 // Do listdom_loaded action
50 do_action('listdom_loaded');
51 }
52
53 /**
54 * Define Listdom Constants.
55 */
56 private function define_constants()
57 {
58 // Listdom Absolute Path
59 if (!defined('LSD_ABSPATH')) define('LSD_ABSPATH', dirname(__FILE__));
60
61 // Listdom Directory Name
62 if (!defined('LSD_DIRNAME')) define('LSD_DIRNAME', basename(LSD_ABSPATH));
63
64 // Listdom Plugin Base Name
65 if (!defined('LSD_BASENAME')) define('LSD_BASENAME', plugin_basename(LSD_ABSPATH . '/listdom.php')); // listdom/listdom.php or listdom-pro/listdom.php
66
67 // Listdom Version
68 if (!defined('LSD_VERSION')) define('LSD_VERSION', $this->version);
69
70 // Listdom Update Server
71 if (!defined('LSD_LICENSING_SERVER')) define('LSD_LICENSING_SERVER', 'https://api.webilia.com/licensing');
72
73 // WordPress Upload Directory
74 $upload_dir = wp_upload_dir();
75
76 // Listdom Logs Directory
77 if (!defined('LSD_LOG_DIR')) define('LSD_LOG_DIR', $upload_dir['basedir'] . '/lsd-logs/');
78
79 // Listdom Upload Directory
80 if (!defined('LSD_UP_DIR')) define('LSD_UP_DIR', $upload_dir['basedir'] . '/listdom/');
81
82 // Listdom Map Providers
83 if (!defined('LSD_MP_GOOGLE')) define('LSD_MP_GOOGLE', 'googlemap');
84 if (!defined('LSD_MP_LEAFLET')) define('LSD_MP_LEAFLET', 'leaflet');
85 }
86
87 /**
88 * Initialize the Listdom
89 */
90 private function init()
91 {
92 // LSD Main
93 $main = new LSD_Main();
94
95 // Plugin Activation / Deactivation / Uninstall
96 LSD_Plugin_Hooks::instance();
97
98 // Repair Listdom roles when a site lost them after activation.
99 LSD_Roles::ensure();
100
101 // Life Cycle
102 $life_cycle = new LSD_LifeCycle();
103 $life_cycle->init();
104
105 // Listdom Kses
106 $kses = new LSD_Kses();
107 $kses->init();
108
109 // Listdom Menus
110 $menus = new LSD_Menus();
111 $menus->init();
112
113 // Listdom Announcements
114 LSD_Announcements::instance()->init();
115
116 // Listdom Post Types
117 $post_types = new LSD_PTypes();
118 $post_types->init();
119
120 // Listdom Taxonomies
121 $taxonomies = new LSD_Taxonomies();
122 $taxonomies->init();
123
124 // Listdom Author
125 $author = new LSD_Author();
126 $author->init();
127
128 // Listdom Actions / Filters
129 $hooks = new LSD_Hooks();
130 $hooks->init();
131
132 // Flush WordPress rewrite rules only if needed
133 LSD_RewriteRules::flush();
134
135 // Listdom Assets
136 $assets = new LSD_Assets();
137 $assets->init();
138
139 // Listdom Social Networks
140 $socials = new LSD_Socials();
141 $socials->init();
142
143 // Listdom Skins
144 $skins = new LSD_Skins();
145 $skins->init();
146
147 // Listdom Shortcodes
148 $shortcodes = new LSD_Shortcodes();
149 $shortcodes->init();
150
151 // Listdom RSS Feeds
152 $feeds = new LSD_Feed();
153 $feeds->init();
154
155 // Listdom Widgets
156 $widgets = new LSD_Widgets();
157 $widgets->init();
158
159 // Listdom Integrations
160 $integrations = new LSD_Integrations();
161 $integrations->init();
162
163 // Listdom Endpoints
164 $endpoints = new LSD_Endpoints();
165 $endpoints->init();
166
167 // Listdom Compatibility
168 $compatibility = new LSD_Compatibility();
169 $compatibility->init();
170
171 // Listdom Internationalization
172 $i18n = new LSD_i18n();
173 $i18n->init();
174
175 // Listdom Notifications
176 $notifications = new LSD_Notifications();
177 $notifications->init();
178
179 // Listdom Privacy
180 $privacy = new LSD_Privacy();
181 $privacy->init();
182
183 // Listdom AJAX
184 $ajax = new LSD_Ajax();
185 $ajax->init();
186
187 // Listdom Admin
188 $admin = new LSD_Admin();
189 $admin->init();
190
191 // Listdom Dummy Data
192 $dummy = new LSD_Dummy();
193 $dummy->init();
194
195 // Listdom Search
196 $search = new LSD_Search();
197 $search->init();
198
199 // Dashboard
200 $dashboard = new LSD_Dashboard();
201 $dashboard->init();
202
203 // Launch Checklist
204 $checklist = LSD_Checklist::instance();
205 $checklist->init();
206
207 // Internal Actions
208 LSD_Actions::instance()->init();
209
210 // Directory Blueprints
211 LSD_Blueprints::instance()->init();
212
213 // Upgrade
214 $upgrade = new LSD_Upgrade();
215 $upgrade->init();
216
217 // License Activation
218 $activation = new LSD_Activation();
219 $activation->init();
220
221 // Listing Statuses
222 $statuses = new LSD_Statuses();
223 $statuses->init();
224
225 // Review Notice
226 $review = new LSD_Plugin_Notice();
227 $review->init();
228
229 // Deactivation Feedback
230 new LSD_Plugin_Feedback([
231 'plugin' => 'listdom',
232 'basename' => LSD_BASENAME,
233 ]);
234
235 // Settings Import / Export
236 $ixs = new LSD_IX_Settings();
237 $ixs->init();
238
239 // Jobs Manager
240 $jobs = new LSD_Jobs();
241 $jobs->init();
242
243 // Semantic AI
244 $semantic = new LSD_AI_Semantic();
245 $semantic->init();
246
247 // AI Visibility
248 $ai_visibility = new LSD_AI_Visibility();
249 $ai_visibility->init();
250
251 // Listdom Bar
252 $bar = LSD_Bar::instance();
253 $bar->init();
254
255 // Listing Visibility
256 (new LSD_Visibility())->init();
257
258 // Payments
259 if (LSD_Payments_Engine::instance()->listdom())
260 {
261 (new LSD_Payments())->init();
262 }
263
264 // Initialize Lite Features
265 if ($main->isLite())
266 {
267 $lite = new LSD_Lite();
268 $lite->init();
269 }
270 }
271
272 /**
273 * Include Helper Functions
274 */
275 public function helpers()
276 {
277 // Template Functions
278 require_once 'app/includes/helpers/templates.php';
279
280 // Util Functions
281 require_once 'app/includes/helpers/util.php';
282 }
283
284 /**
285 * Automatically load Listdom classes whenever needed.
286 * @param string $class_name
287 * @return void
288 */
289 private function autoload(string $class_name)
290 {
291 $class_ex = explode('_', strtolower($class_name));
292
293 // It's not a Listdom Class
294 if ($class_ex[0] != 'lsd') return;
295
296 // Drop Class Prefix
297 $class_path = array_slice($class_ex, 1);
298
299 // Create Class File Path
300 $file_path = LSD_ABSPATH . '/app/includes/' . implode('/', $class_path) . '.php';
301
302 // We found the class!
303 if (file_exists($file_path)) require_once $file_path;
304 }
305 }
306
307 /**
308 * Main instance of Listdom.
309 *
310 * Returns the main instance of Listdom to prevent the need to use globals.
311 *
312 * @return Listdom
313 * @since 1.0.0
314 */
315 function listdom(): Listdom
316 {
317 return Listdom::instance();
318 }
319
320 // Init the Listdom :)
321 listdom();
322