Exemple #1
0
        public static string Logo(HotcakesApplication app, bool isSecureRequest)
        {
            var storeRootUrl = app.StoreUrl(isSecureRequest, false);
            var storeName    = app.CurrentStore.Settings.FriendlyName;

            var logoImage = app.CurrentStore.Settings.LogoImageFullUrl(app, isSecureRequest);
            var logoText  = app.CurrentStore.Settings.LogoText;

            var sb = new StringBuilder();

            sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\"");

            if (app.CurrentStore.Settings.UseLogoImage)
            {
                sb.Append("><img src=\"" + logoImage + "\" alt=\"" + storeName + "\" />");
            }
            else
            {
                sb.Append(" class=\"logo\">");
                sb.Append(HttpUtility.HtmlEncode(logoText));
            }
            sb.Append("</a>");

            return(sb.ToString());
        }
Exemple #2
0
        public static string HeaderLinks(HotcakesApplication app, string currentUserId)
        {
            var sb = new StringBuilder();

            var rootUrl       = app.StoreUrl(false, true);
            var rootUrlSecure = app.StoreUrl(true, false);

            sb.Append("<ul>");

            sb.Append("<li><a class=\"myaccountlink\" href=\"" + rootUrlSecure + "account\"><span>");
            sb.Append("My Account");
            sb.Append("</span></a></li>");

            sb.Append("<li><a class=\"signinlink\"");

            if (currentUserId == string.Empty)
            {
                sb.Append(" href=\"" + rootUrlSecure + "SignIn\"><span>");
                sb.Append("Sign In");
            }
            else
            {
                var name = string.Empty;
                var a    = app.MembershipServices.Customers.Find(currentUserId);
                if (a != null)
                {
                    name = a.Email;
                }
                sb.Append(" href=\"" + rootUrlSecure + "SignOut\" title=\"" + HttpUtility.HtmlEncode(name) + "\"><span>");
                sb.Append("Sign Out");
            }
            sb.Append("</span></a></li>");

            sb.Append("<li><a class=\"contactlink\" href=\"" + rootUrl + "Checkout\"><span>");
            sb.Append("Checkout");
            sb.Append("</span></a></li>");

            sb.Append("</ul>");

            return(sb.ToString());
        }
Exemple #3
0
        public static string LogoText(HotcakesApplication app)
        {
            var storeRootUrl = app.StoreUrl(false, true);
            var storeName    = app.CurrentStore.Settings.FriendlyName;
            var logoText     = app.CurrentStore.Settings.LogoText;

            var sb = new StringBuilder();

            sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\"");
            sb.Append(" class=\"logo\">");
            sb.Append(HttpUtility.HtmlEncode(logoText));
            sb.Append("</a>");

            return(sb.ToString());
        }
Exemple #4
0
        public static string ReplaceContentTags(string source, HotcakesApplication app)
        {
            if (source.Contains("{{"))
            {
                var isSecureRequest = app.IsCurrentRequestSecure();
                var currentUserId   = app.CurrentCustomerId;

                var output = source;

                var r = RouteTable.Routes;

                output = output.Replace("{{homelink}}", app.StoreUrl(isSecureRequest, false));
                output = output.Replace("{{logo}}", HtmlRendering.Logo(app, isSecureRequest));
                output = output.Replace("{{logotext}}", HtmlRendering.LogoText(app));
                output = output.Replace("{{headerlinks}}", HtmlRendering.HeaderLinks(app, currentUserId));
                output = output.Replace("{{sitefiles}}", DiskStorage.GetStoreDataUrl(app, isSecureRequest));

                output = output.Replace("{{storeaddress}}",
                                        app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString());

                return(output);
            }
            return(source);
        }