From: <var...@us...> - 2009-05-27 16:10:17
|
Revision: 6814 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6814&view=rev Author: vargenau Date: 2009-05-27 16:10:12 +0000 (Wed, 27 May 2009) Log Message: ----------- Handle "[[SandBox|{{image.jpg}}]]" and "[[SandBox|{{image.jpg|alt text}}]]" Modified Paths: -------------- trunk/lib/InlineParser.php Modified: trunk/lib/InlineParser.php =================================================================== --- trunk/lib/InlineParser.php 2009-05-25 13:18:10 UTC (rev 6813) +++ trunk/lib/InlineParser.php 2009-05-27 16:10:12 UTC (rev 6814) @@ -393,6 +393,19 @@ } else if (preg_match('/^(\.\.\/|\/)/', $link)) { return new Cached_ExternalLink($link, $label); } + + // Handle "[[SandBox|{{image.jpg}}]]" and "[[SandBox|{{image.jpg|alt text}}]]" + if (string_starts_with($label, "{{")) { + $imgurl = substr($label, 2, -2); // Remove "{{" and "}}" + $pipe = strpos($imgurl, '|'); + if ($pipe === false) { + $label = LinkImage(UPLOAD_DATA_PATH . $imgurl, $link); + } else { + list($img, $alt) = explode("|", $imgurl); + $label = LinkImage(UPLOAD_DATA_PATH . $img, $alt); + } + } else + // [label|link] // If label looks like a url to an image or object, we want an image link. if (isImageLink($label)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |