/// <exclude /> public string ConvertInternalLinks(string xhtml) { using (Profiler.Measure("Converting internal urls to public")) { return(InternalUrls.ConvertInternalUrlsToPublic(xhtml)); } }
internal static void ProcessXhtmlDocument(XhtmlDocument xhtmlDocument, IPage page) { using (Profiler.Measure("Normalizing XHTML document")) { NormalizeXhtmlDocument(xhtmlDocument); } using (Profiler.Measure("Resolving relative paths")) { ResolveRelativePaths(xhtmlDocument); } using (Profiler.Measure("Appending C1 meta tags")) { AppendC1MetaTags(page, xhtmlDocument); } using (Profiler.Measure("Sorting <head> elements")) { PrioritizeHeadNodes(xhtmlDocument); } using (Profiler.Measure("Parsing localization strings")) { LocalizationParser.Parse(xhtmlDocument); } using (Profiler.Measure("Converting URLs from internal to public format (XhtmlDocument)")) { InternalUrls.ConvertInternalUrlsToPublic(xhtmlDocument); } var filters = ServiceLocator.GetServices <IPageContentFilter>().OrderBy(f => f.Order).ToList(); if (filters.Any()) { using (Profiler.Measure("Executing page content filters")) { filters.ForEach(filter => { using (Profiler.Measure($"Filter: {filter.GetType().FullName}")) { filter.Filter(xhtmlDocument, page); } }); } } }
public virtual IHttpActionResult Body([FromBody] string body) { InitializeFullPageCaching(System.Web.HttpContext.Current); if (string.IsNullOrWhiteSpace(body)) { NotFound(); } var decrypted = LazyFunctionCallDataProvider.UnprotectFunctionCall(body); if (decrypted == null) { return(NotFound()); } HttpContext.RewritePath(HttpContext.Request.FilePath, HttpContext.Request.PathInfo, decrypted.QueryString); using (var data = new DataConnection(PublicationScope.Published, ComposerContext.CultureInfo)) { // Grab a function object to execute IFunction function = FunctionFacade.GetFunction(decrypted.FunctionName); PageRenderer.CurrentPage = PageManager.GetPageById(decrypted.PageId);; // Execute the function, passing all query string parameters as input parameters var functionResult = (XhtmlDocument)FunctionFacade.Execute <object>(function, decrypted.Parameters.ToDictionary(d => d.Key, d => (object)d.Value)); // output result if (functionResult != null) { var functionContext = new FunctionContextContainer(); PageRenderer.ExecuteEmbeddedFunctions(functionResult.Root, functionContext); //PageRenderer.ProcessXhtmlDocument(functionResult, productPage); using (Profiler.Measure("Normalizing XHTML document")) { PageRenderer.NormalizeXhtmlDocument(functionResult); } using (Profiler.Measure("Resolving relative paths")) { PageRenderer.ResolveRelativePaths(functionResult); } using (Profiler.Measure("Parsing localization strings")) { LocalizationParser.Parse(functionResult); } using (Profiler.Measure("Converting URLs from internal to public format (XhtmlDocument)")) { InternalUrls.ConvertInternalUrlsToPublic(functionResult); } //TODO: Update C1 Version //PageRenderer.ProcessDocumentHead(functionResult); StringBuilder sb = new StringBuilder(); foreach (var node in functionResult.Body.Nodes()) { sb.Append(node.ToString()); } return(Json(sb.ToString())); } } return(NotFound()); }
/// <exclude /> public static string ChangeInternalMediaUrlsToPublic(string content) { return(InternalUrls.ConvertInternalUrlsToPublic(content, new[] { new MediaInternalUrlConverter() })); }
/// <exclude /> public static string ChangeRenderingPageUrlsToPublic(string html) { return(InternalUrls.ConvertInternalUrlsToPublic(html, new[] { new PageInternalUrlConverter() })); }