change undo_post_tagging() to emit quoted tags rather than using underscore replacement if they contain spaces.

This commit is contained in:
zotlabs 2018-02-26 20:30:36 -08:00
parent afe2ba3690
commit 5277e79fa2

View File

@ -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);