Example #1
0
 /// <summary>
 /// Creates a new <see cref="AtomWriter"/> instance.
 /// </summary>
 public AtomWriter(TextWriter writer, ICollection<Entry> entries, DateTime dateLastViewedFeedItemPublished,
                   bool useDeltaEncoding, ISubtextContext context)
     : base(writer, dateLastViewedFeedItemPublished, useDeltaEncoding, context)
 {
     Items = entries;
     UseAggBugs = true;
 }
Example #2
0
 /// <summary>
 /// Creates a new <see cref="CategoryWriter"/> instance.
 /// </summary>
 public CategoryWriter(TextWriter writer, ICollection<Entry> ec, LinkCategory lc, Uri url,
                       ISubtextContext context)
     : base(writer, ec, NullValue.NullDateTime, false, context)
 {
     Category = lc;
     Url = url;
 }
 public BlogImportRepository(ISubtextContext context, ICommentService commentService, IEntryPublisher entryPublisher, IBlogMLImportMapper mapper)
 {
     SubtextContext = context;
     CommentService = commentService;
     EntryPublisher = entryPublisher;
     Mapper = mapper;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommentFilter"/> class.
 /// </summary>
 public CommentFilter(ISubtextContext context, ICommentSpamService spamService)
 {
     SubtextContext = context;
     SpamService = spamService;
     Blog = context.Blog;
     Cache = context.Cache;
 }
Example #5
0
 public EmailService(EmailProvider provider, ITemplateEngine templateEngine, ISubtextContext context)
 {
     EmailProvider = provider;
     TemplateEngine = templateEngine;
     Url = context.UrlHelper;
     Blog = context.Blog;
     Context = context;
 }
Example #6
0
 public EntryViewModel(Entry entry, ISubtextContext context)
 {
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     Entry = entry;
     SubtextContext = context;
 }
        public void CreateWelcomeContent(ISubtextContext context, IEntryPublisher entryPublisher, Blog blog)
        {
            var repository = context.Repository;
            CreateWelcomeCategories(repository, blog);

            var adminUrlHelper = new AdminUrlHelper(context.UrlHelper);
            Entry article = CreateWelcomeArticle(blog, entryPublisher, adminUrlHelper);
            Entry entry = CreateWelcomeBlogPost(context, blog, entryPublisher, adminUrlHelper, article);
            CreateWelcomeComment(repository, adminUrlHelper, entry);
        }
 /// <summary>
 /// Creates a new <see cref="BaseSyndicationWriter"/> instance.
 /// </summary>
 protected BaseSyndicationWriter(TextWriter writer, DateTime dateLastViewedFeedItemPublished,
                                 bool useDeltaEncoding, ISubtextContext context)
     : base(writer)
 {
     LatestPublishDateUtc = NullValue.NullDateTime;
     DateLastViewedFeedItemPublishedUtc = dateLastViewedFeedItemPublished;
     _writer = writer;
     SubtextContext = context;
     Blog = context.Blog;
     UrlHelper = context.UrlHelper;
     UseDeltaEncoding = useDeltaEncoding;
     Formatting = Formatting.Indented;
     Indentation = 4;
 }
Example #9
0
 public EntryPublisher(ISubtextContext context, ITextTransformation transformation, ISlugGenerator slugGenerator,
     IIndexingService indexingService)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (indexingService == null)
     {
         throw new ArgumentNullException("indexingService");
     }
     SubtextContext = context;
     Transformation = transformation ?? EmptyTextTransformation.Instance;
     SlugGenerator = slugGenerator ?? new SlugGenerator(FriendlyUrlSettings.Settings, context.Repository);
     IndexingService = indexingService;
 }
Example #10
0
        public void Logout(ISubtextContext context)
        {
            var request = context.HttpContext.Request;
            var response = context.HttpContext.Response;
            var authCookie = new HttpCookie(request.GetFullCookieName(context.Blog)) { Expires = DateTime.Now.AddYears(-30) };
            response.Cookies.Add(authCookie);

            if(Log.IsDebugEnabled)
            {
                string username = context.HttpContext.User.Identity.Name;
                if(Log.IsDebugEnabled)
                {
                    Log.Debug("Logging out " + username);
                    Log.Debug("the code MUST call a redirect after this");
                }
            }

            FormsAuthentication.SignOut();
        }
