Hide all the translation namespaces

This commit is contained in:
Tim Schumacher 2015-02-03 20:42:39 +01:00
parent 8d4bb76dfe
commit 48eb47df8d

View file

@ -130,7 +130,7 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin
private function RenderNodes(DokuWikiNameSpace $node) private function RenderNodes(DokuWikiNameSpace $node)
{ {
global $INFO; global $INFO,$conf;
$this->depth++; $this->depth++;
$output = ''; $output = '';
foreach ($node->getNodes() as $node) { foreach ($node->getNodes() as $node) {
@ -139,6 +139,12 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin
continue; continue;
if (preg_match($this->exclusion_mask,$node->getFullID())) if (preg_match($this->exclusion_mask,$node->getFullID()))
continue; continue;
// check if the translation plugin is active and if so, hide all the translation namespaces
if (!plugin_isdisabled('translation')) {
$translations = $this->getTranslations();
if (in_array($node->getName(),$translations))
continue;
}
$title = (strlen($node->getMetaData('title')) > 0 ? $node->getMetaData('title') : $node->getName()); $title = (strlen($node->getMetaData('title')) > 0 ? $node->getMetaData('title') : $node->getName());
$access = auth_quickaclcheck($node->getFullID()); $access = auth_quickaclcheck($node->getFullID());
if ($node instanceof DokuWikiPage) { if ($node instanceof DokuWikiPage) {
@ -174,4 +180,17 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin
} }
return $output; return $output;
} }
/**
* @param $conf
* @return array|string
*/
private function getTranslations()
{
global $conf;
$translations = strtolower(str_replace(',', ' ', $conf['plugin']['translation']['translations']));
$translations = array_unique(array_filter(explode(' ', $translations)));
sort($translations);
return $translations;
}
} }