-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
98 lines (83 loc) · 1.68 KB
/
index.php
File metadata and controls
98 lines (83 loc) · 1.68 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
<?php
require_once './JSMin.php';
require_once './CssMin.php';
error_reporting(0);
$dir = '../editor';
$ateditorjs = '
/*
* In the name of GOD
*
*
* ATEditor
* By: AliReza_Tofighi
* Version: 0.0001 Alfa
*/
';
$ateditorcss = '
/*
* In the name of GOD
*
*
* ATEditor
* By: AliReza_Tofighi
* Version: 0.0001 Alfa
*/
';
$replacements = 0;
$fixes = 0;
$skipped = 0;
$tabs = '';
fix_file($dir.'/editor.js');
fix_file($dir.'/stylesheet.css');
while(($msg = browse($dir.'/plugins', $tabs)) === true);
echo $msg;
file_put_contents('./minify/editor.min.js', $ateditorjs);
file_put_contents('./minify/stylesheet.min.css', $ateditorcss);
exit;
function browse($dir, &$tabs)
{
$tabs .= '+';
// Directory?
if (is_dir($dir))
{
if ($directory = opendir($dir))
{
echo "<br /><strong>$tabs Entering directory $dir</strong>";
while (($file = readdir($directory)) !== false)
{
if($file == '..' || $file == '.')
continue;
if(is_dir($dir.'/'.$file))
{
browse($dir.'/'.$file, $tabs);
$tabs = substr_replace($tabs, '', strlen($tabs)-1, 1);
}
else
{
if(substr($file, -3) != '.js' && substr($file, -4) != '.css')
continue;
fix_file($dir.'/'.$file, $tabs);
}
}
closedir($directory);
}
}
else
return "Error: $dir is not a directory.";
}
function fix_file($filepath, $tabs)
{
echo "<br />$tabs Minify $filepath...";
global $ateditorjs, $ateditorcss;
if(substr($filepath, -3) == '.js')
{
$output = JSMin::minify(file_get_contents($filepath));
$ateditorjs .= $output;
}
elseif(substr($filepath, -4) == '.css')
{
$output = CssMin::minify(file_get_contents($filepath));
$ateditorcss .= $output;
}
return true;
}