public static function textFormatter($text) { if (!is_object(self::$markdownParser)) { include_once P . 'inc/script/parsedown/Parsedown.php'; self::$markdownParser = new Parsedown(); } $text = self::$markdownParser->text($text); // Start customized markdown // xiami music loader $text = preg_replace("/!~!(.+?)\\[xiami\\]/", "<span class=\"xiamiLoader\" data-src=\"\$1\" data-root=\"" . bw::$conf['siteURL'] . "\"></span>", $text); // Wangyi Yun Yinyue loader $text = preg_replace("/!~!(.+?)\\[wangyiyun]/", "<p><iframe frameborder=\"no\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" width='330' height='86' src=\"http://music.163.com/outchain/player?type=2&id=\$1&auto=0&height=66\"></iframe></p>", $text); // Youku loader $text = preg_replace("/!~!(.+?)\\[youku\\]/", "<iframe src=\"http://player.youku.com/embed/\$1\" frameborder='0' class=\"videoFrame\"></iframe>", $text); // Geolocation from Baidu $text = preg_replace("/!~!(.+?)\\[location\\]/", "<span class=\"icon-location geoLocator\"></span> <span class=\"geoLocator\">\$1</span>", $text); // !!URL = music $text = preg_replace("/!!<a href=\"(.+?)\">(.+?)<\\/a>/", "<audio controls><source src=\"\$1\" type=\"audio/mpeg\">Your browser does not support the audio element.</audio>", $text); $text = str_replace("\n", '<br/>', $text); $text = preg_replace("/<\\/(.+?)><br\\/>/", "</\$1>", $text); //Image aligned to left or right $text = preg_replace("/<img (.+?) alt=\"-R\"/", "<img \$1 class=\"RImg\" alt=\"\"", $text); $text = preg_replace("/<img (.+?) alt=\"-L\"/", "<img \$1 class=\"LImg\" alt=\"\"", $text); //Image Gallery $varAlbumID = rand(100000, 999999); $text = preg_replace("/<img (.+?) alt=\"-Album:(.+?)\"/", "<img \$1 class=\"ImgAlbum Alb" . $varAlbumID . "\" data-desc=\"\$2\" data-album=\"" . $varAlbumID . "\"", $text); $text = hook('textParser', 'Replace', $text); return $text; }