Merge pull request #97 from nicolas-brousse/patch-1

Harmonization of indentation and debug "Undefined variable: language"
This commit is contained in:
Denis Kisselev 2013-10-18 19:08:31 -07:00
commit a6f1c31537

398
index.php
View File

@ -42,12 +42,12 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
met: met:
* Redistributions of source code must retain the above copyright notice, * Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright * Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
This software is provided by the copyright holders and contributors "as This software is provided by the copyright holders and contributors "as
is" and any express or implied warranties, including, but not limited is" and any express or implied warranties, including, but not limited
@ -69,7 +69,7 @@ $options = get_options();
$tree = get_tree($options['docs_path'], $base_url); $tree = get_tree($options['docs_path'], $base_url);
// If a language is set in the config, rewrite urls based on the language // If a language is set in the config, rewrite urls based on the language
if ($language === null) { if (! isset($language) || $language === null) {
$homepage_url = homepage_url($tree); $homepage_url = homepage_url($tree);
$docs_url = docs_url($tree); $docs_url = docs_url($tree);
} else { } else {
@ -96,13 +96,13 @@ $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 a timezone has been set in the config file, override the default PHP timezone for this application.
if(isset($options['timezone'])) if(isset($options['timezone']))
{ {
date_default_timezone_set($options['timezone']); date_default_timezone_set($options['timezone']);
} }
// Redirect to docs, if there is no homepage // Redirect to docs, if there is no homepage
if ($homepage && $homepage_url !== '/') { if ($homepage && $homepage_url !== '/') {
header('Location: '.$homepage_url); header('Location: '.$homepage_url);
} }
?> ?>
@ -112,94 +112,94 @@ if ($homepage && $homepage_url !== '/') {
<!--[if IE 8]> <html class="no-js ie8 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]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head> <head>
<title><?php echo $options['title']; ?></title> <title><?php echo $options['title']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $options['tagline'];?>" /> <meta name="description" content="<?php echo $options['tagline'];?>" />
<meta name="author" content="<?php echo $options['title']; ?>"> <meta name="author" content="<?php echo $options['title']; ?>">
<?php if ($options['colors']) { ?> <?php if ($options['colors']) { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon"> <link rel="icon" href="<?php echo $base_url ?>/img/favicon.png" type="image/x-icon">
<?php } else { ?> <?php } else { ?>
<link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon"> <link rel="icon" href="<?php echo $base_url ?>/img/favicon-<?php echo $options['theme'];?>.png" type="image/x-icon">
<?php } ?> <?php } ?>
<!-- Mobile --> <!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font --> <!-- Font -->
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300,100' rel='stylesheet' type='text/css'>
<!-- LESS --> <!-- LESS -->
<?php if ($options['colors']) { ?> <?php if ($options['colors']) { ?>
<style type="text/less"> <style type="text/less">
<?php foreach($options['colors'] as $k => $v) { ?> <?php foreach($options['colors'] as $k => $v) { ?>
@<?php echo $k;?>: <?php echo $v;?>; @<?php echo $k;?>: <?php echo $v;?>;
<?php } ?> <?php } ?>
@import "<?php echo $base_url ?>/less/import/daux-base.less"; @import "<?php echo $base_url ?>/less/import/daux-base.less";
</style> </style>
<script src="<?php echo $base_url ?>/js/less.min.js"></script> <script src="<?php echo $base_url ?>/js/less.min.js"></script>
<?php } else { ?> <?php } else { ?>
<link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css"> <link rel="stylesheet" href="<?php echo $base_url ?>/css/daux-<?php echo $options['theme'];?>.css">
<?php } ?> <?php } ?>
<!-- hightlight.js --> <!-- hightlight.js -->
<script src="<?php echo $base_url ?>/js/highlight.min.js"></script> <script src="<?php echo $base_url ?>/js/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script> <script>hljs.initHighlightingOnLoad();</script>
<!-- Navigation --> <!-- Navigation -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script> <script>
if (typeof jQuery == 'undefined') { 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")); 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>
<script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script> <script src="<?php echo $base_url ?>/js/bootstrap.min.js"></script>
<script src="<?php echo $base_url ?>/js/custom.js"></script> <script src="<?php echo $base_url ?>/js/custom.js"></script>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
</head> </head>
<body> <body>
<?php if ($homepage) { ?> <?php if ($homepage) { ?>
<!-- Hompage --> <!-- Hompage -->
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a> <a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right"> <p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a> Generated by <a href="http://daux.io">Daux.io</a>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<div class="homepage-hero well container-fluid"> <div class="homepage-hero well container-fluid">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="text-center span12"> <div class="text-center span12">
<?php if ($options['tagline']) { ?> <?php if ($options['tagline']) { ?>
<h2><?php echo $options['tagline'];?></h2> <h2><?php echo $options['tagline'];?></h2>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="span10 offset1"> <div class="span10 offset1">
<?php if ($options['image']) { ?> <?php if ($options['image']) { ?>
<img class="homepage-image" src="<?php echo $base_url ?>/<?php echo $options['image'];?>" alt="<?php echo $options['title'];?>"> <img class="homepage-image" src="<?php echo $base_url ?>/<?php echo $options['image'];?>" alt="<?php echo $options['title'];?>">
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="hero-buttons container-fluid"> <div class="hero-buttons container-fluid">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="text-center span12"> <div class="text-center span12">
<?php if ($options['repo']) { ?> <?php if ($options['repo']) { ?>
<a href="https://github.com/<?php echo $options['repo']; ?>" class="btn btn-secondary btn-hero"> <a href="https://github.com/<?php echo $options['repo']; ?>" class="btn btn-secondary btn-hero">
View On GitHub View On GitHub
</a> </a>
<?php } ?> <?php } ?>
<?php if (count($options['languages']) > 0) { ?> <?php if (count($options['languages']) > 0) { ?>
<?php foreach ($options['languages'] as $language_key => $language_name) { ?> <?php foreach ($options['languages'] as $language_key => $language_name) { ?>
<a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero"> <a href="<?php echo $base_url . "/" . $language_key . "/"; ?>" class="btn btn-primary btn-hero">
@ -207,124 +207,124 @@ if ($homepage && $homepage_url !== '/') {
</a> </a>
<?php } ?> <?php } ?>
<?php } else { ?> <?php } else { ?>
<a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero"> <a href="<?php echo $docs_url;?>" class="btn btn-primary btn-hero">
View Documentation View Documentation
</a> </a>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="homepage-content container-fluid"> <div class="homepage-content container-fluid">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="span10 offset1"> <div class="span10 offset1">
<?php echo $page['html'];?> <?php echo $page['html'];?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="homepage-footer well container-fluid"> <div class="homepage-footer well container-fluid">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="span5 offset1"> <div class="span5 offset1">
<?php if (!empty($options['links'])) { ?> <?php if (!empty($options['links'])) { ?>
<ul class="footer-nav"> <ul class="footer-nav">
<?php foreach($options['links'] as $name => $url) { ?> <?php foreach($options['links'] as $name => $url) { ?>
<li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li> <li><a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a></li>
<?php } ?> <?php } ?>
</ul> </ul>
<?php } ?> <?php } ?>
</div> </div>
<div class="span5"> <div class="span5">
<div class="pull-right"> <div class="pull-right">
<?php if (!empty($options['twitter'])) { ?> <?php if (!empty($options['twitter'])) { ?>
<?php foreach($options['twitter'] as $handle) { ?> <?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter"> <div class="twitter">
<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> <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> </div>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php } else { ?> <?php } else { ?>
<!-- Docs --> <!-- Docs -->
<?php if ($options['repo']) { ?> <?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> <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 } ?> <?php } ?>
<div class="container-fluid fluid-height wrapper"> <div class="container-fluid fluid-height wrapper">
<div class="navbar navbar-fixed-top"> <div class="navbar navbar-fixed-top">
<div class="navbar-inner"> <div class="navbar-inner">
<a class="brand pull-left" href="<?php echo $homepage_url;?>"><?php echo $options['title']; ?></a> <a class="brand pull-left" href="<?php echo $base_url ?><?php echo $homepage_url;?>"><?php echo $options['title']; ?></a>
<p class="navbar-text pull-right"> <p class="navbar-text pull-right">
Generated by <a href="http://daux.io">Daux.io</a> Generated by <a href="http://daux.io">Daux.io</a>
</p> </p>
</div> </div>
</div> </div>
<div class="row-fluid columns content"> <div class="row-fluid columns content">
<div class="left-column article-tree span3"> <div class="left-column article-tree span3">
<!-- For Mobile --> <!-- For Mobile -->
<div class="responsive-collapse"> <div class="responsive-collapse">
<button type="button" class="btn btn-sidebar" id="menu-spinner-button"> <button type="button" class="btn btn-sidebar" id="menu-spinner-button">
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
</div> </div>
<div id="sub-nav-collapse" class="sub-nav-collapse"> <div id="sub-nav-collapse" class="sub-nav-collapse">
<!-- Navigation --> <!-- Navigation -->
<?php echo build_nav($tree, $url_params); ?> <?php echo build_nav($tree, $url_params); ?>
<?php if (!empty($options['links']) || !empty($options['twitter'])) { ?> <?php if (!empty($options['links']) || !empty($options['twitter'])) { ?>
<div class="well well-sidebar"> <div class="well well-sidebar">
<!-- Links --> <!-- Links -->
<?php foreach($options['links'] as $name => $url) { ?> <?php foreach($options['links'] as $name => $url) { ?>
<a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br> <a href="<?php echo $url;?>" target="_blank"><?php echo $name;?></a><br>
<?php } ?> <?php } ?>
<!-- Twitter --> <!-- Twitter -->
<?php foreach($options['twitter'] as $handle) { ?> <?php foreach($options['twitter'] as $handle) { ?>
<div class="twitter"> <div class="twitter">
<hr/> <hr/>
<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> <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> </div>
<?php } ?> <?php } ?>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9"> <div class="right-column <?php echo ($options['float']?'float-view':''); ?> content-area span9">
<div class="content-page"> <div class="content-page">
<article> <article>
<?php if($options['date_modified'] && isset($page['modified'])) { ?> <?php if($options['date_modified'] && isset($page['modified'])) { ?>
<div class="page-header sub-header clearfix"> <div class="page-header sub-header clearfix">
<h1><?php echo $page['title'];?></h1> <h1><?php echo $page['title'];?></h1>
<span style="float: left; font-size: 10px; color: gray;"> <span style="float: left; font-size: 10px; color: gray;">
<?php echo date("l, F j, Y", $page['modified']);?> <?php echo date("l, F j, Y", $page['modified']);?>
</span> </span>
<span style="float: right; font-size: 10px; color: gray;"> <span style="float: right; font-size: 10px; color: gray;">
<?php echo date ("g:i A", $page['modified']);?> <?php echo date ("g:i A", $page['modified']);?>
</span> </span>
</div> </div>
<?php } else { ?> <?php } else { ?>
<div class="page-header"> <div class="page-header">
<h1><?php echo $page['title'];?></h1> <h1><?php echo $page['title'];?></h1>
</div> </div>
<?php } ?> <?php } ?>
<?php echo $page['html'];?> <?php echo $page['html'];?>
</article> </article>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
<?php if ($options['google_analytics']) { ?> <?php if ($options['google_analytics']) { ?>
<script> <script>