PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.7.7
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.7.7
8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 8.5.7 8.5.6 8.5.5 8.5.4 8.5.3 8.5.2 All 533 releases
chatbot / addons / automator / includes / autoloader.php

autoloader.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.7.7, at addons/automator/includes/autoloader.php

53 lines 997 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Autoloader for WPbot Automator
4 *
5 * @package WPbot_Automator
6 */
7
8 namespace WPbot_Automator;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Autoloader class
16 */
17 class Autoloader {
18
19 /**
20 * Run autoloader.
21 */
22 public static function run() {
23 spl_autoload_register( array( __CLASS__, 'autoload' ) );
24 }
25
26 /**
27 * Autoload classes.
28 *
29 * @param string $class Class name.
30 */
31 public static function autoload( $class ) {
32 // Check if the class uses our namespace.
33 if ( strpos( $class, 'WPbot_Automator\\' ) !== 0 ) {
34 return;
35 }
36
37 // Remove namespace prefix.
38 $class = str_replace( 'WPbot_Automator\\', '', $class );
39
40 // Convert class name to file path.
41 $file = str_replace( '_', '-', strtolower( $class ) );
42 $file = str_replace( '\\', DIRECTORY_SEPARATOR, $file );
43
44 // Build the file path.
45 $path = WPBOT_AUTOMATOR_PLUGIN_DIR . 'includes/' . $file . '.php';
46
47 // Include the file if it exists.
48 if ( file_exists( $path ) ) {
49 require_once $path;
50 }
51 }
52 }
53