[dokuwiki] include and blog bug

  • From: Andrwe Lord Weber <lord-weber-andrwe@xxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 20 Mar 2010 13:58:54 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I encountered a bug in the plugins include and blog.
I don't know whether I could post the dirty fixed I've written here or
not, so I'll just do.

Both plugins doesn't handle the levels correctly if you use php-5.3.

So I've written a fix for both.

http://andrwe.dyndns.org/doku.php/blog/dokuwiki

Diffs are as attachments.

Maybe someone of you has a better solution.

Regards
Andrwe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkukxo4ACgkQblnA9uk/GvdZtACeN52VPI2/T02Oy4j6J1LghCx7
gIoAnRoFWAphfX0xt8uEf3jimNXXY1Ka
=qBpc
-----END PGP SIGNATURE-----
155c155,165
<       if ($clevel) $renderer->doc .= '<div class="level'.$clevel.'">'.DOKU_LF;
---
>       // fix for blog include on php-5.3
>       if ($clevel)
>       {
>               preg_match_all('|<div .*>|', $renderer->doc, $divs, 
> PREG_SET_ORDER);
>               preg_match_all('|</div>|', $renderer->doc, $divs_close, 
> PREG_SET_ORDER);
>               for ( $i = count($divs_close); $i < count($divs); $i++ ) 
>               {
>                       $renderer->doc .= '</div>';
>               }
>               $renderer->doc .= '<div class="level'.$clevel.'">'.DOKU_LF;
>       }
143c143,147
<       return '<div class="' . $class . '">' . DOKU_LF . DOKU_TAB . $xhtml . 
DOKU_LF . '</div>' . DOKU_LF;
---
>       // fix for include on php-5.3
>       preg_match_all('|<div .*>|', $renderer->doc, $divs, PREG_SET_ORDER);
>       preg_match_all('|</div>|', $renderer->doc, $divs_close, PREG_SET_ORDER);
>       $close = "";
>       for ( $i = count($divs_close); $i < count($divs)-1; $i++ )
>       {
>               $close .= '</div>'.DOKU_LF;
>       }
>       return $close . '<div class="' . $class . '">' . DOKU_LF . DOKU_TAB . 
> $xhtml . DOKU_LF . '</div>' . DOKU_LF;

Other related posts: