Beispiel #1
0
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;
}
Beispiel #2
0
 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);
         }
     }
 }
Beispiel #3
0
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;
}
Beispiel #4
0
 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;
     }
 }
Beispiel #5
0
 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);
     }
 }