From 48eb47df8d798aef0746d28cd4365095da9edc43 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Tue, 3 Feb 2015 20:42:39 +0100 Subject: [PATCH] Hide all the translation namespaces --- syntax.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/syntax.php b/syntax.php index f86bb7f..d347c4f 100755 --- a/syntax.php +++ b/syntax.php @@ -130,7 +130,7 @@ function render($mode, &$renderer, $data) private function RenderNodes(DokuWikiNameSpace $node) { - global $INFO; + global $INFO,$conf; $this->depth++; $output = ''; foreach ($node->getNodes() as $node) { @@ -139,6 +139,12 @@ private function RenderNodes(DokuWikiNameSpace $node) continue; if (preg_match($this->exclusion_mask,$node->getFullID())) 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()); $access = auth_quickaclcheck($node->getFullID()); if ($node instanceof DokuWikiPage) { @@ -174,4 +180,17 @@ private function RenderNodes(DokuWikiNameSpace $node) } 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; + } } \ No newline at end of file