/** * Process the emoticons, BBCode, rich text, embedded content etc in this object and return as HTML * @since Version 3.10.0 * @param string $string * @param array $options * @return string */ public static function formatText($string, $options) { AppCore::getSmarty()->addStylesheet("/themes/jiffy_simple/style/opt.embedded.css"); $defaultOptions = ["bbcode_uid" => "sausages", "flag_html" => true, "flag_bbcode" => true, "flag_emoticons" => true, "strip_formatting" => false, "editor_version" => 1]; $options = array_merge($defaultOptions, is_array($options) ? $options : []); if (empty(trim($string))) { throw new InvalidArgumentException("Cannot execute " . __METHOD__ . " as no text was provided!"); } $cacheKey = "railpage:formatText=" . sha1((string) $string . json_encode($options)) . ";" . self::$formatTextVer; $cacheProvider = AppCore::getMemcached(); $processedText = false; if ($processedText = $cacheProvider->fetch($cacheKey)) { return $processedText; } /** * @todo * - make clickable - doesn't seem to do anything? 24/03/2016 * - convert to UTF8 - is this still required? 24/03/2016 */ $string = EmoticonsUtility::Process($string, $options['flag_emoticons']); $string = Html::cleanupBadHtml($string, $options['editor_version']); $string = Html::removeHeaders($string); $string = BbcodeUtility::Process($string, $options['flag_bbcode']); $string = MultimediaUtility::Process($string); $string = MakeClickable::Process($string); $string = Url::offsiteUrl((string) $string); if (is_object($string)) { $string = $string->__toString(); } if ($options['strip_formatting'] == true) { $string = strip_tags($string); } $rs = $cacheProvider->save($cacheKey, $string, 0); // 3600 * 24 * 30); return $string; }
<?php /** * Custom config of emoticons for BBCode parser * @since Version 3.10.0 * @package Railpage * @author Michael Greenhill */ /** * Mapping of emoticons to a list of smilies that represents it. * The smiley will be replaced with an image that uses the emoticon name. */ return \Railpage\Formatting\EmoticonsUtility::getEmoticons();