Exemplo n.º 1
0
        /// <summary>
        /// Takes a piece of content that may contain dynamic links (e.g. rich text content) and expands them from dynamic link format (i.e. /~/link/dasfsdgsdfsdf) to their appropriate
        /// friendly URL. This is normally handled by FieldRenderer automatically, but this brings that to places where FieldRender isn't necessary or desirable.
        /// </summary>
        public static string ExpandDynamicLinks(string fieldContent)
        {
            string containsFriendlyLinks = LinkManager.ExpandDynamicLinks(fieldContent, Settings.Rendering.SiteResolving);
            string mediaPrefix           = string.Empty;

            foreach (string currentPrefix in MediaManager.Provider.Config.MediaPrefixes)
            {
                if (containsFriendlyLinks.IndexOf(currentPrefix, 0, StringComparison.Ordinal) > 0)
                {
                    mediaPrefix = currentPrefix;
                    break;
                }
            }

            if (mediaPrefix.Length > 0)
            {
                containsFriendlyLinks = Regex.Replace(containsFriendlyLinks, "([^/])" + mediaPrefix, "$1/" + mediaPrefix);
            }

            return(containsFriendlyLinks);
        }
 public string ExpandDynamicLinks(string text, bool resolveSites)
 {
     return(LinkManager.ExpandDynamicLinks(text, resolveSites));
 }
 public string ExpandDynamicLinks(string text)
 {
     return(LinkManager.ExpandDynamicLinks(text, false));
 }