-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
47 lines (36 loc) · 1.24 KB
/
index.php
File metadata and controls
47 lines (36 loc) · 1.24 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
<?php
/**
* Simple demo : How to use filecombiner class
*
* Author : Leif Nesheim (gitleif)
* Url: https://github.com/gitleif/filecombiner
*/
// simple timer
$before = microtime(true);
// Add the filecombiner class
require("src/filecombiner.php");
// Instantiation of the filebombiner
$Combiner = new fileCombiner();
// Register a unique settings, this is for JS files
$Combiner->registerNew("JS", array("basepath"=>dirname(__FILE__) . "/js/", "outputpath"=>dirname(__FILE__) . "/js/", "extention"=>"js", "postfix"=>"?ver1", "url"=>dirname(__FILE__) . "/js/"));
// Add three JS files found in the JS Folder.
// No need to use the complete filepath, because basepath is set in registerNew
$Combiner->addFile("JS", array("jscript1.js", "jscript2.js","jscript3.js"));
?>
<html>
<head>
<!-- Normal way to load scripts
<script src="js/jscript1.js"></script>
<script src="js/jscript2.js"></script>
<script src="js/jscript3.js"></script>
-->
<!-- filecombiner class -->
<script src="js/<?php echo($Combiner->Combine("JS")); ?>"></script>
</head>
<body>
<h1>JS Files Combined</h1>
</body>
</html>
<?php
echo "Time used: " . number_format(( microtime(true) - $before), 6) . " Seconds\n";
?>