daux.io/index.php

358 lines
12 KiB
PHP
Raw Normal View History

2013-07-13 05:26:27 +02:00
<?php
2013-06-04 19:26:14 +02:00
/*
2013-06-12 00:28:29 +02:00
Daux.io
2013-06-04 19:26:14 +02:00
==================
Description
-----------
This is a tool for auto-generating documentation based on markdown files
located in the /docs folder of the project. To see all of the available
2013-06-12 00:28:29 +02:00
options and to read more about how to use the generator, visit:
http://daux.io
2013-06-04 19:26:14 +02:00
Author
------
Justin Walsh (Todaymade): justin@todaymade.com, @justin_walsh
2013-06-12 00:28:29 +02:00
Garrett Moon (Todaymade): garrett@todaymade.com, @garrett_moon
Feedback & Suggestions
----
To give us feedback or to suggest an idea, please create an request on the the
2013-07-17 18:54:08 +02:00
GitHub issue tracker:
2013-06-04 19:26:14 +02:00
2013-06-21 17:49:05 +02:00
https://github.com/justinwalsh/daux.io/issues
2013-06-04 19:26:14 +02:00
Bugs
----
To file bug reports please create an issue using the github issue tracker:
2013-06-21 17:49:05 +02:00
https://github.com/justinwalsh/daux.io/issues
2013-06-04 19:26:14 +02:00
Copyright and License
---------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited
to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the copyright owner
or contributors be liable for any direct, indirect, incidental, special,
exemplary, or consequential damages (including, but not limited to,
procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including
negligence or otherwise) arising in any way out of the use of this
software, even if advised of the possibility of such damage.
*/
2013-06-21 17:49:05 +02:00
require_once('libs/functions.php');
$options = get_options();
$tree = get_tree($options['docs_path'], $base_url);
2013-10-03 23:16:42 +02:00
// If a language is set in the config, rewrite urls based on the language
if ($language === null) {
$homepage_url = homepage_url($tree);
$docs_url = docs_url($tree);
} else {
$homepage_url = "/";
}
2013-06-21 17:49:05 +02:00
$docs_url = docs_url($tree);
2013-08-23 21:49:08 +02:00
$url_params = url_params();
if (count($options['languages']) > 0 && count($url_params) > 0 && strlen($url_params[0]) > 0) {
$language = array_shift($url_params);
$base_path = "docs/" . $language;
} else {
$language = null;
$base_path = "docs";
}
$tree = get_tree($base_path, $base_url, '', true, $language);
2013-06-21 17:49:05 +02:00
2013-10-03 23:16:42 +02:00
2013-06-21 17:49:05 +02:00
2013-08-23 21:49:08 +02:00
$page = load_page($tree, $url_params);
// If a timezone has been set in the config file, override the default PHP timezone for this application.
if(isset($options['timezone']))
{
date_default_timezone_set($options['timezone']);
}
2013-06-21 17:49:05 +02:00
// Redirect to docs, if there is no homepage
if ($homepage && $homepage_url !== '/') {
header('Location: '.$homepage_url);
}
2013-06-04 19:26:14 +02:00
2013-06-03 15:32:55 +02:00
?>
2013-06-12 21:42:00 +02:00
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
2013-06-03 15:32:55 +02:00
<head>
2013-07-13 05:26:27 +02:00
<title><?php echo $options['title']; ?></title>
2013-06-21 17:49:05 +02:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2013-07-13 05:26:27 +02:00
<meta name="description" content="<?php echo $options['tagline'];?>" />
<meta name="author" content="<?php echo $options['title']; ?>">
<?php if ($options['colors']) { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon">
2013-07-13 05:26:27 +02:00
<?php } else { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon">
2013-07-13 05:26:27 +02:00
<?php } ?>
<!-- Mobile -->
2013-06-12 21:42:00 +02:00
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2013-06-12 00:28:29 +02:00
<!-- Font -->
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'>
2013-06-12 00:28:29 +02:00
<!-- LESS -->
2013-07-13 05:26:27 +02:00
<?php if ($options['colors']) { ?>
2013-06-12 00:28:29 +02:00
<style type="text/less">
2013-07-13 05:26:27 +02:00
<?php foreach($options['colors'] as $k => $v) { ?>
@<?php echo $k;?>: <?php echo $v;?>;
<?php } ?>
@import "<?php echo $base_url ?>/less/import/daux-base.less";
2013-06-12 00:28:29 +02:00
</style>
<script src="<?php echo $base_url ?>/js/less.min.js"></script>
2013-07-13 05:26:27 +02:00
<?php } else { ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css">
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-03 15:32:55 +02:00
<!-- hightlight.js -->
<script src="<?php echo $base_url ?>/js/highlight.min.js"></script>
2013-06-03 15:32:55 +02:00
<script>hljs.initHighlightingOnLoad();</script>
<!-- Navigation -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script>
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='<?php echo $base_url ?>/js/jquery-1.10.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script>
<script src="<?php echo $base_url ?>/js/custom.js"></script>
2013-06-12 21:42:00 +02:00
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
2013-06-03 15:32:55 +02:00
</head>
<body>
2013-07-13 05:26:27 +02:00
<?php if ($homepage) { ?>
2013-06-12 00:28:29 +02:00
<!-- Hompage -->
2013-06-12 21:42:00 +02:00
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
2013-10-02 14:16:43 +02:00
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
2013-06-12 21:42:00 +02:00
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
</div>
</div>
<div class="homepage-hero well container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
2013-07-13 05:26:27 +02:00
<?php if ($options['tagline']) { ?>
<h2><?php echo $options['tagline'];?></h2>
<?php } ?>
2013-06-12 21:42:00 +02:00
</div>
</div>
<div class="row">
<div class="span10 offset1">
2013-07-13 05:26:27 +02:00
<?php if ($options['image']) { ?>
<img class="homepage-image" src="<?php echo $base_url ?>/<?php echo $options['image'];?>" alt="<?php echo $options['title'];?>">
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-12 21:42:00 +02:00
</div>
</div>
</div>
</div>
<div class="hero-buttons container-fluid">
<div class="container">
<div class="row">
<div class="text-center span12">
2013-07-13 05:26:27 +02:00
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" class="btn btn-secondary btn-hero">
2013-06-21 17:49:05 +02:00
View On GitHub
</a>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-08-23 21:49:08 +02:00
<?php if (count($options['languages']) > 0) { ?>
<?php foreach ($options['languages'] as $language_key => $language_name) { ?>
<a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero">
<?php echo $language_name; ?>
</a>
<?php } ?>
<?php } else { ?>
2013-07-13 05:26:27 +02:00
<a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero">
2013-06-12 21:42:00 +02:00
View Documentation
</a>
2013-08-23 21:49:08 +02:00
<?php } ?>
2013-06-12 21:42:00 +02:00
</div>
</div>
</div>
</div>
2013-06-12 00:28:29 +02:00
2013-06-12 21:42:00 +02:00
<div class="homepage-content container-fluid">
<div class="container">
<div class="row">
2013-10-02 14:16:43 +02:00
<div class="span10 offset1">
<?php echo $page['html'];?>
2013-06-12 21:42:00 +02:00
</div>
</div>
</div>
</div>
<div class="homepage-footer well container-fluid">
<div class="container">
<div class="row">
<div class="span5 offset1">
2013-07-13 05:26:27 +02:00
<?php if (!empty($options['links'])) { ?>
2013-06-12 21:42:00 +02:00
<ul class="footer-nav">
2013-07-13 05:26:27 +02:00
<?php foreach($options['links'] as $name => $url) { ?>
<li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li>
<?php } ?>
2013-06-12 21:42:00 +02:00
</ul>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-12 21:42:00 +02:00
</div>
<div class="span5">
<div class="pull-right">
2013-07-13 05:26:27 +02:00
<?php if (!empty($options['twitter'])) { ?>
<?php foreach($options['twitter'] as $handle) { ?>
2013-06-12 21:42:00 +02:00
<div class="twitter">
2013-07-13 05:26:27 +02:00
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
2013-06-12 21:42:00 +02:00
</div>
2013-07-13 05:26:27 +02:00
<?php } ?>
<?php } ?>
2013-06-12 21:42:00 +02:00
</div>
</div>
</div>
</div>
</div>
2013-06-12 00:28:29 +02:00
2013-07-13 05:26:27 +02:00
<?php } else { ?>
2013-06-12 00:28:29 +02:00
<!-- Docs -->
2013-07-13 05:26:27 +02:00
<?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" target="_blank" id="github-ribbon"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<?php } ?>
2013-06-12 21:42:00 +02:00
<div class="container-fluid fluid-height wrapper">
2013-06-12 00:28:29 +02:00
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
2013-10-08 16:57:28 +02:00
<a class="brand pull-left" href="<?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
2013-06-12 00:28:29 +02:00
<p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a>
</p>
</div>
2013-06-12 00:28:29 +02:00
</div>
2013-06-12 00:28:29 +02:00
<div class="row-fluid columns content">
<div class="left-column article-tree span3">
<!-- For Mobile -->
<div class="responsive-collapse">
<button type="button" class="btn btn-sidebar" id="menu-spinner-button">
2013-06-12 00:28:29 +02:00
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="sub-nav-collapse" class="sub-nav-collapse">
2013-06-12 00:28:29 +02:00
<!-- Navigation -->
2013-08-23 21:49:08 +02:00
<?php echo build_nav($tree, $url_params); ?>
2013-06-12 00:28:29 +02:00
2013-07-13 05:26:27 +02:00
<?php if (!empty($options['links']) || !empty($options['twitter'])) { ?>
2013-06-12 00:28:29 +02:00
<div class="well well-sidebar">
<!-- Links -->
2013-07-13 05:26:27 +02:00
<?php foreach($options['links'] as $name => $url) { ?>
<a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br>
<?php } ?>
2013-06-12 00:28:29 +02:00
<!-- Twitter -->
2013-07-13 05:26:27 +02:00
<?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter">
2013-06-11 00:39:34 +02:00
<hr/>
2013-07-13 05:26:27 +02:00
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=<?php echo $handle;?>&amp;show_count=false"></iframe>
</div>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-12 00:28:29 +02:00
</div>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-12 00:28:29 +02:00
</div>
</div>
2013-07-13 05:26:27 +02:00
<div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
2013-06-12 00:28:29 +02:00
<div class="content-page">
<article>
<?php if($options['date_modified'] && isset($page['modified'])) { ?>
<div class="page-header sub-header clearfix">
<h1><?php echo $page['title'];?></h1>
<span style="float: left; font-size: 10px; color: gray;">
<?php echo date("l, F j, Y", $page['modified']);?>
</span>
<span style="float: right; font-size: 10px; color: gray;">
<?php echo date ("g:i A", $page['modified']);?>
</span>
</div>
<?php } else { ?>
<div class="page-header">
<h1><?php echo $page['title'];?></h1>
</div>
2013-10-02 14:16:43 +02:00
<?php } ?>
<?php echo $page['html'];?>
2013-06-12 00:28:29 +02:00
</article>
</div>
</div>
2013-06-03 15:32:55 +02:00
</div>
</div>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-06-21 21:36:50 +02:00
2013-07-13 05:26:27 +02:00
<?php if ($options['google_analytics']) { ?>
2013-06-21 21:36:50 +02:00
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
2013-07-13 05:26:27 +02:00
ga('create', '<?php echo $options['google_analytics'];?>', '<?php echo $_SERVER['HTTP_HOST'];?>');
2013-06-21 21:36:50 +02:00
ga('send', 'pageview');
</script>
2013-07-13 05:26:27 +02:00
<?php } ?>
2013-07-21 21:05:09 +02:00
<?php if ($options['piwik_analytics']) { ?>
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<?php echo $options['piwik_analytics'];?>/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<?php } ?>
2013-06-03 15:32:55 +02:00
</body>
2013-07-21 21:05:09 +02:00
</html>