ini_set('display_errors', 1);
error_reporting(E_ALL);
/*
* WARNING: DO NOT EDIT THIS FILE.
* If you edit this file, you will not be able to update to new versions of
* Daux.io without overwritting your changes. Instead use the config.json file
* in the /docs folder to customize your documentation.
*
* Want to add a new feature? Send me a pull request or open an issue - https://github.com/justinwalsh/daux.io
*
* Learn more about what you can customize here: http://daux.io
*/
require_once('libs/markdown_extended.php');
// Check for homepage
$path = url_path();
if ($path === '/' || $path === '') {
$homepage = true;
} else {
$homepage = false;
}
// Daux.io Functions
function get_options() {
$options = array(
'title' => "Documentation",
'tagline' => false,
'image' => false,
'theme' => 'blue',
'float' => true,
'repo' => false,
'twitter' => array(),
'links' => array(),
'colors' => false
);
// Load User Config
$config_file = './docs/config.json';
if (file_exists($config_file)) {
$config = json_decode(file_get_contents($config_file), true);
$options = array_merge($options, $config);
}
if ($options['theme'] !== 'custom') {
// Load Theme
if (!in_array($options['theme'], array("blue","navy","green","red"))) {
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;
}
}
return $options;
}
function homepage_url($tree) {
// Check for homepage
if (isset($tree['index'])) {
return '/';
} else {
return docs_url($tree);
}
}
function docs_url($tree, $branch = false) {
// Get next branch
if (!$branch) {
$branch = current($tree);
}
if ($branch['type'] === 'file') {
return $branch['url'];
} else if (!empty($branch['tree'])) {
return docs_url($branch['tree']);
} else {
// Try next folder...
$branch = next($tree);
if ($branch) {
return docs_url($tree, $branch);
} else {
echo 'Daux.io Config Error:
Unable to find the first page in the /docs folder. Double check you have at least one file in the root of of the /docs folder. Also make sure you do not have any empty folders. Visit the docs to learn more about how the default routing works.';
exit;
}
}
}
function load_page($tree) {
$branch = find_branch($tree);
if (isset($branch['type']) && $branch['type'] == 'file') {
$html = '';
if ($branch['name'] !== 'index') {
$html .= '