From 39b7cb4201b1511af5703b0dd7f2fa3e20a18c66 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 8 Jan 2020 13:35:05 +0100 Subject: [PATCH] AB4375 - Moved Tour to Umbraco.Abstractions --- .../Tour/BackOfficeTourFilter.cs | 0 .../Tour/TourFilterCollection.cs | 0 .../Tour/TourFilterCollectionBuilder.cs | 0 .../Templates/TemplateUtilities.cs | 70 ------------------- src/Umbraco.Web/Umbraco.Web.csproj | 4 -- 5 files changed, 74 deletions(-) rename src/{Umbraco.Web => Umbraco.Abstractions}/Tour/BackOfficeTourFilter.cs (100%) rename src/{Umbraco.Web => Umbraco.Abstractions}/Tour/TourFilterCollection.cs (100%) rename src/{Umbraco.Web => Umbraco.Abstractions}/Tour/TourFilterCollectionBuilder.cs (100%) delete mode 100644 src/Umbraco.Web/Templates/TemplateUtilities.cs diff --git a/src/Umbraco.Web/Tour/BackOfficeTourFilter.cs b/src/Umbraco.Abstractions/Tour/BackOfficeTourFilter.cs similarity index 100% rename from src/Umbraco.Web/Tour/BackOfficeTourFilter.cs rename to src/Umbraco.Abstractions/Tour/BackOfficeTourFilter.cs diff --git a/src/Umbraco.Web/Tour/TourFilterCollection.cs b/src/Umbraco.Abstractions/Tour/TourFilterCollection.cs similarity index 100% rename from src/Umbraco.Web/Tour/TourFilterCollection.cs rename to src/Umbraco.Abstractions/Tour/TourFilterCollection.cs diff --git a/src/Umbraco.Web/Tour/TourFilterCollectionBuilder.cs b/src/Umbraco.Abstractions/Tour/TourFilterCollectionBuilder.cs similarity index 100% rename from src/Umbraco.Web/Tour/TourFilterCollectionBuilder.cs rename to src/Umbraco.Abstractions/Tour/TourFilterCollectionBuilder.cs diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs deleted file mode 100644 index 4625707b33..0000000000 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ /dev/null @@ -1,70 +0,0 @@ -using HtmlAgilityPack; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using Umbraco.Core; -using Umbraco.Core.IO; -using Umbraco.Core.Logging; -using Umbraco.Core.Models; -using Umbraco.Core.Services; -using Umbraco.Web.Composing; -using Umbraco.Web.PropertyEditors; -using Umbraco.Web.PublishedCache; -using Umbraco.Web.Routing; -using File = System.IO.File; - -namespace Umbraco.Web.Templates -{ - - [Obsolete("This class is obsolete, all methods have been moved to other classes: " + nameof(HtmlLocalLinkParser) + ", " + nameof(HtmlUrlParser) + " and " + nameof(HtmlImageSourceParser))] - public static class TemplateUtilities - { - - // TODO: Replace mediaCache with media url provider - internal static string ParseInternalLinks(string text, UrlProvider urlProvider, IPublishedMediaCache mediaCache) - { - if (urlProvider == null) throw new ArgumentNullException(nameof(urlProvider)); - if (mediaCache == null) throw new ArgumentNullException(nameof(mediaCache)); - - // Parse internal links - var tags = HtmlLocalLinkParser.LocalLinkPattern.Matches(text); - foreach (Match tag in tags) - { - if (tag.Groups.Count > 0) - { - var id = tag.Groups[1].Value; //.Remove(tag.Groups[1].Value.Length - 1, 1); - - //The id could be an int or a UDI - if (UdiParser.TryParse(id, out var udi)) - { - var guidUdi = udi as GuidUdi; - if (guidUdi != null) - { - var newLink = "#"; - if (guidUdi.EntityType == Constants.UdiEntityType.Document) - newLink = urlProvider.GetUrl(guidUdi.Guid); - else if (guidUdi.EntityType == Constants.UdiEntityType.Media) - newLink = mediaCache.GetById(guidUdi.Guid)?.Url; - - if (newLink == null) - newLink = "#"; - - text = text.Replace(tag.Value, "href=\"" + newLink); - } - } - - if (int.TryParse(id, out var intId)) - { - var newLink = urlProvider.GetUrl(intId); - text = text.Replace(tag.Value, "href=\"" + newLink); - } - } - } - - return text; - } - - - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 0aacdef88a..95c987dd55 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -580,9 +580,6 @@ - - - @@ -1106,7 +1103,6 @@ -