
|
[dokuwiki] [Problem][own plugin] dont stop after end
- From: progamler@xxxxxxxxxxxxxxxxx
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Thu, 05 Jul 2007 10:04:41 +0200
Hello i have writen a syntax plugin but i have an error after </drop>
it render all the rest with the links (everytime new links)
<code>
<?php
/**
<?php
/**
* Plugin Color: Sets new colors for text and background.
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Christopher Smith <chris@xxxxxxxxxxxxx>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC'))
die();
if (!defined('DOKU_PLUGIN'))
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once (DOKU_PLUGIN . 'syntax.php');
/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_drop_me extends DokuWiki_Syntax_Plugin {
/**
* return some info
*/
function getInfo() {
return array (
'author' => 'Jan-Philipp Warmers',
'email' => 'Progamler@xxxxxxxxxxxxxxxxx',
'date' => '2007-07-04',
'name' => 'Drop ME',
'desc' => 'Creat menüs with display and js',
'url' => '',
);
}
function getType() {
return 'formatting';
}
function getAllowedTypes() {
return array (
'formatting',
'substition',
'disabled',
'container'
);
}
function getSort() {
return 158;
}
function connectTo($mode) {
$this->Lexer->addEntryPattern('<drop.*?>(?=.*?</drop>)', $mode,
'plugin_drop_me');
}
function postConnect() {
$this->Lexer->addExitPattern('</drop>', 'plugin_drop_me');
}
/**
* Handle the match
*/
function handle($match, $state, $pos, & $handler) {
switch ($state) {
case DOKU_LEXER_ENTER :
list ($color, $background) = preg_split("/\//u", substr($match, 5,
-1), 2);
if ($color = $this->_link($color, $background))
{
$color = $color;
}
return array (
$state,
array (
$color,
$background
)
);
case DOKU_LEXER_UNMATCHED :
return array (
$state,
$match
);
case DOKU_LEXER_EXIT :
return array (
$state,
''
);
}
return array ();
}
/**
* Create output
*/
function render($mode, & $renderer, $data) {
global $color_ende;
if ($mode == 'xhtml') {
list ($state, $match) = $data;
switch ($state) {
case DOKU_LEXER_ENTER :
list ($color, $background, $ende) =
$match;
$renderer->doc .= $color;
break;
case DOKU_LEXER_UNMATCHED :
$renderer->doc .=
$renderer->_xmlEntities($match);
break;
case DOKU_LEXER_EXIT :
$renderer->doc .= $this->_ende($color);
break;
}
return true;
}
return false;
}
function _link($c, $o) {
$c = trim($c);
if ($c == "link") {
$color_ende = "</a>";
return "<a href=javascript:showhide('$o')
onclik=showhide('$o')>";
}
elseif ($c == "menu") {
$color_ende = "</div>";
return "<div id=\"$o\" >";
}
}
function _ende($ende) {
$c = trim($ende);
$c = substr($c, "1", "1");
if ($c == "a") {
return "</a>";
}
elseif ($c == "d") {
return "</div>";
}
}
}
?>
</code>
thx Jan-Philipp Warmers
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts:[dokuwiki] [Problem][own plugin] dont stop after end [dokuwiki] Re: [Problem][own plugin] dont stop after end
|

|

|
[ Home |
Signup |
Help |
Login |
Archives |
Lists
]
All trademarks and copyrights within the FreeLists archives are owned
by their respective owners. Everything else ©2008 Avenir Technologies, LLC.
|

|
|