Exemplo n.º 1
0
        /// <summary>
        /// Get the HTML for a favicon link
        /// </summary>
        /// <param name="portalId">The portal id</param>
        /// <returns>The HTML for the favicon link for the portal, or an empty string if there is no favicon</returns>
        public static string GetHeaderLink(int portalId)
        {
            string headerLink;
            object fromCache = DataCache.GetCache(GetCacheKey(portalId));

            if (fromCache == null)
            {
                //only create an instance of FavIcon when there is a cache miss
                string favIconPath = new FavIcon(portalId).GetRelativeUrl();
                if (!string.IsNullOrEmpty(favIconPath))
                {
                    headerLink = string.Format("<link rel='SHORTCUT ICON' href='{0}' type='image/x-icon' />", favIconPath);
                }
                else
                {
                    headerLink = "";
                }

                //cache link or empty string to ensure we don't always have a
                //cache miss when no favicon is in use
                UpdateCachedHeaderLink(portalId, headerLink);
            }
            else
            {
                headerLink = fromCache.ToString();
            }

            return(headerLink);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the HTML for a favicon link
        /// </summary>
        /// <param name="portalId">The portal id</param>
        /// <returns>The HTML for the favicon link for the portal, or an empty string if there is no favicon</returns>
        public static string GetHeaderLink(int portalId)
        {
            string headerLink;
            object fromCache = DataCache.GetCache(GetCacheKey(portalId));

            if (fromCache == null)
            {
                //only create an instance of FavIcon when there is a cache miss
                string favIconPath = new FavIcon(portalId).GetRelativeUrl();
                if (!string.IsNullOrEmpty(favIconPath))
                {
                    headerLink = string.Format("<link rel='SHORTCUT ICON' href='{0}' type='image/x-icon' />", favIconPath);
                }
                else
                {
                    headerLink = "";
                }

                //cache link or empty string to ensure we don't always have a
                //cache miss when no favicon is in use
                UpdateCachedHeaderLink(portalId, headerLink);
            }
            else
            {
                headerLink = fromCache.ToString();
            }

            return headerLink;
        }