Example #11
0
        /// <summary>
        /// Returns all the feedback for the specified entry. Checks the cache first.
        /// </summary>
        public static ICollection <FeedbackItem> GetFeedback(Entry parentEntry, ISubtextContext context)
        {
            string key = GetFeedbackCacheKey(parentEntry, context);

            return(context.Cache.GetOrInsertSliding(key, () => context.Repository.GetFeedbackForEntry(parentEntry), null, LongDuration));
        }
Example #12
0
 public AccountService(ISubtextContext context)
 {
     SubtextContext = context;
 }
Example #13
0
 public RsdHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #14
0
 public AccountService(ISubtextContext context)
 {
     SubtextContext = context;
 }
 public CommentApiController(ISubtextContext context, ICommentService commentService)
 {
     SubtextContext = context;
     CommentService = commentService;
 }
Example #16
0
 public AtomHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
 public ManifestController(ISubtextContext context)
 {
     SubtextContext = context;
 }
Example #18
0
 public RssAdminHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #19
0
 public AtomHandler(ISubtextContext subtextContext) : base(subtextContext)
 {
 }
Example #20
0
 protected GenericRssWriter(TextWriter writer, DateTime dateLastViewedFeedItemPublished, bool useDeltaEncoding,
                            ISubtextContext context)
     : base(writer, dateLastViewedFeedItemPublished, useDeltaEncoding, context)
 {
 }
Example #21
0
 protected SubtextHttpHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #22
0
 public MetaWeblog(ISubtextContext context, IEntryPublisher entryPublisher)
     : base(context)
 {
     EntryPublisher = entryPublisher;
 }
Example #23
0
 public MetaWeblog(ISubtextContext context)
     : this(context, context.ServiceLocator.GetService<IEntryPublisher>())
 {
 }
Example #24
0
 public TrackBackHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
 public SiteMapHttpHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #26
0
 public IndexingService(ISubtextContext subtextContext, ISearchEngineService searchEngine)
 {
     SubtextContext      = subtextContext;
     SearchEngineService = searchEngine;
 }
Example #27
0
 public MetaWeblog(ISubtextContext context, IEntryPublisher entryPublisher)
     : base(context)
 {
     EntryPublisher = entryPublisher;
 }
 public LogRssWriter(TextWriter writer, ICollection <LogEntry> logs, bool useDeltaEncoding,
                     ISubtextContext context)
     : base(writer, NullValue.NullDateTime, useDeltaEncoding, context)
 {
     Items = logs;
 }
Example #29
0
 private static XmlNodeList GetRssHandlerItemNodes(ISubtextContext context, StringBuilder sb)
 {
     string output = sb.ToString();
     return GetRssHandlerItemNodes(context, ref output);
 }
Example #30
0
 public CommentViewModel(FeedbackItem feedbackItem, ISubtextContext context)
 {
     Feedback       = feedbackItem;
     SubtextContext = context;
 }
Example #31
0
 protected EntryCollectionHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #32
0
 public BlogMLExportMapper(ISubtextContext subtextContext)
 {
     SubtextContext = subtextContext;
     Blog           = subtextContext.Blog;
     Url            = subtextContext.UrlHelper;
 }
Example #33
0
        public static void InvalidateFeedback(IIdentifiable parentEntry, ISubtextContext context)
        {
            string key = GetFeedbackCacheKey(parentEntry, context);

            context.Cache.Remove(key);
        }
 protected SubtextXmlRpcService(ISubtextContext context)
 {
     SubtextContext = context;
 }
Example #35
0
 private static string GetFeedbackCacheKey(IIdentifiable parentEntry, ISubtextContext context)
 {
     return(string.Format(CultureInfo.InvariantCulture, ParentCommentEntryKey, parentEntry.Id, context.Blog.Id));
 }
        private static Entry CreateWelcomeBlogPost(ISubtextContext context, Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper, IEntryIdentity article)
        {
            string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomePost.htm");
            string articleUrl = context.UrlHelper.EntryUrl(article);
            body = String.Format(body, articleUrl, adminUrlHelper.Home(), context.UrlHelper.HostAdminUrl("default.aspx"));

            var entry = new Entry(PostType.BlogPost)
            {
                Title = "Welcome to Subtext!",
                EntryName = "welcome-to-subtext",
                BlogId = blog.Id,
                Author = blog.Author,
                Body = body,
                DateCreated = DateTime.Now,
                DateModified = DateTime.Now,
                DateSyndicated = DateTime.Now,
                IsActive = true,
                IncludeInMainSyndication = true,
                DisplayOnHomePage = true,
                AllowComments = true
            };

            entryPublisher.Publish(entry);
            return entry;
        }
