Пример #1
0
        /// <summary>
        /// Posts trackbacks and pingbacks for the specified entry.
        /// </summary>
        public static void Run(Entry entry, Blog blog, BlogUrlHelper urlHelper)
        {
            if (!blog.TrackbacksEnabled)
            {
                return;
            }

            if (!Config.Settings.Tracking.EnablePingBacks && !Config.Settings.Tracking.EnableTrackBacks)
            {
                return;
            }

            if (entry != null)
            {
                VirtualPath blogUrl = urlHelper.BlogUrl();
                Uri fullyQualifiedUrl = blogUrl.ToFullyQualifiedUrl(blog);

                var notify = new Notifier
                {
                    FullyQualifiedUrl = fullyQualifiedUrl.AbsoluteUri,
                    BlogName = blog.Title,
                    Title = entry.Title,
                    PostUrl = urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(blog),
                    Description = entry.HasDescription ? entry.Description : entry.Title,
                    Text = entry.Body
                };

                //This could take a while, do it on another thread
                ThreadHelper.FireAndForget(notify.Notify, "Exception occured while attempting trackback notification");
            }
        }
Пример #2
0
        //Text to insert into a file with pingback service location
        public static string GetPingbackTag(BlogUrlHelper urlHelper, Entry entry)
        {
            VirtualPath blogUrl = urlHelper.BlogUrl();
            Uri absoluteUrl = blogUrl.ToFullyQualifiedUrl(entry.Blog);

            return string.Format(CultureInfo.InvariantCulture,
                "<link rel=\"pingback\" href=\"{0}Services/Pingback/{1}.aspx\"></link>",
                absoluteUrl.AbsoluteUri,
                entry.Id);
        }
Пример #3
0
        //Body of text to insert into a post with Trackback
        public static string TrackBackTag(Entry entry, Blog blog, BlogUrlHelper urlHelper)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            Uri entryUrl = urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(blog);
            return String.Format(CultureInfo.InvariantCulture, Resources.TrackbackTag, entryUrl, entryUrl, entry.Title,
                                 urlHelper.BlogUrl(), entry.Id.ToString(CultureInfo.InvariantCulture));
        }
Пример #4
0
 public AkismetSpamService(string apiKey, Blog blog, AkismetClient akismetClient, BlogUrlHelper urlHelper)
 {
     _blog = blog;
     _akismet = akismetClient ?? new AkismetClient(apiKey, urlHelper.BlogUrl().ToFullyQualifiedUrl(blog));
     IWebProxy proxy = HttpHelper.GetProxy();
     if (proxy != null)
     {
         _akismet.Proxy = proxy;
     }
     _urlHelper = urlHelper ?? new BlogUrlHelper(null, null);
 }
Пример #5
0
 //Text to insert into a file with pinkback service location
 public static string GetPingPackTag(BlogUrlHelper urlHelper)
 {
     return string.Format(CultureInfo.InvariantCulture,
                          "<link rel=\"pingback\" href=\"{0}Services/Pingback.aspx\"></link>",
                          urlHelper.BlogUrl());
 }
Пример #6
0
        /// <summary>
        /// Writes the RSD for the specified blog into the XmlWriter.
        /// </summary>
        public void WriteRsd(XmlWriter writer, Blog blog, BlogUrlHelper urlHelper)
        {
            writer.WriteStartDocument();
            writer.WriteStartElement("rsd", "http://archipelago.phrasewise.com/rsd");
            writer.WriteAttributeString("version", "1.0");
            writer.WriteStartElement("service");
            writer.WriteElementString("engineName", "Subtext");
            writer.WriteElementString("engineLink", "http://subtextproject.com/");
            writer.WriteElementString("homePageLink", urlHelper.BlogUrl().ToFullyQualifiedUrl(blog).ToString());

            writer.WriteStartElement("apis");

            //When we have more than one API, we'll list them here.
            writer.WriteStartElement("api");
            writer.WriteAttributeString("name", "MetaWeblog");
            writer.WriteAttributeString("preferred", "true");
            writer.WriteAttributeString("apiLink", urlHelper.MetaWeblogApiUrl(blog).ToString());
            writer.WriteAttributeString("blogID", blog.Id.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement(); // </api>

            writer.WriteEndElement(); // </apis>

            writer.WriteEndElement(); // </service>
            writer.WriteEndElement(); // </rsd>
            writer.WriteEndDocument();
            writer.Flush();
        }