Esempio n. 1
0
 /**
  * 
  * get bullets set from some dir
  */
 private static function getBulletSetFromDir($dir)
 {
     $pathSet = GlobalsUniteHCar::$pathAssetsBullets . $dir . "/";
     if (is_dir($pathSet) == false) {
         UniteFunctionsHCar::throwError("The bullet directory: {$dir} not found!");
     }
     $urlSet = GlobalsUniteHCar::$urlAssetsBullets . $dir . "/";
     //set paths
     $bulletNormal = "bullet_normal.png";
     $bulletActive = "bullet_active.png";
     $bgLeft = "bg_left.png";
     $bgRepeat = "bg_repeat.png";
     $bgRight = "bg_right.png";
     $preview = "preview.png";
     $options = "options.ini";
     //validate required paths:
     if (file_exists($pathSet . $bulletNormal) == false) {
         UniteFunctionsHCar::throwError("{$bulletNormal} not found in bullets set: {$dir}");
     }
     if (file_exists($pathSet . $bulletActive) == false) {
         UniteFunctionsHCar::throwError("{$bulletActive} not found in bullets set: {$dir}");
     }
     //validate required paths:
     if (file_exists($pathSet . $preview) == false) {
         UniteFunctionsHCar::throwError("{$preview} not found in bullets set: {$dir}");
     }
     //set data array
     $set = array();
     $set["name"] = $dir;
     $set["url_normal"] = $urlSet . $bulletNormal;
     $set["url_active"] = $urlSet . $bulletActive;
     $set["url_preview"] = $urlSet . $preview;
     //set bg
     $set["url_bgleft"] = "";
     $set["url_bgright"] = "";
     $set["url_bgrepeat"] = "";
     $set["is_bg"] = false;
     if (file_exists($pathSet . $bgLeft) && file_exists($pathSet . $bgRight) && file_exists($pathSet . $bgRepeat)) {
         $set["is_bg"] = true;
         $set["url_bgleft"] = $urlSet . $bgLeft;
         $set["url_bgright"] = $urlSet . $bgRight;
         $set["url_bgrepeat"] = $urlSet . $bgRepeat;
     }
     //set options
     $set["options"] = array();
     if (file_exists($pathSet . $options)) {
         $content = file_get_contents($pathSet . $options);
         $arrOptions = UniteFunctionsHCar::parseSettingsFile($content);
         $set["options"] = $arrOptions;
     }
     return $set;
 }