Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add param newpagevars #66

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# General Plugin Info
base addnewpage
author Benjamin Santalucia, Sam Wilson, Michael Braun, Gerrit Uitslag, Albert Chern
email
base addnewpagefork
author Benjamin Santalucia, Sam Wilson, Michael Braun, Gerrit Uitslag, Albert Chern, Vladimir
email
date 2015-11-02
name Add New Page
desc Adds a "new page form" to any wiki page.
url http://www.dokuwiki.org/plugin:addnewpage
url https://github.com/ReanGD/dokuwiki-plugin-addnewpage
8 changes: 6 additions & 2 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function connectTo($mode) {
* {{NEWPAGE#newtpl1,newtpl2}}
* {{NEWPAGE#newtpl1|Title1,newtpl2|Title1}}
* {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1}}
* {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1#@HI@,Howdy}}
*
* @param string $match The text matched by the patterns
* @param int $state The lexer state for the match
Expand All @@ -60,14 +61,16 @@ public function connectTo($mode) {
public function handle($match, $state, $pos, Doku_Handler $handler) {
/* @codingStandardsIgnoreEnd */
$options = substr($match, 9, -2); // strip markup
$options = explode('#', $options, 2);
$options = explode('#', $options, 3);

$namespace = trim(ltrim($options[0], '>'));
$templates = explode(',', $options[1]);
$templates = array_map('trim', $templates);
$newpagevars = trim($options[2]);
return array(
'namespace' => $namespace,
'newpagetemplates' => $templates
'newpagetemplates' => $templates,
'newpagevars' => $newpagevars
);
}

Expand Down Expand Up @@ -102,6 +105,7 @@ public function render($mode, Doku_Renderer $renderer, $data) {
. DOKU_TAB . DOKU_TAB . $namespaceinput . DOKU_LF
. DOKU_TAB . DOKU_TAB . '<input class="edit" type="text" name="title" size="20" maxlength="255" tabindex="2" />' . DOKU_LF
. $newpagetemplateinput
. DOKU_TAB . DOKU_TAB . '<input type="hidden" name="newpagevars" value="' . $data['newpagevars'] . '"/>' . DOKU_LF
. DOKU_TAB . DOKU_TAB . '<input type="hidden" name="do" value="edit" />' . DOKU_LF
. DOKU_TAB . DOKU_TAB . '<input type="hidden" name="id" />' . DOKU_LF
. DOKU_TAB . DOKU_TAB . '<input class="button" type="submit" value="' . $this->getLang('okbutton') . '" tabindex="4" />' . DOKU_LF
Expand Down