<?php


$file = "offline/cache.manifest";
$handler = fopen($file, "w");
fwrite($handler, "CACHE MANIFEST\n");
$dir = scandir("offline");
$dir2 = scandir("offline/img");
$dir2 = array_map(function ($str) { return "img/$str"; }, $dir2);
$dir3 = scandir("img/catalog");
$dir3 = array_map(function ($str) { return "../img/catalog/$str"; }, $dir3);
$dir4 = scandir("offline/css");
$dir4 = array_map(function ($str) { return "css/$str"; }, $dir4);
$dir5 = scandir("offline/js");
$dir5 = array_map(function ($str) { return "js/$str"; }, $dir5);
$dir6 = scandir("offline/images");
$dir6 = array_map(function ($str) { return "images/$str"; }, $dir6);
$dir7 = scandir("offline/fonts");
$dir7 = array_map(function ($str) { return "fonts/$str"; }, $dir7);
$dirFinal = array_merge($dir, $dir2);
$dirFinal = array_merge($dirFinal, $dir3, $dir4, $dir5, $dir6, $dir7);



foreach ($dirFinal as $key => $value) {
  switch($value){
    case ".":
    case "..":
      break;
    default:
      if(!is_dir($value)){
          fwrite($handler, str_replace('%2F', '/', rawurlencode($value)) . "\n");
      }

      break;
  }

}
fwrite($handler, "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js");
var_dump(fclose($handler));

 ?>
