From: friendica Date: Fri, 2 Mar 2012 09:24:20 +0000 (-0800) Subject: expand multiple heart smilies e.g. <3333 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f1bf6dcdfb89bf3c21e498ba3d76c600dafed934;p=friendica.git expand multiple heart smilies e.g. <3333 --- diff --git a/include/text.php b/include/text.php index 81e22527a6..4276b7fcb3 100755 --- a/include/text.php +++ b/include/text.php @@ -786,6 +786,7 @@ function smilies($s, $sample = false) { } } else { + $params['string'] = preg_replace_callback('/<(3+)/','preg_heart',$params['string']); $s = str_replace($params['texts'],$params['icons'],$params['string']); } @@ -804,7 +805,18 @@ function smile_decode($m) { return(str_replace($m[1],base64url_decode($m[1]),$m[0])); } +// expand <3333 to the correct number of hearts +function preg_heart($x) { + $a = get_app(); + if(strlen($x[1]) == 1) + return $x[0]; + $t = ''; + for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) + $t .= '<3'; + $r = str_replace($x[0],$t,$x[0]); + return $r; +} if(! function_exists('day_translate')) {