From 03475bb4c1b9333821b5ed44908504b99089a742 Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Fri, 16 May 2014 14:35:32 +0800 Subject: [PATCH] Merge newpagetemplate feature, and fix up some coding standards items. --- README.md | 1 + plugin.info.txt | 2 +- syntax.php | 16 +++++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1dd1d5c..f0f0968 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ If you give @NS@ or @PAGE@ as namespace, the namespace of the current page or th - Updated by Sam Wilson , 2013. - Updated by Michael Braun , 2013. - Improved by RĂ³bert Toth (FurloSK), 2013. +- Support for newpagetemplate added by Gerrit Uitslag , 2014. diff --git a/plugin.info.txt b/plugin.info.txt index 3dc3b1e..462650f 100755 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,6 +1,6 @@ # General Plugin Info base addnewpage -author iDo, Sam Wilson, Michael Braun +author iDo, Sam Wilson, Michael Braun, Gerrit Uitslag email date 2013-06-20 name Add New Page diff --git a/syntax.php b/syntax.php index 61e730d..fd34cbb 100644 --- a/syntax.php +++ b/syntax.php @@ -55,8 +55,10 @@ public function connectTo($mode) { * @param int $pos The character position of the matched text * @param Doku_Handler $handler The Doku_Handler object * @return array Return an array with all data you want to use in render + * @codingStandardsIgnoreStart */ public function handle($match, $state, $pos, Doku_Handler $handler) { + /* @codingStandardsIgnoreEnd */ $options = substr($match, 9, -2); // strip markup $options = explode('#', $options, 2); @@ -118,7 +120,7 @@ public function render($mode, Doku_Renderer $renderer, $data) { * @author Samuele Tognini * @author Michael Braun */ - protected function _parse_ns($ns) { + protected function _parseNS($ns) { global $ID; if($ns == "@PAGE@") return $ID; if($ns == "@NS@") return getNS($ID); @@ -151,7 +153,7 @@ protected function _htmlNamespaceInput($dest_ns, &$disablecache) { //namespace given, but hidden if($hide && !empty($dest_ns)) { if($can_create) { - return ''; + return ''; } else { return false; } @@ -178,7 +180,7 @@ protected function _htmlNamespaceInput($dest_ns, &$disablecache) { } } - $subnamespaces = $this->_getnslist($dest_ns); + $subnamespaces = $this->_getNamespaceList($dest_ns); foreach($subnamespaces as $ns) { if(auth_quickaclcheck($ns . ":") < AUTH_CREATE) continue; $nsparts = explode(':', $ns); @@ -203,7 +205,7 @@ protected function _htmlNamespaceInput($dest_ns, &$disablecache) { * @param string $topns The top namespace * @return array Multi-dimensional array of all namespaces below $tns */ - protected function _getnslist($topns = '') { + protected function _getNamespaceList($topns = '') { global $conf; $topns = utf8_encodeFN(str_replace(':', '/', $topns)); @@ -243,7 +245,7 @@ public function _htmlTemplateInput($newpagetemplates) { } else { if($cnt == 1) { - list($template, ) = $this->_parseNStemplatepage($newpagetemplates[0]); + list($template, ) = $this->_parseNSTemplatePage($newpagetemplates[0]); $input = ''; } else { $first = true; @@ -252,7 +254,7 @@ public function _htmlTemplateInput($newpagetemplates) { $p = ($first ? ' selected="selected"' : ''); $first = false; - list($template, $name) = $this->_parseNStemplatepage($template); + list($template, $name) = $this->_parseNSTemplatePage($template); $p .= ' value="'.formText($template).'"'; $input .= ""; } @@ -269,7 +271,7 @@ public function _htmlTemplateInput($newpagetemplates) { * @param $nstemplate * @return array */ - protected function _parseNStemplatepage($nstemplate) { + protected function _parseNSTemplatePage($nstemplate) { global $ID; @list($template, $name) = explode('|', $nstemplate, 2);