Exemple #1
0
        public static CustomHeaderImage HeaderImage(string fallbackImageUrl)
        {
            var fallbackImage = new CustomHeaderImage(fallbackImageUrl, "50px");

            var headerLogoSetting = DbUtil.Db.Setting("UX-HeaderLogo", "");

            if (!string.IsNullOrWhiteSpace(headerLogoSetting))
            {
                return(new CustomHeaderImage(headerLogoSetting, "45px"));
            }

            var customHeaderContent = DbUtil.Db.Content("CustomHeader", "");

            if (!string.IsNullOrWhiteSpace(customHeaderContent))
            {
                var match           = Regex.Match(customHeaderContent, @"background-image:(\s+)?url\((?<backgroundImage>.+?)\)");
                var backgroundImage = match.Groups["backgroundImage"].Value;

                return(string.IsNullOrWhiteSpace(backgroundImage)
                    ? fallbackImage
                    : new CustomHeaderImage(backgroundImage, "45px"));
            }

            return(fallbackImage);
        }
Exemple #2
0
        public static CustomHeaderImage HeaderImage(string fallbackImageUrl)
        {
            var fallbackImage = new CustomHeaderImage(fallbackImageUrl, "50px");

            var headerLogoSetting = DbUtil.Db.Setting("UX-HeaderLogo", "");
            if (!string.IsNullOrWhiteSpace(headerLogoSetting))
            {
                return new CustomHeaderImage(headerLogoSetting, "45px");
            }

            var customHeaderContent = DbUtil.Db.Content("CustomHeader", "");
            if (!string.IsNullOrWhiteSpace(customHeaderContent))
            {
                var match = Regex.Match(customHeaderContent, @"background-image:(\s+)?url\((?<backgroundImage>.+?)\)");
                var backgroundImage = match.Groups["backgroundImage"].Value;

                return string.IsNullOrWhiteSpace(backgroundImage)
                    ? fallbackImage
                    : new CustomHeaderImage(backgroundImage, "45px");
            }

            return fallbackImage;
        }