# shopbuilder/2.1.15/app/Modules/ModuleManager.php

ShopBuilder – WooCommerce Builder For Elementor, version 2.1.15. 53 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/2.1.15/code/app/Modules/ModuleManager.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/2.1.15/raw/app/Modules/ModuleManager.php
- Modified: 2024-07-10T11:00:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/2.1.15/code/app/Modules/ModuleManager.php#L10-L20`.

```php
<?php

namespace RadiusTheme\SB\Modules;

defined( 'ABSPATH' ) || exit();

use RadiusTheme\SB\Models\ModuleList;

use RadiusTheme\SB\Traits\SingletonTrait;

class ModuleManager {

	use SingletonTrait;

	private $module_list;

	private $module_instances = [];
	private function __construct() {
		add_action( 'init', [ $this, 'load_modules' ], 15 );
	}

	public function load_modules() {
		if ( ! is_null( $this->module_list ) ) {
			return;
		}
		$this->module_list = ModuleList::instance()->get_list( true, 'active' );
		foreach ( $this->module_list as $module ) {
			if ( isset( $module['active'] ) && $module['active'] !== 'on' ) {
				continue;
			}

			if ( ! empty( $module['package'] ) && $module['package'] === 'pro-disabled' ) {
				continue;
			}

			if ( ! isset( $module['base_class'] ) ) {
				continue;
			}

			if ( isset( $this->module_instances[ $module['base_class'] ] ) ) {
				continue;
			}

			if ( ! class_exists( $module['base_class'] ) ) {
				continue;
			}

			$module['base_class']::instance();

		}
	}
}

```
