| 1 |
<?php |
| 2 |
$acb_settings = get_option( 'wpsc-ps-acb-chatbot-settings', array() ); |
| 3 |
|
| 4 |
// Load includes (settings, admin & cron hooks) so the settings UI stays reachable regardless of status. |
| 5 |
foreach ( glob( __DIR__ . '/includes/*.php' ) as $filename ) { |
| 6 |
include_once $filename; |
| 7 |
} |
| 8 |
|
| 9 |
// Load the rest of the chatbot's functionality only when it's enabled. |
| 10 |
if ( ! empty( $acb_settings['status'] ) && '1' === $acb_settings['status'] ) { |
| 11 |
|
| 12 |
// Load controller. |
| 13 |
foreach ( glob( __DIR__ . '/controller/*.php' ) as $filename ) { |
| 14 |
include_once $filename; |
| 15 |
} |
| 16 |
|
| 17 |
// Load tools. |
| 18 |
foreach ( glob( __DIR__ . '/tools/*.php' ) as $filename ) { |
| 19 |
include_once $filename; |
| 20 |
} |
| 21 |
|
| 22 |
// Load models. |
| 23 |
foreach ( glob( __DIR__ . '/models/*.php' ) as $filename ) { |
| 24 |
include_once $filename; |
| 25 |
} |
| 26 |
|
| 27 |
// Load providers. |
| 28 |
require_once __DIR__ . '/providers/class-wpsc-aibot-provider-interface.php'; |
| 29 |
foreach ( glob( __DIR__ . '/providers/*.php' ) as $filename ) { |
| 30 |
if ( $filename === __DIR__ . '/providers/class-wpsc-aibot-provider-interface.php' ) { |
| 31 |
continue; |
| 32 |
} |
| 33 |
include_once $filename; |
| 34 |
} |
| 35 |
|
| 36 |
// Load ui templates. |
| 37 |
foreach ( glob( __DIR__ . '/templates/*.php' ) as $filename ) { |
| 38 |
include_once $filename; |
| 39 |
} |
| 40 |
} |
| 41 |
|