Merge pull request #135 from Gautham/Dev

Fix incompatibility issue with PHP < 5.4
This commit is contained in:
Denis Kisselev 2014-03-04 07:50:32 -08:00
commit f3bbd134fc

View File

@ -7,7 +7,9 @@
$b = explode('/', clean_url($page, "Live")); $b = explode('/', clean_url($page, "Live"));
$output_language = $b[0]; $output_language = $b[0];
} }
return generate_page(clean_url_to_file($page)); $file = clean_url_to_file($page);
if (!is_file($file)) $file = FALSE;
return generate_page($file);
} }
// Clean Live Url // Clean Live Url
@ -30,14 +32,19 @@
if (is_file($docs_path . "/index.md")) return $docs_path . "/index.md"; if (is_file($docs_path . "/index.md")) return $docs_path . "/index.md";
else { else {
if (empty($options['languages'])) return $base_doc; if (empty($options['languages'])) return $base_doc;
else return $base_doc[array_keys($base_doc)[0]]; else {
$t = array_keys($base_doc);
return $base_doc[$t[0]];
}
} }
} else { } else {
$url = explode("/", $url); $url = explode("/", $url);
$file = $docs_path; $file = $docs_path;
foreach ($url as $part) { foreach ($url as $part) {
if (isset($tree)) {
$dirs = array_keys($tree); $dirs = array_keys($tree);
$key = array_search($part, array_map("clean_live", $dirs)); $key = array_search($part, array_map("clean_live", $dirs));
} else $key = FALSE;
if ($key === FALSE) { if ($key === FALSE) {
return FALSE; return FALSE;
} }