| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace RadiusTheme\SB\Modules; |
| 4 | + | |
| 4 | 5 | defined( 'ABSPATH' ) || exit(); |
| 5 | 6 | |
| 6 | 7 | use RadiusTheme\SB\Models\ModuleList; |
| 7 | 8 | |
| @@ -12,9 +13,9 @@ | ||
| 12 | 13 | use SingletonTrait; |
| 13 | 14 | |
| 14 | 15 | private $module_list; |
| 15 | 16 | |
| 16 | - private $module_instances = array(); | |
| 17 | + private $module_instances = []; | |
| 17 | 18 | private function __construct() { |
| 18 | 19 | add_action( 'init', [ $this, 'load_modules' ], 15 ); |
| 19 | 20 | } |
| 20 | 21 | |
| @@ -43,21 +44,9 @@ | ||
| 43 | 44 | if ( ! class_exists( $module['base_class'] ) ) { |
| 44 | 45 | continue; |
| 45 | 46 | } |
| 46 | 47 | |
| 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 | - } | |
| 48 | + $module['base_class']::instance(); | |
| 57 | 49 | |
| 58 | 50 | } |
| 59 | - | |
| 60 | 51 | } |
| 61 | - | |
| 62 | - | |
| 63 | -} | |
| 52 | +} | |