public static void Send(IPublishable item, Uri itemUrl) { foreach (var url in GetUrlsFromContent(item.Content)) { var trackbackSent = false; if (BlogSettings.Instance.EnableTrackBackSend) { var remoteFile = new RemoteFile(url, true); var pageContent = remoteFile.GetFileAsString(); var trackbackUrl = GetTrackBackUrlFromPage(pageContent); if (trackbackUrl != null) { var message = new TrackbackMessage(item, trackbackUrl, itemUrl); trackbackSent = Trackback.Send(message); } } if (!trackbackSent && BlogSettings.Instance.EnablePingBackSend) { Pingback.Send(itemUrl, url); } } }
/// <summary> /// Executes the pings from the new thread. /// </summary> /// <param name="item"> /// The publishable item. /// </param> /// <param name="itemUrl"> /// The item Url. /// </param> private static void Ping(IPublishable item, Uri itemUrl) { try { Thread.Sleep(2000); // Ping the specified ping services. PingService.Send(itemUrl); // Send trackbacks and pingbacks. if (!BlogSettings.Instance.EnableTrackBackSend && !BlogSettings.Instance.EnablePingBackSend) { return; } if (item.Content.ToUpperInvariant().Contains("\"HTTP")) { Manager.Send(item, itemUrl); } } catch (Exception) { // We need to catch this exception so the application doesn't get killed. } }
/// <summary> /// Sends the trackback or pingback message. /// <remarks> /// It will try to send a trackback message first, and if the refered web page /// doesn't support trackbacks, a pingback is sent. /// </remarks> /// </summary> /// <param name="item"> /// The publishable item. /// </param> /// <param name="itemUrl"> /// The item Url. /// </param> public static void Send(IPublishable item, Uri itemUrl) { foreach (var url in GetUrlsFromContent(item.Content)) { var trackbackSent = false; if (BlogSettings.Instance.EnableTrackBackSend) { // ignoreRemoteDownloadSettings should be set to true // for backwards compatibilty with Utils.DownloadWebPage. var remoteFile = new RemoteFile(url, true); var pageContent = remoteFile.GetFileAsString(); // ReadFromWeb(url); var trackbackUrl = GetTrackBackUrlFromPage(pageContent); if (trackbackUrl != null) { var message = new TrackbackMessage(item, trackbackUrl, itemUrl); trackbackSent = Trackback.Send(message); } } if (!trackbackSent && BlogSettings.Instance.EnablePingBackSend) { Pingback.Send(itemUrl, url); } } }
/// <summary> /// Initializes a new instance of the <see cref="TrackbackMessage"/> class. /// </summary> /// <param name="item"> /// The publishable item. /// </param> /// <param name="urlToNotifyTrackback"> /// The URL to notify trackback. /// </param> /// <param name="itemUrl"> /// The item Url. /// </param> public TrackbackMessage(IPublishable item, Uri urlToNotifyTrackback, Uri itemUrl) { if (item == null) { throw new ArgumentNullException("item"); } this.Title = item.Title; this.PostUrl = itemUrl; this.Excerpt = item.Title; this.BlogName = GetBlogName(); this.UrlToNotifyTrackback = urlToNotifyTrackback; }
public void InstanceSend(IPublishable item, Uri itemUrl = null) { foreach (var url in GetUrlsFromContent(item.Content)) { var trackbackSent = false; if (IsTrackbackSendEnabled()) { var trackbackUrl = GetTrackbackUrl(url); if (trackbackUrl != null) { var message = GetTrackbackMessage(item, itemUrl, trackbackUrl); trackbackSent = GetTrackbackSent(message); } } if (!trackbackSent && IsPingbackEnabled()) { SendPingback(itemUrl, url); } } }
/// <summary> /// Sends the trackback or pingback message. /// <remarks> /// It will try to send a trackback message first, and if the refered web page /// doesn't support trackbacks, a pingback is sent. /// </remarks> /// </summary> public static void Send(IPublishable item, Uri itemUrl) { foreach (Uri url in GetUrlsFromContent(item.Content)) { bool isTrackbackSent = false; if (BlogSettings.Instance.EnableTrackBackSend) { string pageContent = Utils.DownloadWebPage(url);// ReadFromWeb(url); Uri trackbackUrl = GetTrackBackUrlFromPage(pageContent); if (trackbackUrl != null) { TrackbackMessage message = new TrackbackMessage(item, trackbackUrl, itemUrl); isTrackbackSent = Trackback.Send(message); } } if (!isTrackbackSent && BlogSettings.Instance.EnablePingBackSend) { Pingback.Send(itemUrl, url); } } }
/// <summary> /// Send emails to newsletter subscribers /// </summary> public static void SendEmails(IPublishable publishable) { var emails = LoadEmails(); if (emails != null && emails.Count > 0) { foreach (var email in emails) { if (!Utils.StringIsNullOrWhitespace(email) && Utils.IsEmailValid(email)) { MailMessage message = CreateEmail(publishable); message.To.Add(email); try { Utils.SendMailMessage(message); //Utils.Log("sent to " + email + " on - " + publishable.Title); } catch (Exception ex) { Utils.Log("Custom.Widgets.Newsletter.SendEmails", ex); } } } } }
private void WritePub(Stream stream, IPublishable pub) { XmlWriter xmlWriter = GetWriter(stream); if (pub is Post) WriteFoafDocument(xmlWriter, "post", pub.AbsoluteLink.ToString()); else WriteFoafDocument(xmlWriter, "comment", pub.AbsoluteLink.ToString()); WriteSiocPost(xmlWriter, pub); CloseWriter(xmlWriter); }
/// <summary> /// Writes the Atom feed entry element information to the specified <see cref="XmlWriter"/> using the supplied <see cref="Page"/>. /// </summary> /// <param name="writer"> /// The <see cref="XmlWriter"/> to write feed entry element information to. /// </param> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate feed entry content. /// </param> private static void WriteAtomEntry(XmlWriter writer, IPublishable publishable) { var post = publishable as Post; // var comment = publishable as Comment; // ------------------------------------------------------------ // Raise serving event // ------------------------------------------------------------ var arg = new ServingEventArgs(publishable.Content, ServingLocation.Feed); publishable.OnServing(arg); if (arg.Cancel) { return; } // ------------------------------------------------------------ // Modify publishable content to make references absolute // ------------------------------------------------------------ var content = Utils.ConvertPublishablePathsToAbsolute(arg.Body, publishable); writer.WriteStartElement("entry"); // ------------------------------------------------------------ // Write required entry elements // ------------------------------------------------------------ writer.WriteElementString("id", publishable.AbsoluteLink.ToString()); writer.WriteElementString("title", publishable.Title); writer.WriteElementString("updated", ToW3CDateTime(publishable.DateCreated.ToUniversalTime())); // ------------------------------------------------------------ // Write recommended entry elements // ------------------------------------------------------------ writer.WriteStartElement("link"); writer.WriteAttributeString("rel", "self"); writer.WriteAttributeString("href", GetPermaLink(publishable).ToString()); writer.WriteEndElement(); writer.WriteStartElement("link"); writer.WriteAttributeString("href", publishable.AbsoluteLink.ToString()); writer.WriteEndElement(); writer.WriteStartElement("author"); writer.WriteElementString("name", publishable.Author); writer.WriteEndElement(); writer.WriteStartElement("summary"); writer.WriteAttributeString("type", "html"); writer.WriteString(content); writer.WriteEndElement(); // ------------------------------------------------------------ // Write optional entry elements // ------------------------------------------------------------ writer.WriteElementString("published", ToW3CDateTime(publishable.DateCreated.ToUniversalTime())); writer.WriteStartElement("link"); writer.WriteAttributeString("rel", "related"); writer.WriteAttributeString("href", String.Concat(publishable.AbsoluteLink.ToString(), "#comment")); writer.WriteEndElement(); // ------------------------------------------------------------ // Write enclosure tag for podcasting support // ------------------------------------------------------------ if (BlogSettings.Instance.EnableEnclosures) { var encloser = GetEnclosure(content, publishable); if (!string.IsNullOrEmpty(encloser)) { writer.WriteRaw(encloser); } } // ------------------------------------------------------------ // Write entry category elements // ------------------------------------------------------------ if (publishable.Categories != null) { foreach (var category in publishable.Categories) { writer.WriteStartElement("category"); writer.WriteAttributeString("term", category.Title); writer.WriteEndElement(); } } // ------------------------------------------------------------ // Write entry tag elements // ------------------------------------------------------------ if (BlogSettings.Instance.EnableTagExport && publishable.Categories != null) { foreach (var tag in publishable.Tags) { writer.WriteElementString("betag", "tag", "http://dotnetblogengine.net/schemas/tags", tag); } } // ------------------------------------------------------------ // Write Dublin Core syndication extension elements // ------------------------------------------------------------ if (!String.IsNullOrEmpty(publishable.Author)) { writer.WriteElementString("dc", "publisher", "http://purl.org/dc/elements/1.1/", publishable.Author); } if (!String.IsNullOrEmpty(publishable.Description)) { writer.WriteElementString( "dc", "description", "http://purl.org/dc/elements/1.1/", publishable.Description); } // ------------------------------------------------------------ // Write pingback syndication extension elements // ------------------------------------------------------------ Uri pingbackServer; if (Uri.TryCreate( String.Concat(publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), "/pingback.axd"), UriKind.RelativeOrAbsolute, out pingbackServer)) { writer.WriteElementString( "pingback", "server", "http://madskills.com/public/xml/rss/module/pingback/", pingbackServer.ToString()); writer.WriteElementString( "pingback", "target", "http://madskills.com/public/xml/rss/module/pingback/", GetPermaLink(publishable).ToString()); } // ------------------------------------------------------------ // Write slash syndication extension elements // ------------------------------------------------------------ if (post != null && post.Comments != null) { writer.WriteElementString( "slash", "comments", "http://purl.org/rss/1.0/modules/slash/", post.Comments.Count.ToString(CultureInfo.InvariantCulture)); } // ------------------------------------------------------------ // Write trackback syndication extension elements // ------------------------------------------------------------ if (post != null && post.TrackbackLink != null) { writer.WriteElementString( "trackback", "ping", "http://madskills.com/public/xml/rss/module/trackback/", post.TrackbackLink.ToString()); } // ------------------------------------------------------------ // Write well-formed web syndication extension elements // ------------------------------------------------------------ writer.WriteElementString( "wfw", "comment", "http://wellformedweb.org/CommentAPI/", String.Concat(publishable.AbsoluteLink.ToString(), "#comment")); writer.WriteElementString( "wfw", "commentRss", "http://wellformedweb.org/CommentAPI/", string.Format("{0}/syndication.axd?post={1}", publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), publishable.Id)); // ------------------------------------------------------------ // Write </entry> element // ------------------------------------------------------------ writer.WriteEndElement(); }
/// <summary> /// Creates a <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </summary> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate the permalink for. /// </param> /// <returns> /// A <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// The <paramref name="publishable"/> is a null reference (Nothing in Visual Basic). /// </exception> private static Uri GetPermaLink(IPublishable publishable) { var post = publishable as Post; return(post != null ? post.PermaLink : publishable.AbsoluteLink); }
private void UpdateComments(IPublishable parent, DbConnection conn, DbProviderFactory provider) { int type = 0; if (parent is Training) { type = 1; } string sqlQuery = "DELETE FROM " + tablePrefix + "Comments WHERE ParentID = " + parmPrefix + "id and ParentType=" + type; using (DbCommand cmd = conn.CreateCommand()) { cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "id"; dpID.Value = parent.Id.ToString(); cmd.Parameters.Add(dpID); cmd.ExecuteNonQuery(); foreach (Comment comment in parent.Comments) { sqlQuery = "INSERT INTO " + tablePrefix + "Comments (CommentID,ParentID,ParentType,CommentDate,Author,Count,Sex,Phone,Mobile,Email,Company,QQ_msn,Comment,IsDispose,DisposeBy,Country,IP) " + "VALUES (@commentid, @parentid, @type, @date, @author,@count,@sex,@phone,@mobile, @email, @company,@qq_msn,@comment, @isapproved, @moderatedby, @country, @ip)"; if (parmPrefix != "@") sqlQuery = sqlQuery.Replace("@", parmPrefix); cmd.CommandText = sqlQuery; cmd.Parameters.Clear(); DbParameter dpCommentID = provider.CreateParameter(); dpCommentID.ParameterName = parmPrefix + "commentid"; dpCommentID.Value = comment.Id.ToString(); cmd.Parameters.Add(dpCommentID); DbParameter dpParentID = provider.CreateParameter(); dpParentID.ParameterName = parmPrefix + "parentid"; dpParentID.Value = comment.ParentId.ToString(); cmd.Parameters.Add(dpParentID); DbParameter dpParentType = provider.CreateParameter(); dpParentType.ParameterName = parmPrefix + "type"; dpParentType.Value = type; cmd.Parameters.Add(dpParentType); DbParameter dpCommentDate = provider.CreateParameter(); dpCommentDate.ParameterName = parmPrefix + "date"; dpCommentDate.Value = comment.DateCreated.AddHours(-TrainSettings.Instance.Timezone); cmd.Parameters.Add(dpCommentDate); DbParameter dpAuthor = provider.CreateParameter(); dpAuthor.ParameterName = parmPrefix + "author"; dpAuthor.Value = comment.Author; cmd.Parameters.Add(dpAuthor); DbParameter dpCount = provider.CreateParameter(); dpCount.ParameterName = parmPrefix + "count"; dpCount.Value = comment.Count; cmd.Parameters.Add(dpCount); DbParameter dpSex = provider.CreateParameter(); dpSex.ParameterName = parmPrefix + "sex"; dpSex.Value = comment.Sex; cmd.Parameters.Add(dpSex); DbParameter dpPhone = provider.CreateParameter(); dpPhone.ParameterName = parmPrefix + "phone"; dpPhone.Value = comment.Phone; cmd.Parameters.Add(dpPhone); DbParameter dpMobile = provider.CreateParameter(); dpMobile.ParameterName = parmPrefix + "mobile"; dpMobile.Value = comment.Mobile; cmd.Parameters.Add(dpMobile); DbParameter dpEmail = provider.CreateParameter(); dpEmail.ParameterName = parmPrefix + "email"; dpEmail.Value = comment.Email ?? ""; cmd.Parameters.Add(dpEmail); DbParameter dpCompany = provider.CreateParameter(); dpCompany.ParameterName = parmPrefix + "company"; if (comment.Company == null) dpCompany.Value = string.Empty; else dpCompany.Value = comment.Company.ToString(); cmd.Parameters.Add(dpCompany); DbParameter dpQQ_msn = provider.CreateParameter(); dpQQ_msn.ParameterName = parmPrefix + "qq_msn"; if (comment.QQ_msn == null) dpQQ_msn.Value = string.Empty; else dpQQ_msn.Value = comment.QQ_msn.ToString(); cmd.Parameters.Add(dpQQ_msn); DbParameter dpContent = provider.CreateParameter(); dpContent.ParameterName = parmPrefix + "comment"; dpContent.Value = comment.Content; cmd.Parameters.Add(dpContent); DbParameter dpIsApproved = provider.CreateParameter(); dpIsApproved.ParameterName = parmPrefix + "isapproved"; dpIsApproved.Value = comment.IsApproved; cmd.Parameters.Add(dpIsApproved); DbParameter dpModeratedBy = provider.CreateParameter(); dpModeratedBy.ParameterName = parmPrefix + "moderatedby"; dpModeratedBy.Value = comment.ModeratedBy ?? string.Empty; cmd.Parameters.Add(dpModeratedBy); DbParameter dpCountry = provider.CreateParameter(); dpCountry.ParameterName = parmPrefix + "country"; dpCountry.Value = comment.Country ?? string.Empty; cmd.Parameters.Add(dpCountry); DbParameter dpIP = provider.CreateParameter(); dpIP.ParameterName = parmPrefix + "ip"; dpIP.Value = comment.IP ?? string.Empty; cmd.Parameters.Add(dpIP); cmd.ExecuteNonQuery(); } } }
protected virtual TrackbackMessage GetTrackbackMessage(IPublishable item, Uri itemUrl, Uri trackbackUrl) { return new TrackbackMessage(item, trackbackUrl, itemUrl); }
/// <summary> /// A converter delegate used for converting Results to Posts. /// </summary> /// <param name="item"> /// The publishable item. /// </param> /// <returns> /// Converts to publishable interface. /// </returns> private static IPublishable ConvertToIPublishable(IPublishable item) { return item; }
/// <summary> /// Replace tags below in newsletter.html theme /// [TITLE] /// [LINK_DESCRIPTION] /// [LINK] /// [WebRoot] /// [httpBase] /// </summary> /// <param name="publishable"> /// The publishable to format. /// </param> /// <returns> /// The format body mail. /// </returns> private static string FormatBodyMail(IPublishable publishable) { var body = new StringBuilder(); var urlbase = Path.Combine( Path.Combine(Utils.AbsoluteWebRoot.AbsoluteUri, "themes"), BlogSettings.Instance.Theme); var filePath = string.Format("~/themes/{0}/newsletter.html", BlogSettings.Instance.Theme); filePath = HostingEnvironment.MapPath(filePath); if (File.Exists(filePath)) { body.Append(File.ReadAllText(filePath)); } else { // if custom theme doesn't have email template // use email template from standard theme filePath = HostingEnvironment.MapPath("~/themes/Standard/newsletter.html"); if (File.Exists(filePath)) { body.Append(File.ReadAllText(filePath)); } else { Utils.Log( "When sending newsletter, newsletter.html does not exist " + "in theme folder, and does not exist in the Standard theme " + "folder."); } } body = body.Replace("[TITLE]", publishable.Title); body = body.Replace("[LINK]", publishable.AbsoluteLink.AbsoluteUri); body = body.Replace("[LINK_DESCRIPTION]", publishable.Description); body = body.Replace("[WebRoot]", Utils.AbsoluteWebRoot.AbsoluteUri); body = body.Replace("[httpBase]", urlbase); return body.ToString(); }
/// <summary> /// Gets enclosure for supported media type /// </summary> /// <param name="content">The content.</param> /// <param name="publishable">The publishable instance.</param> /// <returns>The enclosure.</returns> private static string GetEnclosure(string content, IPublishable publishable) { var enclosure = string.Empty; fileSize = 0; fileExists = false; foreach (var media in SupportedMedia) { enclosure = GetMediaEnclosure(publishable, content, media.Key, media.Value); if (enclosure.Length > 0) { break; } } return enclosure; }
/// <summary> /// Creates a <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </summary> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate the permalink for. /// </param> /// <returns> /// A <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// The <paramref name="publishable"/> is a null reference (Nothing in Visual Basic). /// </exception> private static Uri GetPermaLink(IPublishable publishable) { var post = publishable as Post; return post != null ? post.PermaLink : publishable.AbsoluteLink; }
/// <summary> /// Creates a <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </summary> /// <param name="publishable">The <see cref="IPublishable"/> used to generate the permalink for.</param> /// <returns>A <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="publishable"/> is a null reference (Nothing in Visual Basic).</exception> private static Uri GetPermaLink(IPublishable publishable) { Training post = publishable as Training; if (post != null) { return post.PermaLink; } return publishable.AbsoluteLink; }
private static MailMessage CreateEmail(IPublishable publishable) { var subject = publishable.Title; //var settings = GetSettings(); //if (settings["subjectPrefix"] != null) // subject = settings["subjectPrefix"] + subject; var mail = new MailMessage { Subject = subject, Body = FormatBodyMail(publishable), From = new MailAddress(BlogSettings.Instance.Email, BlogSettings.Instance.Name) }; return mail; }
public TestableTrackbackMessage(IPublishable item, Uri urlToNotifyTrackback, Uri itemUrl, string blogName) : base(item, urlToNotifyTrackback, itemUrl) { BlogName = blogName; }
private void UpdateTags(IPublishable parent, DbConnection conn, DbProviderFactory provider) { int type = 0; if (parent is Training) { type = 1; } string sqlQuery = "DELETE FROM " + tablePrefix + "Tags WHERE ParentID = " + parmPrefix + "id and ParentType="+type; using (DbCommand cmd = conn.CreateCommand()) { cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "id"; dpID.Value = parent.Id.ToString() ; cmd.Parameters.Add(dpID); cmd.ExecuteNonQuery(); foreach (string tag in (parent is Training) ? ((Training)parent).Tags : ((Curricula)parent).Tags) { cmd.CommandText = "INSERT INTO " + tablePrefix + "Tags (ParentID,ParentType, Tag) " + "VALUES (" + parmPrefix + "parentid, " + parmPrefix + "parenttype, " + parmPrefix + "tag)"; cmd.Parameters.Clear(); DbParameter dpTrainingID = provider.CreateParameter(); dpTrainingID.ParameterName = parmPrefix + "parentid"; dpTrainingID.Value = parent.Id.ToString(); cmd.Parameters.Add(dpTrainingID); DbParameter dpParentType = provider.CreateParameter(); dpParentType.ParameterName = parmPrefix + "parenttype"; dpParentType.Value = type; cmd.Parameters.Add(dpParentType); DbParameter dpTag = provider.CreateParameter(); dpTag.ParameterName = parmPrefix + "tag"; dpTag.Value = tag; cmd.Parameters.Add(dpTag); cmd.ExecuteNonQuery(); } } }
private void UpdateFields(IPublishable parent, DbConnection conn, DbProviderFactory provider) { string table = "CurriculaField"; string key = "CurriculaID"; if (parent is Training) { table = "TrainingField"; key = "TrainingID"; } string sqlQuery = "DELETE FROM " + tablePrefix + table + " WHERE " + key + " = " + parmPrefix + "id"; using (DbCommand cmd = conn.CreateCommand()) { cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "id"; dpID.Value = parent.Id.ToString(); cmd.Parameters.Add(dpID); cmd.ExecuteNonQuery(); foreach (Field fld in parent.Fields) { cmd.CommandText = "INSERT INTO " + tablePrefix + table + " (" + key + ", FieldID) " + "VALUES (" + parmPrefix + "id, " + parmPrefix + "fld)"; cmd.Parameters.Clear(); DbParameter dpPostID = provider.CreateParameter(); dpPostID.ParameterName = parmPrefix + "id"; dpPostID.Value = parent.Id.ToString(); cmd.Parameters.Add(dpPostID); DbParameter dpfld = provider.CreateParameter(); dpfld.ParameterName = parmPrefix + "fld"; dpfld.Value = fld.Id.ToString(); cmd.Parameters.Add(dpfld); cmd.ExecuteNonQuery(); } } }
private void WriteSiocPost(XmlWriter xmlWriter, IPublishable pub) { xmlWriter.WriteStartElement("sioc", "Post", null); xmlWriter.WriteAttributeString("rdf", "about", null, pub.AbsoluteLink.ToString()); xmlWriter.WriteStartElement("sioc", "link", null); xmlWriter.WriteAttributeString("rdf", "resource", null, pub.AbsoluteLink.ToString()); xmlWriter.WriteEndElement(); //sioc:link xmlWriter.WriteStartElement("sioc", "has_container", null); xmlWriter.WriteAttributeString("rdf", "resource", null, GetSiocBlogUrl()); xmlWriter.WriteEndElement(); //sioc:has_container xmlWriter.WriteElementString("dc", "title", null, pub.Title); // SIOC:USER if (pub is Post) { xmlWriter.WriteStartElement("sioc", "has_creator", null); xmlWriter.WriteStartElement("sioc", "User", null); xmlWriter.WriteAttributeString("rdf", "about", null, GetBlogAuthorUrl(pub.Author)); xmlWriter.WriteStartElement("rdfs", "seeAlso", null); xmlWriter.WriteAttributeString("rdf", "resource", null, GetSiocAuthorUrl(pub.Author)); xmlWriter.WriteEndElement(); //rdf:about xmlWriter.WriteEndElement(); //sioc:User xmlWriter.WriteEndElement(); //sioc:has_creator } // FOAF:maker xmlWriter.WriteStartElement("foaf", "maker", null); xmlWriter.WriteStartElement("foaf", "Person", null); if (pub is Post) xmlWriter.WriteAttributeString("rdf", "about", null, GetBlogAuthorUrl(pub.Author)); xmlWriter.WriteAttributeString("foaf", "name", null, pub.Author); if (pub is Post) { MembershipUser user = Membership.GetUser(pub.Author); xmlWriter.WriteElementString("foaf", "mbox_sha1sum", null, (user != null) ? CalculateSHA1(user.Email, Encoding.UTF8) : ""); } else { xmlWriter.WriteElementString("foaf", "mbox_sha1sum", null, CalculateSHA1(((Comment)pub).Email, Encoding.UTF8)); } xmlWriter.WriteStartElement("foaf", "homepage", null); if (pub is Post) xmlWriter.WriteAttributeString("rdf", "resource", null, Utils.AbsoluteWebRoot.ToString()); else xmlWriter.WriteAttributeString("rdf", "resource", null, "TODO:"); xmlWriter.WriteEndElement(); //foaf:homepage if (pub is Post) { xmlWriter.WriteStartElement("rdfs", "seeAlso", null); xmlWriter.WriteAttributeString("rdf", "resource", null, GetSiocAuthorUrl(pub.Author)); xmlWriter.WriteEndElement(); //rdfs:seeAlso } xmlWriter.WriteEndElement(); //foaf:Person xmlWriter.WriteEndElement(); //foaf:maker // CONTENT //xmlWriter.WriteElementString("dcterms", "created", null, DpUtility.ToW3cDateTime(pub.DateCreated)); xmlWriter.WriteElementString("sioc", "content", null, Utils.StripHtml(pub.Content)); xmlWriter.WriteElementString("content", "encoded", null, pub.Content); // TOPICS if (pub is Post) { // categories foreach (Category category in ((Post)pub).Categories) { xmlWriter.WriteStartElement("sioc", "topic", null); xmlWriter.WriteAttributeString("rdfs", "label", null, category.Title); xmlWriter.WriteAttributeString("rdf", "resource", null, category.AbsoluteLink.ToString()); xmlWriter.WriteEndElement(); //sioc:topic } // tags are also supposed to be treated as sioc:topic foreach (string tag in ((Post)pub).Tags) { xmlWriter.WriteStartElement("sioc", "topic", null); xmlWriter.WriteAttributeString("rdfs", "label", null, tag); xmlWriter.WriteAttributeString("rdf", "resource", null, Utils.AbsoluteWebRoot.ToString() + "?tag=/" + tag); xmlWriter.WriteEndElement(); //sioc:topic } // COMMENTS foreach (Comment comment in ((Post)pub).ApprovedComments) { xmlWriter.WriteStartElement("sioc", "has_reply", null); xmlWriter.WriteStartElement("sioc", "Post", null); xmlWriter.WriteAttributeString("rdf", "about", null, comment.AbsoluteLink.ToString()); xmlWriter.WriteStartElement("rdfs", "seeAlso", null); xmlWriter.WriteAttributeString("rdf", "resource", null, GetSiocCommentUrl(comment.Id.ToString())); xmlWriter.WriteEndElement(); //rdfs:seeAlso xmlWriter.WriteEndElement(); //sioc:Post xmlWriter.WriteEndElement(); //sioc:has_reply } // TODO: LINKS MatchCollection linkMatches = Regex.Matches(pub.Content, @"<a[^(href)]?href=""([^""]+)""[^>]?>([^<]+)</a>"); List<string> linkPairs = new List<string>(); foreach (Match linkMatch in linkMatches) { string url = linkMatch.Groups[1].Value; string text = linkMatch.Groups[2].Value; if (url.IndexOf(Utils.AbsoluteWebRoot.ToString()) != 0) { string pair = url + "|" + text; if (!linkPairs.Contains(pair)) { xmlWriter.WriteStartElement("sioc", "links_to", null); xmlWriter.WriteAttributeString("rdf", "resource", null, url); xmlWriter.WriteAttributeString("rdfs", "label", null, text); xmlWriter.WriteEndElement(); //sioc:links_to linkPairs.Add(pair); } } } } xmlWriter.WriteEndElement(); //sioc:Post }
/// <summary> /// Writes the Atom feed entry element information to the specified <see cref="XmlWriter"/> using the supplied <see cref="Page"/>. /// </summary> /// <param name="writer"> /// The <see cref="XmlWriter"/> to write feed entry element information to. /// </param> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate feed entry content. /// </param> private static void WriteAtomEntry(XmlWriter writer, IPublishable publishable) { var post = publishable as Post; // var comment = publishable as Comment; // ------------------------------------------------------------ // Raise serving event // ------------------------------------------------------------ var arg = new ServingEventArgs(publishable.Content, ServingLocation.Feed); publishable.OnServing(arg); if (arg.Cancel) { return; } // ------------------------------------------------------------ // Modify publishable content to make references absolute // ------------------------------------------------------------ var content = Utils.ConvertPublishablePathsToAbsolute(arg.Body, publishable); writer.WriteStartElement("entry"); // ------------------------------------------------------------ // Write required entry elements // ------------------------------------------------------------ writer.WriteElementString("id", publishable.AbsoluteLink.ToString()); writer.WriteElementString("title", publishable.Title); writer.WriteElementString("updated", ToW3CDateTime(publishable.DateCreated.ToUniversalTime())); // ------------------------------------------------------------ // Write recommended entry elements // ------------------------------------------------------------ writer.WriteStartElement("link"); writer.WriteAttributeString("rel", "self"); writer.WriteAttributeString("href", GetPermaLink(publishable).ToString()); writer.WriteEndElement(); writer.WriteStartElement("link"); writer.WriteAttributeString("href", publishable.AbsoluteLink.ToString()); writer.WriteEndElement(); writer.WriteStartElement("author"); writer.WriteElementString("name", publishable.Author); writer.WriteEndElement(); writer.WriteStartElement("summary"); writer.WriteAttributeString("type", "html"); writer.WriteString(content); writer.WriteEndElement(); // ------------------------------------------------------------ // Write optional entry elements // ------------------------------------------------------------ writer.WriteElementString("published", ToW3CDateTime(publishable.DateCreated.ToUniversalTime())); writer.WriteStartElement("link"); writer.WriteAttributeString("rel", "related"); writer.WriteAttributeString("href", String.Concat(publishable.AbsoluteLink.ToString(), BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus ? "#disqus_thread" : "#comment")); writer.WriteEndElement(); // ------------------------------------------------------------ // Write enclosure tag for podcasting support // ------------------------------------------------------------ if (BlogSettings.Instance.EnableEnclosures) { var encloser = GetEnclosure(content, publishable); if (!string.IsNullOrEmpty(encloser)) { writer.WriteRaw(encloser); } } // ------------------------------------------------------------ // Write entry category elements // ------------------------------------------------------------ if (publishable.Categories != null) { foreach (var category in publishable.Categories) { writer.WriteStartElement("category"); writer.WriteAttributeString("term", category.Title); writer.WriteEndElement(); } } // ------------------------------------------------------------ // Write Dublin Core syndication extension elements // ------------------------------------------------------------ if (!String.IsNullOrEmpty(publishable.Author)) { writer.WriteElementString("dc", "publisher", "http://purl.org/dc/elements/1.1/", publishable.Author); } if (!String.IsNullOrEmpty(publishable.Description)) { writer.WriteElementString( "dc", "description", "http://purl.org/dc/elements/1.1/", publishable.Description); } // ------------------------------------------------------------ // Write pingback syndication extension elements // ------------------------------------------------------------ Uri pingbackServer; if (Uri.TryCreate( String.Concat(publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), "/pingback.axd"), UriKind.RelativeOrAbsolute, out pingbackServer)) { writer.WriteElementString( "pingback", "server", "http://madskills.com/public/xml/rss/module/pingback/", pingbackServer.ToString()); writer.WriteElementString( "pingback", "target", "http://madskills.com/public/xml/rss/module/pingback/", GetPermaLink(publishable).ToString()); } // ------------------------------------------------------------ // Write slash syndication extension elements // ------------------------------------------------------------ if (post != null && post.Comments != null) { writer.WriteElementString( "slash", "comments", "http://purl.org/rss/1.0/modules/slash/", post.Comments.Count.ToString(CultureInfo.InvariantCulture)); } // ------------------------------------------------------------ // Write trackback syndication extension elements // ------------------------------------------------------------ if (post != null && post.TrackbackLink != null) { writer.WriteElementString( "trackback", "ping", "http://madskills.com/public/xml/rss/module/trackback/", post.TrackbackLink.ToString()); } // ------------------------------------------------------------ // Write well-formed web syndication extension elements // ------------------------------------------------------------ writer.WriteElementString( "wfw", "comment", "http://wellformedweb.org/CommentAPI/", String.Concat(publishable.AbsoluteLink.ToString(), BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus ? "#disqus_thread" : "#comment")); writer.WriteElementString( "wfw", "commentRss", "http://wellformedweb.org/CommentAPI/", string.Format("{0}/syndication.axd?post={1}", publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), publishable.Id)); // ------------------------------------------------------------ // Write </entry> element // ------------------------------------------------------------ writer.WriteEndElement(); }
string GetDescription(IPublishable post) { var description = Utils.StripHtml(post.Description); if (description != null && description.Length > this.DescriptionMaxLength) { description = string.Format("{0}...", description.Substring(0, this.DescriptionMaxLength)); } if (String.IsNullOrEmpty(description)) { var content = Utils.StripHtml(post.Content); description = content.Length > this.DescriptionMaxLength ? string.Format("{0}...", content.Substring(0, this.DescriptionMaxLength)) : content; } return description; }
public WeakSubscription(IPublishable subscription, Guid?id = null) { ID = id ?? Guid.NewGuid(); subref = new WeakReference <IPublishable>(subscription); }
/// <summary> /// Creates the email. /// </summary> /// <param name="publishable"> /// The publishable to mail. /// </param> /// <returns> /// The email. /// </returns> private static MailMessage CreateEmail(IPublishable publishable) { var mail = new MailMessage { Subject = publishable.Title, Body = FormatBodyMail(publishable), From = new MailAddress(BlogSettings.Instance.Email, BlogSettings.Instance.Name) }; return mail; }
/// <summary> /// Writes the RSS channel item element information to the specified <see cref="XmlWriter"/> using the supplied <see cref="Page"/>. /// </summary> /// <param name="writer"> /// The <see cref="XmlWriter"/> to write channel item element information to. /// </param> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate channel item content. /// </param> private static void WriteRssItem(XmlWriter writer, IPublishable publishable) { // ------------------------------------------------------------ // Cast IPublishable as Post to support comments/trackback // ------------------------------------------------------------ var post = publishable as Post; var comment = publishable as Comment; // ------------------------------------------------------------ // Raise serving event // ------------------------------------------------------------ var arg = new ServingEventArgs(publishable.Content, ServingLocation.Feed); publishable.OnServing(arg); if (arg.Cancel) { return; } // ------------------------------------------------------------ // Modify post content to make references absolute // ------------------------------------------------------------ var content = Utils.ConvertPublishablePathsToAbsolute(arg.Body, publishable); // handle custom fields in the posts content = CustomFieldsParser.GetPageHtml(content); if (comment != null) { content = content.Replace(Environment.NewLine, "<br />"); } writer.WriteStartElement("item"); // ------------------------------------------------------------ // Write required channel item elements // ------------------------------------------------------------ if (comment != null) { writer.WriteElementString("title", publishable.Author + " on " + comment.Parent.Title); } else { writer.WriteElementString("title", publishable.Title); } writer.WriteElementString("description", content); writer.WriteElementString("link", publishable.AbsoluteLink.ToString()); // ------------------------------------------------------------ // Write enclosure tag for podcasting support // ------------------------------------------------------------ if (BlogSettings.Instance.EnableEnclosures) { var encloser = GetEnclosure(content, publishable); if (!string.IsNullOrEmpty(encloser)) { writer.WriteRaw(encloser); } } // ------------------------------------------------------------ // Write optional channel item elements // ------------------------------------------------------------ if (!string.IsNullOrEmpty(BlogSettings.Instance.FeedAuthor)) { writer.WriteElementString("author", BlogSettings.Instance.FeedAuthor); } if (post != null) { writer.WriteElementString( "comments", String.Concat(publishable.AbsoluteLink.ToString(), "#comment")); } writer.WriteElementString("guid", GetPermaLink(publishable).ToString()); writer.WriteElementString("pubDate", RssDateString(publishable.DateCreated)); // ------------------------------------------------------------ // Write channel item category elements // ------------------------------------------------------------ if (publishable.Categories != null) { foreach (var category in publishable.Categories) { writer.WriteElementString("category", category.Title); } } // ------------------------------------------------------------ // Write channel item tag elements // ------------------------------------------------------------ if (BlogSettings.Instance.EnableTagExport && publishable.Categories != null) { foreach (var tag in publishable.Tags) { writer.WriteElementString("betag", "tag", "http://dotnetblogengine.net/schemas/tags", tag); } } // ------------------------------------------------------------ // Write Dublin Core syndication extension elements // ------------------------------------------------------------ if (!String.IsNullOrEmpty(publishable.Author)) { writer.WriteElementString("dc", "publisher", "http://purl.org/dc/elements/1.1/", publishable.Author); } // if (!String.IsNullOrEmpty(publishable.Description)) // { // writer.WriteElementString("dc", "description", "http://purl.org/dc/elements/1.1/", publishable.Description); // } // ------------------------------------------------------------ // Write pingback syndication extension elements // ------------------------------------------------------------ Uri pingbackServer; if (Uri.TryCreate( String.Concat(publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), "/pingback.axd"), UriKind.RelativeOrAbsolute, out pingbackServer)) { writer.WriteElementString( "pingback", "server", "http://madskills.com/public/xml/rss/module/pingback/", pingbackServer.ToString()); writer.WriteElementString( "pingback", "target", "http://madskills.com/public/xml/rss/module/pingback/", GetPermaLink(publishable).ToString()); } // ------------------------------------------------------------ // Write slash syndication extension elements // ------------------------------------------------------------ if (post != null && post.Comments != null) { writer.WriteElementString( "slash", "comments", "http://purl.org/rss/1.0/modules/slash/", post.Comments.Count.ToString(CultureInfo.InvariantCulture)); } // ------------------------------------------------------------ // Write trackback syndication extension elements // ------------------------------------------------------------ if (post != null && post.TrackbackLink != null) { writer.WriteElementString( "trackback", "ping", "http://madskills.com/public/xml/rss/module/trackback/", post.TrackbackLink.ToString()); } // ------------------------------------------------------------ // Write well-formed web syndication extension elements // ------------------------------------------------------------ writer.WriteElementString( "wfw", "comment", "http://wellformedweb.org/CommentAPI/", String.Concat(publishable.AbsoluteLink.ToString(), "#comment")); writer.WriteElementString( "wfw", "commentRss", "http://wellformedweb.org/CommentAPI/", string.Format("{0}/syndication.axd?post={1}", publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), publishable.Id)); // ------------------------------------------------------------ // Write </item> element // ------------------------------------------------------------ writer.WriteEndElement(); }
/// <summary> /// Creates a <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>. /// </summary> /// <param name="publishable">The <see cref="IPublishable"/> used to generate the permalink for.</param> /// <returns>A <see cref="Uri"/> that represents the peramlink for the supplied <see cref="IPublishable"/>.</returns> /// <exception cref="ArgumentNullException">The <paramref name="publishable"/> is a null reference (Nothing in Visual Basic).</exception> private static Uri GetPermaLink(IPublishable publishable) { Post post = publishable as Post; if (post != null) { return post.PermaLink; } return publishable.AbsoluteLink; }
public TestableTrackbackMessage(IPublishable item, Uri urlToNotifyTrackback, Uri itemUrl) : base(item, urlToNotifyTrackback, itemUrl){}
/// <summary> /// Gets enclosure for supported media type /// </summary> /// <param name="publishable">The publishable instance.</param> /// <param name="content">The content.</param> /// <param name="media">The media.</param> /// <param name="mediatype">The mediatype.</param> /// <returns>The enclosure.</returns> private static string GetMediaEnclosure(IPublishable publishable, string content, string media, string mediatype) { const string RegexLink = @"<a href=((.|\n)*?)>((.|\n)*?)</a>"; var enclosure = "<enclosure url=\"{0}\" length=\"{1}\" type=\"{2}\" />"; var matches = Regex.Matches(content, RegexLink); if (matches.Count > 0) { string filename; foreach (var match in matches.Cast<Match>().Where(match => match.Value.Contains(media))) { filename = match.Value.Substring(match.Value.IndexOf("http")); filename = filename.Substring(0, filename.IndexOf(">")).Replace("\"", string.Empty).Trim(); filename = ValidateFileName(publishable, filename); if (!fileExists) { continue; } enclosure = string.Format(enclosure, filename, fileSize, mediatype); return enclosure; } } return string.Empty; }
/// <summary> /// Adds the categories. /// </summary> /// <param name="categories"> /// The categories. /// </param> /// <param name="post"> /// The post to add to. /// </param> private static void AddCategories(IEnumerable<string> categories, IPublishable post) { try { foreach (var category in categories) { var added = false; var category1 = category; foreach (var cat in Category.Categories.Where( cat => cat.Title.Equals(category1, StringComparison.OrdinalIgnoreCase))) { post.Categories.Add(cat); added = true; } if (added) { continue; } var newCat = new Category(category, string.Empty); newCat.Save(); post.Categories.Add(newCat); } } catch (Exception ex) { Utils.Log("BlogImporter.AddCategories(): " + ex.Message); } }
/// <summary> /// Validates the name of the file. /// </summary> /// <param name="publishable">The publishable instance.</param> /// <param name="fileName">Name of the file.</param> /// <returns>The validated file name.</returns> private static string ValidateFileName(IPublishable publishable, string fileName) { fileName = fileName.Replace(publishable.Blog.AbsoluteWebRoot.ToString(), string.Empty); try { var physicalPath = HttpContext.Current.Server.MapPath(fileName); var info = new FileInfo(physicalPath); fileSize = info.Length; fileExists = true; } catch (Exception) { // if file does not exist - try to strip down leading // directory in the path; sometimes it duplicated if (fileName.IndexOf("/") > 0) { fileName = fileName.Substring(fileName.IndexOf("/") + 1); ValidateFileName(publishable, fileName); } } return publishable.Blog.AbsoluteWebRoot + fileName; }
/// <summary> /// Sends the trackback or pingback message. /// <remarks> /// It will try to send a trackback message first, and if the refered web page /// doesn't support trackbacks, a pingback is sent. /// </remarks> /// </summary> /// <param name="item"> /// The publishable item. /// </param> /// <param name="itemUrl"> /// The item Url. /// </param> public static void Send(IPublishable item, Uri itemUrl) { new Manager().InstanceSend(item, itemUrl); }
/// <summary> /// Writes the RSS channel item element information to the specified <see cref="XmlWriter"/> using the supplied <see cref="Page"/>. /// </summary> /// <param name="writer"> /// The <see cref="XmlWriter"/> to write channel item element information to. /// </param> /// <param name="publishable"> /// The <see cref="IPublishable"/> used to generate channel item content. /// </param> private static void WriteRssItem(XmlWriter writer, IPublishable publishable) { // ------------------------------------------------------------ // Cast IPublishable as Post to support comments/trackback // ------------------------------------------------------------ var post = publishable as Post; var comment = publishable as Comment; // ------------------------------------------------------------ // Raise serving event // ------------------------------------------------------------ var arg = new ServingEventArgs(publishable.Content, ServingLocation.Feed); publishable.OnServing(arg); if (arg.Cancel) { return; } // ------------------------------------------------------------ // Modify post content to make references absolute // ------------------------------------------------------------ var content = Utils.ConvertPublishablePathsToAbsolute(arg.Body, publishable); if (comment != null) { content = content.Replace(Environment.NewLine, "<br />"); } writer.WriteStartElement("item"); // ------------------------------------------------------------ // Write required channel item elements // ------------------------------------------------------------ if (comment != null) { writer.WriteElementString("title", publishable.Author + " on " + comment.Parent.Title); } else { writer.WriteElementString("title", publishable.Title); } writer.WriteElementString("description", content); writer.WriteElementString("link", publishable.AbsoluteLink.ToString()); // ------------------------------------------------------------ // Write enclosure tag for podcasting support // ------------------------------------------------------------ if (BlogSettings.Instance.EnableEnclosures) { var encloser = GetEnclosure(content, publishable); if (!string.IsNullOrEmpty(encloser)) { writer.WriteRaw(encloser); } } // ------------------------------------------------------------ // Write optional channel item elements // ------------------------------------------------------------ if (!string.IsNullOrEmpty(BlogSettings.Instance.FeedAuthor)) { writer.WriteElementString("author", BlogSettings.Instance.FeedAuthor); } if (post != null) { writer.WriteElementString( "comments", String.Concat(publishable.AbsoluteLink.ToString(), BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus ? "#disqus_thread" : "#comment")); } writer.WriteElementString("guid", GetPermaLink(publishable).ToString()); writer.WriteElementString("pubDate", ToRfc822DateTime(publishable.DateCreated)); // ------------------------------------------------------------ // Write channel item category elements // ------------------------------------------------------------ if (publishable.Categories != null) { foreach (var category in publishable.Categories) { writer.WriteElementString("category", category.Title); } } // ------------------------------------------------------------ // Write Dublin Core syndication extension elements // ------------------------------------------------------------ if (!String.IsNullOrEmpty(publishable.Author)) { writer.WriteElementString("dc", "publisher", "http://purl.org/dc/elements/1.1/", publishable.Author); } // if (!String.IsNullOrEmpty(publishable.Description)) // { // writer.WriteElementString("dc", "description", "http://purl.org/dc/elements/1.1/", publishable.Description); // } // ------------------------------------------------------------ // Write pingback syndication extension elements // ------------------------------------------------------------ Uri pingbackServer; if (Uri.TryCreate( String.Concat(publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), "/pingback.axd"), UriKind.RelativeOrAbsolute, out pingbackServer)) { writer.WriteElementString( "pingback", "server", "http://madskills.com/public/xml/rss/module/pingback/", pingbackServer.ToString()); writer.WriteElementString( "pingback", "target", "http://madskills.com/public/xml/rss/module/pingback/", GetPermaLink(publishable).ToString()); } // ------------------------------------------------------------ // Write slash syndication extension elements // ------------------------------------------------------------ if (post != null && post.Comments != null) { writer.WriteElementString( "slash", "comments", "http://purl.org/rss/1.0/modules/slash/", post.Comments.Count.ToString(CultureInfo.InvariantCulture)); } // ------------------------------------------------------------ // Write trackback syndication extension elements // ------------------------------------------------------------ if (post != null && post.TrackbackLink != null) { writer.WriteElementString( "trackback", "ping", "http://madskills.com/public/xml/rss/module/trackback/", post.TrackbackLink.ToString()); } // ------------------------------------------------------------ // Write well-formed web syndication extension elements // ------------------------------------------------------------ writer.WriteElementString( "wfw", "comment", "http://wellformedweb.org/CommentAPI/", String.Concat(publishable.AbsoluteLink.ToString(), BlogSettings.Instance.ModerationType == BlogSettings.Moderation.Disqus ? "#disqus_thread" : "#comment")); writer.WriteElementString( "wfw", "commentRss", "http://wellformedweb.org/CommentAPI/", string.Format("{0}/syndication.axd?post={1}", publishable.Blog.AbsoluteWebRoot.ToString().TrimEnd('/'), publishable.Id)); // ------------------------------------------------------------ // Write </item> element // ------------------------------------------------------------ writer.WriteEndElement(); }
/// <summary> /// A converter delegate used for converting Results to Posts. /// </summary> private static IPublishable ConvertToIPublishable(IPublishable item) { return(item); }