Added a very basic helper
And removed old equivalent and outdated functions
This commit is contained in:
parent
8bb4f0838a
commit
33a1a0908d
|
@ -55,9 +55,9 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
||||||
$this->private_ns = cleanID($this->getConf('users_namespace').':'. $this->privateNamespace());
|
$this->private_ns = cleanID($this->getConf('users_namespace').':'. $this->privateNamespace());
|
||||||
}
|
}
|
||||||
// private:simon:start.txt
|
// private:simon:start.txt
|
||||||
$this->private_page= cleanID($this->private_ns . ':' . $this->privatePage());
|
$this->private_page = cleanID($this->private_ns . ':' . $this->privatePage());
|
||||||
// user:simon.txt
|
// user:simon.txt
|
||||||
$this->public_page= cleanID($this->getConf('public_pages_ns').':'. $_SERVER['REMOTE_USER']);
|
$this->public_page = cleanID($this->getConf('public_pages_ns').':'. $_SERVER['REMOTE_USER']);
|
||||||
// if private page doesn't exists, create it (from template)
|
// if private page doesn't exists, create it (from template)
|
||||||
if ($this->getConf('create_private_ns') && !page_exists($this->private_page) && !checklock($this->private_page) && !checkwordblock()) {
|
if ($this->getConf('create_private_ns') && !page_exists($this->private_page) && !checklock($this->private_page) && !checkwordblock()) {
|
||||||
// set acl's if requested
|
// set acl's if requested
|
||||||
|
@ -136,7 +136,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
||||||
return $conf['start'];
|
return $conf['start'];
|
||||||
} else {
|
} else {
|
||||||
return $this->homeNamespace();
|
return $this->homeNamespace();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
function _template_private() {
|
function _template_private() {
|
||||||
global $INFO;
|
global $INFO;
|
||||||
|
|
52
helper.php
Normal file
52
helper.php
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Helper Component for the Userhomepage Plugin
|
||||||
|
*
|
||||||
|
* @author: Simon Delage <simon.geekitude@gmail.com>
|
||||||
|
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// must be run within Dokuwiki
|
||||||
|
if(!defined('DOKU_INC')) die();
|
||||||
|
|
||||||
|
class helper_plugin_userhomepage extends DokuWiki_Plugin {
|
||||||
|
|
||||||
|
function getPrivateNs() {
|
||||||
|
if ($this->getConf('group_by_name')) {
|
||||||
|
// private:s:simon
|
||||||
|
$this->private_ns = cleanID($this->getConf('users_namespace').':'.strtolower(substr($this->privateNamespace(), 0, 1)).':'. $this->privateNamespace());
|
||||||
|
} else {
|
||||||
|
// private:simon
|
||||||
|
$this->private_ns = cleanID($this->getConf('users_namespace').':'. $this->privateNamespace());
|
||||||
|
}
|
||||||
|
// private:simon:start.txt
|
||||||
|
return $this->private_page = cleanID($this->private_ns . ':' . $this->privatePage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPublicPage() {
|
||||||
|
return $this->public_page = cleanID($this->getConf('public_pages_ns').':'. $_SERVER['REMOTE_USER']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function privateNamespace() {
|
||||||
|
if ( $this->getConf('use_name_string')) {
|
||||||
|
global $INFO;
|
||||||
|
$raw_string = $INFO['userinfo']['name'];
|
||||||
|
// simon_delage
|
||||||
|
return $raw_string;
|
||||||
|
} else {
|
||||||
|
// simon
|
||||||
|
return strtolower($_SERVER['REMOTE_USER']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function privatePage() {
|
||||||
|
if ( $this->getConf('use_start_page')) {
|
||||||
|
global $conf;
|
||||||
|
return $conf['start'];
|
||||||
|
} else {
|
||||||
|
return $this->homeNamespace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue