<?php

namespace SparkConstructionLiteElements;

if (!defined('ABSPATH'))
    exit; // Exit if accessed directly

if (!function_exists('is_plugin_active')) {

    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}

final class sparkconstructionlite_themes_Modules_Manager {

    private function get_modules() {
        $modules = [
            'heading',
            'slider-block',
            'progress-bar',
            'featured-block',
            'service-block',
            'highlight-block',
            'call-to-action-block',
            'team-block',
            'team-carousel',
            'testimonial-block',
            'testimonial-carousel',
            'testimonial-slider',
            'counter-block',
            'advance-gallery',
            'blog-section',
            'logo-carousel',
            'image-flipster',
            'video-popup',
            'contact-section',
            'working-process',
            'pricing-block',
        ];
        return $modules;
    }

    public function __construct() {
        
        $this->sparkconstructionlite_themes_register_modules();
    }

    public function sparkconstructionlite_themes_register_modules() {

        $modules = $this->get_modules();

        foreach ($modules as $module) {

            $class_name = str_replace('-', ' ', $module);
            $class_name = str_replace(' ', '', ucwords($class_name));
            $class_name = __NAMESPACE__ . '\\Modules\\' . $class_name . '\Module';

            $class_name::instance();
        }
    }

}

if (!function_exists('sparkconstructionlite_themes_module_manager')) {

    /**
     * Returns an instance of the plugin class.
     * @since  1.0.0
     * @return object
    */
    function sparkconstructionlite_themes_module_manager() {

        return new sparkconstructionlite_themes_Modules_Manager();
    }

}
sparkconstructionlite_themes_module_manager();
