|
@@ -41,23 +41,19 @@ if (PAGE !== 'index') {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-for (
|
|
|
- $path_i = PAGE_LINEAGE , $results = [] , $firstIteration = true ;
|
|
|
- $title = TITLES , $path_i !== [] ;
|
|
|
- array_pop($path_i) , $results[] = $title
|
|
|
-) {
|
|
|
- foreach ($path_i as $el) {
|
|
|
- if (end($path_i) !== $el)
|
|
|
- $title = $title[$el];
|
|
|
- else {
|
|
|
- if ($firstIteration AND end($path_i) !== 'index')
|
|
|
- $results[] = $title[$el];
|
|
|
- $firstIteration = false;
|
|
|
- $title = $title['index'];
|
|
|
- }
|
|
|
- }
|
|
|
+function getTitlesLineage($titles, $pageElements) {
|
|
|
+ if (!isset($titles['index']) OR $pageElements[0] === 'index')
|
|
|
+ return [$titles[$pageElements[0]]];
|
|
|
+ $result = $titles['index'];
|
|
|
+ if (!isset($pageElements[1]))
|
|
|
+ unset($titles['index']);
|
|
|
+ else
|
|
|
+ $titles = $titles[array_shift($pageElements)];
|
|
|
+ $results = getTitlesLineage($titles, $pageElements);
|
|
|
+ $results[] = $result;
|
|
|
+ return $results;
|
|
|
}
|
|
|
-define('TITLES_LINEAGE', array_reverse($results));
|
|
|
+define('TITLES_LINEAGE', array_reverse(getTitlesLineage(TITLES, PAGE_LINEAGE)));
|
|
|
|
|
|
require "html.php";
|
|
|
|