X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FSmilies.php;h=d63511cd1d20af430b1c6ac0bcf3df09f0459cf1;hb=ef8ad9f1ede56c80ba0cc13298511d7943e04894;hp=193f3b555ddd2986f7e3adf009928678eba0f57c;hpb=0e531e148e0693f305f3062046de27ae349262c4;p=friendica.git diff --git a/include/Smilies.php b/include/Smilies.php index 193f3b555d..d63511cd1d 100644 --- a/include/Smilies.php +++ b/include/Smilies.php @@ -1,24 +1,48 @@ smilie shortcut * 'icons' => icon in html - * + * * @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array) */ public static function get_list() { @@ -63,48 +87,47 @@ class Smilies { ); $icons = array( - '<3', - '</3', - '<\\3', - ':-)', - ';-)', - ':-(', - ':-P', - ':-p', - ':-\', - ':-\', - ':-x', - ':-X', - ':-D', - '8-|', - '8-O', - ':-O', - '\\o/', - 'o.O', - 'O.o', - 'o_O', - 'O_o', - ':\'(', - ':-!', - ':-/', - ':-[', - '8-)', - ':beer', - ':homebrew', - ':coffee', - ':facepalm', - ':like', - ':dislike', - '~friendica ~friendica', - 'redredmatrix', - 'redredmatrix' + '<3', + '</3', + '<\\3', + ':-)', + ';-)', + ':-(', + ':-P', + ':-p', + ':-\', + ':-\', + ':-x', + ':-X', + ':-D', + '8-|', + '8-O', + ':-O', + '\\o/', + 'o.O', + 'O.o', + 'o_O', + 'O_o', + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', + ':beer', + ':homebrew', + ':coffee', + ':facepalm', + ':like', + ':dislike', + '~friendica ~friendica', + 'redred#matrix', + 'redred#matrixmatrix' ); $params = array('texts' => $texts, 'icons' => $icons); call_hooks('smilie', $params); return $params; - } /** @@ -118,12 +141,13 @@ class Smilies { * function from being executed by the prepare_text() routine when preparing * bbcode source for HTML display * - * @param string $s + * @param string $s Text that should be replaced * @param boolean $sample - * - * @return string + * @param boolean $no_images Only replace emoticons without images + * + * @return string HML Output of the Smilie */ - public static function replace($s, $sample = false) { + public static function replace($s, $sample = false, $no_images = false) { if(intval(get_config('system','no_smilies')) || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies')))) return $s; @@ -132,6 +156,19 @@ class Smilies { $s = preg_replace_callback('/(.*?)<\/code>/ism','self::encode',$s); $params = self::get_list(); + + if ($no_images) { + $cleaned = array('texts' => array(), 'icons' => array()); + $icons = $params['icons']; + foreach ($icons AS $key => $icon) { + if (!strstr($icon, '<3'; + $t .= '<3'; $r = str_replace($x[0],$t,$x[0]); return $r; } - }