diff --git a/include/text.php b/include/text.php index 317028065..082d907ff 100755 --- a/include/text.php +++ b/include/text.php @@ -678,21 +678,56 @@ function linkify($s) { */ if(! function_exists('smilies')) { -function smilies($s) { +function smilies($s, $sample = false) { $a = get_app(); - $s = str_replace( - array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ';)', ':-(', ':(', ':-P', ':P', ':-"', ':-"', ':-x', ':-X', ':-D', ':D', '8-|', '8-O', ':-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', ":'(", ":-!", ":-/", ":-[", "8-)", - ':beer', ':homebrew', ':coffee', - '~friendika', '~friendica', 'Diaspora*' ), - array( + $texts = array( + '<3', + '</3', + '<\\3', + ':-)', + ':)', + ';-)', + ';)', + ':-(', + ':(', + ':-P', + ':P', + ':-"', + ':-"', + ':-x', + ':-X', + ':-D', + ':D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + '\\.../', + '\\ooo/', + ":'(", + ":-!", + ":-/", + ":-[", + "8-)", + ':beer', + ':homebrew', + ':coffee', + '~friendika', + '~friendica', + 'Diaspora*' + ); + + $icons = array( '', '', '', '', '', '', - '', + '', '', '', '', @@ -702,7 +737,7 @@ function smilies($s) { '', '', '', - '', + '', '', '', '', @@ -715,19 +750,29 @@ function smilies($s) { '', '', '', - '', - + '', '', '', '', - '~friendika ', '~friendica ', 'Diaspora', - ), $s); + ); - call_hooks('smilie', $s); + $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); + call_hooks('smilie', $params); + + if($sample) { + $s = '