| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* Checks and loads custom Divi Builder modules. |
| 5 |
* |
| 6 |
* This script checks if the base class 'ET_Builder_Element' exists to prevent errors. |
| 7 |
* and then dynamically loads PHP files for custom Divi modules from a specified directory. |
| 8 |
* |
| 9 |
* @package WPVR |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! class_exists( 'ET_Builder_Element' ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
/** |
| 16 |
* Retrieve and load all module PHP files. |
| 17 |
* |
| 18 |
* Searches for PHP files within the 'modules' subdirectory and requires them to. |
| 19 |
* instantiate custom modules for the Divi Builder. |
| 20 |
*/ |
| 21 |
$module_files = glob( __DIR__ . '/modules/*/*.php' ); |
| 22 |
|
| 23 |
// Load custom Divi Builder modules. |
| 24 |
foreach ( (array) $module_files as $module_file ) { |
| 25 |
if ( $module_file ) { |
| 26 |
require_once $module_file; |
| 27 |
} |
| 28 |
} |
| 29 |
|