Skip to content

Commit

Permalink
Merge newpagetemplate feature, and fix up some coding standards items.
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed May 16, 2014
1 parent 41f7d8f commit 03475bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ If you give @NS@ or @PAGE@ as namespace, the namespace of the current page or th
- Updated by Sam Wilson <[email protected]>, 2013.
- Updated by Michael Braun <[email protected]>, 2013.
- Improved by Róbert Toth (FurloSK), 2013.
- Support for newpagetemplate added by Gerrit Uitslag <[email protected]>, 2014.
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 9 additions & 7 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -118,7 +120,7 @@ public function render($mode, Doku_Renderer $renderer, $data) {
* @author Samuele Tognini <[email protected]>
* @author Michael Braun <[email protected]>
*/
protected function _parse_ns($ns) {
protected function _parseNS($ns) {
global $ID;
if($ns == "@PAGE@") return $ID;
if($ns == "@NS@") return getNS($ID);
Expand Down Expand Up @@ -151,7 +153,7 @@ protected function _htmlNamespaceInput($dest_ns, &$disablecache) {
//namespace given, but hidden
if($hide && !empty($dest_ns)) {
if($can_create) {
return '<input type="hidden" name="np_cat" id="np_cat" value="' . $this->_parse_ns($dest_ns) . '"/>';
return '<input type="hidden" name="np_cat" id="np_cat" value="' . $this->_parseNS($dest_ns) . '"/>';
} else {
return false;
}
Expand All @@ -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);
Expand All @@ -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));
Expand Down Expand Up @@ -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 = '<input type="hidden" name="newpagetemplate" value="' . formText($template) . '" />';
} else {
$first = true;
Expand All @@ -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 .= "<option $p>".formText($name)."</option>";
}
Expand All @@ -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);
Expand Down

0 comments on commit 03475bb

Please sign in to comment.