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( '<3', '</3', '<\\3', ':-)', ':)', ';-)', - ';)', + ';)', ':-(', ':(', ':-P', @@ -702,7 +737,7 @@ function smilies($s) { ':-x', ':-X', ':-D', - ':D', + ':D', '8-|', '8-O', ':-O', @@ -715,19 +750,29 @@ function smilies($s) { ':-!', ':-/', ':-[', - '8-)', - + '8-)', ':beer', ':homebrew', ':coffee', - '~friendika ~friendika', '~friendica ~friendica', 'DiasporaDiaspora*', - ), $s); + ); - call_hooks('smilie', $s); + $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); + call_hooks('smilie', $params); + + if($sample) { + $s = '
'; + for($x = 0; $x < count($params['texts']); $x ++) { + $s .= '
' . $params['texts'][$x] . '
' . $params['icons'][$x] . '
'; + } + } + else { + $s = str_replace($params['texts'],$params['icons'],$params['string']); + } + return $s; }}