diff options
author | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-03-07 12:06:09 +0100 |
---|---|---|
committer | Alexander Kampmann <programmer@nurfuerspam.de> | 2012-03-07 12:06:09 +0100 |
commit | b2df1205ef805ab471a73f906d2eda5603a1aa66 (patch) | |
tree | 137e81ed5c1227bdd502156811e1ce85e3d23cdc /include/text.php | |
parent | fbc017cdba81fa7b159bca5fd0b3a4fb4885c5ad (diff) | |
parent | 0d9c2ca06f9394bc039a43410d3902338e8412a1 (diff) | |
download | volse-hubzilla-b2df1205ef805ab471a73f906d2eda5603a1aa66.tar.gz volse-hubzilla-b2df1205ef805ab471a73f906d2eda5603a1aa66.tar.bz2 volse-hubzilla-b2df1205ef805ab471a73f906d2eda5603a1aa66.zip |
merged
Diffstat (limited to 'include/text.php')
-rwxr-xr-x | include/text.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php index 81e22527a..042ee982c 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 <br>\n"; + return $r; }} @@ -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 .= '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />'; + $r = str_replace($x[0],$t,$x[0]); + return $r; +} if(! function_exists('day_translate')) { |