mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-14 20:14:05 +02:00
initial commit after switching to bootstrap
This commit is contained in:
19
compiler.php
Normal file → Executable file
19
compiler.php
Normal file → Executable file
@@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
// This compiles the source files into one file
|
||||
|
||||
$IFM_CONFIG = "src/config.php";
|
||||
$IFM_INCLUDES = "src/includes.php";
|
||||
$IFM_MAIN = "src/main.php";
|
||||
$IFM_STYLE = "src/style.css";
|
||||
$IFM_JS = "src/ifm.js";
|
||||
$IFM_OTHER_PHPFILES = array("src/ifmzip.php");
|
||||
|
||||
$filename = "ifm.php";
|
||||
@@ -14,15 +12,10 @@ $filename = "ifm.php";
|
||||
// config
|
||||
file_put_contents($filename, file_get_contents($IFM_CONFIG));
|
||||
|
||||
// includes
|
||||
$content_includes = file($IFM_INCLUDES);
|
||||
unset($content_includes[0]);
|
||||
file_put_contents($filename, $content_includes, FILE_APPEND);
|
||||
|
||||
// other php classes
|
||||
foreach ( $IFM_OTHER_PHPFILES as $file) {
|
||||
$content_file = file($file);
|
||||
unset($content_file[0]);
|
||||
unset($content_file[0]); // remove <?php line
|
||||
file_put_contents($filename, $content_file, FILE_APPEND);
|
||||
}
|
||||
|
||||
@@ -30,6 +23,10 @@ foreach ( $IFM_OTHER_PHPFILES as $file) {
|
||||
$content_main = file($IFM_MAIN);
|
||||
unset($content_main[0]);
|
||||
$content_main = implode($content_main);
|
||||
$content_main = str_replace("@@@COMPILE:style.css@@@", file_get_contents($IFM_STYLE), $content_main);
|
||||
$content_main = str_replace("@@@COMPILE:ifm.js@@@", file_get_contents($IFM_JS), $content_main);
|
||||
$include_files = NULL;
|
||||
preg_match_all( "/\@\@\@([^\@]+)\@\@\@/", $content_main, $include_files, PREG_SET_ORDER );
|
||||
foreach( $include_files as $file ) {
|
||||
//echo $file[0]. " " .$file[1]."\n";
|
||||
$content_main = str_replace( $file[0], file_get_contents( $file[1] ), $content_main );
|
||||
}
|
||||
file_put_contents($filename, $content_main, FILE_APPEND);
|
||||
|
Reference in New Issue
Block a user