Merge pull request #2805 from AnthonyCogworks/refactor-obsolete-sweep2

v8hackathon Refactor obsolete sweep2 [v8hackaton]
This commit is contained in:
Sebastiaan Janssen
2018-07-30 16:27:39 +02:00
committed by GitHub
6 changed files with 4 additions and 65 deletions

View File

@@ -169,21 +169,6 @@ namespace Umbraco.Core.Services
/// <returns></returns>
IEnumerable<ITemplate> GetTemplateChildren(int masterTemplateId);
/// <summary>
/// Returns a template as a template node which can be traversed (parent, children)
/// </summary>
/// <param name="alias"></param>
/// <returns></returns>
TemplateNode GetTemplateNode(string alias);
/// <summary>
/// Given a template node in a tree, this will find the template node with the given alias if it is found in the hierarchy, otherwise null
/// </summary>
/// <param name="anyNode"></param>
/// <param name="alias"></param>
/// <returns></returns>
TemplateNode FindTemplateInTree(TemplateNode anyNode, string alias);
/// <summary>
/// Saves a <see cref="ITemplate"/>
/// </summary>

View File

@@ -503,37 +503,6 @@ namespace Umbraco.Core.Services.Implement
}
}
/// <summary>
/// Returns a template as a template node which can be traversed (parent, children)
/// </summary>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public TemplateNode GetTemplateNode(string alias)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
return _templateRepository.GetTemplateNode(alias);
}
}
/// <summary>
/// Given a template node in a tree, this will find the template node with the given alias if it is found in the hierarchy, otherwise null
/// </summary>
/// <param name="anyNode"></param>
/// <param name="alias"></param>
/// <returns></returns>
[Obsolete("Use GetDescendants instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public TemplateNode FindTemplateInTree(TemplateNode anyNode, string alias)
{
using (var scope = ScopeProvider.CreateScope(autoComplete: true))
{
return _templateRepository.FindTemplateInTree(anyNode, alias);
}
}
/// <summary>
/// Saves a <see cref="Template"/>
/// </summary>

View File

@@ -1,4 +1,4 @@
@model dynamic
@using Umbraco.Web.Templates
@Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString()))
@Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString(), UmbracoContext.Current.UrlProvider))

View File

@@ -22,7 +22,7 @@ namespace Umbraco.Web.Templates
{
using (UmbracoContext.Current.ForcedPreview(preview)) // force for url provider
{
text = ParseInternalLinks(text);
text = ParseInternalLinks(text, UmbracoContext.Current.UrlProvider);
}
return text;
@@ -69,21 +69,6 @@ namespace Umbraco.Web.Templates
return text;
}
/// <summary>
/// Parses the string looking for the {localLink} syntax and updates them to their correct links.
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
[Obsolete("Use the overload specifying all dependencies instead")]
public static string ParseInternalLinks(string text)
{
//don't attempt to proceed without a context as we cannot lookup urls without one
if (UmbracoContext.Current == null)
return text;
var urlProvider = UmbracoContext.Current.UrlProvider;
return ParseInternalLinks(text, urlProvider);
}
// static compiled regex for faster performance
private static readonly Regex LocalLinkPattern = new Regex(@"href=""[/]?(?:\{|\%7B)localLink:([a-zA-Z0-9-://]+)(?:\}|\%7D)",

View File

@@ -180,7 +180,7 @@ namespace Umbraco.Web
_umbracoContext.HttpContext.Response.ContentType = contentType;
//Now, we need to ensure that local links are parsed
html = TemplateUtilities.ParseInternalLinks(output.ToString());
html = TemplateUtilities.ParseInternalLinks(output.ToString(), UmbracoContext.Current.UrlProvider);
}
}

View File

@@ -128,7 +128,7 @@ namespace umbraco
string text = sw.ToString();
// filter / parse internal links - although this should be done elsewhere!
text = TemplateUtilities.ParseInternalLinks(text);
text = TemplateUtilities.ParseInternalLinks(text, UmbracoContext.Current.UrlProvider);
// filter / add preview banner
if (UmbracoContext.Current.InPreviewMode)