| @@ -1,9 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace RadiusTheme\SB\Modules; |
| 4 | + | |
| 4 | 5 | defined( 'ABSPATH' ) || exit(); |
| 5 | 6 | |
| 7 | +use RadiusTheme\SB\Helpers\Fns; | |
| 6 | 8 | use RadiusTheme\SB\Models\ModuleList; |
| 7 | 9 | |
| 8 | 10 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 9 | 11 | |
| @@ -12,9 +14,9 @@ | ||
| 12 | 14 | use SingletonTrait; |
| 13 | 15 | |
| 14 | 16 | private $module_list; |
| 15 | 17 | |
| 16 | - private $module_instances = array(); | |
| 18 | + private $module_instances = []; | |
| 17 | 19 | private function __construct() { |
| 18 | 20 | add_action( 'init', [ $this, 'load_modules' ], 15 ); |
| 19 | 21 | } |
| 20 | 22 | |
| @@ -43,21 +45,9 @@ | ||
| 43 | 45 | if ( ! class_exists( $module['base_class'] ) ) { |
| 44 | 46 | continue; |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | - // Check if the instance is already in the cache | |
| 48 | - $cached_instance = wp_cache_get( $module['base_class'], 'module_instances' ); | |
| 49 | - if ( false === $cached_instance ) { | |
| 50 | - // Create an instance and store it in the cache | |
| 51 | - $this->module_instances[ $module['base_class'] ] = $module['base_class']::instance(); | |
| 52 | - wp_cache_set( $module['base_class'], $this->module_instances[ $module['base_class'] ], 'module_instances' ); | |
| 53 | - } else { | |
| 54 | - // Use the cached instance | |
| 55 | - $this->module_instances[ $module['base_class'] ] = $cached_instance; | |
| 56 | - } | |
| 49 | + $module['base_class']::instance(); | |
| 57 | 50 | |
| 58 | 51 | } |
| 59 | - | |
| 60 | 52 | } |
| 61 | - | |
| 62 | - | |
| 63 | -} | |
| 53 | +} | |