', $text); $text = preg_replace("/[\r\n]{2,}/", "\n\n", $text); // Get the theme's directory if it is numeric if (is_numeric($theme)) { $result = $db->execute(" SELECT folder FROM arrowchat_themes WHERE id='".$theme."' "); if ($result AND $db->count_select() > 0) { $row = $db->fetch_array($result); $theme = $row['folder']; } else { $theme = "new_facebook"; } } if (!empty($blocked_words)) { $bad_words = explode(",", $blocked_words); $container_words = array(); $exact_match_words = array(); foreach ($bad_words as $word) { $s_word = trim($word); if (preg_match('/\[(.*?)\]/', $s_word)) { $exact_match_words[] = trim($s_word, '[]'); } else { $container_words[] = $s_word; } } if (!empty($exact_match_words)) $text = preg_replace("/\b(" . implode("|",$exact_match_words) . ")\b/i", "****", $text); if (!empty($container_words)) $text = preg_replace("/(" . implode("|",$container_words) . ")/i", "****", $text); } if ($disable_smilies != 1) { $text = preg_replace('/^([*#0-9](?>\\xEF\\xB8\\x8F)?\\xE2\\x83\\xA3|\\xC2[\\xA9\\xAE]|\\xE2..(\\xF0\\x9F\\x8F[\\xBB-\\xBF])?(?>\\xEF\\xB8\\x8F)?|\\xE3(?>\\x80[\\xB0\\xBD]|\\x8A[\\x97\\x99])(?>\\xEF\\xB8\\x8F)?|\\xF0\\x9F(?>[\\x80-\\x86].(?>\\xEF\\xB8\\x8F)?|\\x87.\\xF0\\x9F\\x87.|..(\\xF0\\x9F\\x8F[\\xBB-\\xBF])?|(((?\\xE2\\x80\\x8D)\\xE2\\x9D\\xA4\\xEF\\xB8\\x8F\k\\xF0\\x9F..(\k\\xF0\\x9F\\x91.)?|(\\xE2\\x80\\x8D\\xF0\\x9F\\x91.){2,3}))?))$/', '$1', $text); if (!empty($smileys)) { foreach ($smileys as $pattern => $result) { $pattern = str_replace("\;", ";", $pattern); $pattern = htmlspecialchars($pattern); $text = str_replace($pattern, ' ', $text); } } $premade_smilies = array( ":)" => "🙂", ":-)" => "🙂", "=)" => "🙂", ":p" => "😛", ":o" => "😮", ":|" => "😐", ":(" => "☹️", "=(" => "☹️", ":D" => "😃", "=D" => "😃", ":/" => "😕", "=/" => "😕", ";)" => "😉", ":'(" => "😢", "<3" => "❤️", ">:(" => "😡" ); foreach ($premade_smilies as $pattern => $result) { $pattern = str_replace("\;", ";", $pattern); $pattern = htmlspecialchars($pattern); if ($text == $pattern) $text = str_replace($pattern, $result, $text); else $text = str_replace(" " . $pattern, ' ' . $result, $text); } } if (preg_match('@video[{](.*)[}]@', $text, $match)) { $text = str_replace($match[0], '
' . $language[61] . '
', $text); } if (preg_match('@file[{]([0-9]{13})[}][{](.*)[}]@', $text, $match)) { $text = str_replace($match[0], '
' . $language[69] . '
', $text); } if (preg_match('@image[{]([0-9]{13})[}][{](.*)[}]@', $text, $match)) { $text = str_replace($match[0], '
Image
', $text); } if (preg_match('~^(?:https?://)?(?:www.)?(?:youtube.com|youtu.be)/(?:watch\?v=)?([^\s]+)$~i', $text, $match)) { $text = str_replace($match[0], ' ' . htmlentities($match[0]) . ' ', $text); } if ($giphy_chatroom_off != 1 OR $giphy_off != 1) { if (preg_match('@giphy[{](.*)[}][{](.*)[}]@', $text, $match)) { $parsed_url = parse_url($match[2]); if (preg_match('@giphy@i', $parsed_url['host'])) { $text = str_replace($match[0], '
', $text); } } } return $text; } ?>