forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
107 lines (85 loc) · 2.28 KB
/
Copy pathindex.php
File metadata and controls
107 lines (85 loc) · 2.28 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Phaser Documentation Viewer</title>
<style type="text/css">
body {
font-family: Arial;
font-size: 14px;
background-color: #fff;
color: #000;
}
textarea {
width: 100%;
height: 1000px;
}
</style>
</head>
<body>
<a href="export.php">Export</a>
<?php
// http://uk1.php.net/manual/en/class.splfileinfo.php
function dirToArray($dir) {
global $src;
$ignore = array('.', '..');
$fileIgnore = array('p2.js');
$result = array();
$root = scandir($dir);
$dirs = array_diff($root, $ignore);
foreach ($dirs as $key => $value)
{
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (is_dir($path))
{
$result[$value] = dirToArray($path);
}
else
{
if (substr($value, -3) == '.js')
{
if (!in_array($value, $fileIgnore))
{
$index = str_replace($src, "", $path);
$index = substr($index, 1);
$result[substr($value, 0, -3)] = $index;
}
}
}
}
return $result;
}
function displaySection($title, $files) {
if ($title === "")
{
echo "<h1>Phaser v2.1.1</h1>";
}
else
{
echo "<h2>$title</h2>";
}
echo "<ul>";
foreach ($files as $name => $file)
{
if (is_array($file))
{
displaySection($name, $file);
}
else
{
echo "<li><a href=\"view.php?src=$file\">$name</a>";
echo " [ <a href=\"export.php?src=$file\">json</a> ]</li>";
}
}
echo "</ul>";
}
$src = realpath('../src');
$files = dirToArray($src);
displaySection("", $files);
// echo "<pre>";
// var_dump($src);
// print_r($files);
// echo "</pre>";
?>
</body>
</html>