コード例 #1
0
ファイル: Manager.cs プロジェクト: waynejr2/dotnetmocks2demo
        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);
                }
            }
        }
コード例 #2
0
        /// <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);
                }
            }
        }
コード例 #3
0
ファイル: Manager.cs プロジェクト: ihortatarov/3_in_1
        /// <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))
            {
                string pageContent     = ReadFromWeb(url);
                Uri    trackbackUrl    = GetTrackBackUrlFromPage(pageContent);
                bool   isTrackbackSent = false;

                if (trackbackUrl != null)
                {
                    TrackbackMessage message = new TrackbackMessage(item, trackbackUrl, itemUrl);
                    isTrackbackSent = Trackback.Send(message);
                }

                if (!isTrackbackSent)
                {
                    Pingback.Send(itemUrl, url);
                }
            }
        }
コード例 #4
0
 protected virtual void SendPingback(Uri itemUrl, Uri url)
 {
     Pingback.Send(itemUrl, url);
 }