Merge branch 'issue-41' of github.com:kisselev/daux.io into kisselev-issue-41
Dieser Commit ist enthalten in:
Commit
be399baea3
18
README.md
18
README.md
@ -197,6 +197,24 @@ By default, Daux.io will create clean url's that do not include index.php. On se
|
||||
}
|
||||
```
|
||||
|
||||
###Date Modified
|
||||
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
|
||||
|
||||
```json
|
||||
{
|
||||
"date_modified": false
|
||||
}
|
||||
```
|
||||
|
||||
###Timezone
|
||||
If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php).
|
||||
|
||||
```json
|
||||
{
|
||||
"timezone": "America/Los_Angeles"
|
||||
}
|
||||
```
|
||||
|
||||
## Running Remotely
|
||||
|
||||
Copy the files from the repo to a web server that can run PHP 5.3 or greater.
|
||||
|
@ -6725,6 +6725,10 @@ code {
|
||||
.page-header h1 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
/* To be applied to the same element as page-header for sites that have sub-heading content such as Last modified time */
|
||||
.page-header .sub-heading {
|
||||
padding: 0px, 0px, 20px;
|
||||
}
|
||||
pre {
|
||||
border: none;
|
||||
background-color: #82becd;
|
||||
|
@ -6725,6 +6725,10 @@ code {
|
||||
.page-header h1 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
/* To be applied to the same element as page-header for sites that have sub-heading content such as Last modified time */
|
||||
.page-header .sub-heading {
|
||||
padding: 0px, 0px, 20px;
|
||||
}
|
||||
pre {
|
||||
border: none;
|
||||
background-color: #8acc37;
|
||||
|
@ -6725,6 +6725,10 @@ code {
|
||||
.page-header h1 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
/* To be applied to the same element as page-header for sites that have sub-heading content such as Last modified time */
|
||||
.page-header .sub-heading {
|
||||
padding: 0px, 0px, 20px;
|
||||
}
|
||||
pre {
|
||||
border: none;
|
||||
background-color: #7795b4;
|
||||
|
@ -6725,6 +6725,10 @@ code {
|
||||
.page-header h1 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
/* To be applied to the same element as page-header for sites that have sub-heading content such as Last modified time */
|
||||
.page-header .sub-heading {
|
||||
padding: 0px, 0px, 20px;
|
||||
}
|
||||
pre {
|
||||
border: none;
|
||||
background-color: #ecb5a1;
|
||||
|
@ -197,6 +197,24 @@ By default, Daux.io will create clean url's that do not include index.php. On se
|
||||
}
|
||||
```
|
||||
|
||||
###Date Modified
|
||||
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
|
||||
|
||||
```json
|
||||
{
|
||||
"date_modified": false
|
||||
}
|
||||
```
|
||||
|
||||
###Timezone
|
||||
If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php).
|
||||
|
||||
```json
|
||||
{
|
||||
"timezone": "America/Los_Angeles"
|
||||
}
|
||||
```
|
||||
|
||||
## Running Remotely
|
||||
|
||||
Copy the files from the repo to a web server that can run PHP 5.3 or greater.
|
||||
|
@ -3,6 +3,7 @@
|
||||
"tagline": "The Easiest Way To Document Your Project",
|
||||
"image": "img/app.png",
|
||||
"theme": "navy",
|
||||
"date_modified": true,
|
||||
"repo": "justinwalsh/daux.io",
|
||||
"twitter": ["justin_walsh", "todaymade"],
|
||||
"google_analytics": "UA-12653604-10",
|
||||
|
46
index.php
46
index.php
@ -70,6 +70,15 @@ $tree = get_tree("docs", $base_url);
|
||||
$homepage_url = homepage_url($tree);
|
||||
$docs_url = docs_url($tree);
|
||||
|
||||
$page = load_page($tree);
|
||||
|
||||
// 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']);
|
||||
}
|
||||
|
||||
|
||||
// Redirect to docs, if there is no homepage
|
||||
if ($homepage && $homepage_url !== '/') {
|
||||
header('Location: '.$homepage_url);
|
||||
@ -176,7 +185,24 @@ if ($homepage && $homepage_url !== '/') {
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span10 offset1">
|
||||
<?php echo load_page($tree); ?>
|
||||
|
||||
<?php if($options['date_modified'] && isset($page['modified'])) { ?>
|
||||
<div class="page-header sub-header">';
|
||||
<h1><?php echo $page['title'];?></h1>';
|
||||
<span style="float: left; font-size: 10px; color: gray;">';
|
||||
<?php date("l, F j, Y", $page['modified']);?>
|
||||
</span>
|
||||
<span style="float: right; font-size: 10px; color: gray;">';
|
||||
<?php date ("g:i A", $modified);?>
|
||||
</span>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="page-header">';
|
||||
<h1><?php echo $page['title'];?></h1>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<?php echo $page['html'];?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -258,7 +284,23 @@ if ($homepage && $homepage_url !== '/') {
|
||||
<div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
|
||||
<div class="content-page">
|
||||
<article>
|
||||
<?php echo load_page($tree); ?>
|
||||
<?php if($options['date_modified'] && isset($page['modified'])) { ?>
|
||||
<div class="page-header sub-header">
|
||||
<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>
|
||||
|
||||
<?php } ?>
|
||||
<?php echo $page['html'];?>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -478,6 +478,9 @@ code {
|
||||
h1 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
sub-heading {
|
||||
padding: 0px, 0px, 20px;
|
||||
}
|
||||
}
|
||||
pre {
|
||||
border: none;
|
||||
|
@ -34,6 +34,7 @@ function get_options() {
|
||||
'tagline' => false,
|
||||
'image' => false,
|
||||
'theme' => 'blue',
|
||||
'date_modified' => true,
|
||||
'float' => true,
|
||||
'repo' => false,
|
||||
'twitter' => array(),
|
||||
@ -102,16 +103,29 @@ function docs_url($tree, $branch = false) {
|
||||
function load_page($tree) {
|
||||
$branch = find_branch($tree);
|
||||
|
||||
$page = array();
|
||||
|
||||
if (isset($branch['type']) && $branch['type'] == 'file') {
|
||||
$html = '';
|
||||
if ($branch['name'] !== 'index') {
|
||||
$html .= '<div class="page-header"><h1>'. $branch['title'] . '</h1></div>';
|
||||
|
||||
$page['title'] = $branch['title'];
|
||||
$page['modified'] = filemtime($branch['path']);
|
||||
|
||||
}
|
||||
$html .= MarkdownExtended(file_get_contents($branch['path']));
|
||||
return $html;
|
||||
|
||||
$page['html'] = $html;
|
||||
|
||||
} else {
|
||||
return "Oh No. That page dosn't exist";
|
||||
|
||||
$page['title'] = "Oh no";
|
||||
$page['html'] = "<h3>Oh No. That page dosn't exist</h3>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
function find_branch($tree) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren