mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-17 13:30:38 +02:00
Fix docker, remove debug output from ifmarchive class
Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
69
compiler.php
69
compiler.php
@@ -6,21 +6,20 @@
|
||||
* This script compiles all sources into one single file.
|
||||
*/
|
||||
|
||||
chdir( realpath( dirname( __FILE__ ) ) );
|
||||
chdir(realpath(dirname(__FILE__)));
|
||||
|
||||
// output files and common attrs
|
||||
define( "IFM_CDN", false );
|
||||
define( "IFM_VERSION", "<a href='https://github.com/misterunknown/ifm/tree/cryol-2.6.1' target=_blank>v2.6.1</a>" );
|
||||
define( "IFM_RELEASE_DIR", "dist/");
|
||||
define( "IFM_STANDALONE", "ifm.php" );
|
||||
define( "IFM_STANDALONE_GZ", "ifm.min.php" );
|
||||
define( "IFM_LIB", "libifm.php" );
|
||||
define("IFM_CDN", false);
|
||||
define("IFM_VERSION", "<a href='https://github.com/misterunknown/ifm/releases/tag/v2.6.1' target=_blank>v2.6.1</a>" );
|
||||
define("IFM_RELEASE_DIR", "dist/");
|
||||
define("IFM_STANDALONE", "ifm.php" );
|
||||
define("IFM_STANDALONE_GZ", "ifm.min.php" );
|
||||
define("IFM_LIB", "libifm.php" );
|
||||
|
||||
if( IFM_CDN ){
|
||||
if (IFM_CDN)
|
||||
$IFM_ASSETS = "src/assets.cdn.part";
|
||||
} else {
|
||||
else
|
||||
$IFM_ASSETS = "src/assets.part";
|
||||
}
|
||||
|
||||
// php source files
|
||||
$IFM_SRC_PHP = array(
|
||||
@@ -30,14 +29,38 @@ $IFM_SRC_PHP = array(
|
||||
);
|
||||
|
||||
// get options
|
||||
$options = getopt( null, array( "language::" ) );
|
||||
$options = getopt(null, array("language::", "languages::", "cdn::"));
|
||||
|
||||
// process languages
|
||||
$vars['languages'] = isset( $options['language'] ) ? explode( ',', $options['language'] ) : array( "en", "ru" );
|
||||
$langs = array_unique(array_merge(explode(",", join(",", [$options['language']])), explode(",", join(",", [$options['languages']]))));
|
||||
print_r($langs);
|
||||
if (in_array("all", $langs)) {
|
||||
$available_languages = array_map(
|
||||
function($i) { return str_replace("src/i18n/", "", str_replace(".json", "", $i)); },
|
||||
glob("src/i18n/*.json")
|
||||
);
|
||||
// default language is english, if not given
|
||||
if ($langs[0] == 'all' || !file_exists($lang[0]))
|
||||
$default_lang = "en";
|
||||
else
|
||||
$default_lang = $lang[0];
|
||||
|
||||
unset($available_langs[array_search($default_lang, $available_langs)]);
|
||||
$include_langs = array_merge($default_lang, $available_langs);
|
||||
}
|
||||
|
||||
print_r($options['language']);
|
||||
print_r($include_langs);
|
||||
die();
|
||||
|
||||
|
||||
// process languages
|
||||
$vars['languages'] = isset($options['language']) ? explode(',', $options['language']) : ["all"];
|
||||
$vars['defaultlanguage'] = $vars['languages'][0];
|
||||
|
||||
$vars['languageincludes'] = "";
|
||||
foreach( $vars['languages'] as $l ) {
|
||||
if( file_exists( "src/i18n/".$l.".json" ) )
|
||||
foreach ($vars['languages'] as $l)
|
||||
if (file_exists("src/i18n/".$l.".json"))
|
||||
$vars['languageincludes'] .=
|
||||
'$i18n["'.$l.'"] = <<<\'f00bar\'' . "\n"
|
||||
. file_get_contents( "src/i18n/".$l.".json" ) . "\n"
|
||||
@@ -45,11 +68,8 @@ foreach( $vars['languages'] as $l ) {
|
||||
. '$i18n["'.$l.'"] = json_decode( $i18n["'.$l.'"], true );' . "\n" ;
|
||||
else
|
||||
print "WARNING: Language file src/i18n/".$l.".json not found.\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Concat PHP Files
|
||||
*/
|
||||
// Concat PHP Files
|
||||
$compiled = array( "<?php" );
|
||||
foreach( $IFM_SRC_PHP as $phpfile ) {
|
||||
$lines = file( $phpfile );
|
||||
@@ -59,17 +79,14 @@ foreach( $IFM_SRC_PHP as $phpfile ) {
|
||||
$compiled = join( $compiled );
|
||||
|
||||
$compiled = str_replace( "IFM_ASSETS", file_get_contents( $IFM_ASSETS ), $compiled );
|
||||
/**
|
||||
* Process file includes
|
||||
*/
|
||||
|
||||
// Process file includes
|
||||
$includes = NULL;
|
||||
preg_match_all( "/\@\@\@file:([^\@]+)\@\@\@/", $compiled, $includes, PREG_SET_ORDER );
|
||||
foreach( $includes as $file )
|
||||
$compiled = str_replace( $file[0], file_get_contents( $file[1] ), $compiled );
|
||||
|
||||
/**
|
||||
* Process ace includes
|
||||
*/
|
||||
// Process ace includes
|
||||
$includes = NULL;
|
||||
$vars['ace_includes'] = "";
|
||||
preg_match_all( "/\@\@\@acedir:([^\@]+)\@\@\@/", $compiled, $includes, PREG_SET_ORDER );
|
||||
@@ -84,9 +101,7 @@ foreach( $includes as $dir ) {
|
||||
$compiled = str_replace( $dir[0], $dircontent, $compiled );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process variable includes
|
||||
*/
|
||||
// Process variable includes
|
||||
$includes = NULL;
|
||||
preg_match_all( "/\@\@\@vars:([^\@]+)\@\@\@/", $compiled, $includes, PREG_SET_ORDER );
|
||||
foreach( $includes as $var )
|
||||
|
Reference in New Issue
Block a user