using System;
using System.Data;
using System.Text.RegularExpressions;
using BlogEngine.Core;
using BlogEngine.Core.Web.Controls;
/// <summary>
/// Add Google AdSense Code to the bottom of post.
/// Written by Jaosn 2008-09-06 Visit www.tiray.net for details
/// </summary>
[Extension("Add Google AdSense Code to the bottom of post", "1.0", "<a href=\"http://www.tiray.net\">www.tiray.net</a>")]
public class PostAD
{
static PostAD()
{
Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving);
}
/// <summary>
/// The event handler that is triggered every time a post is served to a client.
/// </summary>
private static void Post_Serving(object sender, ServingEventArgs e)
{
//Add Google AdSense only when a single post is served to a client
if (e.Location == ServingLocation.SinglePost)
{
e.Body = e.Body +
"<br><div id=\"googlead\" style=\"text-align: center\">" + "\r\n" +
"[ADCODE]"+"\r\n"+
"</div><br>"+"\r\n";
}
}
}