From 63d4b4c4f0a737d27458de3d38a8bb4d1b8fe464 Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Wed, 3 Sep 2014 02:52:22 +0200 Subject: [PATCH] Shortened templates names And changed to keep a copy of original template --- action.php | 24 +++++++++---------- ...rivate_template.txt => default_private.txt | 0 ..._public_template.txt => default_public.txt | 0 lang/en/settings.php | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) rename userhomepage_private_template.txt => default_private.txt (100%) rename userhomepage_public_template.txt => default_public.txt (100%) diff --git a/action.php b/action.php index c04ca6a..260ddbb 100644 --- a/action.php +++ b/action.php @@ -19,18 +19,18 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ $controller->register_hook('AUTH_LOGIN_CHECK', 'AFTER', $this, 'templates',array()); } function templates(&$event, $param) { - if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt')) { - if (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_private_template.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt')) { - echo ' An error occured while attempting to copy private template.'; - } else { - echo ' Successfully copied private template.'; + if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) { + if (!copy(DOKU_INC.'lib/plugins/userhomepage/default_private.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) { + echo ' An error occured while attempting to copy default_private.txt to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt'; +// } else { +// echo ' Successfully copied private template.'; } } - if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt')) { - if (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_public_template.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt')) { - echo ' An error occured while attempting to copy public template.'; - } else { - echo ' Successfully copied public template.'; + if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt')) { + if (!copy(DOKU_INC.'lib/plugins/userhomepage/default_public.txt', DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt')) { + echo ' An error occured while attempting to copy default_public.txt to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt'; +// } else { +// echo ' Successfully copied public template.'; } } } @@ -72,7 +72,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ // Write things back to conf/acl.auth.php file_put_contents(DOKU_INC.'conf/acl.auth.php', implode($lines)); // Read private start page template - $this->private_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_private_template.txt'; + $this->private_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt'; // Create private page lock($this->private_page); saveWikiText($this->private_page,$this->_template_private(),$lang['created']); @@ -84,7 +84,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ // If public page doesn't exists, create it (from template) if ($this->getConf('create_public_page') && !page_exists($this->public_page) && !checklock($this->public_page) && !checkwordblock()) { // Read public page template - $this->public_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_public_template.txt'; + $this->public_page_template = DOKU_INC.$this->getConf('templates_path').'/userhomepage_public.txt'; // Create public page lock($this->public_page); saveWikiText($this->public_page,$this->_template_public(),$lang['created']); diff --git a/userhomepage_private_template.txt b/default_private.txt similarity index 100% rename from userhomepage_private_template.txt rename to default_private.txt diff --git a/userhomepage_public_template.txt b/default_public.txt similarity index 100% rename from userhomepage_public_template.txt rename to default_public.txt diff --git a/lang/en/settings.php b/lang/en/settings.php index 844d736..55b36a0 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -22,4 +22,4 @@ $lang['group_by_name'] = 'Group users\' namespaces by the first character of use $lang['edit_before_create'] = 'Allow users to edit their namespace start page before create (this will only work if you disable [create_public_page]).'; $lang['create_public_page'] = 'Create a public page for user'; $lang['public_pages_ns'] = 'Namespace under wich public pages are created. If a value other than user is used, you will have to manually handle interwiki user link used by showuseras option (in Display settings).'; -$lang['templates_path'] = 'Path from DokuWiki root to store templates (userhomepage_private_template.txt and userhomepage_public_template.txt). Examples: data/pages/wiki (wich will make templates editable within DokuWiki) or lib/plugins/userhomepage (usefull in a farm setup to centralize templates).'; +$lang['templates_path'] = 'Path from DokuWiki root to store templates (userhomepage_private.txt and userhomepage_public.txt). Examples: data/pages/wiki (wich will make templates editable within DokuWiki) or lib/plugins/userhomepage (usefull in a farm setup to centralize templates).';