public string FullMediaUrl(string s)
        {
            XElement content = XElement.Parse(s);

            foreach (XElement img in content.Descendants(content.Name.Namespace + "img"))
            {
                try
                {
                    XAttribute src = img.Attribute("src");
                    if (src != null)
                    {
                        Match match = Regex.Match(src.Value, @"Renderers/ShowMedia\.ashx.*");
                        if (match.Success)
                        {
                            img.SetAttributeValue("src",
                                                  BlogFacade.GetFullPath(UrlUtils.PublicRootPath + "/" + match.Value));
                        }
                    }
                }
                catch
                {
                }
            }
            return(content.ToString());
        }
Example #2
0
        private string GetFullBlogPageUrl(Guid blogPageId)
        {
            var pageUrl = string.Empty;

            if (blogPageId != Guid.Empty)
            {
                pageUrl = BlogFacade.GetPageUrlById(blogPageId);
                if (!string.IsNullOrEmpty(pageUrl))
                {
                    pageUrl = BlogFacade.GetFullPath(pageUrl);
                }
            }
            return(pageUrl);
        }
Example #3
0
        private static string GetBlogListTitle(string tags, int totalItems)
        {
            var rm = new ResourceManager("Resources.Blog", Assembly.Load("App_GlobalResources"));

            var title = rm.GetString("List_AllBlogsTitle");

            if (!string.IsNullOrEmpty(tags))
            {
                var separator = rm.GetString("List_SelectedTagsTitle_Separator");
                title = BlogFacade.Decode(tags.Replace(",", separator));
                if (totalItems == 0)
                {
                    title = rm.GetString("List_SelectedTagsTitle_NoFound").FormatWith(title);
                }
            }
            return(title);
        }
Example #4
0
        private BlogListItemModel CreateBlogItemModel(Entries entry, string blogPageUrl)
        {
            using (var con = new DataConnection())
            {
                var image = con.Get <IMediaFile>().FirstOrDefault(m => m.KeyPath == entry.Image);
                var model = new BlogListItemModel
                {
                    Title      = entry.Title,
                    Url        = BlogFacade.GetBlogUrl(entry, blogPageUrl),
                    Tags       = entry.Tags,
                    TagsByType = BlogFacade.GetTagsByType(entry.Tags),
                    ImageUrl   = image != null?BlogFacade.GetFullPath(MediaUrls.BuildUrl(image)) : string.Empty
                };

                return(model);
            }
        }
Example #5
0
        private Expression <Func <Entries, bool> > GetBlogFilter(GetBlogEntriesParameter param)
        {
            Expression <Func <Entries, bool> > filter;

            if (!string.IsNullOrEmpty(param.Tags))
            {
                var tagsList = param.Tags.Split(',').Select(i => BlogFacade.Decode(i)).ToList();
                filter =
                    f =>
                    Enumerable.Intersect(f.Tags.Split(','), tagsList).Count() == tagsList.Count &&
                    (param.BlogPageId == Guid.Empty || f.PageId == param.BlogPageId);
            }
            else
            {
                filter = f => param.BlogPageId == Guid.Empty || f.PageId == param.BlogPageId;
            }

            return(filter);
        }
Example #6
0
 public static string GetPublicUrl(this Entries entry)
 {
     return(GetPagePublicUrl(entry.PageId) + BlogFacade.GetBlogUrl(entry.Date, entry.Title, entry.PageId));
 }
Example #7
0
 public static string GetPublicUrl(this Entries entry)
 {
     return(BlogFacade.GetBlogUrl(entry));
 }