From a2043af0ca81695ac9170f330b6df766a7ee0955 Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Thu, 20 Aug 2015 02:10:37 +0200 Subject: [PATCH] Added function to get pages ID's and string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return samples: Array ( [private] => Array ( [id] => user:admin:start [string] => Espace Privé ) [public] => Array ( [id] => user:admin [string] => Page Publique ) ) Array ( [public] => Array ( [id] => user:admin [string] => Page Publique ) ) --- helper.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/helper.php b/helper.php index 539c3a3..bfd2af0 100644 --- a/helper.php +++ b/helper.php @@ -108,8 +108,29 @@ class helper_plugin_userhomepage extends DokuWiki_Plugin { } } + // Returns an array containing id and language of Private NS Start Page and/or Public Page (depending on options, page existance isn't checked) + function getElements() { + $return = array(); + // Don't return anything if no known user is logged in + if ($_SERVER['REMOTE_USER'] != null) { + // Add PRIVATE NAMESPACE START PAGE INFO IF NEEDED (is required by options) + if ($this->getConf('create_private_ns')) { + $return['private'] = array(); + $return['private']['id'] = $this->getPrivateID(); + $return['private']['string'] = $this->getLang('privatenamespace'); + } + // Add PUBLIC PAGE INFO IF NEEDED (is required by options) + if ($this->getConf('create_public_page')) { + $return['public'] = array(); + $return['public']['id'] = $this->getPublicID(); + $return['public']['string'] = $this->getLang('publicpage'); + } + } + return $return; + } + function privateNamespace() { - if ( $this->getConf('use_name_string')) { + if ($this->getConf('use_name_string')) { global $INFO; $raw_string = cleanID($INFO['userinfo']['name']); // simon_delage