Beispiel #1
0
function getFile($url)
{
    $hostDir = BuCore::fstab('staticHostDir') . '/' . HTTP_HOST;
    $prjDir = BuCore::fstab('staticPrj');
    $coreDir = BuCore::fstab('staticCore');
    foreach (array($hostDir, $prjDir, $coreDir) as $v) {
        if (file_exists($v . $url)) {
            return $v . $url;
        }
    }
}
Beispiel #2
0
 private static function readConfigFromFiles($configPath)
 {
     $config = array();
     $configCoreDir = BuCore::fstab('configCore') . '/';
     $configPrjDir = BuCore::fstab('configPrj') . '/';
     $configHostDir = BuCore::fstab('configHostDir') . '/' . HTTP_HOST . '/';
     if (!file_exists($configCoreDir . $configPath . '.yaml') and !file_exists($configPrjDir . $configPath . '.yaml') and !file_exists($configHostDir . $configPath . '.yaml')) {
         throw new Exception('Config file ' . $configPath . ' not exists');
     }
     $config = array();
     foreach (array($configCoreDir, $configPrjDir, $configHostDir) as $v) {
         if (file_exists($v . $configPath . '.yaml')) {
             ob_start();
             include $v . $configPath . '.yaml';
             $data = ob_get_contents();
             ob_end_clean();
             $newConfig = Spyc::YAMLLoad($data);
             $config = array_merge($config, $newConfig);
         }
     }
     return $config;
 }
Beispiel #3
0
 private static function getFile($pathArray, $fstabPrefix, $exceptionString)
 {
     if (is_string($pathArray)) {
         $pathArray = array($pathArray);
     }
     $coreDir = BuCore::fstab($fstabPrefix . 'Core') . '/';
     $prjDir = BuCore::fstab($fstabPrefix . 'Prj') . '/';
     $hostDir = BuCore::fstab($fstabPrefix . 'HostDir') . '/' . HTTP_HOST . '/';
     foreach ($pathArray as $path) {
         if ($path == 'blank') {
             return 'blank';
         }
         foreach (array($hostDir, $prjDir, $coreDir) as $v) {
             if (file_exists($v . $path . '.php')) {
                 return $v . $path . '.php';
             } elseif (file_exists($v . $path . '/index' . '.php')) {
                 return $v . $path . '/index' . '.php';
             }
         }
     }
     throw new Exception(sprintf($exceptionString, implode(', ', $pathArray)));
 }
Beispiel #4
0
 public static function delete($path)
 {
     unlink(BuCore::fstab('cache') . '/' . $path);
 }