X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ftext.php;h=c8c03174e613625281240e0f0276c74e56d2e630;hb=eec4cff84be630bf3a4165321a423c29ed7926e9;hp=81e22527a679c657f3dc5d0df4f167a17e655353;hpb=bd2c8c92f1b30d8f811bd4aab0fe3a2c5496ec61;p=friendica.git diff --git a/include/text.php b/include/text.php index 81e22527a6..c8c03174e6 100755 --- a/include/text.php +++ b/include/text.php @@ -14,7 +14,13 @@ if(! function_exists('replace_macros')) { function replace_macros($s,$r) { global $t; - return $t->replace($s,$r); + //$ts = microtime(); + $r = $t->replace($s,$r); + //$tt = microtime() - $ts; + + //$a = get_app(); + //$a->page['debug'] .= "$tt
\n"; + return $r; }} @@ -731,7 +737,7 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika', '~friendica', - 'Diaspora*' +// 'Diaspora*' ); $icons = array( @@ -772,7 +778,7 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika ~friendika', '~friendica ~friendica', - 'DiasporaDiaspora*', +// 'DiasporaDiaspora*', ); @@ -786,6 +792,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 +811,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')) {