array( 'detect' => function () { return did_action( 'elementor/loaded' ) || defined( 'ELEMENTOR_VERSION' ); }, 'file' => 'Elementor/Loader.php', ), 'beaver' => array( 'detect' => function () { return class_exists( 'FLBuilder' ); }, 'file' => 'Beaver/Loader.php', ), 'bricks' => array( 'detect' => function () { return defined( 'BRICKS_VERSION' ) || 'bricks' === get_template(); }, 'file' => 'Bricks/Loader.php', ), 'wpbakery' => array( 'detect' => function () { return defined( 'WPB_VC_VERSION' ) || function_exists( 'vc_map' ); }, 'file' => 'WPBakery/Loader.php', ), 'widget' => array( 'detect' => function () { return function_exists( 'register_widget' ); }, 'file' => 'Widget/Loader.php', ), ); } /** * Checks each builder and requires ONLY active builder loaders. */ public function load_active_integrations() { $registry = $this->registry(); $enabled = apply_filters( 'gridmaster_enabled_integrations', array_keys( $registry ) ); foreach ( $registry as $key => $entry ) { if ( ! in_array( $key, $enabled, true ) ) { continue; } // Run detector callable. if ( ! is_callable( $entry['detect'] ) || ! call_user_func( $entry['detect'] ) ) { // Builder is inactive or not present; do not include any file from its folder. continue; } $loader_path = __DIR__ . '/' . $entry['file']; if ( file_exists( $loader_path ) ) { require_once $loader_path; } } } }