Esempio n. 1
0
 public EntryCollection GetFrontPagePosts(string acceptLanguageHeader)
 {
     return(dataService.GetEntriesForDay(Pass(() => dasBlogSettings.GetContentLookAhead(), () => SettingsUtils.GetContentLookAhead(opts.ContentLookaheadDays), AreStringsEqual)
                                         , Pass(() => dasBlogSettings.GetConfiguredTimeZone(), () => SettingsUtils.GetConfiguredTimeZone(opts.AdjustDisplayTimeZone, opts.DisplayTimeZoneIndex)),
                                         acceptLanguageHeader, Pass(() => dasBlogSettings.SiteConfiguration.FrontPageDayCount, () => opts.FrontPageEntryCount),
                                         Pass(() => dasBlogSettings.SiteConfiguration.FrontPageEntryCount, () => opts.FrontPageEntryCount), string.Empty));
 }
Esempio n. 2
0
 public EntryCollection GetFrontPagePosts(string acceptLanguageHeader)
 {
     return(dataService.GetEntriesForDay(dasBlogSettings.GetContentLookAhead(), dasBlogSettings.GetConfiguredTimeZone(),
                                         acceptLanguageHeader, dasBlogSettings.SiteConfiguration.FrontPageEntryCount,
                                         dasBlogSettings.SiteConfiguration.FrontPageEntryCount,
                                         dasBlogSettings.SiteConfiguration.FrontPageCategory));
 }
Esempio n. 3
0
        public Blogger.Post[] blogger_getRecentPosts(string appKey, string blogid, string username, string password, int numberOfPosts)
        {
            if (!_dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }
            UserToken token = _siteSecurity.Login(username, password);

            if (token == null)
            {
                throw new SecurityException();
            }

            EntryCollection entries = _dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), _dasBlogSettings.GetConfiguredTimeZone(),
                                                                    null, _dasBlogSettings.SiteConfiguration.RssDayCount, numberOfPosts, null);
            List <Blogger.Post> arrayList = new List <Blogger.Post>();

            foreach (Entry entry in entries)
            {
                Blogger.Post post = new Blogger.Post();
                FillBloggerPostFromEntry(entry, ref post);
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }
Esempio n. 4
0
        public MoveableType.PostTitle[] mt_getRecentPostTitles(string blogid, string username, string password, int numberOfPosts)
        {
            if (!dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }

            if (!VerifyLogin(username, password))
            {
                throw new SecurityException();
            }

            EntryCollection entries = dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), dasBlogSettings.GetConfiguredTimeZone(), null,
                                                                   dasBlogSettings.SiteConfiguration.RssDayCount, numberOfPosts, null);
            List <MoveableType.PostTitle> arrayList = new List <MoveableType.PostTitle>();

            foreach (Entry entry in entries)
            {
                MoveableType.PostTitle post = new MoveableType.PostTitle();
                post.title       = NoNull(entry.Title);
                post.dateCreated = entry.CreatedUtc;
                post.postid      = NoNull(entry.EntryId);
                post.userid      = username;
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }
Esempio n. 5
0
 public EntryCollection GetEntriesForMonth(DateTime date, string acceptLanguages)
 {
     return(dataService.GetEntriesForMonth(date, dasBlogSettings.GetConfiguredTimeZone(), acceptLanguages));
 }
Esempio n. 6
0
        public MoveableType.PostTitle[] mt_getRecentPostTitles(string blogid, string username, string password, int numberOfPosts)
        {
            VerifyAccess(username, password);

            var entries = dataService.GetEntriesForDay(DateTime.Now.ToUniversalTime(), dasBlogSettings.GetConfiguredTimeZone(), null,
                                                       numberOfPosts, numberOfPosts, null);
            var arrayList = new List <MoveableType.PostTitle>();

            foreach (Entry entry in entries)
            {
                var post = new MoveableType.PostTitle();
                post.title       = NoNull(entry.Title);
                post.dateCreated = entry.CreatedUtc;
                post.postid      = NoNull(entry.EntryId);
                post.userid      = username;
                arrayList.Add(post);
            }
            return(arrayList.ToArray());
        }
        protected EntryCollection BuildEntries(string category, int maxDayCount, int maxEntryCount)
        {
            EntryCollection entryList = new EntryCollection();

            if (category != null)
            {
                int entryCount = dasBlogSettings.SiteConfiguration.RssEntryCount;
                category = category.ToUpper();
                foreach (CategoryCacheEntry catEntry in dataService.GetCategories())
                {
                    if (catEntry.Name.ToUpper() == category)
                    {
                        foreach (CategoryCacheEntryDetail detail in catEntry.EntryDetails)
                        {
                            Entry entry = dataService.GetEntry(detail.EntryId);
                            if (entry != null)
                            {
                                entryList.Add(entry);
                                entryCount--;
                            }
                            if (entryCount <= 0)
                            {
                                break;
                            }
                        } // foreach (CategoryCacheEntryDetail
                    }
                    if (entryCount <= 0)
                    {
                        break;
                    }
                } // foreach (CategoryCacheEntry
            }
            else
            {
                entryList = dataService.GetEntriesForDay(dasBlogSettings.GetContentLookAhead(), dasBlogSettings.GetConfiguredTimeZone(), null, maxDayCount, maxEntryCount, null);
            }
            entryList.Sort(new EntrySorter());
            return(entryList);
        }
Esempio n. 8
0
        protected EntryCollection BuildEntries(string category, int maxDayCount, int maxEntryCount)
        {
            var entryList = new EntryCollection();

            if (category != null)
            {
                int entryCount = dasBlogSettings.SiteConfiguration.RssEntryCount;
                category = category.Replace(dasBlogSettings.SiteConfiguration.TitlePermalinkSpaceReplacement, " ");
                foreach (var catEntry in dataService.GetCategories())
                {
                    if (string.Compare(catEntry.Name, category, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols) == 0)
                    {
                        foreach (CategoryCacheEntryDetail detail in catEntry.EntryDetails)
                        {
                            Entry entry = dataService.GetEntry(detail.EntryId);
                            if (entry != null)
                            {
                                entryList.Add(entry);
                                entryCount--;
                            }
                            if (entryCount <= 0)
                            {
                                break;
                            }
                        } // foreach (CategoryCacheEntryDetail
                    }
                    if (entryCount <= 0)
                    {
                        break;
                    }
                } // foreach (CategoryCacheEntry
            }
            else
            {
                entryList = dataService.GetEntriesForDay(dasBlogSettings.GetContentLookAhead(), dasBlogSettings.GetConfiguredTimeZone(), null, maxDayCount, maxEntryCount, null);
            }
            entryList.Sort(new EntrySorter());
            return(entryList);
        }