function GetAllFiles($folder, $recursif = true) { $files = array(); $dir = opendir($folder); while ($file = readdir($dir)) { if ($file == '.' || $file == '..') { continue; } if (is_dir($folder . '/' . $file)) { if ($recursif == true) { $files = array_merge($files, GetAllFiles($folder . '/' . $file)); } } else { $files[] = $folder . '/' . $file; } } closedir($dir); return $files; }
protected function CacheModels() { // Make sure the model folder exists $modelCacheFolder = Directory($this->ModelFolder); if (!is_dir($modelCacheFolder)) { mkdir($modelCacheFolder, 777, true); } // Make sure the cache folder and cache folders exists $cacheFilePath = Directory(MODEL_CACHE_FOLDER); if (!is_dir($cacheFilePath)) { mkdir($cacheFilePath, 777, true); } $modelHelper = ScriptCore::$Instance->GetModelHelper(); $modelFiles = GetAllFiles($modelCacheFolder); foreach ($modelFiles as $modelFile) { $cacheFile = $modelHelper->GetModelFilePath($modelFile); if (!file_exists($cacheFile)) { $modelHelper->CacheModelFromModel($this, $modelFile, $cacheFile, false); } else { $modelHelper->ReadModelCache($this, $modelFile, $cacheFile); } } }
function GetAllProjectsCode() { $templateCode = file_get_contents("project_template.html"); $projectFiles = GetAllFiles("projects"); for ($i = 0; $i < count($projectFiles); $i++) { $code .= GetProjectButtonCode($templateCode, basename($projectFiles[$i], ".xml")); } return $code; }
public function SetupPlugins() { $this->Plugins = array(); $pluginFolder = Directory(PLUGINS_FOLDER); if (!is_dir($pluginFolder)) { mkdir($pluginFolder, 777, true); } foreach (GetAllFiles($pluginFolder) as $plugin) { $pluginCore = new Core(PLUGINS_FOLDER . $plugin, $this); $this->Plugins[] = $pluginCore; } }
public function SetupHelpers() { $helperFileDirectory = Directory($this->HelperFolder); $helperFiles = GetAllFiles($helperFileDirectory); foreach ($helperFiles as $helperFile) { $helperFileName = $helperFileDirectory . $helperFile; $helperName = $this->Helpers->GetHelperName($helperFile); $helperClassName = $this->Helpers->GetHelperClassName($helperFile); $this->Helpers->AddHelperFile($helperName, $helperFileName, $helperClassName, $this->ApplicationConfig); } }