| Conditions | 6 | 
| Paths | 3 | 
| Total Lines | 28 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php namespace CMSFactory; | ||
| 29 |     public function adminAutoload() { | ||
| 30 |         if (!self::$adminAutoLoaded) { | ||
| 31 | /** Search module with autoload */ | ||
| 32 |             $query = $this->db->select('name')->where('autoload', 1)->get('components'); | ||
| 33 | |||
| 34 |             if ($query) { | ||
| 35 | /** Run all Admin autoload method */ | ||
| 36 | $modules = $query->result_array(); | ||
| 37 | $modules = array_column($modules, 'name'); | ||
| 38 | array_unshift($modules, 'core'); | ||
| 39 | |||
| 40 | $modules = array_unique($modules); | ||
| 41 | |||
| 42 |                 foreach ($modules as $moduleName) { | ||
| 43 | \Modules::load_file($moduleName, APPPATH . 'modules' . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR); | ||
| 44 | $moduleName = ucfirst($moduleName); | ||
| 45 |                     if (class_exists($moduleName)) { | ||
| 46 |                         if (method_exists($moduleName, 'adminAutoload')) { | ||
| 47 | $moduleName::adminAutoload(); | ||
| 48 | } | ||
| 49 | } | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | self::$adminAutoLoaded = true; | ||
| 54 | } | ||
| 55 | |||
| 56 | } | ||
| 57 | |||
| 58 | } |