From 5277e79fa2dcac5ddd5e4577fb1719fe57ee3829 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 26 Feb 2018 20:30:36 -0800 Subject: change undo_post_tagging() to emit quoted tags rather than using underscore replacement if they contain spaces. --- include/text.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index d4cfecd75..c82fad517 100644 --- a/include/text.php +++ b/include/text.php @@ -2028,14 +2028,14 @@ function undo_post_tagging($s) { $cnt = preg_match_all('/([@#])(\!*)\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - $s = str_replace($mtch[0], $mtch[1] . $mtch[2] . str_replace(' ','_',$mtch[4]),$s); + $s = str_replace($mtch[0], $mtch[1] . $mtch[2] . quote_tag($mtch[4]),$s); } } // undo forum tags $cnt = preg_match_all('/\!\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$s,$matches,PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - $s = str_replace($mtch[0], '!' . str_replace(' ','_',$mtch[2]),$s); + $s = str_replace($mtch[0], '!' . quote_tag($mtch[2]),$s); } } @@ -2043,6 +2043,13 @@ function undo_post_tagging($s) { return $s; } +function quote_tag($s) { + if(strpos($s,' ') !== false) + return '"' . $s . '"'; + return $s; +} + + function fix_mce_lf($s) { $s = str_replace("\r\n","\n",$s); // $s = str_replace("\n\n","\n",$s); -- cgit v1.2.3