X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fmessage.func.inc.php;h=e32d97388589f791a06e3d0d625ef187321a05d7;hb=9bd9df1eace08648ddf2616d3008631f2b697474;hp=31f3e473eb3d8b3ce6f18767bb72f0f65b48180e;hpb=6ec8703c9a26dc36334478488789433b00c471d7;p=banana.git diff --git a/banana/message.func.inc.php b/banana/message.func.inc.php index 31f3e47..e32d973 100644 --- a/banana/message.func.inc.php +++ b/banana/message.func.inc.php @@ -88,13 +88,16 @@ function banana_catchFormats($text) 'strong' => array('\B\*\b', '\b\*\B')); $url = Banana::$msgshow_url; preg_match_all("/$url/ui", $text, $urls); - $text = str_replace($urls[0], "&&&urls&&&", $text); + $urls = $urls[0]; + $replace = $urls; + rsort($replace); + $text = str_replace($replace, "&&&urls&&&", $text); foreach ($formatting as $mark=>$limit) { list($ll, $lr) = $limit; $text = preg_replace('/' . $ll . '(\w+?)' . $lr . '/us', "<$mark>\\1", $text); } - return preg_replace('/&&&urls&&&/e', 'array_shift($urls[0])', $text); + return preg_replace('/&&&urls&&&/e', 'array_shift($urls)', $text); } /** Build a flowed text from plain text