function exportConfig(array $config) { ksort($config); // Remove null values at the end of the config while (end($config) === null) { array_pop($config); } $i = 0; $elements = []; foreach ($config as $k => $v) { $php = $k === $i++ ? '' : var_export($k, true) . '=>'; if (is_array($v)) { $php .= exportConfig($v); } elseif (is_null($v)) { // var_export() exports null values as "NULL" in uppercase and uppercase sucks $php .= 'null'; } elseif (strpos($v, "\n") !== false) { $php .= '"' . addcslashes($v, "\\\"\n") . '"'; } else { $php .= var_export($v, true); } $elements[] = $php; } return 'array(' . implode(',', $elements) . ')'; }
$FORCE = "true"; } else { if ($_option == "--update") { runSelfUpdate(); } else { if ($_option == "--update-check") { $returnValue = updateCheck(); exit($returnValue); } else { if (0 === strpos($_option, "--base=")) { global $BASE; $BASE = substr($_option, strpos($_option, "=") + 1); consoleWriteLine("\$BASE was set to " . $BASE); } else { if ($_option == "--export-config") { exportConfig(); exit(0); } else { if ($_option == "--extract-config") { extractConfig(); exit(0); } else { if ($_option == "--dump") { $DUMP = "true"; } else { if (0 === strpos($_option, "--get=")) { $GET_VARIABLE = substr($_option, strpos($_option, "=") + 1); } else { if (0 === strpos($_option, "--set=")) { $SET_VARIABLE = substr($_option, strpos($_option, "=") + 1); } else {