"Documentation",
'tagline' => false,
'image' => false,
'theme' => 'red',
'docs_path' => 'docs',
'date_modified' => true,
'float' => true,
'repo' => false,
'toggle_code' => false,
'twitter' => array(),
'links' => array(),
'colors' => false,
'clean_urls' => true,
'google_analytics' => false,
'piwik_analytics' => false,
'piwik_analytics_id' => 1,
'ignore' => array(),
'languages' => array(),
'file_editor' => false,
'template' => 'default'
);
// Load User Config
$config_file = (($config_file === '') ? 'docs/config.json' : $config_file);
if (substr($config_file, 0, 1) !== '/') $config_file = $base . '/' . $config_file;
if (file_exists($config_file)) {
$config = json_decode(file_get_contents($config_file), true);
if(!isset($config)) {
echo 'Daux.io Config Error:
The config file ' . $config_file . ' that was passed contained invalid JSON. Learn More.';
exit;
}
$options = array_merge($options, $config);
}
if (!isset($options['ignore']['files'])) $options['ignore']['files'] = array();
if (!isset($options['ignore']['folders'])) $options['ignore']['folders'] = array();
if ($options['theme'] !== 'custom') {
$themes = array("blue","navy","green","red");
if (!in_array($options['theme'], $themes)) {
echo "Daux.io Config Error:
The theme you set is not not a valid option. Please use one of the following options: " . join(array_keys($themes), ', ') . ' or learn more about how to customize the colors.';
exit;
}
} else {
if (empty($options['colors'])) {
echo 'Daux.io Config Error:
You are trying to use a custom theme, but did not setup your color options in the config. Learn more about how to customize the colors.';
exit;
}
}
if (!ini_get('date.timezone')) date_default_timezone_set('GMT');
return $options;
}
// Build Directory Tree
function build_tree() {
global $tree, $options, $docs_path , $multilanguage, $output_language;
if (!$multilanguage) $tree = directory_tree($docs_path, $options['ignore']);
else
foreach ($options['languages'] as $languageKey => $language) {
$output_language = $languageKey;
$tree[$languageKey] = directory_tree($docs_path . '/' . $languageKey, $options['ignore']);
}
}
// Recursively add files & directories to Tree
function directory_tree($dir, $ignore) {
global $base_doc, $multilanguage, $output_language;
$tree = array();
$Item = array_diff(scandir($dir), array(".", "..", "index.md"));
foreach ($Item as $key => $value) {
if (is_dir($dir . '/' . $value)) {
if (!in_array($value, $ignore['folders']))
$tree[$value] = directory_tree($dir . '/' . $value, $ignore);
} else if (!in_array($value, $ignore['files'])) {
if (substr($value, -3) === ".md") {
$tree[$value] = $value;
if ($multilanguage)
$base_doc[$output_language] = isset($base_doc[$output_language]) ? $base_doc[$output_language] : $dir . '/' . $value;
else $base_doc = isset($base_doc) ? $base_doc : $dir . '/' . $value;
}
}
}
return $tree;
}
// Build Navigation
function get_navigation($url) {
global $tree, $multilanguage, $output_language, $output_path;
$dir = isset($output_path) ? $output_path : '';
$return = "