#!/usr/bin/env php "src/main.php", 1 => "src/ifmarchive.php", 2 => "src/htpasswd.php" ); // get options $options = getopt(null, array("language::", "languages::", "lang::", "cdn")); // build CDN version? if (isset($options['cdn'])) define("IFM_CDN", true); else define("IFM_CDN", false); // process languages $langs = []; foreach ($options as $key => $value) if (substr($key, 0, 4) == "lang") $langs = array_merge($langs, explode(",", $value)); $langs = array_unique($langs); $vars['default_lang'] = ($langs[0] == "all") ? "en" : $langs[0]; if (in_array("all", $langs)) $langs = array_map( function($i) { return str_replace("src/i18n/", "", str_replace(".json", "", $i)); }, glob("src/i18n/*.json") ); $vars['languageincludes'] = ""; foreach ($langs as $l) if (file_exists("src/i18n/".$l.".json")) $vars['languageincludes'] .= '$i18n["'.$l.'"] = <<<\'f00bar\'' . "\n" . file_get_contents( "src/i18n/".$l.".json" ) . "\n" . 'f00bar;' . "\n" . '$i18n["'.$l.'"] = json_decode( $i18n["'.$l.'"], true );' . "\n" ; else print "WARNING: Language file src/i18n/".$l.".json not found.\n"; // Concat PHP Files $compiled = array( "run(); ', FILE_APPEND ); // build compressed ifm file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_STANDALONE_GZ, '' . gzencode( file_get_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') .IFM_STANDALONE, false, null, 5 ) ) ); // build lib file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_LIB, $compiled );