Format the code
This commit is contained in:
parent
ac753695e9
commit
fb1ed3d78e
1 changed files with 115 additions and 107 deletions
24
syntax.php
24
syntax.php
|
@ -19,13 +19,15 @@ require_once dirname (__FILE__) . DIRECTORY_SEPARATOR . 'objectrepresentation' .
|
||||||
* All DokuWiki plugins to extend the parser/rendering mechanism
|
* All DokuWiki plugins to extend the parser/rendering mechanism
|
||||||
* need to inherit from this class
|
* need to inherit from this class
|
||||||
*/
|
*/
|
||||||
class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
|
class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin
|
||||||
|
{
|
||||||
|
|
||||||
// TODO add a config option for this
|
// TODO add a config option for this
|
||||||
private $maxDepth = 3;
|
private $maxDepth = 3;
|
||||||
private $depth = 0;
|
private $depth = 0;
|
||||||
|
|
||||||
function getInfo () {
|
function getInfo()
|
||||||
|
{
|
||||||
return array('author' => 'Tim Schumacher',
|
return array('author' => 'Tim Schumacher',
|
||||||
'email' => 'tim@bandenkrieg.hacked.jp',
|
'email' => 'tim@bandenkrieg.hacked.jp',
|
||||||
'date' => '2013-11-12',
|
'date' => '2013-11-12',
|
||||||
|
@ -34,24 +36,29 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
|
||||||
'url' => 'https://bk-dev.hacked.jp/project/view/3/');
|
'url' => 'https://bk-dev.hacked.jp/project/view/3/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getType () {
|
function getType()
|
||||||
|
{
|
||||||
return 'substition';
|
return 'substition';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSort () {
|
function getSort()
|
||||||
|
{
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectTo ($mode) {
|
function connectTo($mode)
|
||||||
|
{
|
||||||
$this->Lexer->addSpecialPattern('{{indexmenu_n>.+?}}', $mode, 'plugin_navigation');
|
$this->Lexer->addSpecialPattern('{{indexmenu_n>.+?}}', $mode, 'plugin_navigation');
|
||||||
$this->Lexer->addSpecialPattern('\[Navigation\]', $mode, 'plugin_navigation');
|
$this->Lexer->addSpecialPattern('\[Navigation\]', $mode, 'plugin_navigation');
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle ($match, $state, $pos, &$handler) {
|
function handle($match, $state, $pos, &$handler)
|
||||||
|
{
|
||||||
return array($match, $state, $pos);
|
return array($match, $state, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
function render ($mode, &$renderer, $data) {
|
function render($mode, &$renderer, $data)
|
||||||
|
{
|
||||||
if (preg_match('/{{indexmenu_n>(\d+)}}/', $data[0], $matches)) {
|
if (preg_match('/{{indexmenu_n>(\d+)}}/', $data[0], $matches)) {
|
||||||
global $ACT, $INFO;
|
global $ACT, $INFO;
|
||||||
if ($INFO['isadmin'] && $ACT == 'show') {
|
if ($INFO['isadmin'] && $ACT == 'show') {
|
||||||
|
@ -101,7 +108,8 @@ class syntax_plugin_navigation extends DokuWiki_Syntax_Plugin {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function RenderNodes(DokuWikiNameSpace $node) {
|
private function RenderNodes(DokuWikiNameSpace $node)
|
||||||
|
{
|
||||||
$this->depth++;
|
$this->depth++;
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach ($node->getNodes() as $node) {
|
foreach ($node->getNodes() as $node) {
|
||||||
|
|
Reference in a new issue