/// <summary> /// Formats the private message text /// </summary> /// <param name="message">Private message</param> /// <returns>Formatted text</returns> public static string FormatPrivateMessageText(this PrivateMessage message) { Guard.NotNull(message, nameof(message)); var text = message.Text; if (text.IsEmpty()) { return(string.Empty); } text = HtmlUtils.ConvertPlainTextToHtml(text.HtmlEncode()); return(BBCodeHelper.ToHtml(text)); }
/// <summary> /// Formats the forum post text /// </summary> /// <param name="post">Forum post</param> /// <returns>Formatted text</returns> public static string FormatPostText(this ForumPost post) { Guard.NotNull(post, nameof(post)); var text = post.Text; if (text.IsEmpty()) { return(string.Empty); } text = HtmlUtils.ConvertPlainTextToHtml(text.HtmlEncode()); if (EngineContext.Current.Resolve <ForumSettings>().ForumEditor == EditorType.BBCodeEditor) { text = BBCodeHelper.ToHtml(text); } return(text); }