📄 weblogformattingmodule.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Text.RegularExpressions;
using System.Xml;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Components
{
/// <summary>
/// Summary description for WeblogFormattingModule.
/// </summary>
public class WeblogFormattingModule : ICSModule
{
public WeblogFormattingModule()
{
//
// TODO: Add constructor logic here
//
}
public void Init(CSApplication csa, XmlNode node)
{
csa.PreSectionUpdate +=new CSSectionEventHandler(csa_PreSectionUpdate);
}
private void csa_PreSectionUpdate(Section section, CSEventArgs e)
{
if(e.ApplicationType == ApplicationType.Weblog && (e.State == ObjectState.Create || e.State == ObjectState.Update))
{
Weblog w = section as Weblog;
if (w != null)
{
// Clean fields using HtmlScrubber
w.Description = HtmlScrubber.Clean(w.Description,true,true);
w.Name = HtmlScrubber.Clean(w.Name,true,true);
w.News = HtmlScrubber.Clean(w.News,true,true);
w.AboutTitle = HtmlScrubber.Clean(w.AboutTitle,true,true);
w.AboutDescription = HtmlScrubber.Clean(w.AboutDescription,true,true);
// These values are inserted into a HTML tag attrib, so we cannot allow HTML
w.MetaTagDescription = Transforms.StripHtmlXmlTags(w.MetaTagDescription);
w.MetaTagKeywords = Transforms.StripHtmlXmlTags(w.MetaTagKeywords);
CSContext cntx = CSContext.Current;
// Clean fields using Censorship
if(cntx.SiteSettings.EnableCensorship )
{
w.Description = Transforms.CensorPost( w.Description );
w.Name = Transforms.CensorPost( w.Name );
w.News = Transforms.CensorPost( w.News );
w.AboutTitle = Transforms.CensorPost( w.AboutTitle );
w.AboutDescription = Transforms.CensorPost(w.AboutDescription);
w.MetaTagDescription = Transforms.CensorPost( w.MetaTagDescription );
w.MetaTagKeywords = Transforms.CensorPost( w.MetaTagKeywords );
}
//Can not use until we store pre-processed copies
// if(cntx.SiteSettings.EnableEmoticons)
// {
// w.News = Transforms.EmoticonTransforms(w.News);
// w.AboutDescription = Transforms.EmoticonTransforms(w.AboutDescription);
// }
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -