diff --git a/src/Umbraco.Abstractions/StringExtensions.cs b/src/Umbraco.Abstractions/StringExtensions.cs
index 00e24b32e8..2ba185ae50 100644
--- a/src/Umbraco.Abstractions/StringExtensions.cs
+++ b/src/Umbraco.Abstractions/StringExtensions.cs
@@ -13,13 +13,11 @@ using Umbraco.Core.Strings;
namespace Umbraco.Core
{
-
///
/// String extension methods
///
public static class StringExtensions
{
-
private static readonly char[] ToCSharpHexDigitLower = "0123456789abcdef".ToCharArray();
private static readonly char[] ToCSharpEscapeChars;
@@ -71,13 +69,10 @@ namespace Umbraco.Core
return string.Format("{0}", fileName.Substring(0, fileName.IndexOf(ext, StringComparison.Ordinal)));
}
+
return fileName;
-
-
}
-
-
///
/// This tries to detect a json string, this is not a fail safe way but it is quicker than doing
/// a try/catch when deserializing when it is not json.
@@ -99,8 +94,6 @@ namespace Umbraco.Core
return JsonEmpties.Contains(Whitespace.Value.Replace(input, string.Empty));
}
-
-
public static string ReplaceNonAlphanumericChars(this string input, string replacement)
{
//any character that is not alphanumeric, convert to a hyphen
@@ -189,9 +182,6 @@ namespace Umbraco.Core
}
-
-
-
//this is from SqlMetal and just makes it a bit of fun to allow pluralization
public static string MakePluralName(this string name)
{
@@ -1231,7 +1221,7 @@ namespace Umbraco.Core
&& Path.GetPathRoot(path).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) == false;
}
- ///
+ ///
/// Based on the input string, this will detect if the string is a JS path or a JS snippet.
/// If a path cannot be determined, then it is assumed to be a snippet the original text is returned
/// with an invalid attempt, otherwise a valid attempt is returned with the resolved path
@@ -1276,77 +1266,83 @@ namespace Umbraco.Core
}
- // FORMAT STRINGS
+ // FORMAT STRINGS
- ///
- /// Cleans a string to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// The safe alias.
- public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper)
- {
- return shortStringHelper.CleanStringForSafeAlias(alias);
- }
+ ///
+ /// Cleans a string to produce a string that can safely be used in an alias.
+ ///
+ /// The text to filter.
+ /// The short string helper.
+ /// The safe alias.
+ public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper)
+ {
+ return shortStringHelper.CleanStringForSafeAlias(alias);
+ }
- ///
- /// Cleans a string to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// A value indicating that we want to camel-case the alias.
- /// The safe alias.
- public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper, bool camel)
- {
- var a = shortStringHelper.CleanStringForSafeAlias(alias);
- if (string.IsNullOrWhiteSpace(a) || camel == false) return a;
- return char.ToLowerInvariant(a[0]) + a.Substring(1);
- }
+ ///
+ /// Cleans a string to produce a string that can safely be used in an alias.
+ ///
+ /// The text to filter.
+ /// A value indicating that we want to camel-case the alias.
+ /// The short string helper.
+ /// The safe alias.
+ public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper, bool camel)
+ {
+ var a = shortStringHelper.CleanStringForSafeAlias(alias);
+ if (string.IsNullOrWhiteSpace(a) || camel == false) return a;
+ return char.ToLowerInvariant(a[0]) + a.Substring(1);
+ }
- ///
- /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// The culture.
- /// The safe alias.
- public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper, string culture)
- {
- return shortStringHelper.CleanStringForSafeAlias(alias, culture);
- }
+ ///
+ /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
+ ///
+ /// The text to filter.
+ /// The culture.
+ /// The short string helper.
+ /// The safe alias.
+ public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper, string culture)
+ {
+ return shortStringHelper.CleanStringForSafeAlias(alias, culture);
+ }
- // the new methods to get a url segment
+ // the new methods to get a url segment
- ///
- /// Cleans a string to produce a string that can safely be used in an url segment.
- ///
- /// The text to filter.
- /// The safe url segment.
- public static string ToUrlSegment(this string text, IShortStringHelper shortStringHelper)
- {
- if (text == null) throw new ArgumentNullException(nameof(text));
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
+ ///
+ /// Cleans a string to produce a string that can safely be used in an url segment.
+ ///
+ /// The text to filter.
+ /// The short string helper.
+ /// The safe url segment.
+ public static string ToUrlSegment(this string text, IShortStringHelper shortStringHelper)
+ {
+ if (text == null) throw new ArgumentNullException(nameof(text));
+ if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
- return shortStringHelper.CleanStringForUrlSegment(text);
- }
+ return shortStringHelper.CleanStringForUrlSegment(text);
+ }
- ///
- /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an url segment.
- ///
- /// The text to filter.
- /// The culture.
- /// The safe url segment.
- public static string ToUrlSegment(this string text, IShortStringHelper shortStringHelper, string culture)
- {
- if (text == null) throw new ArgumentNullException(nameof(text));
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
+ ///
+ /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an url segment.
+ ///
+ /// The text to filter.
+ /// The short string helper.
+ /// The culture.
+ /// The safe url segment.
+ public static string ToUrlSegment(this string text, IShortStringHelper shortStringHelper, string culture)
+ {
+ if (text == null) throw new ArgumentNullException(nameof(text));
+ if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
- return shortStringHelper.CleanStringForUrlSegment(text, culture);
- }
+ return shortStringHelper.CleanStringForUrlSegment(text, culture);
+ }
- ///
+ ///
/// Cleans a string.
///
/// The text to clean.
+ /// The short string helper.
/// A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.
/// The clean string.
@@ -1360,6 +1356,7 @@ namespace Umbraco.Core
/// Cleans a string, using a specified separator.
///
/// The text to clean.
+ /// The short string helper.
/// A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.
/// The separator.
@@ -1374,6 +1371,7 @@ namespace Umbraco.Core
/// Cleans a string in the context of a specified culture.
///
/// The text to clean.
+ /// The short string helper.
/// A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.
/// The culture.
@@ -1387,6 +1385,7 @@ namespace Umbraco.Core
/// Cleans a string in the context of a specified culture, using a specified separator.
///
/// The text to clean.
+ /// The short string helper.
/// A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.
/// The separator.
diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
index 0b317c4029..b405ed1095 100644
--- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
+++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs
@@ -678,7 +678,7 @@ namespace Umbraco.Core.Packaging
foreach (var templateElement in allowedTemplatesElement.Elements("Template"))
{
var alias = templateElement.Value;
- var template = _fileService.GetTemplate(alias.ToSafeAlias());
+ var template = _fileService.GetTemplate(alias.ToSafeAlias(_shortStringHelper));
if (template != null)
{
if (allowedTemplates.Any(x => x.Id == template.Id)) continue;
@@ -695,7 +695,7 @@ namespace Umbraco.Core.Packaging
if (string.IsNullOrEmpty((string)defaultTemplateElement) == false)
{
- var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value.ToSafeAlias());
+ var defaultTemplate = _fileService.GetTemplate(defaultTemplateElement.Value.ToSafeAlias(_shortStringHelper));
if (defaultTemplate != null)
{
contentType.SetDefaultTemplate(defaultTemplate);
@@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Packaging
var name = prop.Element("Name")?.Value;
if (sp == null)
{
- sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(), "");
+ sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(_shortStringHelper), string.Empty);
s.AddProperty(sp);
}
else
diff --git a/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs b/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs
index 84cd641ce5..fb9b1e8d13 100644
--- a/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs
+++ b/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs
@@ -1,27 +1,24 @@
using System;
-using System.Reflection;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Serialization;
-using Umbraco.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
using Current = Umbraco.Core.Composing.Current;
namespace Umbraco.Core.Persistence.Factories
{
internal static class DataTypeFactory
{
- public static IDataType BuildEntity(DataTypeDto dto, PropertyEditorCollection editors, ILogger logger, IIOHelper ioHelper)
+ public static IDataType BuildEntity(DataTypeDto dto, PropertyEditorCollection editors, ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
{
if (!editors.TryGet(dto.EditorAlias, out var editor))
{
logger.Warn(typeof(DataType), "Could not find an editor with alias {EditorAlias}, treating as Label."
+" The site may fail to boot and / or load data types and run.", dto.EditorAlias);
//convert to label
- editor = new LabelPropertyEditor(logger, ioHelper, Current.Services.DataTypeService, Current.Services.TextService, Current.Services.LocalizationService, Current.ShortStringHelper);
+ editor = new LabelPropertyEditor(logger, ioHelper, Current.Services.DataTypeService, Current.Services.TextService, Current.Services.LocalizationService, shortStringHelper);
}
var dataType = new DataType(editor);
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs
index 8e40251d6a..73db1775f8 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs
@@ -17,6 +17,7 @@ using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using static Umbraco.Core.Persistence.SqlExtensionsStatics;
namespace Umbraco.Core.Persistence.Repositories.Implement
@@ -28,13 +29,15 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
{
private readonly Lazy _editors;
private readonly IIOHelper _ioHelper;
+ private readonly IShortStringHelper _shortStringHelper;
// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4237 - get rid of Lazy injection and fix circular dependencies
- public DataTypeRepository(IScopeAccessor scopeAccessor, AppCaches cache, Lazy editors, ILogger logger, IIOHelper ioHelper)
+ public DataTypeRepository(IScopeAccessor scopeAccessor, AppCaches cache, Lazy editors, ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
: base(scopeAccessor, cache, logger)
{
_editors = editors;
_ioHelper = ioHelper;
+ _shortStringHelper = shortStringHelper;
}
#region Overrides of RepositoryBase
@@ -58,7 +61,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
}
var dtos = Database.Fetch(dataTypeSql);
- return dtos.Select(x => DataTypeFactory.BuildEntity(x, _editors.Value, Logger,_ioHelper)).ToArray();
+ return dtos.Select(x => DataTypeFactory.BuildEntity(x, _editors.Value, Logger,_ioHelper, _shortStringHelper)).ToArray();
}
protected override IEnumerable PerformGetByQuery(IQuery query)
@@ -69,7 +72,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
var dtos = Database.Fetch(sql);
- return dtos.Select(x => DataTypeFactory.BuildEntity(x, _editors.Value, Logger, _ioHelper)).ToArray();
+ return dtos.Select(x => DataTypeFactory.BuildEntity(x, _editors.Value, Logger, _ioHelper, _shortStringHelper)).ToArray();
}
#endregion
diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
index a26b818ca9..83a80da5bc 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs
@@ -635,7 +635,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
private void EnsureValidAlias(ITemplate template)
{
//ensure unique alias
- template.Alias = template.Alias.ToCleanString(CleanStringType.UnderscoreAlias);
+ template.Alias = template.Alias.ToCleanString(_shortStringHelper, CleanStringType.UnderscoreAlias);
if (template.Alias.Length > 100)
template.Alias = template.Alias.Substring(0, 95);
diff --git a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
index c8212fc265..17cb62ec86 100644
--- a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
+++ b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs
@@ -54,7 +54,7 @@ namespace Umbraco.Core.Services.Implement
{
if (content == null) throw new ArgumentNullException(nameof(content));
- var nodeName = content.ContentType.Alias.ToSafeAlias();
+ var nodeName = content.ContentType.Alias.ToSafeAlias(_shortStringHelper);
var xml = SerializeContentBase(content, content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders), nodeName, published);
@@ -100,7 +100,7 @@ namespace Umbraco.Core.Services.Implement
if (media == null) throw new ArgumentNullException(nameof(media));
if (_urlSegmentProviders == null) throw new ArgumentNullException(nameof(_urlSegmentProviders));
- var nodeName = media.ContentType.Alias.ToSafeAlias();
+ var nodeName = media.ContentType.Alias.ToSafeAlias(_shortStringHelper);
const bool published = false; // always false for media
var xml = SerializeContentBase(media, media.GetUrlSegment(_shortStringHelper, _urlSegmentProviders), nodeName, published);
@@ -135,7 +135,7 @@ namespace Umbraco.Core.Services.Implement
///
public XElement Serialize(IMember member)
{
- var nodeName = member.ContentType.Alias.ToSafeAlias();
+ var nodeName = member.ContentType.Alias.ToSafeAlias(_shortStringHelper);
const bool published = false; // always false for member
var xml = SerializeContentBase(member, "", nodeName, published);
diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs
index d3ae4e04f5..7e5a7b6cb5 100644
--- a/src/Umbraco.Core/StringExtensions.cs
+++ b/src/Umbraco.Core/StringExtensions.cs
@@ -1,111 +1,21 @@
-using System;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Umbraco.Core.Composing;
-using Umbraco.Core.IO;
-using Umbraco.Core.Strings;
+using Umbraco.Core.Strings;
namespace Umbraco.Core
{
-
///
/// String extension methods
///
public static class StringExtensions
{
-
- // FORMAT STRINGS
-
- ///
- /// Cleans a string to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// The safe alias.
- public static string ToSafeAlias(this string alias)
- {
- return Current.ShortStringHelper.CleanStringForSafeAlias(alias);
- }
-
- ///
- /// Cleans a string to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// A value indicating that we want to camel-case the alias.
- /// The safe alias.
- public static string ToSafeAlias(this string alias, bool camel)
- {
- var a = Current.ShortStringHelper.CleanStringForSafeAlias(alias);
- if (string.IsNullOrWhiteSpace(a) || camel == false) return a;
- return char.ToLowerInvariant(a[0]) + a.Substring(1);
- }
-
- ///
- /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
- ///
- /// The text to filter.
- /// The culture.
- /// The safe alias.
- public static string ToSafeAlias(this string alias, string culture)
- {
- return Current.ShortStringHelper.CleanStringForSafeAlias(alias, culture);
- }
-
- // the new methods to get a url segment
-
- ///
- /// Cleans a string to produce a string that can safely be used in an url segment.
- ///
- /// The text to filter.
- /// The safe url segment.
- public static string ToUrlSegment(this string text)
- {
- if (text == null) throw new ArgumentNullException(nameof(text));
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
-
- return Current.ShortStringHelper.CleanStringForUrlSegment(text);
- }
-
- ///
- /// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an url segment.
- ///
- /// The text to filter.
- /// The culture.
- /// The safe url segment.
- public static string ToUrlSegment(this string text, string culture)
- {
- if (text == null) throw new ArgumentNullException(nameof(text));
- if (string.IsNullOrWhiteSpace(text)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(text));
-
- return Current.ShortStringHelper.CleanStringForUrlSegment(text, culture);
- }
-
- // the new methods to clean a string (to alias, url segment...)
-
- ///
- /// Cleans a string.
- ///
- /// The text to clean.
- /// A flag indicating the target casing and encoding of the string. By default,
- /// strings are cleaned up to camelCase and Ascii.
- /// The clean string.
- /// The string is cleaned in the context of the ICurrent.ShortStringHelper default culture.
- public static string ToCleanString(this string text, CleanStringType stringType)
- {
- return Current.ShortStringHelper.CleanString(text, stringType);
- }
-
- // note: LegacyCurrent.ShortStringHelper will produce 100% backward-compatible output for SplitPascalCasing.
- // other helpers may not. DefaultCurrent.ShortStringHelper produces better, but non-compatible, results.
-
///
/// Splits a Pascal cased string into a phrase separated by spaces.
///
/// The text to split.
+ /// The short string helper.
/// The split text.
- public static string SplitPascalCasing(this string phrase)
+ public static string SplitPascalCasing(this string phrase, IShortStringHelper shortStringHelper)
{
- return Current.ShortStringHelper.SplitPascalCasing(phrase, ' ');
+ return shortStringHelper.SplitPascalCasing(phrase, ' ');
}
//NOTE: Not sure what this actually does but is used a few places, need to figure it out and then move to StringExtensions and obsolete.
@@ -113,9 +23,9 @@ namespace Umbraco.Core
// plugging string extensions here to be 99% compatible
// the only diff. is with numbers, Number6Is was "Number6 Is", and the new string helper does it too,
// but the legacy one does "Number6Is"... assuming it is not a big deal.
- internal static string SpaceCamelCasing(this string phrase)
+ internal static string SpaceCamelCasing(this string phrase, IShortStringHelper shortStringHelper)
{
- return phrase.Length < 2 ? phrase : phrase.SplitPascalCasing().ToFirstUpperInvariant();
+ return phrase.Length < 2 ? phrase : phrase.SplitPascalCasing(shortStringHelper).ToFirstUpperInvariant();
}
///
@@ -123,10 +33,11 @@ namespace Umbraco.Core
/// both internally (on disk) and externally (as a url).
///
/// The text to filter.
+ /// The short string helper.
/// The safe filename.
- public static string ToSafeFileName(this string text)
+ public static string ToSafeFileName(this string text, IShortStringHelper shortStringHelper)
{
- return Current.ShortStringHelper.CleanStringForSafeFileName(text);
+ return shortStringHelper.CleanStringForSafeFileName(text);
}
///
@@ -134,15 +45,12 @@ namespace Umbraco.Core
/// both internally (on disk) and externally (as a url).
///
/// The text to filter.
+ /// The short string helper.
/// The culture.
/// The safe filename.
- public static string ToSafeFileName(this string text, string culture)
+ public static string ToSafeFileName(this string text, IShortStringHelper shortStringHelper, string culture)
{
- return Current.ShortStringHelper.CleanStringForSafeFileName(text, culture);
+ return shortStringHelper.CleanStringForSafeFileName(text, culture);
}
-
-
-
-
}
}
diff --git a/src/Umbraco.Core/TypeExtensions.cs b/src/Umbraco.Core/TypeExtensions.cs
index 5cc1270669..749bcbc342 100644
--- a/src/Umbraco.Core/TypeExtensions.cs
+++ b/src/Umbraco.Core/TypeExtensions.cs
@@ -21,7 +21,7 @@ namespace Umbraco.Core
///
/// Currently this will only work for ProperCase and camelCase properties, see the TODO below to enable complete case insensitivity
///
- internal static Attempt GetMemberIgnoreCase(this Type type, object target, string memberName)
+ internal static Attempt GetMemberIgnoreCase(this Type type, object target, string memberName, IShortStringHelper shortStringHelper)
{
Func> getMember =
memberAlias =>
@@ -49,8 +49,8 @@ namespace Umbraco.Core
{
//if we cannot get with the current alias, try changing it's case
attempt = memberName[0].IsUpperCase()
- ? getMember(memberName.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase))
- : getMember(memberName.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase));
+ ? getMember(memberName.ToCleanString(shortStringHelper, CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase))
+ : getMember(memberName.ToCleanString(shortStringHelper, CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase));
// TODO: If this still fails then we should get a list of properties from the object and then compare - doing the above without listing
// all properties will surely be faster than using reflection to get ALL properties first and then query against them.
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
index b0b12b8370..8ccb1680cc 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/DataEditor.cs
@@ -25,7 +25,6 @@ namespace Umbraco.Core.PropertyEditors
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly ILocalizedTextService _localizedTextService;
- private readonly IShortStringHelper _shortStringHelper;
private IDictionary _defaultConfiguration;
private IDataValueEditor _dataValueEditor;
@@ -37,7 +36,7 @@ namespace Umbraco.Core.PropertyEditors
_dataTypeService = dataTypeService;
_localizationService = localizationService;
_localizedTextService = localizedTextService;
- _shortStringHelper = shortStringHelper;
+ ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
// defaults
@@ -62,6 +61,8 @@ namespace Umbraco.Core.PropertyEditors
///
protected DataEditorAttribute Attribute { get; }
+ protected IShortStringHelper ShortStringHelper { get; }
+
///
/// Gets a logger.
///
@@ -178,7 +179,7 @@ namespace Umbraco.Core.PropertyEditors
if (Attribute == null)
throw new InvalidOperationException($"The editor is not attributed with {nameof(DataEditorAttribute)}");
- return new DataValueEditor(_dataTypeService, _localizationService, _localizedTextService, _shortStringHelper, Attribute);
+ return new DataValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
}
///
diff --git a/src/Umbraco.ModelsBuilder.Embedded/Compose/ModelsBuilderComponent.cs b/src/Umbraco.ModelsBuilder.Embedded/Compose/ModelsBuilderComponent.cs
index 0e41c9ac62..bb5f7e36bb 100644
--- a/src/Umbraco.ModelsBuilder.Embedded/Compose/ModelsBuilderComponent.cs
+++ b/src/Umbraco.ModelsBuilder.Embedded/Compose/ModelsBuilderComponent.cs
@@ -8,6 +8,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
+using Umbraco.Core.Strings;
using Umbraco.ModelsBuilder.Embedded.BackOffice;
using Umbraco.ModelsBuilder.Embedded.Configuration;
using Umbraco.Web;
@@ -16,19 +17,19 @@ using Umbraco.Web.Mvc;
namespace Umbraco.ModelsBuilder.Embedded.Compose
{
-
internal class ModelsBuilderComponent : IComponent
{
-
private readonly IModelsBuilderConfig _config;
private readonly LiveModelsProvider _liveModelsProvider;
private readonly OutOfDateModelsStatus _outOfDateModels;
+ private readonly IShortStringHelper _shortStringHelper;
- public ModelsBuilderComponent(IModelsBuilderConfig config, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels)
+ public ModelsBuilderComponent(IModelsBuilderConfig config, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels, IShortStringHelper shortStringHelper)
{
_config = config;
_liveModelsProvider = liveModelsProvider;
_outOfDateModels = outOfDateModels;
+ _shortStringHelper = shortStringHelper;
}
public void Initialize()
@@ -116,7 +117,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Compose
// + this is how we get the default model name in Umbraco.ModelsBuilder.Umbraco.Application
var alias = e.AdditionalData["ContentTypeAlias"].ToString();
var name = template.Name; // will be the name of the content type since we are creating
- var className = UmbracoServices.GetClrName(name, alias);
+ var className = UmbracoServices.GetClrName(_shortStringHelper, name, alias);
var modelNamespace = _config.ModelsNamespace;
diff --git a/src/Umbraco.ModelsBuilder.Embedded/UmbracoServices.cs b/src/Umbraco.ModelsBuilder.Embedded/UmbracoServices.cs
index 5ede5f45e9..17a4800664 100644
--- a/src/Umbraco.ModelsBuilder.Embedded/UmbracoServices.cs
+++ b/src/Umbraco.ModelsBuilder.Embedded/UmbracoServices.cs
@@ -17,13 +17,15 @@ namespace Umbraco.ModelsBuilder.Embedded
private readonly IMediaTypeService _mediaTypeService;
private readonly IMemberTypeService _memberTypeService;
private readonly IPublishedContentTypeFactory _publishedContentTypeFactory;
+ private readonly IShortStringHelper _shortStringHelper;
- public UmbracoServices(IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IPublishedContentTypeFactory publishedContentTypeFactory)
+ public UmbracoServices(IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IPublishedContentTypeFactory publishedContentTypeFactory, IShortStringHelper shortStringHelper)
{
_contentTypeService = contentTypeService;
_mediaTypeService = mediaTypeService;
_memberTypeService = memberTypeService;
_publishedContentTypeFactory = publishedContentTypeFactory;
+ _shortStringHelper = shortStringHelper;
}
#region Services
@@ -61,10 +63,10 @@ namespace Umbraco.ModelsBuilder.Embedded
return GetTypes(PublishedItemType.Member, memberTypes); // aliases have to be unique here
}
- public static string GetClrName(string name, string alias)
+ public static string GetClrName(IShortStringHelper shortStringHelper, string name, string alias)
{
// ModelsBuilder's legacy - but not ideal
- return alias.ToCleanString(CleanStringType.ConvertCase | CleanStringType.PascalCase);
+ return alias.ToCleanString(shortStringHelper, CleanStringType.ConvertCase | CleanStringType.PascalCase);
}
private IList GetTypes(PublishedItemType itemType, IContentTypeComposition[] contentTypes)
@@ -79,7 +81,7 @@ namespace Umbraco.ModelsBuilder.Embedded
{
Id = contentType.Id,
Alias = contentType.Alias,
- ClrName = GetClrName(contentType.Name, contentType.Alias),
+ ClrName = GetClrName(_shortStringHelper, contentType.Name, contentType.Alias),
ParentId = contentType.ParentId,
Name = contentType.Name,
@@ -121,7 +123,7 @@ namespace Umbraco.ModelsBuilder.Embedded
var propertyModel = new PropertyModel
{
Alias = propertyType.Alias,
- ClrName = GetClrName(propertyType.Name, propertyType.Alias),
+ ClrName = GetClrName(_shortStringHelper, propertyType.Name, propertyType.Alias),
Name = propertyType.Name,
Description = propertyType.Description
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
index aed55f3f49..698d9a0bdf 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlPublishedSnapshotService.cs
@@ -12,6 +12,7 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web;
using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
@@ -54,6 +55,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
ILogger logger,
IGlobalSettings globalSettings,
IHostingEnvironment hostingEnvironment,
+ IShortStringHelper shortStringHelper,
ISiteDomainHelper siteDomainHelper,
IEntityXmlSerializer entitySerializer,
MainDom mainDom,
@@ -62,7 +64,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
publishedSnapshotAccessor, variationContextAccessor, umbracoContextAccessor,
documentRepository, mediaRepository, memberRepository,
defaultCultureAccessor,
- logger, globalSettings, hostingEnvironment, siteDomainHelper, entitySerializer, null, mainDom, testing, enableRepositoryEvents)
+ logger, globalSettings, hostingEnvironment, shortStringHelper, siteDomainHelper, entitySerializer, null, mainDom, testing, enableRepositoryEvents)
{
_umbracoContextAccessor = umbracoContextAccessor;
}
@@ -79,6 +81,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
ILogger logger,
IGlobalSettings globalSettings,
IHostingEnvironment hostingEnvironment,
+ IShortStringHelper shortStringHelper,
ISiteDomainHelper siteDomainHelper,
IEntityXmlSerializer entitySerializer,
PublishedContentTypeCache contentTypeCache,
@@ -93,7 +96,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_xmlStore = new XmlStore(serviceContext.ContentTypeService, serviceContext.ContentService, scopeProvider, _routesCache,
_contentTypeCache, publishedSnapshotAccessor, mainDom, testing, enableRepositoryEvents,
- documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment);
+ documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment, shortStringHelper);
_domainService = serviceContext.DomainService;
_memberService = serviceContext.MemberService;
diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
index f10a3975c7..785ab95f45 100644
--- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
+++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs
@@ -19,6 +19,7 @@ using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Changes;
using Umbraco.Core.Services.Implement;
+using Umbraco.Core.Strings;
using Umbraco.Core.Xml;
using Umbraco.Web.Cache;
using Umbraco.Web.Composing;
@@ -45,16 +46,17 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly IGlobalSettings _globalSettings;
private readonly IEntityXmlSerializer _entitySerializer;
private readonly IHostingEnvironment _hostingEnvironment;
- private XmlStoreFilePersister _persisterTask;
- private volatile bool _released;
- private bool _withRepositoryEvents;
-
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly PublishedContentTypeCache _contentTypeCache;
private readonly RoutesCache _routesCache;
private readonly IContentTypeService _contentTypeService;
private readonly IContentService _contentService;
private readonly IScopeProvider _scopeProvider;
+ private readonly IShortStringHelper _shortStringHelper;
+
+ private XmlStoreFilePersister _persisterTask;
+ private volatile bool _released;
+ private bool _withRepositoryEvents;
#region Constructors
@@ -63,8 +65,8 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
///
/// The default constructor will boot the cache, load data from file or database, /// wire events in order to manage changes, etc.
public XmlStore(IContentTypeService contentTypeService, IContentService contentService, IScopeProvider scopeProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache,
- IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment)
- : this(contentTypeService, contentService, scopeProvider, routesCache, contentTypeCache, publishedSnapshotAccessor, mainDom, false, false, documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment)
+ IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment, IShortStringHelper shortStringHelper)
+ : this(contentTypeService, contentService, scopeProvider, routesCache, contentTypeCache, publishedSnapshotAccessor, mainDom, false, false, documentRepository, mediaRepository, memberRepository, globalSettings, entitySerializer, hostingEnvironment, shortStringHelper)
{ }
// internal for unit tests
@@ -72,7 +74,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
// TODO: er, we DO have a DB?
internal XmlStore(IContentTypeService contentTypeService, IContentService contentService, IScopeProvider scopeProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache,
IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom,
- bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment)
+ bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment, IShortStringHelper shortStringHelper)
{
if (testing == false)
EnsureConfigurationIsValid();
@@ -89,6 +91,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
_globalSettings = globalSettings;
_entitySerializer = entitySerializer;
_hostingEnvironment = hostingEnvironment;
+ _shortStringHelper = shortStringHelper;
_xmlFileName = Current.IOHelper.MapPath(SystemFiles.GetContentCacheXml(_hostingEnvironment));
@@ -405,7 +408,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
var dtdInner = new StringBuilder();
var contentTypes = _contentTypeService.GetAll();
// though aliases should be safe and non null already?
- var aliases = contentTypes.Select(x => x.Alias.ToSafeAlias()).WhereNotNull();
+ var aliases = contentTypes.Select(x => x.Alias.ToSafeAlias(_shortStringHelper)).WhereNotNull();
foreach (var alias in aliases)
{
dtdInner.AppendLine($"");
diff --git a/src/Umbraco.Tests/Models/ContentXmlTest.cs b/src/Umbraco.Tests/Models/ContentXmlTest.cs
index 023895654d..fe58889d05 100644
--- a/src/Umbraco.Tests/Models/ContentXmlTest.cs
+++ b/src/Umbraco.Tests/Models/ContentXmlTest.cs
@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Models
var content = MockedContent.CreateTextpageContent(contentType, "Root Home", -1);
ServiceContext.ContentService.Save(content, Constants.Security.SuperUserId);
- var nodeName = content.ContentType.Alias.ToSafeAlias();
+ var nodeName = content.ContentType.Alias.ToSafeAlias(ShortStringHelper);
var urlName = content.GetUrlSegment(ShortStringHelper, new[]{new DefaultUrlSegmentProvider(ShortStringHelper) });
// Act
diff --git a/src/Umbraco.Tests/Models/MediaXmlTest.cs b/src/Umbraco.Tests/Models/MediaXmlTest.cs
index 91a19675f3..f312744db6 100644
--- a/src/Umbraco.Tests/Models/MediaXmlTest.cs
+++ b/src/Umbraco.Tests/Models/MediaXmlTest.cs
@@ -3,13 +3,12 @@ using System.Xml.Linq;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.Composing;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
+using Umbraco.Tests.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
using Umbraco.Tests.Testing;
@@ -21,8 +20,6 @@ namespace Umbraco.Tests.Models
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerFixture)]
public class MediaXmlTest : TestWithDatabaseBase
{
-
-
[Test]
public void Can_Generate_Xml_Representation_Of_Media()
{
@@ -39,7 +36,7 @@ namespace Umbraco.Tests.Models
var localizationService = Mock.Of();
var mediaFileSystem = new MediaFileSystem(Mock.Of(), scheme, logger, ShortStringHelper);
- var ignored = new FileUploadPropertyEditor(Mock.Of(), mediaFileSystem, config, dataTypeService, localizationService);
+ var ignored = new FileUploadPropertyEditor(Mock.Of(), mediaFileSystem, config, dataTypeService, localizationService, ShortStringHelper);
var media = MockedMedia.CreateMediaImage(mediaType, -1);
media.WriterId = -1; // else it's zero and that's not a user and it breaks the tests
@@ -51,7 +48,7 @@ namespace Umbraco.Tests.Models
media.SetValue(Constants.Conventions.Media.Bytes, "100");
media.SetValue(Constants.Conventions.Media.Extension, "png");
- var nodeName = media.ContentType.Alias.ToSafeAlias();
+ var nodeName = media.ContentType.Alias.ToSafeAlias(ShortStringHelper);
var urlName = media.GetUrlSegment(ShortStringHelper, new[] { new DefaultUrlSegmentProvider(ShortStringHelper) });
// Act
diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
index a5b4372283..069d93f409 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs
@@ -36,9 +36,9 @@ namespace Umbraco.Tests.Persistence.Repositories
using (provider.CreateScope())
{
var dtRepo = CreateRepository();
- IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper)) { Name = "dt1" };
+ IDataType dataType1 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt1" };
dtRepo.Save(dataType1);
- IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper)) { Name = "dt2" };
+ IDataType dataType2 = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) { Name = "dt2" };
dtRepo.Save(dataType2);
var ctRepo = Factory.GetInstance();
@@ -106,14 +106,14 @@ namespace Umbraco.Tests.Persistence.Repositories
var container2 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id };
containerRepository.Save(container2);
- var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper), container2.Id)
+ var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container2.Id)
{
Name = "dt1"
};
repository.Save(dataType);
//create a
- var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper), dataType.Id)
+ var dataType2 = (IDataType)new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), dataType.Id)
{
Name = "dt2"
};
@@ -185,7 +185,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
containerRepository.Save(container);
- var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper), container.Id) { Name = "test" };
+ var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
repository.Save(dataTypeDefinition);
Assert.AreEqual(container.Id, dataTypeDefinition.ParentId);
@@ -205,7 +205,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" };
containerRepository.Save(container);
- IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper), container.Id) { Name = "test" };
+ IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper), container.Id) { Name = "test" };
repository.Save(dataType);
// Act
@@ -228,7 +228,7 @@ namespace Umbraco.Tests.Persistence.Repositories
using (provider.CreateScope())
{
var repository = CreateRepository();
- IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper)) {Name = "test"};
+ IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService, IOHelper, ShortStringHelper)) {Name = "test"};
repository.Save(dataType);
diff --git a/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
index b7ae1604c5..a8f620f2c8 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/DocumentRepositoryTest.cs
@@ -50,7 +50,7 @@ namespace Umbraco.Tests.Persistence.Repositories
TemplateRepository tr;
var ctRepository = CreateRepository(scopeAccessor, out contentTypeRepository, out tr);
var editors = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty()));
- dtdRepository = new DataTypeRepository(scopeAccessor, appCaches, new Lazy(() => editors), Logger, TestHelper.IOHelper);
+ dtdRepository = new DataTypeRepository(scopeAccessor, appCaches, new Lazy(() => editors), Logger, TestHelper.IOHelper, ShortStringHelper);
return ctRepository;
}
@@ -359,7 +359,7 @@ namespace Umbraco.Tests.Persistence.Repositories
{
var repository = CreateRepository((IScopeAccessor)provider, out var contentTypeRepository, out DataTypeRepository dataTypeDefinitionRepository);
- var editor = new DecimalPropertyEditor(Logger);
+ var editor = new DecimalPropertyEditor(Logger, ShortStringHelper);
var dtd = new DataType(editor) { Name = "test", DatabaseType = ValueStorageType.Decimal };
dataTypeDefinitionRepository.Save(dtd);
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
index 943125bd21..2f10b23f5a 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs
@@ -1,9 +1,7 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Reflection;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
@@ -11,7 +9,6 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
using Umbraco.Core.Hosting;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
@@ -21,6 +18,7 @@ using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Changes;
using Umbraco.Core.Strings;
+using Umbraco.Tests.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing.Objects;
using Umbraco.Tests.Testing.Objects.Accessors;
@@ -29,7 +27,6 @@ using Umbraco.Web.Cache;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.NuCache;
using Umbraco.Web.PublishedCache.NuCache.DataSource;
-using Umbraco.Web.PublishedCache.NuCache.Snap;
namespace Umbraco.Tests.PublishedContent
{
@@ -166,7 +163,8 @@ namespace Umbraco.Tests.PublishedContent
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
- hostingEnvironment);
+ hostingEnvironment,
+ new MockShortStringHelper());
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
index 92c0d697fb..c0ed53d281 100644
--- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs
@@ -8,7 +8,6 @@ using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Events;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
@@ -18,6 +17,7 @@ using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Changes;
using Umbraco.Core.Strings;
+using Umbraco.Tests.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing.Objects;
using Umbraco.Tests.Testing.Objects.Accessors;
@@ -206,7 +206,8 @@ namespace Umbraco.Tests.PublishedContent
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
- TestHelper.GetHostingEnvironment());
+ TestHelper.GetHostingEnvironment(),
+ new MockShortStringHelper());
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs
index e9f923c029..85069b5bdf 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs
@@ -44,7 +44,7 @@ namespace Umbraco.Tests.PublishedContent
var logger = Mock.Of();
var imageSourceParser = new HtmlImageSourceParser(umbracoContextAccessor);
- var pastedImages = new RichTextEditorPastedImages(umbracoContextAccessor, logger, IOHelper, Mock.Of(), Mock.Of());
+ var pastedImages = new RichTextEditorPastedImages(umbracoContextAccessor, logger, IOHelper, Mock.Of(), Mock.Of(), ShortStringHelper);
var localLinkParser = new HtmlLocalLinkParser(umbracoContextAccessor);
var dataTypeService = new TestObjects.TestDataTypeService(
new DataType(new RichTextPropertyEditor(
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
index 78ef0318af..a50037d7a6 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs
@@ -52,7 +52,7 @@ namespace Umbraco.Tests.PublishedContent
var contentTypeBaseServiceProvider = Mock.Of();
var umbracoContextAccessor = Mock.Of();
var imageSourceParser = new HtmlImageSourceParser(umbracoContextAccessor);
- var pastedImages = new RichTextEditorPastedImages(umbracoContextAccessor, logger, IOHelper, mediaService, contentTypeBaseServiceProvider);
+ var pastedImages = new RichTextEditorPastedImages(umbracoContextAccessor, logger, IOHelper, mediaService, contentTypeBaseServiceProvider, ShortStringHelper);
var linkParser = new HtmlLocalLinkParser(umbracoContextAccessor);
var localizationService = Mock.Of();
diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
index 8ec3b326ef..f50bbbda26 100644
--- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
+++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs
@@ -46,6 +46,7 @@ namespace Umbraco.Tests.Routing
WebInitialComponent.CreateRoutes(
new TestUmbracoContextAccessor(),
TestObjects.GetGlobalSettings(),
+ ShortStringHelper,
new SurfaceControllerTypeCollection(Enumerable.Empty()),
new UmbracoApiControllerTypeCollection(Enumerable.Empty()));
}
@@ -106,7 +107,7 @@ namespace Umbraco.Tests.Routing
frequest.TemplateModel = template;
var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext);
- var handler = new RenderRouteHandler(umbracoContext, new TestControllerFactory(umbracoContextAccessor, Mock.Of()));
+ var handler = new RenderRouteHandler(umbracoContext, new TestControllerFactory(umbracoContextAccessor, Mock.Of()), ShortStringHelper);
handler.GetHandlerForRoute(umbracoContext.HttpContext.Request.RequestContext, frequest);
Assert.AreEqual("RenderMvc", routeData.Values["controller"].ToString());
@@ -146,22 +147,22 @@ namespace Umbraco.Tests.Routing
ContentTypesCache.GetPublishedContentTypeByAlias = alias => type;
var handler = new RenderRouteHandler(umbracoContext, new TestControllerFactory(umbracoContextAccessor, Mock.Of(), context =>
- {
- var membershipHelper = new MembershipHelper(
- umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of());
- return new CustomDocumentController(Factory.GetInstance(),
- umbracoContextAccessor,
- Factory.GetInstance(),
- Factory.GetInstance(),
- Factory.GetInstance(),
- new UmbracoHelper(Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), membershipHelper));
- }));
+ {
+ var membershipHelper = new MembershipHelper(
+ umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of(), ShortStringHelper);
+ return new CustomDocumentController(Factory.GetInstance(),
+ umbracoContextAccessor,
+ Factory.GetInstance(),
+ Factory.GetInstance(),
+ Factory.GetInstance(),
+ new UmbracoHelper(Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), membershipHelper));
+ }), ShortStringHelper);
handler.GetHandlerForRoute(umbracoContext.HttpContext.Request.RequestContext, frequest);
Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
Assert.AreEqual(
//global::umbraco.cms.helpers.Casing.SafeAlias(template.Alias),
- template.Alias.ToSafeAlias(),
+ template.Alias.ToSafeAlias(ShortStringHelper),
routeData.Values["action"].ToString());
}
diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
index 22afd913fb..73f8f38d6c 100644
--- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
+++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs
@@ -14,11 +14,11 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence.Repositories;
-using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Core.Strings;
using Umbraco.Core.Sync;
+using Umbraco.Tests.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.Testing;
using Umbraco.Tests.Testing.Objects.Accessors;
@@ -104,7 +104,8 @@ namespace Umbraco.Tests.Scoping
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(ShortStringHelper) }),
typeFinder,
- hostingEnvironment);
+ hostingEnvironment,
+ new MockShortStringHelper());
}
protected UmbracoContext GetUmbracoContextNu(string url, int templateId = 1234, RouteData routeData = null, bool setSingleton = false, IUmbracoSettingsSection umbracoSettings = null, IEnumerable urlProviders = null)
diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
index 0f66b6e273..0f1b1fed32 100644
--- a/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
+++ b/src/Umbraco.Tests/Services/ContentTypeServiceVariantsTests.cs
@@ -15,10 +15,10 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Repositories;
-using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Core.Sync;
+using Umbraco.Tests.Strings;
using Umbraco.Tests.TestHelpers.Entities;
using Umbraco.Tests.Testing;
using Umbraco.Web.PublishedCache;
@@ -78,7 +78,8 @@ namespace Umbraco.Tests.Services
Mock.Of(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(ShortStringHelper) }),
typeFinder,
- hostingEnvironment);
+ hostingEnvironment,
+ new MockShortStringHelper());
}
public class LocalServerMessenger : ServerMessengerBase
diff --git a/src/Umbraco.Tests/Strings/CmsHelperCasingTests.cs b/src/Umbraco.Tests/Strings/CmsHelperCasingTests.cs
index a4006409be..ea2041cd9c 100644
--- a/src/Umbraco.Tests/Strings/CmsHelperCasingTests.cs
+++ b/src/Umbraco.Tests/Strings/CmsHelperCasingTests.cs
@@ -18,7 +18,7 @@ namespace Umbraco.Tests.Strings
[TestCase("WhoIsNumber6InTheVillage", "Who Is Number6 In The Village")] // now fixed since DefaultShortStringHelper is the default
public void SpaceCamelCasing(string input, string expected)
{
- var output = input.SpaceCamelCasing();
+ var output = input.SpaceCamelCasing(ShortStringHelper);
Assert.AreEqual(expected, output);
}
diff --git a/src/Umbraco.Tests/Strings/MockShortStringHelper.cs b/src/Umbraco.Tests/Strings/MockShortStringHelper.cs
index a39f962908..1cc959414d 100644
--- a/src/Umbraco.Tests/Strings/MockShortStringHelper.cs
+++ b/src/Umbraco.Tests/Strings/MockShortStringHelper.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using Umbraco.Core.Strings;
+using Umbraco.Core.Strings;
namespace Umbraco.Tests.Strings
{
diff --git a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs
index a273535b62..fa00539e57 100644
--- a/src/Umbraco.Tests/Strings/StringExtensionsTests.cs
+++ b/src/Umbraco.Tests/Strings/StringExtensionsTests.cs
@@ -16,18 +16,7 @@ namespace Umbraco.Tests.Strings
[TestFixture]
public class StringExtensionsTests : UmbracoTestBase
{
- protected override void Compose()
- {
- base.Compose();
- Composition.RegisterUnique(_ => new MockShortStringHelper());
- }
-
- [Test]
- public void CurrentHelper()
- {
- var helper = Current.ShortStringHelper;
- Assert.IsInstanceOf(helper);
- }
+ private readonly IShortStringHelper _mockShortStringHelper = new MockShortStringHelper();
[TestCase("hello-world.png", "Hello World")]
[TestCase("hello-world .png", "Hello World")]
@@ -228,77 +217,77 @@ namespace Umbraco.Tests.Strings
[Test]
public void ToUrlAlias()
{
- var output = "JUST-ANYTHING".ToUrlSegment();
+ var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void FormatUrl()
{
- var output = "JUST-ANYTHING".ToUrlSegment();
+ var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void ToUmbracoAlias()
{
- var output = "JUST-ANYTHING".ToSafeAlias();
+ var output = "JUST-ANYTHING".ToSafeAlias(_mockShortStringHelper);
Assert.AreEqual("SAFE-ALIAS::JUST-ANYTHING", output);
}
[Test]
public void ToSafeAlias()
{
- var output = "JUST-ANYTHING".ToSafeAlias();
+ var output = "JUST-ANYTHING".ToSafeAlias(_mockShortStringHelper);
Assert.AreEqual("SAFE-ALIAS::JUST-ANYTHING", output);
}
[Test]
public void ToSafeAliasWithCulture()
{
- var output = "JUST-ANYTHING".ToSafeAlias((string)null);
+ var output = "JUST-ANYTHING".ToSafeAlias(_mockShortStringHelper, (string)null);
Assert.AreEqual("SAFE-ALIAS-CULTURE::JUST-ANYTHING", output);
}
[Test]
public void ToUrlSegment()
{
- var output = "JUST-ANYTHING".ToUrlSegment();
+ var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void ToUrlSegmentWithCulture()
{
- var output = "JUST-ANYTHING".ToUrlSegment((string)null);
+ var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper, (string)null);
Assert.AreEqual("URL-SEGMENT-CULTURE::JUST-ANYTHING", output);
}
[Test]
public void ToSafeFileName()
{
- var output = "JUST-ANYTHING".ToSafeFileName();
+ var output = "JUST-ANYTHING".ToSafeFileName(_mockShortStringHelper);
Assert.AreEqual("SAFE-FILE-NAME::JUST-ANYTHING", output);
}
[Test]
public void ToSafeFileNameWithCulture()
{
- var output = "JUST-ANYTHING".ToSafeFileName(null);
+ var output = "JUST-ANYTHING".ToSafeFileName(_mockShortStringHelper, null);
Assert.AreEqual("SAFE-FILE-NAME-CULTURE::JUST-ANYTHING", output);
}
[Test]
public void ConvertCase()
{
- var output = "JUST-ANYTHING".ToCleanString(CleanStringType.Unchanged);
+ var output = "JUST-ANYTHING".ToCleanString(_mockShortStringHelper, CleanStringType.Unchanged);
Assert.AreEqual("CLEAN-STRING-A::JUST-ANYTHING", output);
}
[Test]
public void SplitPascalCasing()
{
- var output = "JUST-ANYTHING".SplitPascalCasing();
+ var output = "JUST-ANYTHING".SplitPascalCasing(_mockShortStringHelper);
Assert.AreEqual("SPLIT-PASCAL-CASING::JUST-ANYTHING", output);
}
diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs
index fdc2e6a5bd..cf6438b673 100644
--- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs
+++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs
@@ -23,6 +23,7 @@ using Umbraco.Web.WebApi;
using Umbraco.Core.Logging;
using Umbraco.Tests.Testing.Objects.Accessors;
using Umbraco.Web.Security.Providers;
+using Umbraco.Tests.Strings;
namespace Umbraco.Tests.TestHelpers.ControllerTesting
{
@@ -152,7 +153,7 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting
urlHelper.Setup(provider => provider.GetUrl(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(UrlInfo.Url("/hello/world/1234"));
- var membershipHelper = new MembershipHelper(umbCtx.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of());
+ var membershipHelper = new MembershipHelper(umbCtx.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of(), new MockShortStringHelper());
var umbHelper = new UmbracoHelper(Mock.Of(),
Mock.Of(),
diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
index 85ee03918c..50627a7e02 100644
--- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
+++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs
@@ -270,6 +270,7 @@ namespace Umbraco.Tests.TestHelpers
Logger,
Factory.GetInstance(),
HostingEnvironment,
+ ShortStringHelper,
new SiteDomainHelper(),
Factory.GetInstance(),
ContentTypesCache,
diff --git a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs
index 1b1d3172d3..52e86b36db 100644
--- a/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs
+++ b/src/Umbraco.Tests/Testing/TestingTests/MockTests.cs
@@ -71,7 +71,7 @@ namespace Umbraco.Tests.Testing.TestingTests
Mock.Of(),
Mock.Of(),
Mock.Of(),
- new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of()));
+ new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of(), ShortStringHelper));
Assert.Pass();
}
@@ -103,7 +103,7 @@ namespace Umbraco.Tests.Testing.TestingTests
var memberService = Mock.Of();
var memberTypeService = Mock.Of();
var membershipProvider = new MembersMembershipProvider(memberService, memberTypeService, Mock.Of(), TestHelper.GetHostingEnvironment(), TestHelper.GetIpResolver());
- var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), membershipProvider, Mock.Of(), memberService, memberTypeService, Mock.Of(), AppCaches.Disabled, logger);
+ var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), membershipProvider, Mock.Of(), memberService, memberTypeService, Mock.Of(), AppCaches.Disabled, logger, ShortStringHelper);
var umbracoHelper = new UmbracoHelper(Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), membershipHelper);
var umbracoMapper = new UmbracoMapper(new MapDefinitionCollection(new[] { Mock.Of() }));
diff --git a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
index cffb2a7aaf..02341ef215 100644
--- a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
+++ b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs
@@ -1,4 +1,6 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
@@ -8,32 +10,31 @@ using Moq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
+using Umbraco.Core;
+using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Dictionary;
+using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
+using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.ControllerTesting;
using Umbraco.Tests.TestHelpers.Entities;
using Umbraco.Tests.Testing;
using Umbraco.Web;
+using Umbraco.Web.Actions;
using Umbraco.Web.Editors;
using Umbraco.Web.Models.ContentEditing;
-using Task = System.Threading.Tasks.Task;
-using Umbraco.Core.Dictionary;
using Umbraco.Web.PropertyEditors;
-using System;
-using Umbraco.Web.WebApi;
using Umbraco.Web.Trees;
-using System.Globalization;
-using Umbraco.Core;
-using Umbraco.Core.Cache;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Persistence;
-using Umbraco.Web.Actions;
+using Umbraco.Web.WebApi;
+using Task = System.Threading.Tasks.Task;
namespace Umbraco.Tests.Web.Controllers
{
@@ -267,7 +268,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return controller;
}
@@ -301,7 +303,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ ShortStringHelper);
return controller;
}
@@ -343,7 +346,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return controller;
}
@@ -390,7 +394,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return controller;
}
@@ -429,7 +434,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return controller;
}
@@ -474,7 +480,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return controller;
}
diff --git a/src/Umbraco.Tests/Web/Controllers/UsersControllerTests.cs b/src/Umbraco.Tests/Web/Controllers/UsersControllerTests.cs
index d983a835b8..1301c0e2da 100644
--- a/src/Umbraco.Tests/Web/Controllers/UsersControllerTests.cs
+++ b/src/Umbraco.Tests/Web/Controllers/UsersControllerTests.cs
@@ -23,6 +23,7 @@ using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.ControllerTesting;
using Umbraco.Tests.TestHelpers.Entities;
@@ -84,7 +85,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return usersController;
}
@@ -148,7 +150,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return usersController;
}
@@ -183,7 +186,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return usersController;
}
@@ -253,7 +257,8 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance(),
Factory.GetInstance(),
Factory.GetInstance(),
- helper);
+ helper,
+ Factory.GetInstance());
return usersController;
}
diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs
index 4299b57e07..0660564a52 100644
--- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs
+++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs
@@ -124,7 +124,7 @@ namespace Umbraco.Tests.Web.Mvc
Mock.Of(),
Mock.Of(),
Mock.Of(query => query.Content(2) == content.Object),
- new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of()));
+ new MembershipHelper(umbracoContext.HttpContext, Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), Mock.Of(), AppCaches.Disabled, Mock.Of(), ShortStringHelper));
var ctrl = new TestSurfaceController(umbracoContextAccessor, helper);
var result = ctrl.GetContent(2) as PublishedContentResult;
diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
index 52bd0253a0..50d18bb52a 100644
--- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
+++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs
@@ -427,6 +427,7 @@ namespace Umbraco.Tests.Web.Mvc
new TestDefaultCultureAccessor(),
Current.Logger, TestObjects.GetGlobalSettings(),
TestHelper.GetHostingEnvironment(),
+ ShortStringHelper,
new SiteDomainHelper(),
Factory.GetInstance(),
null, true, false
diff --git a/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs b/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
index aebd13b6c4..24548a8089 100644
--- a/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeNotificationsController.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
@@ -18,8 +19,8 @@ namespace Umbraco.Web.Editors
[PrefixlessBodyModelValidator]
public abstract class BackOfficeNotificationsController : UmbracoAuthorizedJsonController
{
- protected BackOfficeNotificationsController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ protected BackOfficeNotificationsController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
}
diff --git a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs
index 63bf0f0473..c63e2c13a6 100644
--- a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs
+++ b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs
@@ -5,6 +5,7 @@ using System.Web.Http.ModelBinding;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using System.Linq;
using Umbraco.Web.Composing;
@@ -17,15 +18,17 @@ namespace Umbraco.Web.Editors.Binders
internal class MemberBinder : IModelBinder
{
private readonly ContentModelBinderHelper _modelBinderHelper;
+ private readonly IShortStringHelper _shortStringHelper;
private readonly ServiceContext _services;
- public MemberBinder() : this(Current.Services)
+ public MemberBinder() : this(Current.Services, Current.ShortStringHelper)
{
}
- public MemberBinder(ServiceContext services)
+ public MemberBinder(ServiceContext services, IShortStringHelper shortStringHelper)
{
- _services = services;
+ _services = services ?? throw new ArgumentNullException(nameof(services));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
_modelBinderHelper = new ContentModelBinderHelper();
}
@@ -107,7 +110,7 @@ namespace Umbraco.Web.Editors.Binders
///
private void FilterMembershipProviderProperties(IContentTypeBase contentType)
{
- var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(Current.ShortStringHelper);
+ var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper);
//remove all membership properties, these values are set with the membership provider.
var exclude = defaultProps.Select(x => x.Value.Alias).ToArray();
FilterContentTypeProperties(contentType, exclude);
diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs
index 037e7f1702..74e450b7b4 100644
--- a/src/Umbraco.Web/Editors/CodeFileController.cs
+++ b/src/Umbraco.Web/Editors/CodeFileController.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Core.Strings.Css;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
@@ -33,8 +34,8 @@ namespace Umbraco.Web.Editors
[UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)]
public class CodeFileController : BackOfficeNotificationsController
{
- public CodeFileController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public CodeFileController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
@@ -229,7 +230,7 @@ namespace Umbraco.Web.Editors
throw new HttpResponseException(HttpStatusCode.NotFound);
}
- return snippets.Select(snippet => new SnippetDisplay() {Name = snippet.SplitPascalCasing().ToFirstUpperInvariant(), FileName = snippet});
+ return snippets.Select(snippet => new SnippetDisplay() {Name = snippet.SplitPascalCasing(ShortStringHelper).ToFirstUpperInvariant(), FileName = snippet});
}
///
diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs
index fe490e8699..6af9300b76 100644
--- a/src/Umbraco.Web/Editors/ContentController.cs
+++ b/src/Umbraco.Web/Editors/ContentController.cs
@@ -11,31 +11,32 @@ using System.Web.Http.ModelBinding;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Dictionary;
+using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
-using Umbraco.Core.Models.Membership;
-using Umbraco.Core.Services;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.Models.Mapping;
-using Umbraco.Web.Mvc;
-using Umbraco.Web.WebApi;
-using Umbraco.Web.WebApi.Filters;
-using Umbraco.Core.Persistence.Querying;
-using Umbraco.Core.Events;
using Umbraco.Core.Models.ContentEditing;
+using Umbraco.Core.Models.Entities;
+using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Validation;
-using Umbraco.Web.Composing;
+using Umbraco.Core.Persistence;
+using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Security;
+using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Actions;
+using Umbraco.Web.Composing;
using Umbraco.Web.ContentApps;
using Umbraco.Web.Editors.Binders;
using Umbraco.Web.Editors.Filters;
-using Umbraco.Core.Models.Entities;
-using Umbraco.Core.Persistence;
-using Umbraco.Core.Security;
+using Umbraco.Web.Models.ContentEditing;
+using Umbraco.Web.Models.Mapping;
+using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
+using Umbraco.Web.WebApi;
+using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Dictionary;
namespace Umbraco.Web.Editors
{
@@ -56,8 +57,8 @@ namespace Umbraco.Web.Editors
public object Domains { get; private set; }
- public ContentController(ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public ContentController(ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
_allLangs = new Lazy>(() => Services.LocalizationService.GetAllLanguages().ToDictionary(x => x.IsoCode, x => x, StringComparer.InvariantCultureIgnoreCase));
diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs
index 610f668997..81cdb73880 100644
--- a/src/Umbraco.Web/Editors/ContentControllerBase.cs
+++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs
@@ -13,12 +13,12 @@ using Umbraco.Core.Models.Editors;
using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
-
namespace Umbraco.Web.Editors
{
///
@@ -29,8 +29,8 @@ namespace Umbraco.Web.Editors
{
protected ICultureDictionary CultureDictionary { get; }
- protected ContentControllerBase(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ protected ContentControllerBase(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
CultureDictionary = cultureDictionary;
}
@@ -84,7 +84,7 @@ namespace Umbraco.Web.Editors
.ToArray();
foreach (var file in files)
- file.FileName = file.FileName.ToSafeFileName();
+ file.FileName = file.FileName.ToSafeFileName(ShortStringHelper);
// create the property data for the property editor
var data = new ContentPropertyData(propertyDto.Value, propertyDto.DataType.Configuration)
diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs
index c80b23747b..e64485e5ab 100644
--- a/src/Umbraco.Web/Editors/ContentTypeController.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeController.cs
@@ -14,11 +14,9 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dictionary;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
-using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Packaging;
using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
@@ -52,7 +50,6 @@ namespace Umbraco.Web.Editors
private readonly IGlobalSettings _globalSettings;
private readonly PropertyEditorCollection _propertyEditors;
private readonly IScopeProvider _scopeProvider;
- private readonly IShortStringHelper _shortStringHelper;
public ContentTypeController(IEntityXmlSerializer serializer,
ICultureDictionary cultureDictionary,
@@ -63,13 +60,12 @@ namespace Umbraco.Web.Editors
IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper,
IScopeProvider scopeProvider,
IShortStringHelper shortStringHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_serializer = serializer;
_globalSettings = globalSettings;
_propertyEditors = propertyEditors;
_scopeProvider = scopeProvider;
- _shortStringHelper = shortStringHelper;
}
public int GetCount()
@@ -229,9 +225,9 @@ namespace Umbraco.Web.Editors
public CreatedContentTypeCollectionResult PostCreateCollection(int parentId, string collectionName, bool collectionCreateTemplate, string collectionItemName, bool collectionItemCreateTemplate, string collectionIcon, string collectionItemIcon)
{
// create item doctype
- var itemDocType = new ContentType(_shortStringHelper, parentId);
+ var itemDocType = new ContentType(ShortStringHelper, parentId);
itemDocType.Name = collectionItemName;
- itemDocType.Alias = collectionItemName.ToSafeAlias(true);
+ itemDocType.Alias = collectionItemName.ToSafeAlias(ShortStringHelper, true);
itemDocType.Icon = collectionItemIcon;
// create item doctype template
@@ -245,9 +241,9 @@ namespace Umbraco.Web.Editors
Services.ContentTypeService.Save(itemDocType);
// create collection doctype
- var collectionDocType = new ContentType(_shortStringHelper, parentId);
+ var collectionDocType = new ContentType(ShortStringHelper, parentId);
collectionDocType.Name = collectionName;
- collectionDocType.Alias = collectionName.ToSafeAlias(true);
+ collectionDocType.Alias = collectionName.ToSafeAlias(ShortStringHelper, true);
collectionDocType.Icon = collectionIcon;
collectionDocType.IsContainer = true;
collectionDocType.AllowedContentTypes = new List()
@@ -380,10 +376,10 @@ namespace Umbraco.Web.Editors
if (parentId != Constants.System.Root)
{
var parent = Services.ContentTypeService.Get(parentId);
- ct = parent != null ? new ContentType(_shortStringHelper, parent, string.Empty) : new ContentType(_shortStringHelper, parentId);
+ ct = parent != null ? new ContentType(ShortStringHelper, parent, string.Empty) : new ContentType(ShortStringHelper, parentId);
}
else
- ct = new ContentType(_shortStringHelper, parentId);
+ ct = new ContentType(ShortStringHelper, parentId);
ct.Icon = Constants.Icons.Content;
@@ -528,7 +524,7 @@ namespace Umbraco.Web.Editors
}
var dataInstaller = new PackageDataInstallation(Logger, Services.FileService, Services.MacroService, Services.LocalizationService,
- Services.DataTypeService, Services.EntityService, Services.ContentTypeService, Services.ContentService, _propertyEditors, _scopeProvider, _shortStringHelper, _globalSettings, Services.TextService);
+ Services.DataTypeService, Services.EntityService, Services.ContentTypeService, Services.ContentService, _propertyEditors, _scopeProvider, ShortStringHelper, _globalSettings, Services.TextService);
var xd = new XmlDocument {XmlResolver = null};
xd.Load(filePath);
diff --git a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs
index 138ef7e43d..1e4500ddac 100644
--- a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -28,8 +29,8 @@ namespace Umbraco.Web.Editors
public abstract class ContentTypeControllerBase : UmbracoAuthorizedJsonController
where TContentType : class, IContentTypeComposition
{
- protected ContentTypeControllerBase(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ protected ContentTypeControllerBase(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
CultureDictionary = cultureDictionary;
}
diff --git a/src/Umbraco.Web/Editors/CurrentUserController.cs b/src/Umbraco.Web/Editors/CurrentUserController.cs
index 0aa0dd029a..26fd3173b9 100644
--- a/src/Umbraco.Web/Editors/CurrentUserController.cs
+++ b/src/Umbraco.Web/Editors/CurrentUserController.cs
@@ -155,7 +155,7 @@ namespace Umbraco.Web.Editors
public async Task PostSetAvatar()
{
//borrow the logic from the user controller
- return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, Security.GetUserId().ResultOr(0));
+ return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, ShortStringHelper, Security.GetUserId().ResultOr(0));
}
///
diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs
index 27c4d41e95..23f27b3211 100644
--- a/src/Umbraco.Web/Editors/DashboardController.cs
+++ b/src/Umbraco.Web/Editors/DashboardController.cs
@@ -16,6 +16,7 @@ using Umbraco.Web.WebApi.Filters;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Core.Dashboards;
using Umbraco.Web.Services;
@@ -32,15 +33,17 @@ namespace Umbraco.Web.Editors
{
private readonly IDashboardService _dashboardService;
private readonly IUmbracoVersion _umbracoVersion;
+ private readonly IShortStringHelper _shortStringHelper;
///
/// Initializes a new instance of the with all its dependencies.
///
- public DashboardController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, IDashboardService dashboardService, UmbracoHelper umbracoHelper, IUmbracoVersion umbracoVersion)
+ public DashboardController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, IDashboardService dashboardService, UmbracoHelper umbracoHelper, IUmbracoVersion umbracoVersion, IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
{
_dashboardService = dashboardService;
_umbracoVersion = umbracoVersion;
+ _shortStringHelper = shortStringHelper;
}
//we have just one instance of HttpClient shared for the entire application
@@ -155,7 +158,7 @@ namespace Umbraco.Web.Editors
//Make remote call to fetch videos or remote dashboard feed data
- var key = $"umbraco-XML-feed-{site}-{url.ToCleanString(Core.Strings.CleanStringType.UrlSegment)}";
+ var key = $"umbraco-XML-feed-{site}-{url.ToCleanString(_shortStringHelper, Core.Strings.CleanStringType.UrlSegment)}";
var content = AppCaches.RuntimeCache.GetCacheItem(key);
var result = string.Empty;
diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs
index 5329a312e5..670c574d87 100644
--- a/src/Umbraco.Web/Editors/DataTypeController.cs
+++ b/src/Umbraco.Web/Editors/DataTypeController.cs
@@ -8,6 +8,7 @@ using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -38,8 +39,8 @@ namespace Umbraco.Web.Editors
{
private readonly PropertyEditorCollection _propertyEditors;
- public DataTypeController(PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public DataTypeController(PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_propertyEditors = propertyEditors;
}
diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs
index d132fdc201..ce808bab1e 100644
--- a/src/Umbraco.Web/Editors/DictionaryController.cs
+++ b/src/Umbraco.Web/Editors/DictionaryController.cs
@@ -11,6 +11,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -33,8 +34,8 @@ namespace Umbraco.Web.Editors
[EnableOverrideAuthorization]
public class DictionaryController : BackOfficeNotificationsController
{
- public DictionaryController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public DictionaryController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index f3de782620..f767b4e7e2 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -11,7 +11,6 @@ using System.Net.Http;
using System.Net.Http.Formatting;
using System.Reflection;
using Umbraco.Core.Models;
-using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using System.Web.Http.Controllers;
using System.Web.Http.ModelBinding;
using Umbraco.Core.Cache;
@@ -20,6 +19,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Core.Xml;
using Umbraco.Web.Models;
using Umbraco.Web.Models.Mapping;
@@ -53,8 +53,8 @@ namespace Umbraco.Web.Editors
private readonly SearchableTreeCollection _searchableTreeCollection;
public EntityController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState,
- ITreeService treeService, UmbracoHelper umbracoHelper, SearchableTreeCollection searchableTreeCollection, UmbracoTreeSearcher treeSearcher)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ ITreeService treeService, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, SearchableTreeCollection searchableTreeCollection, UmbracoTreeSearcher treeSearcher)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_treeService = treeService;
_searchableTreeCollection = searchableTreeCollection;
@@ -88,7 +88,7 @@ namespace Umbraco.Web.Editors
///
public dynamic GetSafeAlias(string value, bool camelCase = true)
{
- var returnValue = string.IsNullOrWhiteSpace(value) ? string.Empty : value.ToSafeAlias(camelCase);
+ var returnValue = string.IsNullOrWhiteSpace(value) ? string.Empty : value.ToSafeAlias(ShortStringHelper, camelCase);
dynamic returnObj = new System.Dynamic.ExpandoObject();
returnObj.alias = returnValue;
returnObj.original = value;
diff --git a/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs b/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs
index fbbd7582f9..1b2ddf2ace 100644
--- a/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs
+++ b/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs
@@ -6,12 +6,11 @@ using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.ModelBinding;
using Umbraco.Core;
-using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.Security;
namespace Umbraco.Web.Editors.Filters
{
@@ -22,17 +21,20 @@ namespace Umbraco.Web.Editors.Filters
{
private readonly IMemberTypeService _memberTypeService;
private readonly IMemberService _memberService;
+ private readonly IShortStringHelper _shortStringHelper;
public MemberSaveModelValidator(
ILogger logger,
IUmbracoContextAccessor umbracoContextAccessor,
ILocalizedTextService textService,
IMemberTypeService memberTypeService,
- IMemberService memberService)
+ IMemberService memberService,
+ IShortStringHelper shortStringHelper)
: base(logger, umbracoContextAccessor, textService)
{
_memberTypeService = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
_memberService = memberService ?? throw new ArgumentNullException(nameof(memberService));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
///
@@ -90,7 +92,7 @@ namespace Umbraco.Web.Editors.Filters
public override bool ValidateProperties(MemberSave model, IContentProperties modelWithProperties, HttpActionContext actionContext)
{
var propertiesToValidate = model.Properties.ToList();
- var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(Current.ShortStringHelper);
+ var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper);
var exclude = defaultProps.Select(x => x.Value.Alias).ToArray();
foreach (var remove in exclude)
{
diff --git a/src/Umbraco.Web/Editors/Filters/MemberSaveValidationAttribute.cs b/src/Umbraco.Web/Editors/Filters/MemberSaveValidationAttribute.cs
index 629a5a4eec..51fa5652ea 100644
--- a/src/Umbraco.Web/Editors/Filters/MemberSaveValidationAttribute.cs
+++ b/src/Umbraco.Web/Editors/Filters/MemberSaveValidationAttribute.cs
@@ -3,6 +3,7 @@ using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
@@ -18,24 +19,26 @@ namespace Umbraco.Web.Editors.Filters
private readonly ILocalizedTextService _textService;
private readonly IMemberTypeService _memberTypeService;
private readonly IMemberService _memberService;
+ private readonly IShortStringHelper _shortStringHelper;
public MemberSaveValidationAttribute()
- : this(Current.Logger, Current.UmbracoContextAccessor, Current.Services.TextService, Current.Services.MemberTypeService, Current.Services.MemberService)
+ : this(Current.Logger, Current.UmbracoContextAccessor, Current.Services.TextService, Current.Services.MemberTypeService, Current.Services.MemberService, Current.ShortStringHelper)
{ }
- public MemberSaveValidationAttribute(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService textService, IMemberTypeService memberTypeService, IMemberService memberService)
+ public MemberSaveValidationAttribute(ILogger logger, IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService textService, IMemberTypeService memberTypeService, IMemberService memberService, IShortStringHelper shortStringHelper)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
_textService = textService ?? throw new ArgumentNullException(nameof(textService));
_memberTypeService = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
- _memberService = memberService ?? throw new ArgumentNullException(nameof(memberService));;
+ _memberService = memberService ?? throw new ArgumentNullException(nameof(memberService));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
public override void OnActionExecuting(HttpActionContext actionContext)
{
var model = (MemberSave)actionContext.ActionArguments["contentItem"];
- var contentItemValidator = new MemberSaveModelValidator(_logger, _umbracoContextAccessor,_textService, _memberTypeService, _memberService);
+ var contentItemValidator = new MemberSaveModelValidator(_logger, _umbracoContextAccessor,_textService, _memberTypeService, _memberService, _shortStringHelper);
//now do each validation step
if (contentItemValidator.ValidateExistingContent(model, actionContext))
if (contentItemValidator.ValidateProperties(model, model, actionContext))
diff --git a/src/Umbraco.Web/Editors/MacroRenderingController.cs b/src/Umbraco.Web/Editors/MacroRenderingController.cs
index 86609a6254..9e9b7efc1b 100644
--- a/src/Umbraco.Web/Editors/MacroRenderingController.cs
+++ b/src/Umbraco.Web/Editors/MacroRenderingController.cs
@@ -164,7 +164,7 @@ namespace Umbraco.Web.Editors
var macro = new Macro(_shortStringHelper)
{
- Alias = macroName.ToSafeAlias(),
+ Alias = macroName.ToSafeAlias(ShortStringHelper),
Name = macroName,
MacroSource = model.VirtualPath.EnsureStartsWith("~"),
MacroType = MacroTypes.PartialView
diff --git a/src/Umbraco.Web/Editors/MacrosController.cs b/src/Umbraco.Web/Editors/MacrosController.cs
index 5254e2fc40..66c05485f1 100644
--- a/src/Umbraco.Web/Editors/MacrosController.cs
+++ b/src/Umbraco.Web/Editors/MacrosController.cs
@@ -9,7 +9,6 @@ using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
@@ -35,7 +34,7 @@ namespace Umbraco.Web.Editors
private readonly IMacroService _macroService;
public MacrosController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_shortStringHelper = shortStringHelper;
_macroService = Services.MacroService;
@@ -58,7 +57,7 @@ namespace Umbraco.Web.Editors
return this.ReturnErrorResponse("Name can not be empty");
}
- var alias = name.ToSafeAlias();
+ var alias = name.ToSafeAlias(ShortStringHelper);
if (_macroService.GetByAlias(alias) != null)
{
diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs
index 65c0d561b9..861bb5f42f 100644
--- a/src/Umbraco.Web/Editors/MediaController.cs
+++ b/src/Umbraco.Web/Editors/MediaController.cs
@@ -1,43 +1,43 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
+using System.Web.Http.Controllers;
using System.Web.Http.ModelBinding;
using Umbraco.Core;
-using Umbraco.Core.IO;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Membership;
-using Umbraco.Core.Persistence.DatabaseModelDefinitions;
-using Umbraco.Core.Services;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.Mvc;
-using Umbraco.Web.WebApi;
-using System.Linq;
-using System.Web.Http.Controllers;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
-using Umbraco.Web.WebApi.Filters;
-using Umbraco.Core.Persistence.Querying;
-using Notification = Umbraco.Web.Models.ContentEditing.Notification;
-using Umbraco.Core.Persistence;
using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Dictionary;
+using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
using Umbraco.Core.Models.Editors;
+using Umbraco.Core.Models.Entities;
+using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Validation;
+using Umbraco.Core.Persistence;
+using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.ContentApps;
using Umbraco.Web.Editors.Binders;
using Umbraco.Web.Editors.Filters;
-using Umbraco.Core.Models.Entities;
+using Umbraco.Web.Models.ContentEditing;
+using Umbraco.Web.Mvc;
+using Umbraco.Web.WebApi;
+using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Dictionary;
+using Notification = Umbraco.Web.Models.ContentEditing.Notification;
namespace Umbraco.Web.Editors
{
@@ -50,8 +50,8 @@ namespace Umbraco.Web.Editors
[MediaControllerControllerConfiguration]
public class MediaController : ContentControllerBase
{
- public MediaController(ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public MediaController(ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
}
@@ -696,7 +696,7 @@ namespace Umbraco.Web.Editors
foreach (var file in result.FileData)
{
var fileName = file.Headers.ContentDisposition.FileName.Trim(new[] { '\"' }).TrimEnd();
- var safeFileName = fileName.ToSafeFileName();
+ var safeFileName = fileName.ToSafeFileName(ShortStringHelper);
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
if (Current.Configs.Settings().Content.IsFileAllowedForUpload(ext))
diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs
index e590f2860f..b0f21e26e0 100644
--- a/src/Umbraco.Web/Editors/MediaTypeController.cs
+++ b/src/Umbraco.Web/Editors/MediaTypeController.cs
@@ -40,7 +40,7 @@ namespace Umbraco.Web.Editors
private readonly IShortStringHelper _shortStringHelper;
public MediaTypeController(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_shortStringHelper = shortStringHelper;
}
diff --git a/src/Umbraco.Web/Editors/MemberController.cs b/src/Umbraco.Web/Editors/MemberController.cs
index a270460075..86756b03dd 100644
--- a/src/Umbraco.Web/Editors/MemberController.cs
+++ b/src/Umbraco.Web/Editors/MemberController.cs
@@ -1,36 +1,36 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
+using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.ModelBinding;
using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Membership;
-using Umbraco.Core.Services;
-using Umbraco.Core.Services.Implement;
-using Umbraco.Web.WebApi;
-using Umbraco.Web.Models.ContentEditing;
-using Umbraco.Web.Mvc;
-using Umbraco.Web.WebApi.Filters;
-using System.Collections.Generic;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
+using Umbraco.Core.Dictionary;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
+using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Security;
+using Umbraco.Core.Services;
+using Umbraco.Core.Services.Implement;
+using Umbraco.Core.Strings;
using Umbraco.Web.ContentApps;
using Umbraco.Web.Editors.Binders;
using Umbraco.Web.Editors.Filters;
+using Umbraco.Web.Models.ContentEditing;
+using Umbraco.Web.Mvc;
+using Umbraco.Web.WebApi;
+using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
-using Umbraco.Core.Dictionary;
-using Umbraco.Web.Security;
-using Umbraco.Core.Security;
-using System.Threading.Tasks;
namespace Umbraco.Web.Editors
{
@@ -43,8 +43,8 @@ namespace Umbraco.Web.Editors
[OutgoingNoHyphenGuidFormat]
public class MemberController : ContentControllerBase
{
- public MemberController(IMemberPasswordConfiguration passwordConfig, ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public MemberController(IMemberPasswordConfiguration passwordConfig, ICultureDictionary cultureDictionary, PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_passwordConfig = passwordConfig ?? throw new ArgumentNullException(nameof(passwordConfig));
_propertyEditors = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs
index 0ad0d405e3..b10fc23e50 100644
--- a/src/Umbraco.Web/Editors/MemberTypeController.cs
+++ b/src/Umbraco.Web/Editors/MemberTypeController.cs
@@ -13,6 +13,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
@@ -20,7 +21,6 @@ using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Editors
{
-
///
/// An API controller used for dealing with member types
///
@@ -28,8 +28,8 @@ namespace Umbraco.Web.Editors
[UmbracoTreeAuthorize(new string[] { Constants.Trees.MemberTypes, Constants.Trees.Members})]
public class MemberTypeController : ContentTypeControllerBase
{
- public MemberTypeController(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public MemberTypeController(ICultureDictionary cultureDictionary, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(cultureDictionary, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
@@ -98,7 +98,7 @@ namespace Umbraco.Web.Editors
[UmbracoTreeAuthorize(Constants.Trees.MemberTypes)]
public MemberTypeDisplay GetEmpty()
{
- var ct = new MemberType(Current.ShortStringHelper, -1);
+ var ct = new MemberType(ShortStringHelper, -1);
ct.Icon = Constants.Icons.Member;
var dto = Mapper.Map(ct);
diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs
index 64141a32f2..8b62b23688 100644
--- a/src/Umbraco.Web/Editors/PackageInstallController.cs
+++ b/src/Umbraco.Web/Editors/PackageInstallController.cs
@@ -16,6 +16,7 @@ using Umbraco.Core.Models.Packaging;
using Umbraco.Core.Packaging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.JavaScript;
using Umbraco.Web.Models;
using Umbraco.Web.Models.ContentEditing;
@@ -38,8 +39,8 @@ namespace Umbraco.Web.Editors
private readonly IUmbracoVersion _umbracoVersion;
public PackageInstallController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor,
ISqlContext sqlContext, ServiceContext services, AppCaches appCaches,
- IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IUmbracoVersion umbracoVersion)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, IUmbracoVersion umbracoVersion)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_umbracoVersion = umbracoVersion;
diff --git a/src/Umbraco.Web/Editors/RelationTypeController.cs b/src/Umbraco.Web/Editors/RelationTypeController.cs
index f12faf77cc..0906728db2 100644
--- a/src/Umbraco.Web/Editors/RelationTypeController.cs
+++ b/src/Umbraco.Web/Editors/RelationTypeController.cs
@@ -10,8 +10,8 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
-using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -28,8 +28,8 @@ namespace Umbraco.Web.Editors
[EnableOverrideAuthorization]
public class RelationTypeController : BackOfficeNotificationsController
{
- public RelationTypeController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public RelationTypeController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
@@ -100,7 +100,7 @@ namespace Umbraco.Web.Editors
/// A containing the persisted relation type's ID.
public HttpResponseMessage PostCreate(RelationTypeSave relationType)
{
- var relationTypePersisted = new RelationType(relationType.Name, relationType.Name.ToSafeAlias(true), relationType.IsBidirectional, relationType.ChildObjectType, relationType.ParentObjectType);
+ var relationTypePersisted = new RelationType(relationType.Name, relationType.Name.ToSafeAlias(ShortStringHelper, true), relationType.IsBidirectional, relationType.ChildObjectType, relationType.ParentObjectType);
try
{
diff --git a/src/Umbraco.Web/Editors/SectionController.cs b/src/Umbraco.Web/Editors/SectionController.cs
index ac98f576d4..102f962ecb 100644
--- a/src/Umbraco.Web/Editors/SectionController.cs
+++ b/src/Umbraco.Web/Editors/SectionController.cs
@@ -8,6 +8,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Trees;
using Section = Umbraco.Web.Models.ContentEditing.Section;
using Umbraco.Web.Models.Trees;
@@ -26,8 +27,8 @@ namespace Umbraco.Web.Editors
private readonly ITreeService _treeService;
public SectionController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState,
- IDashboardService dashboardService, ISectionService sectionService, ITreeService treeService, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ IDashboardService dashboardService, ISectionService sectionService, ITreeService treeService, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_dashboardService = dashboardService;
_sectionService = sectionService;
diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs
index 666e1d2987..524ecea1eb 100644
--- a/src/Umbraco.Web/Editors/TemplateController.cs
+++ b/src/Umbraco.Web/Editors/TemplateController.cs
@@ -1,17 +1,18 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Cache;
-using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
@@ -23,8 +24,8 @@ namespace Umbraco.Web.Editors
[UmbracoTreeAuthorize(Constants.Trees.Templates)]
public class TemplateController : BackOfficeNotificationsController
{
- public TemplateController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public TemplateController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
@@ -82,7 +83,7 @@ namespace Umbraco.Web.Editors
public TemplateDisplay GetScaffold(int id)
{
//empty default
- var dt = new Template(Current.ShortStringHelper, "", "");
+ var dt = new Template(ShortStringHelper, string.Empty, string.Empty);
dt.Path = "-1";
if (id > 0)
diff --git a/src/Umbraco.Web/Editors/TinyMceController.cs b/src/Umbraco.Web/Editors/TinyMceController.cs
index 9f9cc23e08..65e3f7ea18 100644
--- a/src/Umbraco.Web/Editors/TinyMceController.cs
+++ b/src/Umbraco.Web/Editors/TinyMceController.cs
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
@@ -25,20 +25,20 @@ namespace Umbraco.Web.Editors
Constants.Applications.Members)]
public class TinyMceController : UmbracoAuthorizedApiController
{
- private IMediaService _mediaService;
- private IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
+ private readonly IMediaService _mediaService;
+ private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
+ private readonly IShortStringHelper _shortStringHelper;
-
- public TinyMceController(IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
+ public TinyMceController(IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IShortStringHelper shortStringHelper)
{
_mediaService = mediaService;
_contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
+ _shortStringHelper = shortStringHelper;
}
[HttpPost]
public async Task UploadImage()
{
-
if (Request.Content.IsMimeMultipartContent() == false)
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
@@ -75,7 +75,7 @@ namespace Umbraco.Web.Editors
// Really we should only have one file per request to this endpoint
var file = result.FileData[0];
var fileName = file.Headers.ContentDisposition.FileName.Trim(new[] { '\"' }).TrimEnd();
- var safeFileName = fileName.ToSafeFileName();
+ var safeFileName = fileName.ToSafeFileName(_shortStringHelper);
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
if (Current.Configs.Settings().Content.IsFileAllowedForUpload(ext) == false || Current.Configs.Settings().Content.ImageFileTypes.Contains(ext) == false)
diff --git a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs
index 385ed89b8f..81727dbb1d 100644
--- a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs
+++ b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs
@@ -1,9 +1,11 @@
-using Umbraco.Core;
+using System;
+using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
@@ -24,9 +26,12 @@ namespace Umbraco.Web.Editors
{
}
- protected UmbracoAuthorizedJsonController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
+ protected UmbracoAuthorizedJsonController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
{
+ ShortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
+
+ public IShortStringHelper ShortStringHelper { get; }
}
}
diff --git a/src/Umbraco.Web/Editors/UserGroupsController.cs b/src/Umbraco.Web/Editors/UserGroupsController.cs
index 101716c84e..394a08433e 100644
--- a/src/Umbraco.Web/Editors/UserGroupsController.cs
+++ b/src/Umbraco.Web/Editors/UserGroupsController.cs
@@ -9,6 +9,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Editors.Filters;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
@@ -107,7 +108,7 @@ namespace Umbraco.Web.Editors
///
public UserGroupDisplay GetEmptyUserGroup()
{
- return Mapper.Map(new UserGroup(Current.ShortStringHelper));
+ return Mapper.Map(new UserGroup(ShortStringHelper));
}
///
diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs
index 5ab374ce99..c6530f9b28 100644
--- a/src/Umbraco.Web/Editors/UsersController.cs
+++ b/src/Umbraco.Web/Editors/UsersController.cs
@@ -23,6 +23,7 @@ using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Editors.Filters;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
@@ -40,8 +41,8 @@ namespace Umbraco.Web.Editors
[IsCurrentUserModelFilter]
public class UsersController : UmbracoAuthorizedJsonController
{
- public UsersController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public UsersController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
}
@@ -63,10 +64,10 @@ namespace Umbraco.Web.Editors
[AdminUsersAuthorize]
public async Task PostSetAvatar(int id)
{
- return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, id);
+ return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, ShortStringHelper, id);
}
- internal static async Task PostSetAvatarInternal(HttpRequestMessage request, IUserService userService, IAppCache cache, int id)
+ internal async static Task PostSetAvatarInternal(HttpRequestMessage request, IUserService userService, IAppCache cache, IShortStringHelper shortStringHelper, int id)
{
if (request.Content.IsMimeMultipartContent() == false)
{
@@ -98,7 +99,7 @@ namespace Umbraco.Web.Editors
//get the file info
var file = result.FileData[0];
var fileName = file.Headers.ContentDisposition.FileName.Trim(new[] { '\"' }).TrimEnd();
- var safeFileName = fileName.ToSafeFileName();
+ var safeFileName = fileName.ToSafeFileName(shortStringHelper);
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
if (Current.Configs.Settings().Content.DisallowedUploadFiles.Contains(ext) == false)
diff --git a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
index 0e43de6410..9ae58bf4d0 100644
--- a/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
+++ b/src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs
@@ -76,8 +76,8 @@ namespace Umbraco.Web.Macros
/// The content.
///
/// This is for usage only.
- internal PublishedContentHashtableConverter(IContent content, IVariationContextAccessor variationContextAccessor)
- : this(new PagePublishedContent(content, variationContextAccessor))
+ internal PublishedContentHashtableConverter(IContent content, IVariationContextAccessor variationContextAccessor, IShortStringHelper shortStringHelper)
+ : this(new PagePublishedContent(content, variationContextAccessor, shortStringHelper))
{ }
#endregion
@@ -184,6 +184,7 @@ namespace Umbraco.Web.Macros
private readonly IPublishedProperty[] _properties;
private IReadOnlyDictionary _cultureInfos;
private readonly IVariationContextAccessor _variationContextAccessor;
+ private readonly IShortStringHelper _shortStringHelper;
private static readonly IReadOnlyDictionary NoCultureInfos = new Dictionary();
@@ -192,10 +193,11 @@ namespace Umbraco.Web.Macros
Id = id;
}
- public PagePublishedContent(IContent inner, IVariationContextAccessor variationContextAccessor)
+ public PagePublishedContent(IContent inner, IVariationContextAccessor variationContextAccessor, IShortStringHelper shortStringHelper)
{
- _inner = inner ?? throw new NullReferenceException("content");
+ _inner = inner ?? throw new ArgumentNullException(nameof(inner));
_variationContextAccessor = variationContextAccessor;
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
Id = _inner.Id;
Key = _inner.Key;
@@ -242,7 +244,7 @@ namespace Umbraco.Web.Macros
var urlSegmentProviders = Current.UrlSegmentProviders; // TODO inject
return _cultureInfos = _inner.PublishCultureInfos.Values
- .ToDictionary(x => x.Culture, x => new PublishedCultureInfo(x.Culture, x.Name, _inner.GetUrlSegment(Current.ShortStringHelper, urlSegmentProviders, x.Culture), x.Date));
+ .ToDictionary(x => x.Culture, x => new PublishedCultureInfo(x.Culture, x.Name, _inner.GetUrlSegment(_shortStringHelper, urlSegmentProviders, x.Culture), x.Date));
}
}
diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
index 6eaeef17f2..c39d90682d 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.Mapping
public ContentTypeMapDefinition(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IFileService fileService,
IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService,
- ILogger logger)
+ ILogger logger, IShortStringHelper shortStringHelper)
{
_propertyEditors = propertyEditors;
_dataTypeService = dataTypeService;
@@ -40,7 +40,7 @@ namespace Umbraco.Web.Models.Mapping
_mediaTypeService = mediaTypeService;
_memberTypeService = memberTypeService;
_logger = logger;
- _shortStringHelper = Current.ShortStringHelper;
+ _shortStringHelper = shortStringHelper;
}
@@ -510,7 +510,7 @@ namespace Umbraco.Web.Models.Mapping
{
MapTypeToDisplayBase(source, target);
- var groupsMapper = new PropertyTypeGroupMapper(_propertyEditors, _dataTypeService, _logger);
+ var groupsMapper = new PropertyTypeGroupMapper(_propertyEditors, _dataTypeService, _shortStringHelper, _logger);
target.Groups = groupsMapper.Map(source);
}
diff --git a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs
index 104f0acb15..c41065a967 100644
--- a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Umbraco.Composing;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models.ContentEditing;
using Current = Umbraco.Core.Composing.Current;
@@ -17,12 +17,14 @@ namespace Umbraco.Web.Models.Mapping
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly IDataTypeService _dataTypeService;
+ private readonly IShortStringHelper _shortStringHelper;
private readonly ILogger _logger;
- public PropertyTypeGroupMapper(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, ILogger logger)
+ public PropertyTypeGroupMapper(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, ILogger logger)
{
_propertyEditors = propertyEditors;
_dataTypeService = dataTypeService;
+ _shortStringHelper = shortStringHelper;
_logger = logger;
}
@@ -152,7 +154,7 @@ namespace Umbraco.Web.Models.Mapping
// handle locked properties
var lockedPropertyAliases = new List();
// add built-in member property aliases to list of aliases to be locked
- foreach (var propertyAlias in ConventionsHelper.GetStandardPropertyTypeStubs(Current.ShortStringHelper).Keys)
+ foreach (var propertyAlias in ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper).Keys)
{
lockedPropertyAliases.Add(propertyAlias);
}
diff --git a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs
index 1937634ada..942eded5f8 100644
--- a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs
@@ -13,6 +13,7 @@ using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Sections;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Actions;
using Umbraco.Web.Services;
@@ -27,9 +28,10 @@ namespace Umbraco.Web.Models.Mapping
private readonly ActionCollection _actions;
private readonly AppCaches _appCaches;
private readonly IGlobalSettings _globalSettings;
+ private readonly IShortStringHelper _shortStringHelper;
public UserMapDefinition(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService,
- AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings)
+ AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings, IShortStringHelper shortStringHelper)
{
_sectionService = sectionService;
_entityService = entityService;
@@ -38,11 +40,12 @@ namespace Umbraco.Web.Models.Mapping
_actions = actions;
_appCaches = appCaches;
_globalSettings = globalSettings;
+ _shortStringHelper = shortStringHelper;
}
public void DefineMaps(UmbracoMapper mapper)
{
- mapper.Define((source, context) => new UserGroup(Current.ShortStringHelper) { CreateDate = DateTime.UtcNow }, Map);
+ mapper.Define((source, context) => new UserGroup(_shortStringHelper) { CreateDate = DateTime.UtcNow }, Map);
mapper.Define(Map);
mapper.Define((source, context) => new ContentEditing.UserProfile(), Map);
mapper.Define((source, context) => new UserGroupBasic(), Map);
diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
index 8f07dfb18b..faf82e5f1e 100644
--- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
+++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
@@ -1,18 +1,17 @@
using System;
using System.Linq;
using System.Web;
-using System.Web.Compilation;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
using Umbraco.Core;
-using Umbraco.Core.Logging;
using Umbraco.Core.Composing;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Strings;
+using Umbraco.Web.Features;
using Umbraco.Web.Models;
using Umbraco.Web.Routing;
-using System.Collections.Generic;
using Current = Umbraco.Web.Composing.Current;
-using Umbraco.Web.Features;
namespace Umbraco.Web.Mvc
{
@@ -29,17 +28,20 @@ namespace Umbraco.Web.Mvc
private readonly IControllerFactory _controllerFactory;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly UmbracoContext _umbracoContext;
+ private readonly IShortStringHelper _shortStringHelper;
- public RenderRouteHandler(IUmbracoContextAccessor umbracoContextAccessor, IControllerFactory controllerFactory)
+ public RenderRouteHandler(IUmbracoContextAccessor umbracoContextAccessor, IControllerFactory controllerFactory, IShortStringHelper shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
_controllerFactory = controllerFactory ?? throw new ArgumentNullException(nameof(controllerFactory));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
- public RenderRouteHandler(UmbracoContext umbracoContext, IControllerFactory controllerFactory)
+ public RenderRouteHandler(UmbracoContext umbracoContext, IControllerFactory controllerFactory, IShortStringHelper shortStringHelper)
{
_umbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext));
_controllerFactory = controllerFactory ?? throw new ArgumentNullException(nameof(controllerFactory));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
private UmbracoContext UmbracoContext => _umbracoContext ?? _umbracoContextAccessor.UmbracoContext;
@@ -262,7 +264,7 @@ namespace Umbraco.Web.Mvc
//the template Alias should always be already saved with a safe name.
//if there are hyphens in the name and there is a hijacked route, then the Action will need to be attributed
// with the action name attribute.
- var templateName = request.TemplateAlias.Split('.')[0].ToSafeAlias();
+ var templateName = request.TemplateAlias.Split('.')[0].ToSafeAlias(_shortStringHelper);
def.ActionName = templateName;
}
diff --git a/src/Umbraco.Web/Profiling/WebProfilingController.cs b/src/Umbraco.Web/Profiling/WebProfilingController.cs
index a8935da033..218ecd0669 100644
--- a/src/Umbraco.Web/Profiling/WebProfilingController.cs
+++ b/src/Umbraco.Web/Profiling/WebProfilingController.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Editors;
using Umbraco.Web.WebApi.Filters;
@@ -17,8 +18,8 @@ namespace Umbraco.Web.Profiling
{
private readonly IRuntimeState _runtimeState;
- public WebProfilingController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
- : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
+ public WebProfilingController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper)
+ : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_runtimeState = runtimeState;
}
diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
index 0815d09d08..0a32a2eb7c 100644
--- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
@@ -6,6 +6,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -29,8 +30,9 @@ namespace Umbraco.Web.PropertyEditors
IDataTypeService dataTypeService,
ILocalizationService localizationService,
ILogger logger,
- IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ IIOHelper ioHelper,
+ IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
_dataTypeService = dataTypeService;
_localizationService = localizationService;
@@ -42,11 +44,11 @@ namespace Umbraco.Web.PropertyEditors
return new ContentPickerConfigurationEditor(_ioHelper);
}
- protected override IDataValueEditor CreateValueEditor() => new ContentPickerPropertyValueEditor(_dataTypeService, _localizationService, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new ContentPickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
internal class ContentPickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public ContentPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute) : base(dataTypeService, localizationService,Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public ContentPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute) : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
index d34a630d8b..35d4e29737 100644
--- a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -23,8 +24,8 @@ namespace Umbraco.Web.PropertyEditors
/// Initializes a new instance of the class.
///
///
- public DateTimePropertyEditor(ILogger logger, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public DateTimePropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs b/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
index 6bf48c6be2..4e242fc380 100644
--- a/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DateValueEditor.cs
@@ -14,8 +14,8 @@ namespace Umbraco.Web.PropertyEditors
///
internal class DateValueEditor : DataValueEditor
{
- public DateValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper, attribute)
+ public DateValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
Validators.Add(new DateTimeValidator());
}
diff --git a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
index 8780a5de0d..894c8a3a43 100644
--- a/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/DecimalPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -20,8 +21,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public DecimalPropertyEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public DecimalPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{ }
///
diff --git a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
index 94ac6f4d36..619419085d 100644
--- a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -20,8 +21,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// The constructor will setup the property editor based on the attribute if one is found
///
- public EmailAddressPropertyEditor(ILogger logger, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public EmailAddressPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
index e30a0899c7..0a77c6c12d 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
@@ -9,7 +9,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
-using Umbraco.Core.Services.Implement;
+using Umbraco.Core.Strings;
using Umbraco.Web.Media;
namespace Umbraco.Web.PropertyEditors
@@ -28,8 +28,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
- public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSection, IDataTypeService dataTypeService, ILocalizationService localizationService)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public FileUploadPropertyEditor(ILogger logger, IMediaFileSystem mediaFileSystem, IContentSection contentSection, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
_contentSection = contentSection;
@@ -44,7 +44,7 @@ namespace Umbraco.Web.PropertyEditors
/// The corresponding property value editor.
protected override IDataValueEditor CreateValueEditor()
{
- var editor = new FileUploadPropertyValueEditor(Attribute, _mediaFileSystem, _dataTypeService, _localizationService);
+ var editor = new FileUploadPropertyValueEditor(Attribute, _mediaFileSystem, _dataTypeService, _localizationService, ShortStringHelper);
editor.Validators.Add(new UploadFileTypeValidator());
return editor;
}
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
index a07cfe9dcd..a5e12165af 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs
@@ -1,14 +1,12 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -19,8 +17,8 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly IMediaFileSystem _mediaFileSystem;
- public FileUploadPropertyValueEditor(DataEditorAttribute attribute, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService)
- : base(dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper, attribute)
+ public FileUploadPropertyValueEditor(DataEditorAttribute attribute, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
}
diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
index 8baca0e27d..51f1197245 100644
--- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
@@ -10,11 +10,11 @@ using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Templates;
namespace Umbraco.Web.PropertyEditors
{
-
///
/// Represents a grid property and parameter editor.
///
@@ -28,11 +28,11 @@ namespace Umbraco.Web.PropertyEditors
Group = Constants.PropertyEditors.Groups.RichContent)]
public class GridPropertyEditor : DataEditor
{
- private IUmbracoContextAccessor _umbracoContextAccessor;
+ private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- private ILogger _logger;
+ private readonly ILogger _logger;
private readonly IMediaService _mediaService;
private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
private readonly HtmlImageSourceParser _imageSourceParser;
@@ -49,8 +49,9 @@ namespace Umbraco.Web.PropertyEditors
HtmlImageSourceParser imageSourceParser,
RichTextEditorPastedImages pastedImages,
HtmlLocalLinkParser localLinkParser,
- IIOHelper ioHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService, Current.ShortStringHelper)
+ IIOHelper ioHelper,
+ IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor;
_dataTypeService = dataTypeService;
@@ -70,7 +71,7 @@ namespace Umbraco.Web.PropertyEditors
/// Overridden to ensure that the value is validated
///
///
- protected override IDataValueEditor CreateValueEditor() => new GridPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _imageSourceParser, _pastedImages, _localLinkParser);
+ protected override IDataValueEditor CreateValueEditor() => new GridPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _imageSourceParser, _pastedImages, _localLinkParser, ShortStringHelper);
protected override IConfigurationEditor CreateConfigurationEditor() => new GridConfigurationEditor(_ioHelper);
@@ -92,14 +93,15 @@ namespace Umbraco.Web.PropertyEditors
ILocalizationService localizationService,
HtmlImageSourceParser imageSourceParser,
RichTextEditorPastedImages pastedImages,
- HtmlLocalLinkParser localLinkParser)
- : base(dataTypeService, localizationService, Current.Services.TextService, Current.ShortStringHelper, attribute)
+ HtmlLocalLinkParser localLinkParser,
+ IShortStringHelper shortStringHelper)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_umbracoContextAccessor = umbracoContextAccessor;
_imageSourceParser = imageSourceParser;
_pastedImages = pastedImages;
- _richTextPropertyValueEditor = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, mediaService, contentTypeBaseServiceProvider, umbracoContextAccessor,logger, dataTypeService, localizationService, imageSourceParser, localLinkParser, pastedImages);
- _mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(dataTypeService, localizationService, attribute);
+ _richTextPropertyValueEditor = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, mediaService, contentTypeBaseServiceProvider, umbracoContextAccessor,logger, dataTypeService, localizationService, shortStringHelper, imageSourceParser, localLinkParser, pastedImages);
+ _mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(dataTypeService, localizationService, shortStringHelper, attribute);
}
///
diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
index cfe32a1095..a86f2f9a9b 100644
--- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs
@@ -58,7 +58,7 @@ namespace Umbraco.Web.PropertyEditors
/// Creates the corresponding property value editor.
///
/// The corresponding property value editor.
- protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, _dataTypeService, _localizationService);
+ protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, _dataTypeService, _localizationService, ShortStringHelper);
///
/// Creates the corresponding preValue editor.
diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
index 1e404109ce..f8b6688ded 100644
--- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs
@@ -10,6 +10,7 @@ using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using File = System.IO.File;
namespace Umbraco.Web.PropertyEditors
@@ -22,8 +23,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILogger _logger;
private readonly IMediaFileSystem _mediaFileSystem;
- public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService)
- : base(dataTypeService, localizationService, Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public ImageCropperPropertyValueEditor(DataEditorAttribute attribute, ILogger logger, IMediaFileSystem mediaFileSystem, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_mediaFileSystem = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
diff --git a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
index a47dd125e5..705506abd5 100644
--- a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs
@@ -1,9 +1,9 @@
-using System.Collections.Generic;
-using Umbraco.Core;
+using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -25,8 +25,8 @@ namespace Umbraco.Web.PropertyEditors
/// Initializes a new instance of the class.
///
///
- public ListViewPropertyEditor(ILogger logger, IIOHelper iioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public ListViewPropertyEditor(ILogger logger, IIOHelper iioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
_iioHelper = iioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
index 16a4ad0597..f08452294d 100644
--- a/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MarkdownPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -23,8 +24,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public MarkdownPropertyEditor(ILogger logger, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MarkdownPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
index ad287f5f2e..735cd1ac79 100644
--- a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
@@ -49,11 +49,12 @@ namespace Umbraco.Web.PropertyEditors
///
protected override IConfigurationEditor CreateConfigurationEditor() => new MediaPickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(_dataTypeService, _localizationService, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
internal class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public MediaPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute) : base(dataTypeService,localizationService, Current.Services.TextService,Current.ShortStringHelper,attribute)
+ public MediaPickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService,localizationService, Current.Services.TextService, shortStringHelper,attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
index c2189c57f4..f88e08d84d 100644
--- a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -14,8 +15,8 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.MemberGroup)]
public class MemberGroupPickerPropertyEditor : DataEditor
{
- public MemberGroupPickerPropertyEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MemberGroupPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{ }
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
index 4c643a356b..b7ee696940 100644
--- a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -14,8 +15,8 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.Member)]
public class MemberPickerPropertyEditor : DataEditor
{
- public MemberPickerPropertyEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MemberPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{ }
protected override IConfigurationEditor CreateConfigurationEditor() => new MemberPickerConfiguration();
diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
index 02b0a31596..946b11f365 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs
@@ -6,6 +6,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -22,8 +23,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- public MultiNodeTreePickerPropertyEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public MultiNodeTreePickerPropertyEditor(ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
_dataTypeService = dataTypeService;
_localizationService = localizationService;
@@ -32,11 +33,12 @@ namespace Umbraco.Web.PropertyEditors
protected override IConfigurationEditor CreateConfigurationEditor() => new MultiNodePickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MultiNodeTreePickerPropertyValueEditor(_dataTypeService, _localizationService, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MultiNodeTreePickerPropertyValueEditor(_dataTypeService, _localizationService, ShortStringHelper, Attribute);
public class MultiNodeTreePickerPropertyValueEditor : DataValueEditor, IDataValueReference
{
- public MultiNodeTreePickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute): base(dataTypeService, localizationService, Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public MultiNodeTreePickerPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
}
diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
index 63b3d4fcd3..a56a0a8c63 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
@@ -5,10 +5,8 @@ using Umbraco.Core.IO;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.PublishedCache;
-using System.Collections.Generic;
-using Umbraco.Core.Models.Editors;
-using Newtonsoft.Json;
namespace Umbraco.Web.PropertyEditors
{
@@ -28,8 +26,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- public MultiUrlPickerPropertyEditor(ILogger logger, IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper, EditorType.PropertyValue)
+ public MultiUrlPickerPropertyEditor(ILogger logger, IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, IDataTypeService dataTypeService, ILocalizationService localizationService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, EditorType.PropertyValue)
{
_entityService = entityService ?? throw new ArgumentNullException(nameof(entityService));
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
@@ -40,6 +38,6 @@ namespace Umbraco.Web.PropertyEditors
protected override IConfigurationEditor CreateConfigurationEditor() => new MultiUrlPickerConfigurationEditor(_ioHelper);
- protected override IDataValueEditor CreateValueEditor() => new MultiUrlPickerValueEditor(_entityService, _publishedSnapshotAccessor, Logger, _dataTypeService, _localizationService, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new MultiUrlPickerValueEditor(_entityService, _publishedSnapshotAccessor, Logger, _dataTypeService, _localizationService, ShortStringHelper, Attribute);
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
index 6363048b34..5564d44e4a 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerValueEditor.cs
@@ -10,6 +10,7 @@ using Umbraco.Core.Models.Editors;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.PublishedCache;
@@ -22,8 +23,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly ILogger _logger;
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
- public MultiUrlPickerValueEditor(IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper, attribute)
+ public MultiUrlPickerValueEditor(IEntityService entityService, IPublishedSnapshotAccessor publishedSnapshotAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_entityService = entityService ?? throw new ArgumentNullException(nameof(entityService));
_publishedSnapshotAccessor = publishedSnapshotAccessor ?? throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
index c1937562df..7db6c6f0d9 100644
--- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
@@ -13,6 +13,7 @@ using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.Validators;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -36,8 +37,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public MultipleTextStringPropertyEditor(ILogger logger, IIOHelper ioHelper, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService)
- : base(logger, dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MultipleTextStringPropertyEditor(ILogger logger, IIOHelper ioHelper, IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(logger, dataTypeService, localizationService, Current.Services.TextService, shortStringHelper)
{
_ioHelper = ioHelper;
_dataTypeService = dataTypeService;
@@ -46,7 +47,7 @@ namespace Umbraco.Web.PropertyEditors
}
///
- protected override IDataValueEditor CreateValueEditor() => new MultipleTextStringPropertyValueEditor(_dataTypeService, _localizationService,Attribute, _localizedTextService);
+ protected override IDataValueEditor CreateValueEditor() => new MultipleTextStringPropertyValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
///
protected override IConfigurationEditor CreateConfigurationEditor() => new MultipleTextStringConfigurationEditor(_ioHelper);
@@ -58,8 +59,8 @@ namespace Umbraco.Web.PropertyEditors
{
private readonly ILocalizedTextService _localizedTextService;
- public MultipleTextStringPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute, ILocalizedTextService localizedTextService)
- : base(dataTypeService, localizationService, Current.Services.TextService,Current.ShortStringHelper, attribute)
+ public MultipleTextStringPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_localizedTextService = localizedTextService;
}
diff --git a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
index 82fad308e5..995f7ae509 100644
--- a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs
@@ -67,7 +67,7 @@ namespace Umbraco.Web.PropertyEditors
#region Value Editor
- protected override IDataValueEditor CreateValueEditor() => new NestedContentPropertyValueEditor(_dataTypeService, _localizationService, Attribute, PropertyEditors, _contentTypeService);
+ protected override IDataValueEditor CreateValueEditor() => new NestedContentPropertyValueEditor(_dataTypeService, _localizationService, _contentTypeService, ShortStringHelper, Attribute, PropertyEditors);
internal class NestedContentPropertyValueEditor : DataValueEditor, IDataValueReference
{
@@ -79,8 +79,8 @@ namespace Umbraco.Web.PropertyEditors
Current.Services.ContentTypeService.GetAll().ToDictionary(c => c.Alias)
);
- public NestedContentPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IContentTypeService contentTypeService)
- : base(dataTypeService, localizationService, Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public NestedContentPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IContentTypeService contentTypeService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute, PropertyEditorCollection propertyEditors)
+ : base(dataTypeService, localizationService, Current.Services.TextService, shortStringHelper, attribute)
{
_propertyEditors = propertyEditors;
_dataTypeService = dataTypeService;
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
index dd02f10245..2771b24bd6 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/ContentTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -17,8 +18,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public ContentTypeParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public ContentTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", false);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
index 0b85f99662..baa38b492e 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentPickerParameterEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -18,8 +19,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public MultipleContentPickerParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MultipleContentPickerParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiPicker", "1");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
index c6b1c52449..7fa3679eb1 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleContentTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -11,8 +12,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultipleContentTypeParameterEditor : DataEditor
{
- public MultipleContentTypeParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public MultipleContentTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", true);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
index f3d0231b13..22a3f9784f 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultipleMediaPickerParameterEditor.cs
@@ -2,6 +2,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -19,8 +20,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
///
/// Initializes a new instance of the class.
///
- public MultipleMediaPickerParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MultipleMediaPickerParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
DefaultConfiguration.Add("multiPicker", "1");
}
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
index 0329645ede..4db3226f39 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyGroupParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -11,8 +12,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultiplePropertyGroupParameterEditor : DataEditor
{
- public MultiplePropertyGroupParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MultiplePropertyGroupParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", true);
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
index bce3af2273..9978513810 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/MultiplePropertyTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -11,8 +12,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class MultiplePropertyTypeParameterEditor : DataEditor
{
- public MultiplePropertyTypeParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public MultiplePropertyTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "1");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
index e047bab1f5..eff4546645 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyGroupParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -11,8 +12,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class PropertyGroupParameterEditor : DataEditor
{
- public PropertyGroupParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public PropertyGroupParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "0");
diff --git a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
index b91094a756..e9cf57b7b6 100644
--- a/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ParameterEditors/PropertyTypeParameterEditor.cs
@@ -1,6 +1,7 @@
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
@@ -11,8 +12,8 @@ namespace Umbraco.Web.PropertyEditors.ParameterEditors
"entitypicker")]
public class PropertyTypeParameterEditor : DataEditor
{
- public PropertyTypeParameterEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public PropertyTypeParameterEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
// configure
DefaultConfiguration.Add("multiple", "0");
diff --git a/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
index 384e1c0019..005a684c0d 100644
--- a/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs
@@ -4,6 +4,7 @@ using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -25,8 +26,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// The constructor will setup the property editor based on the attribute if one is found
///
- public RadioButtonsPropertyEditor(ILogger logger, ILocalizedTextService textService, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, Current.ShortStringHelper)
+ public RadioButtonsPropertyEditor(ILogger logger, ILocalizedTextService textService, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService,Current.Services.TextService, shortStringHelper)
{
_textService = textService;
_ioHelper = ioHelper;
diff --git a/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs b/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs
index 23b3050035..47695c6e49 100644
--- a/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs
+++ b/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs
@@ -8,6 +8,7 @@ using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Templates;
namespace Umbraco.Web.PropertyEditors
@@ -19,16 +20,18 @@ namespace Umbraco.Web.PropertyEditors
private readonly IIOHelper _ioHelper;
private readonly IMediaService _mediaService;
private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
+ private readonly IShortStringHelper _shortStringHelper;
const string TemporaryImageDataAttribute = "data-tmpimg";
- public RichTextEditorPastedImages(IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IIOHelper ioHelper, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
+ public RichTextEditorPastedImages(IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IIOHelper ioHelper, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IShortStringHelper shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_ioHelper = ioHelper;
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
_contentTypeBaseServiceProvider = contentTypeBaseServiceProvider ?? throw new ArgumentNullException(nameof(contentTypeBaseServiceProvider));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
///
@@ -63,7 +66,7 @@ namespace Umbraco.Web.PropertyEditors
var absoluteTempImagePath = _ioHelper.MapPath(tmpImgPath);
var fileName = Path.GetFileName(absoluteTempImagePath);
- var safeFileName = fileName.ToSafeFileName();
+ var safeFileName = fileName.ToSafeFileName(_shortStringHelper);
var mediaItemName = safeFileName.ToFriendlyName();
IMedia mediaFile;
diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
index dcc83f1a3c..f80ee2fa6f 100644
--- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs
@@ -29,16 +29,17 @@ namespace Umbraco.Web.PropertyEditors
Icon = "icon-browser-window")]
public class RichTextPropertyEditor : DataEditor
{
- private IUmbracoContextAccessor _umbracoContextAccessor;
+ private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly HtmlImageSourceParser _imageSourceParser;
private readonly HtmlLocalLinkParser _localLinkParser;
private readonly RichTextEditorPastedImages _pastedImages;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
- private ILogger _logger;
+ private readonly ILogger _logger;
private readonly IMediaService _mediaService;
private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
+ private readonly IShortStringHelper _shortStringHelper;
///
/// The constructor will setup the property editor based on the attribute if one is found
@@ -56,7 +57,7 @@ namespace Umbraco.Web.PropertyEditors
IShortStringHelper shortStringHelper,
IIOHelper ioHelper,
ILocalizedTextService localizedTextService)
- : base(logger, dataTypeService, localizationService, localizedTextService,shortStringHelper)
+ : base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor;
_imageSourceParser = imageSourceParser;
@@ -68,13 +69,14 @@ namespace Umbraco.Web.PropertyEditors
_logger = logger;
_mediaService = mediaService;
_contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
+ _shortStringHelper = shortStringHelper;
}
///
/// Create a custom value editor
///
///
- protected override IDataValueEditor CreateValueEditor() => new RichTextPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _imageSourceParser, _localLinkParser, _pastedImages);
+ protected override IDataValueEditor CreateValueEditor() => new RichTextPropertyValueEditor(Attribute, _mediaService, _contentTypeBaseServiceProvider, _umbracoContextAccessor, _logger, _dataTypeService, _localizationService, _shortStringHelper, _imageSourceParser, _localLinkParser, _pastedImages);
protected override IConfigurationEditor CreateConfigurationEditor() => new RichTextConfigurationEditor(_ioHelper);
@@ -90,8 +92,8 @@ namespace Umbraco.Web.PropertyEditors
private readonly HtmlLocalLinkParser _localLinkParser;
private readonly RichTextEditorPastedImages _pastedImages;
- public RichTextPropertyValueEditor(DataEditorAttribute attribute, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, HtmlImageSourceParser imageSourceParser, HtmlLocalLinkParser localLinkParser, RichTextEditorPastedImages pastedImages)
- : base(dataTypeService, localizationService,Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public RichTextPropertyValueEditor(DataEditorAttribute attribute, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger, IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, HtmlImageSourceParser imageSourceParser, HtmlLocalLinkParser localLinkParser, RichTextEditorPastedImages pastedImages)
+ : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
{
_umbracoContextAccessor = umbracoContextAccessor;
_imageSourceParser = imageSourceParser;
diff --git a/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
index a9feae9a2e..f282b7b682 100644
--- a/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/SliderPropertyEditor.cs
@@ -3,6 +3,7 @@ using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -21,8 +22,8 @@ namespace Umbraco.Web.PropertyEditors
///
/// Initializes a new instance of the class.
///
- public SliderPropertyEditor(ILogger logger, IIOHelper ioHelper)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public SliderPropertyEditor(ILogger logger, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
_ioHelper = ioHelper;
}
diff --git a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
index 58d738bb53..5682e512ca 100644
--- a/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/TagsPropertyEditor.cs
@@ -7,10 +7,10 @@ using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -29,22 +29,22 @@ namespace Umbraco.Web.PropertyEditors
private readonly IIOHelper _ioHelper;
private readonly ILocalizedTextService _localizedTextService;
- public TagsPropertyEditor(ManifestValueValidatorCollection validators, ILogger logger, IIOHelper ioHelper, ILocalizedTextService localizedTextService)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public TagsPropertyEditor(ManifestValueValidatorCollection validators, ILogger logger, IIOHelper ioHelper, ILocalizedTextService localizedTextService, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{
_validators = validators;
_ioHelper = ioHelper;
_localizedTextService = localizedTextService;
}
- protected override IDataValueEditor CreateValueEditor() => new TagPropertyValueEditor(Current.Services.DataTypeService, Current.Services.LocalizationService, Attribute);
+ protected override IDataValueEditor CreateValueEditor() => new TagPropertyValueEditor(Current.Services.DataTypeService, Current.Services.LocalizationService, ShortStringHelper, Attribute);
protected override IConfigurationEditor CreateConfigurationEditor() => new TagConfigurationEditor(_validators, _ioHelper, _localizedTextService);
internal class TagPropertyValueEditor : DataValueEditor
{
- public TagPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, DataEditorAttribute attribute)
- : base(dataTypeService, localizationService,Current.Services.TextService, Current.ShortStringHelper, attribute)
+ public TagPropertyValueEditor(IDataTypeService dataTypeService, ILocalizationService localizationService, IShortStringHelper shortStringHelper, DataEditorAttribute attribute)
+ : base(dataTypeService, localizationService,Current.Services.TextService, shortStringHelper, attribute)
{ }
///
diff --git a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
index 56f2f35c8c..607042f143 100644
--- a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs
@@ -1,9 +1,8 @@
-using System.ComponentModel;
-using System.Web.Mvc;
-using Umbraco.Core;
+using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors
{
@@ -16,8 +15,8 @@ namespace Umbraco.Web.PropertyEditors
Icon = Constants.Icons.User)]
public class UserPickerPropertyEditor : DataEditor
{
- public UserPickerPropertyEditor(ILogger logger)
- : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService,Current.ShortStringHelper)
+ public UserPickerPropertyEditor(ILogger logger, IShortStringHelper shortStringHelper)
+ : base(logger, Current.Services.DataTypeService, Current.Services.LocalizationService, Current.Services.TextService, shortStringHelper)
{ }
protected override IConfigurationEditor CreateConfigurationEditor() => new UserPickerConfiguration();
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
index ee5e9a2ee2..be5c237cfa 100755
--- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -32,7 +31,6 @@ using File = System.IO.File;
namespace Umbraco.Web.PublishedCache.NuCache
{
-
internal class PublishedSnapshotService : PublishedSnapshotServiceBase
{
private readonly ServiceContext _serviceContext;
@@ -50,6 +48,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
private readonly UrlSegmentProviderCollection _urlSegmentProviders;
private readonly ITypeFinder _typeFinder;
private readonly IHostingEnvironment _hostingEnvironment;
+ private readonly IShortStringHelper _shortStringHelper;
// volatile because we read it with no lock
private volatile bool _isReady;
@@ -83,7 +82,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
IPublishedModelFactory publishedModelFactory,
UrlSegmentProviderCollection urlSegmentProviders,
ITypeFinder typeFinder,
- IHostingEnvironment hostingEnvironment)
+ IHostingEnvironment hostingEnvironment,
+ IShortStringHelper shortStringHelper)
: base(publishedSnapshotAccessor, variationContextAccessor)
{
//if (Interlocked.Increment(ref _singletonCheck) > 1)
@@ -102,6 +102,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
_urlSegmentProviders = urlSegmentProviders;
_typeFinder = typeFinder;
_hostingEnvironment = hostingEnvironment;
+ _shortStringHelper = shortStringHelper;
// we need an Xml serializer here so that the member cache can support XPath,
// for members this is done by navigating the serialized-to-xml member
@@ -1400,7 +1401,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
cultureData[cultureInfo.Culture] = new CultureVariation
{
Name = cultureInfo.Name,
- UrlSegment = content.GetUrlSegment(Current.ShortStringHelper, _urlSegmentProviders, cultureInfo.Culture),
+ UrlSegment = content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders, cultureInfo.Culture),
Date = content.GetUpdateDate(cultureInfo.Culture) ?? DateTime.MinValue,
IsDraft = cultureIsDraft
};
@@ -1412,7 +1413,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
PropertyData = propertyData,
CultureData = cultureData,
- UrlSegment = content.GetUrlSegment(Current.ShortStringHelper, _urlSegmentProviders)
+ UrlSegment = content.GetUrlSegment(_shortStringHelper, _urlSegmentProviders)
};
var dto = new ContentNuDto
diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
index 1edd289038..d0c67accc7 100644
--- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs
+++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs
@@ -15,6 +15,7 @@ using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Hosting;
+using Umbraco.Core.Strings;
using Umbraco.Core.IO;
using Umbraco.Web.Install;
using Umbraco.Web.JavaScript;
@@ -34,8 +35,9 @@ namespace Umbraco.Web.Runtime
private readonly IGlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IIOHelper _ioHelper;
+ private readonly IShortStringHelper _shortStringHelper;
- public WebInitialComponent(IUmbracoContextAccessor umbracoContextAccessor, SurfaceControllerTypeCollection surfaceControllerTypes, UmbracoApiControllerTypeCollection apiControllerTypes, IHostingSettings hostingSettings, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment, IIOHelper ioHelper)
+ public WebInitialComponent(IUmbracoContextAccessor umbracoContextAccessor, SurfaceControllerTypeCollection surfaceControllerTypes, UmbracoApiControllerTypeCollection apiControllerTypes, IHostingSettings hostingSettings, IGlobalSettings globalSettings, IHostingEnvironment hostingEnvironment, IIOHelper ioHelper, IShortStringHelper shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor;
_surfaceControllerTypes = surfaceControllerTypes;
@@ -44,6 +46,7 @@ namespace Umbraco.Web.Runtime
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnvironment;
_ioHelper = ioHelper;
+ _shortStringHelper = shortStringHelper;
}
public void Initialize()
@@ -68,7 +71,7 @@ namespace Umbraco.Web.Runtime
ConfigureGlobalFilters();
// set routes
- CreateRoutes(_umbracoContextAccessor, _globalSettings, _surfaceControllerTypes, _apiControllerTypes);
+ CreateRoutes(_umbracoContextAccessor, _globalSettings, _shortStringHelper, _surfaceControllerTypes, _apiControllerTypes);
}
public void Terminate()
@@ -154,6 +157,7 @@ namespace Umbraco.Web.Runtime
internal static void CreateRoutes(
IUmbracoContextAccessor umbracoContextAccessor,
IGlobalSettings globalSettings,
+ IShortStringHelper shortStringHelper,
SurfaceControllerTypeCollection surfaceControllerTypes,
UmbracoApiControllerTypeCollection apiControllerTypes)
{
@@ -165,7 +169,7 @@ namespace Umbraco.Web.Runtime
umbracoPath + "/RenderMvc/{action}/{id}",
new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional }
);
- defaultRoute.RouteHandler = new RenderRouteHandler(umbracoContextAccessor, ControllerBuilder.Current.GetControllerFactory());
+ defaultRoute.RouteHandler = new RenderRouteHandler(umbracoContextAccessor, ControllerBuilder.Current.GetControllerFactory(), shortStringHelper);
// register install routes
RouteTable.Routes.RegisterArea();
diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs
index 1fcd2bad56..0fac301be7 100644
--- a/src/Umbraco.Web/Security/MembershipHelper.cs
+++ b/src/Umbraco.Web/Security/MembershipHelper.cs
@@ -14,6 +14,7 @@ using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Editors;
using Umbraco.Web.Security.Providers;
using System.ComponentModel.DataAnnotations;
@@ -32,6 +33,7 @@ namespace Umbraco.Web.Security
private readonly IPublicAccessService _publicAccessService;
private readonly AppCaches _appCaches;
private readonly ILogger _logger;
+ private readonly IShortStringHelper _shortStringHelper;
#region Constructors
@@ -45,7 +47,8 @@ namespace Umbraco.Web.Security
IMemberTypeService memberTypeService,
IPublicAccessService publicAccessService,
AppCaches appCaches,
- ILogger logger
+ ILogger logger,
+ IShortStringHelper shortStringHelper
)
{
HttpContext = httpContext;
@@ -55,6 +58,7 @@ namespace Umbraco.Web.Security
_publicAccessService = publicAccessService;
_appCaches = appCaches;
_logger = logger;
+ _shortStringHelper = shortStringHelper;
_membershipProvider = membershipProvider ?? throw new ArgumentNullException(nameof(membershipProvider));
_roleProvider = roleProvider ?? throw new ArgumentNullException(nameof(roleProvider));
@@ -397,7 +401,7 @@ namespace Umbraco.Web.Security
var memberType = _memberTypeService.Get(member.ContentTypeId);
- var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs(Current.ShortStringHelper).Select(x => x.Key).ToArray();
+ var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper).Select(x => x.Key).ToArray();
model.MemberProperties = GetMemberPropertiesViewModel(memberType, builtIns, member).ToList();
@@ -417,7 +421,7 @@ namespace Umbraco.Web.Security
if (memberType == null)
throw new InvalidOperationException("Could not find a member type with alias " + memberTypeAlias);
- var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs(Current.ShortStringHelper).Select(x => x.Key).ToArray();
+ var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs(_shortStringHelper).Select(x => x.Key).ToArray();
var model = RegisterModel.CreateModel();
model.MemberTypeAlias = memberTypeAlias;
model.MemberProperties = GetMemberPropertiesViewModel(memberType, builtIns).ToList();
diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs
index bf7f04a2f4..850ff4b1d9 100644
--- a/src/Umbraco.Web/Templates/TemplateRenderer.cs
+++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs
@@ -1,19 +1,15 @@
using System;
-using System.Collections;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
-using Umbraco.Core;
+using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.Services;
+using Umbraco.Core.Strings;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Services;
-using Umbraco.Web.Macros;
-using Current = Umbraco.Web.Composing.Current;
namespace Umbraco.Web.Templates
{
@@ -30,14 +26,16 @@ namespace Umbraco.Web.Templates
private readonly IFileService _fileService;
private readonly ILocalizationService _languageService;
private readonly IWebRoutingSection _webRoutingSection;
+ private readonly IShortStringHelper _shortStringHelper;
- public TemplateRenderer(IUmbracoContextAccessor umbracoContextAccessor, IPublishedRouter publishedRouter, IFileService fileService, ILocalizationService textService, IWebRoutingSection webRoutingSection)
+ public TemplateRenderer(IUmbracoContextAccessor umbracoContextAccessor, IPublishedRouter publishedRouter, IFileService fileService, ILocalizationService textService, IWebRoutingSection webRoutingSection, IShortStringHelper shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
_publishedRouter = publishedRouter ?? throw new ArgumentNullException(nameof(publishedRouter));
_fileService = fileService ?? throw new ArgumentNullException(nameof(fileService));
_languageService = textService ?? throw new ArgumentNullException(nameof(textService));
_webRoutingSection = webRoutingSection ?? throw new ArgumentNullException(nameof(webRoutingSection));
+ _shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
public void Render(int pageId, int? altTemplateId, StringWriter writer)
@@ -129,7 +127,7 @@ namespace Umbraco.Web.Templates
{
Route = RouteTable.Routes["Umbraco_default"]
});
- var routeHandler = new RenderRouteHandler(_umbracoContextAccessor, ControllerBuilder.Current.GetControllerFactory());
+ var routeHandler = new RenderRouteHandler(_umbracoContextAccessor, ControllerBuilder.Current.GetControllerFactory(), _shortStringHelper);
var routeDef = routeHandler.GetUmbracoRouteDefinition(requestContext, request);
var renderModel = new ContentModel(request.PublishedContent);
//manually add the action/controller, this is required by mvc