aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-03-02 04:53:54 -0500
committerSimon L'nu <simon.lnu@gmail.com>2012-03-02 04:53:54 -0500
commitbcadd873eea086255152708c4d1cede4d3dcc581 (patch)
tree21aec43a9d5e5ee0b0cdd11e7d797dba47f40c35 /include/text.php
parentf0fdd1a163b6bc7213eeb48c6ee9025087bb0032 (diff)
parentf1bf6dcdfb89bf3c21e498ba3d76c600dafed934 (diff)
downloadvolse-hubzilla-bcadd873eea086255152708c4d1cede4d3dcc581.tar.gz
volse-hubzilla-bcadd873eea086255152708c4d1cede4d3dcc581.tar.bz2
volse-hubzilla-bcadd873eea086255152708c4d1cede4d3dcc581.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: expand multiple heart smilies e.g. <3333 * master:
Diffstat (limited to 'include/text.php')
-rwxr-xr-xinclude/text.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index 81e22527a..4276b7fcb 100755
--- a/include/text.php
+++ b/include/text.php
@@ -786,6 +786,7 @@ function smilies($s, $sample = false) {
}
}
else {
+ $params['string'] = preg_replace_callback('/&lt;(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 .= '<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')) {