-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
70 lines (47 loc) · 1.49 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
$compileFile = false;
if(isset($_GET["compile"])) $compileFile = $_GET["compile"] == "true";
function getFileUrls($htmlUrl){
$file = fopen($htmlUrl,"r");
$text = fread($file,filesize($htmlUrl));
fclose($file);
$text = trim($text);
$t = explode("var scripts = [",$text)[1];
$t = explode("]",$t)[0];
$t = implode("",explode("\n",$t));
$t = implode("",explode('"',$t));
$t = implode("",explode(" ",$t));
$t = explode(",",trim($t));
return $t;
}
$urls = getFileUrls("AllFiles.js");
$len = count($urls);
$allFiles = "";
$urlList = "";
for($i=0;$i<$len;$i++){
$name = trim($urls[$i]);
$file = fopen($name,"r");
$text = fread($file,filesize($name));
fclose($file);
$allFiles .= $text."\n\n";
$urlList .= "<script src = '".$name."' ></script>";
}
$file = fopen("App.js","r");
$text = fread($file,filesize("App.js"));
fclose($file);
//echo $text."<br>";
$allFiles .= $text."\n\n";
//echo $allFiles;
$file = fopen("project.js","w");
fwrite($file,$allFiles);
fclose($file);
//-------
$file = fopen("_index.html","r");
$text = fread($file,filesize("_index.html"));
fclose($file);
if($compileFile == false){
$urlList .= "<script src = 'App.js' ></script>";
$text = implode($urlList,explode('<script src="project.js"></script>',$text));
}
echo $text;
?>