Example #37
0
 public IndexingService(ISubtextContext subtextContext, ISearchEngineService searchEngine)
 {
     SubtextContext = subtextContext;
     SearchEngineService = searchEngine;
 }
Example #38
0
 public StatisticsController(ISubtextContext context, IStatisticsService statisticsService)
 {
     StatisticsService = statisticsService;
     SubtextContext = context;
 }
Example #39
0
        /// <summary>
        /// Gets the entries for the specified month.
        /// </summary>
        public static ICollection <Entry> GetEntriesForMonth(DateTime dateTime, ISubtextContext context)
        {
            string key = string.Format(CultureInfo.InvariantCulture, EntryMonthKey, dateTime, context.Blog.Id);

            return(context.Cache.GetOrInsert(key, () => context.Repository.GetPostsByMonth(dateTime.Month, dateTime.Year), LongDuration));
        }
Example #40
0
 public OpmlHandler(ISubtextContext subtextContext, OpmlWriter writer, LazyNotNull <HostInfo> hostInfo)
     : base(subtextContext)
 {
     OpmlWriter = writer;
     _hostInfo  = hostInfo;
 }
Example #41
0
 public StatisticsService(ISubtextContext context, Configuration.Tracking settings)
 {
     SubtextContext = context;
     Settings       = settings;
 }
Example #42
0
 public SiteMapHttpHandler(ISubtextContext subtextContext) : base(subtextContext)
 {
 }
 public OpenSearchController(ISubtextContext context)
 {
     SubtextContext = context;
 }
 public OpenSearchController(ISubtextContext context)
 {
     SubtextContext = context;
 }
 public ModeratedCommentRssWriter(TextWriter writer, ICollection<FeedbackItem> commentEntries, Entry entry,
                                  ISubtextContext context)
     : base(writer, commentEntries, entry, context)
 {
 }
Example #46
0
 public RssCategoryHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #47
0
 public MetaWeblog(ISubtextContext context)
     : this(context, context.ServiceLocator.GetService<IEntryPublisher>())
 {
 }
Example #48
0
 public BlogMLSource(ISubtextContext context, IBlogMLExportMapper blogMLConverter)
 {
     SubtextContext = context;
     BlogMLConverter = blogMLConverter;
 }
 protected SubtextXmlRpcService(ISubtextContext context)
 {
     SubtextContext = context;
 }
Example #50
0
 public CommentViewModel(FeedbackItem feedbackItem, ISubtextContext context)
 {
     Feedback = feedbackItem;
     SubtextContext = context;
 }
Example #51
0
 private static XmlNodeList GetRssHandlerItemNodes(ISubtextContext context, ref string rssOutput)
 {
     var handler = new RssHandler(context);
     handler.ProcessRequest();
     var doc = new XmlDocument();
     doc.LoadXml(rssOutput);
     return doc.SelectNodes("/rss/channel/item");
 }
Example #52
0
        /// <summary>
        /// Clears the comment cache.
        /// </summary>
        public static void ClearCommentCache(int entryId, ISubtextContext context)
        {
            string key = string.Format(CultureInfo.InvariantCulture, ParentCommentEntryKey, entryId, context.Blog.Id);

            context.Cache.Remove(key);
        }
Example #53
0
 public BlogMLExportMapper(ISubtextContext subtextContext)
 {
     SubtextContext = subtextContext;
     Blog = subtextContext.Blog;
     Url = subtextContext.UrlHelper;
 }
 protected SubtextHttpHandler(ISubtextContext subtextContext)
 {
     SubtextContext = subtextContext;
 }
 protected BaseSyndicationHandler(ISubtextContext subtextContext) : base(subtextContext)
 {
 }
 public PingBackService(ISubtextContext context)
     : base(context)
 {
 }
Example #57
0
 protected SubtextHttpHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #58
0
 public RsdHandler(ISubtextContext subtextContext)
     : base(subtextContext)
 {
 }
Example #59
0
 public ManifestController(ISubtextContext context)
 {
     SubtextContext = context;
 }
Example #60
0
        /// <summary>
        /// Retrieves the current tags from the cache based on the ItemCount and
        /// Blog Id. If it is not in the cache, it gets it from the database and
        /// inserts it into the cache.
        /// </summary>
        public static IEnumerable <Tag> GetTopTags(int itemCount, ISubtextContext context)
        {
            string key = string.Format(CultureInfo.InvariantCulture, TagsKey, itemCount, context.Blog.Id);

            return(context.Cache.GetOrInsert(key, () => context.Repository.GetMostUsedTags(itemCount), LongDuration));
        }