/** * @param RegisterService $registerService */ public function register(RegisterService $registerService) { $cacheDir = $registerService->getProjectPath() . '/' . Module::COMMON_CACHE; $load = new Load($cacheDir); $load->execute(PluginService::CACHE_FILE, function () use($registerService) { _loadServices($registerService->getDependencyInjection()); }); }
/** * Load all php file in a directory * @param $dir string Directory to load */ function _loadServices($dir) { // include type $files = scandir($dir); // include files first for ($i = 0; $i < count($files); $i++) { if (preg_match("/\\.php\$/", $files[$i])) { $files[$i] = preg_replace("/\\.php\$/", "", $files[$i]); include_once $dir . $files[$i] . ".php"; } } // then include dir for ($i = 0; $i < count($files); $i++) { if (is_dir($dir . $files[$i]) && $files[$i] != "." && $files[$i] != "..") { _loadServices($dir . $files[$i] . "/"); } } }
<?php $config = \Core\Config::get("database"); if (empty($config)) { $config = array(); } _loadServices("core/"); _loadServices("services/"); ?> <div style="display:none;" id="template_<?php echo $randId; ?> "> <div class="panel panel-default databaseitem_{dbid}"> <div class="panel-heading"> <h4 class="form-group form-inline"> <span style="float:right;color:red;cursor:pointer;" class="fa fa-minus-circle" id="deletedatabase_{dbid}" data-parent="databaseitem_{dbid}" ></span> <a data-toggle="collapse" data-parent="#accordion_{rnd}" href="#collapseOne_{rnd}" > Key </a> <input