mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit b4a8aec53325a73e9210b38724752b87de1946d8
parent 0c9d4bcc762adaf53797957427c001d9ce8f5ddb
Author: markseu <mark2011@mayberg.se>
Date:   Thu, 10 Jul 2014 11:02:56 +0200

Markdown update (bug fix for PHP closures)

Diffstat:
Msystem/core/core-markdownextra.php | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/system/core/core-markdownextra.php b/system/core/core-markdownextra.php @@ -5,7 +5,7 @@ // Markdown extra core plugin class YellowMarkdownExtra { - const Version = "0.3.5"; + const Version = "0.3.6"; var $yellow; //access to API // Handle plugin initialisation @@ -18,7 +18,7 @@ class YellowMarkdownExtra function onParseContentText($page, $text) { $markdown = new YellowMarkdownExtraParser($this->yellow, $page); - return $markdown->transformText($text); + return $markdown->transformText($page, $text); } } @@ -38,14 +38,14 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser } // Transform page text - function transformText($text) + function transformText($page, $text) { - $text = preg_replace("/@pageRead/i", $this->page->get("pageRead"), $text); - $text = preg_replace("/@pageEdit/i", $this->page->get("pageEdit"), $text); - $text = preg_replace("/@pageError/i", $this->page->get("pageError"), $text); - $callback = function($matches) + $text = preg_replace("/@pageRead/i", $page->get("pageRead"), $text); + $text = preg_replace("/@pageEdit/i", $page->get("pageEdit"), $text); + $text = preg_replace("/@pageError/i", $page->get("pageError"), $text); + $callback = function($matches) use ($page) { - $matches[2] = $this->yellow->toolbox->normaliseLocation($matches[2], $this->page->base, $this->page->location); + $matches[2] = $page->yellow->toolbox->normaliseLocation($matches[2], $page->base, $page->location); return "<a$matches[1]href=\"$matches[2]\"$matches[3]>"; }; return preg_replace_callback("/<a(.*?)href=\"([^\"]+)\"(.*?)>/i", $callback, $this->transform($text));