weblogemoticonsmodule.cs

来自「community server 源码」· CS 代码 · 共 36 行

CS
36
字号
using System;
using System.Xml;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Smilies for Weblogs
	/// </summary>
	public class WeblogEmoticonsModule : ICSModule
	{
		public WeblogEmoticonsModule(){}

	    public void Init(CSApplication csa, XmlNode node)
	    {
	        csa.PrePostUpdate +=new CSPostEventHandler(csa_PrePostUpdate);
        }

        private void csa_PrePostUpdate(IContent content, CSPostEventArgs e)
        {
            if(e.ApplicationType == ApplicationType.Weblog)
            {
                WeblogPost wp = content as WeblogPost;
                if(wp != null && e.State != ObjectState.Delete)
                {
                    if(CSContext.Current.SiteSettings.EnableEmoticons)
                    {
                        wp.FormattedBody = Transforms.EmoticonTransforms(wp.FormattedBody);
                    }
                    
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?