Merge pull request #7380 from AndyButland/feature/7371-short-string-helper

.NET Core transition: Removed (almost) all instances of Current.ShortStringHlper and replaced with constructor injection (#7371)
This commit is contained in:
Bjarke Berg
2020-01-07 09:05:28 +01:00
committed by GitHub
92 changed files with 454 additions and 432 deletions
+68 -69
View File
@@ -14,13 +14,11 @@ using Umbraco.Core.Strings;
namespace Umbraco.Core
{
///<summary>
/// String extension methods
///</summary>
public static class StringExtensions
{
private static readonly char[] ToCSharpHexDigitLower = "0123456789abcdef".ToCharArray();
private static readonly char[] ToCSharpEscapeChars;
@@ -72,13 +70,10 @@ namespace Umbraco.Core
return string.Format("{0}", fileName.Substring(0, fileName.IndexOf(ext, StringComparison.Ordinal)));
}
return fileName;
}
/// <summary>
/// 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.
@@ -100,8 +95,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
@@ -190,9 +183,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)
{
@@ -1232,7 +1222,7 @@ namespace Umbraco.Core
&& Path.GetPathRoot(path).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal) == false;
}
/// <summary>
/// <summary>
/// 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
@@ -1277,77 +1267,83 @@ namespace Umbraco.Core
}
// FORMAT STRINGS
// FORMAT STRINGS
/// <summary>
/// Cleans a string to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <returns>The safe alias.</returns>
public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper)
{
return shortStringHelper.CleanStringForSafeAlias(alias);
}
/// <summary>
/// Cleans a string to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <returns>The safe alias.</returns>
public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper)
{
return shortStringHelper.CleanStringForSafeAlias(alias);
}
/// <summary>
/// Cleans a string to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="camel">A value indicating that we want to camel-case the alias.</param>
/// <returns>The safe alias.</returns>
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);
}
/// <summary>
/// Cleans a string to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="camel">A value indicating that we want to camel-case the alias.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <returns>The safe alias.</returns>
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);
}
/// <summary>
/// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="culture">The culture.</param>
/// <returns>The safe alias.</returns>
public static string ToSafeAlias(this string alias, IShortStringHelper shortStringHelper, string culture)
{
return shortStringHelper.CleanStringForSafeAlias(alias, culture);
}
/// <summary>
/// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="culture">The culture.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <returns>The safe alias.</returns>
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
/// <summary>
/// Cleans a string to produce a string that can safely be used in an url segment.
/// </summary>
/// <param name="text">The text to filter.</param>
/// <returns>The safe url segment.</returns>
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));
/// <summary>
/// Cleans a string to produce a string that can safely be used in an url segment.
/// </summary>
/// <param name="text">The text to filter.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <returns>The safe url segment.</returns>
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);
}
/// <summary>
/// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an url segment.
/// </summary>
/// <param name="text">The text to filter.</param>
/// <param name="culture">The culture.</param>
/// <returns>The safe url segment.</returns>
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));
/// <summary>
/// Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an url segment.
/// </summary>
/// <param name="text">The text to filter.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <param name="culture">The culture.</param>
/// <returns>The safe url segment.</returns>
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);
}
/// <summary>
/// <summary>
/// Cleans a string.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <returns>The clean string.</returns>
@@ -1361,6 +1357,7 @@ namespace Umbraco.Core
/// Cleans a string, using a specified separator.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="separator">The separator.</param>
@@ -1375,6 +1372,7 @@ namespace Umbraco.Core
/// Cleans a string in the context of a specified culture.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="culture">The culture.</param>
@@ -1388,6 +1386,7 @@ namespace Umbraco.Core
/// Cleans a string in the context of a specified culture, using a specified separator.
/// </summary>
/// <param name="text">The text to clean.</param>
/// <param name="shortStringHelper">The short string helper.</param>
/// <param name="stringType">A flag indicating the target casing and encoding of the string. By default,
/// strings are cleaned up to camelCase and Ascii.</param>
/// <param name="separator">The separator.</param>
@@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Packaging
var name = prop.Element("Name")?.Value;
if (sp == null)
{
sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(_shortStringHelper), "");
sp = new StylesheetProperty(name, "#" + name.ToSafeAlias(_shortStringHelper), string.Empty);
s.AddProperty(sp);
}
else
@@ -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<string, object> _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
/// </summary>
protected DataEditorAttribute Attribute { get; }
protected IShortStringHelper ShortStringHelper { get; }
/// <summary>
/// Gets a logger.
/// </summary>
@@ -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);
}
/// <summary>
@@ -17,21 +17,20 @@ using Umbraco.Web.Mvc;
namespace Umbraco.ModelsBuilder.Embedded.Compose
{
internal class ModelsBuilderComponent : IComponent
{
private readonly IModelsBuilderConfig _config;
private readonly IShortStringHelper _shortStringHelper;
private readonly LiveModelsProvider _liveModelsProvider;
private readonly OutOfDateModelsStatus _outOfDateModels;
public ModelsBuilderComponent(IModelsBuilderConfig config, IShortStringHelper shortStringHelper, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels)
public ModelsBuilderComponent(IModelsBuilderConfig config, IShortStringHelper shortStringHelper, LiveModelsProvider liveModelsProvider, OutOfDateModelsStatus outOfDateModels)
{
_config = config;
_shortStringHelper = shortStringHelper;
_liveModelsProvider = liveModelsProvider;
_outOfDateModels = outOfDateModels;
_shortStringHelper = shortStringHelper;
}
public void Initialize()
@@ -47,10 +47,6 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly IEntityXmlSerializer _entitySerializer;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IShortStringHelper _shortStringHelper;
private XmlStoreFilePersister _persisterTask;
private volatile bool _released;
private bool _withRepositoryEvents;
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
private readonly PublishedContentTypeCache _contentTypeCache;
private readonly RoutesCache _routesCache;
@@ -58,6 +54,10 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
private readonly IContentService _contentService;
private readonly IScopeProvider _scopeProvider;
private XmlStoreFilePersister _persisterTask;
private volatile bool _released;
private bool _withRepositoryEvents;
#region Constructors
/// <summary>
@@ -65,7 +65,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache
/// </summary>
/// <remarks>The default constructor will boot the cache, load data from file or database, /// wire events in order to manage changes, etc.</remarks>
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, IShortStringHelper shortStringHelper)
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)
{ }
@@ -74,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, IShortStringHelper shortStringHelper)
bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer, IHostingEnvironment hostingEnvironment, IShortStringHelper shortStringHelper)
{
if (testing == false)
EnsureConfigurationIsValid();
+2 -5
View File
@@ -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<ILocalizationService>();
var mediaFileSystem = new MediaFileSystem(Mock.Of<IFileSystem>(), scheme, logger, ShortStringHelper);
var ignored = new FileUploadPropertyEditor(Mock.Of<ILogger>(), mediaFileSystem, config, dataTypeService, localizationService);
var ignored = new FileUploadPropertyEditor(Mock.Of<ILogger>(), 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
@@ -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<IContentTypeRepository>();
@@ -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);
@@ -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);
@@ -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<IPublishedModelFactory>(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
hostingEnvironment);
hostingEnvironment,
new MockShortStringHelper());
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
@@ -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<IPublishedModelFactory>(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(TestHelper.ShortStringHelper) }),
typeFinder,
TestHelper.GetHostingEnvironment());
TestHelper.GetHostingEnvironment(),
new MockShortStringHelper());
// invariant is the current default
_variationAccesor.VariationContext = new VariationContext();
@@ -149,16 +149,16 @@ namespace Umbraco.Tests.Routing
ContentTypesCache.GetPublishedContentTypeByAlias = alias => type;
var handler = new RenderRouteHandler(umbracoContext, new TestControllerFactory(umbracoContextAccessor, Mock.Of<ILogger>(), context =>
{
var membershipHelper = new MembershipHelper(
umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>());
return new CustomDocumentController(Factory.GetInstance<IGlobalSettings>(),
umbracoContextAccessor,
Factory.GetInstance<ServiceContext>(),
Factory.GetInstance<AppCaches>(),
Factory.GetInstance<IProfilingLogger>(),
new UmbracoHelper(Mock.Of<IPublishedContent>(), Mock.Of<ITagQuery>(), Mock.Of<ICultureDictionaryFactory>(), Mock.Of<IUmbracoComponentRenderer>(), Mock.Of<IPublishedContentQuery>(), membershipHelper));
}), ShortStringHelper);
{
var membershipHelper = new MembershipHelper(
umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>(), ShortStringHelper);
return new CustomDocumentController(Factory.GetInstance<IGlobalSettings>(),
umbracoContextAccessor,
Factory.GetInstance<ServiceContext>(),
Factory.GetInstance<AppCaches>(),
Factory.GetInstance<IProfilingLogger>(),
new UmbracoHelper(Mock.Of<IPublishedContent>(), Mock.Of<ITagQuery>(), Mock.Of<ICultureDictionaryFactory>(), Mock.Of<IUmbracoComponentRenderer>(), Mock.Of<IPublishedContentQuery>(), membershipHelper));
}), ShortStringHelper);
handler.GetHandlerForRoute(umbracoContext.HttpContext.Request.RequestContext, frequest);
Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
@@ -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<IPublishedModelFactory>(),
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<IUrlProvider> urlProviders = null)
@@ -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<IPublishedModelFactory>(),
new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider(ShortStringHelper) }),
typeFinder,
hostingEnvironment);
hostingEnvironment,
new MockShortStringHelper());
}
public class LocalServerMessenger : ServerMessengerBase
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Umbraco.Core.Strings;
using Umbraco.Core.Strings;
namespace Umbraco.Tests.Strings
{
@@ -16,18 +16,7 @@ namespace Umbraco.Tests.Strings
[TestFixture]
public class StringExtensionsTests : UmbracoTestBase
{
protected override void Compose()
{
base.Compose();
Composition.RegisterUnique<IShortStringHelper>(_ => new MockShortStringHelper());
}
[Test]
public void CurrentHelper()
{
var helper = Current.ShortStringHelper;
Assert.IsInstanceOf<MockShortStringHelper>(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(ShortStringHelper);
var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void FormatUrl()
{
var output = "JUST-ANYTHING".ToUrlSegment(ShortStringHelper);
var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void ToUmbracoAlias()
{
var output = "JUST-ANYTHING".ToSafeAlias(ShortStringHelper);
var output = "JUST-ANYTHING".ToSafeAlias(_mockShortStringHelper);
Assert.AreEqual("SAFE-ALIAS::JUST-ANYTHING", output);
}
[Test]
public void ToSafeAlias()
{
var output = "JUST-ANYTHING".ToSafeAlias(ShortStringHelper);
var output = "JUST-ANYTHING".ToSafeAlias(_mockShortStringHelper);
Assert.AreEqual("SAFE-ALIAS::JUST-ANYTHING", output);
}
[Test]
public void ToSafeAliasWithCulture()
{
var output = "JUST-ANYTHING".ToSafeAlias(ShortStringHelper, (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(ShortStringHelper);
var output = "JUST-ANYTHING".ToUrlSegment(_mockShortStringHelper);
Assert.AreEqual("URL-SEGMENT::JUST-ANYTHING", output);
}
[Test]
public void ToUrlSegmentWithCulture()
{
var output = "JUST-ANYTHING".ToUrlSegment(ShortStringHelper, (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(ShortStringHelper);
var output = "JUST-ANYTHING".ToSafeFileName(_mockShortStringHelper);
Assert.AreEqual("SAFE-FILE-NAME::JUST-ANYTHING", output);
}
[Test]
public void ToSafeFileNameWithCulture()
{
var output = "JUST-ANYTHING".ToSafeFileName(ShortStringHelper, 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(ShortStringHelper, 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(ShortStringHelper);
var output = "JUST-ANYTHING".SplitPascalCasing(_mockShortStringHelper);
Assert.AreEqual("SPLIT-PASCAL-CASING::JUST-ANYTHING", output);
}
@@ -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<UmbracoContext>(), It.IsAny<IPublishedContent>(), It.IsAny<UrlMode>(), It.IsAny<string>(), It.IsAny<Uri>()))
.Returns(UrlInfo.Url("/hello/world/1234"));
var membershipHelper = new MembershipHelper(umbCtx.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>());
var membershipHelper = new MembershipHelper(umbCtx.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>(), new MockShortStringHelper());
var umbHelper = new UmbracoHelper(Mock.Of<IPublishedContent>(),
Mock.Of<ITagQuery>(),
@@ -71,7 +71,7 @@ namespace Umbraco.Tests.Testing.TestingTests
Mock.Of<ICultureDictionaryFactory>(),
Mock.Of<IUmbracoComponentRenderer>(),
Mock.Of<IPublishedContentQuery>(),
new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>()));
new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>(), ShortStringHelper));
Assert.Pass();
}
@@ -103,7 +103,7 @@ namespace Umbraco.Tests.Testing.TestingTests
var memberService = Mock.Of<IMemberService>();
var memberTypeService = Mock.Of<IMemberTypeService>();
var membershipProvider = new MembersMembershipProvider(memberService, memberTypeService, Mock.Of<IUmbracoVersion>(), TestHelper.GetHostingEnvironment(), TestHelper.GetIpResolver());
var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), membershipProvider, Mock.Of<RoleProvider>(), memberService, memberTypeService, Mock.Of<IPublicAccessService>(), AppCaches.Disabled, logger);
var membershipHelper = new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), membershipProvider, Mock.Of<RoleProvider>(), memberService, memberTypeService, Mock.Of<IPublicAccessService>(), AppCaches.Disabled, logger, ShortStringHelper);
var umbracoHelper = new UmbracoHelper(Mock.Of<IPublishedContent>(), Mock.Of<ITagQuery>(), Mock.Of<ICultureDictionaryFactory>(), Mock.Of<IUmbracoComponentRenderer>(), Mock.Of<IPublishedContentQuery>(), membershipHelper);
var umbracoMapper = new UmbracoMapper(new MapDefinitionCollection(new[] { Mock.Of<IMapDefinition>() }));
@@ -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
{
@@ -24,6 +24,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;
@@ -87,8 +88,7 @@ namespace Umbraco.Tests.Web.Controllers
Factory.GetInstance<IRuntimeState>(),
helper,
Factory.GetInstance<IMediaFileSystem>(),
ShortStringHelper
);
ShortStringHelper);
return usersController;
}
@@ -124,7 +124,7 @@ namespace Umbraco.Tests.Web.Mvc
Mock.Of<ICultureDictionaryFactory>(),
Mock.Of<IUmbracoComponentRenderer>(),
Mock.Of<IPublishedContentQuery>(query => query.Content(2) == content.Object),
new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>()));
new MembershipHelper(umbracoContext.HttpContext, Mock.Of<IPublishedMemberCache>(), Mock.Of<MembersMembershipProvider>(), Mock.Of<RoleProvider>(), Mock.Of<IMemberService>(), Mock.Of<IMemberTypeService>(), Mock.Of<IPublicAccessService>(), AppCaches.Disabled, Mock.Of<ILogger>(), ShortStringHelper));
var ctrl = new TestSurfaceController(umbracoContextAccessor, helper);
var result = ctrl.GetContent(2) as PublishedContentResult;
@@ -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)
{
}
}
@@ -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
/// <param name="contentType"></param>
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);
@@ -34,8 +34,6 @@ namespace Umbraco.Web.Editors
[UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)]
public class CodeFileController : BackOfficeNotificationsController
{
private readonly IShortStringHelper _shortStringHelper;
public CodeFileController(
IGlobalSettings globalSettings,
IUmbracoContextAccessor umbracoContextAccessor,
@@ -46,9 +44,9 @@ namespace Umbraco.Web.Editors
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;
}
/// <summary>
@@ -242,7 +240,7 @@ namespace Umbraco.Web.Editors
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return snippets.Select(snippet => new SnippetDisplay() {Name = snippet.SplitPascalCasing(_shortStringHelper).ToFirstUpperInvariant(), FileName = snippet});
return snippets.Select(snippet => new SnippetDisplay() {Name = snippet.SplitPascalCasing(ShortStringHelper).ToFirstUpperInvariant(), FileName = snippet});
}
/// <summary>
+15 -14
View File
@@ -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;
using Umbraco.Core.Strings;
namespace Umbraco.Web.Editors
@@ -19,7 +19,6 @@ using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Editors
{
/// <summary>
@@ -29,7 +28,6 @@ namespace Umbraco.Web.Editors
public abstract class ContentControllerBase : BackOfficeNotificationsController
{
protected ICultureDictionary CultureDictionary { get; }
public IShortStringHelper ShortStringHelper { get; }
protected ContentControllerBase(
ICultureDictionary cultureDictionary,
@@ -42,10 +40,9 @@ namespace Umbraco.Web.Editors
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)
{
CultureDictionary = cultureDictionary;
ShortStringHelper = shortStringHelper;
}
protected HttpResponseMessage HandleContentNotFound(object id, bool throwException = true)
@@ -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(_shortStringHelper, 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(_shortStringHelper, true);
collectionDocType.Alias = collectionName.ToSafeAlias(ShortStringHelper, true);
collectionDocType.Icon = collectionIcon;
collectionDocType.IsContainer = true;
collectionDocType.AllowedContentTypes = new List<ContentTypeSort>()
@@ -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);
@@ -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<TContentType> : 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;
}
@@ -31,7 +31,6 @@ namespace Umbraco.Web.Editors
public class CurrentUserController : UmbracoAuthorizedJsonController
{
private readonly IMediaFileSystem _mediaFileSystem;
private readonly IShortStringHelper _shortStringHelper;
public CurrentUserController(
IGlobalSettings globalSettings,
@@ -44,10 +43,9 @@ namespace Umbraco.Web.Editors
UmbracoHelper umbracoHelper,
IMediaFileSystem mediaFileSystem,
IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem;
_shortStringHelper = shortStringHelper;
}
/// <summary>
@@ -181,7 +179,7 @@ namespace Umbraco.Web.Editors
public async Task<HttpResponseMessage> PostSetAvatar()
{
//borrow the logic from the user controller
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, _shortStringHelper, Security.GetUserId().ResultOr(0));
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, ShortStringHelper, Security.GetUserId().ResultOr(0));
}
/// <summary>
@@ -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.Core.Strings;
using Umbraco.Web.Services;
@@ -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;
}
@@ -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)
{
}
+3 -5
View File
@@ -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;
@@ -51,7 +50,6 @@ namespace Umbraco.Web.Editors
{
private readonly ITreeService _treeService;
private readonly UmbracoTreeSearcher _treeSearcher;
private readonly IShortStringHelper _shortStringHelper;
private readonly SearchableTreeCollection _searchableTreeCollection;
public EntityController(
@@ -67,12 +65,12 @@ namespace Umbraco.Web.Editors
SearchableTreeCollection searchableTreeCollection,
UmbracoTreeSearcher treeSearcher,
IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_treeService = treeService;
_searchableTreeCollection = searchableTreeCollection;
_treeSearcher = treeSearcher;
_shortStringHelper = shortStringHelper;
}
/// <summary>
@@ -102,7 +100,7 @@ namespace Umbraco.Web.Editors
/// <returns></returns>
public dynamic GetSafeAlias(string value, bool camelCase = true)
{
var returnValue = string.IsNullOrWhiteSpace(value) ? string.Empty : value.ToSafeAlias(_shortStringHelper, camelCase);
var returnValue = string.IsNullOrWhiteSpace(value) ? string.Empty : value.ToSafeAlias(ShortStringHelper, camelCase);
dynamic returnObj = new System.Dynamic.ExpandoObject();
returnObj.alias = returnValue;
returnObj.original = value;
@@ -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));
}
/// <summary>
@@ -90,7 +92,7 @@ namespace Umbraco.Web.Editors.Filters
public override bool ValidateProperties(MemberSave model, IContentProperties<ContentPropertyBasic> 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)
{
@@ -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))
+4 -2
View File
@@ -9,6 +9,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;
@@ -32,8 +33,9 @@ namespace Umbraco.Web.Editors
IProfilingLogger logger,
IRuntimeState runtimeState,
UmbracoHelper umbracoHelper,
IMediaFileSystem mediaFileSystem)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
IMediaFileSystem mediaFileSystem,
IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem;
}
@@ -164,7 +164,7 @@ namespace Umbraco.Web.Editors
var macro = new Macro(_shortStringHelper)
{
Alias = macroName.ToSafeAlias(_shortStringHelper),
Alias = macroName.ToSafeAlias(ShortStringHelper),
Name = macroName,
MacroSource = model.VirtualPath.EnsureStartsWith("~"),
MacroType = MacroTypes.PartialView
+2 -3
View File
@@ -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(_shortStringHelper);
var alias = name.ToSafeAlias(ShortStringHelper);
if (_macroService.GetByAlias(alias) != null)
{
+17 -17
View File
@@ -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;
using Umbraco.Core.Strings;
namespace Umbraco.Web.Editors
@@ -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;
}
+14 -14
View File
@@ -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;
using Umbraco.Core.Strings;
namespace Umbraco.Web.Editors
@@ -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
{
/// <summary>
/// An API controller used for dealing with member types
/// </summary>
@@ -28,8 +28,8 @@ namespace Umbraco.Web.Editors
[UmbracoTreeAuthorize(new string[] { Constants.Trees.MemberTypes, Constants.Trees.Members})]
public class MemberTypeController : ContentTypeControllerBase<IMemberType>
{
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<IMemberType, MemberTypeDisplay>(ct);
@@ -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;
@@ -10,7 +10,6 @@ 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;
@@ -29,8 +28,6 @@ namespace Umbraco.Web.Editors
[EnableOverrideAuthorization]
public class RelationTypeController : BackOfficeNotificationsController
{
private readonly IShortStringHelper _shortStringHelper;
public RelationTypeController(
IGlobalSettings globalSettings,
IUmbracoContextAccessor umbracoContextAccessor,
@@ -41,9 +38,8 @@ namespace Umbraco.Web.Editors
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;
}
/// <summary>
@@ -113,7 +109,7 @@ namespace Umbraco.Web.Editors
/// <returns>A <see cref="HttpResponseMessage"/> containing the persisted relation type's ID.</returns>
public HttpResponseMessage PostCreate(RelationTypeSave relationType)
{
var relationTypePersisted = new RelationType(relationType.Name, relationType.Name.ToSafeAlias(_shortStringHelper, 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
{
+3 -2
View File
@@ -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;
@@ -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)
+2 -5
View File
@@ -7,7 +7,6 @@ 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;
@@ -26,11 +25,10 @@ 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, IShortStringHelper shortStringHelper)
{
_mediaService = mediaService;
@@ -41,7 +39,6 @@ namespace Umbraco.Web.Editors
[HttpPost]
public async Task<HttpResponseMessage> UploadImage()
{
if (Request.Content.IsMimeMultipartContent() == false)
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
@@ -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; }
}
}
@@ -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
/// <returns></returns>
public UserGroupDisplay GetEmptyUserGroup()
{
return Mapper.Map<UserGroupDisplay>(new UserGroup(Current.ShortStringHelper));
return Mapper.Map<UserGroupDisplay>(new UserGroup(ShortStringHelper));
}
/// <summary>
+2 -4
View File
@@ -43,7 +43,6 @@ namespace Umbraco.Web.Editors
public class UsersController : UmbracoAuthorizedJsonController
{
private readonly IMediaFileSystem _mediaFileSystem;
private readonly IShortStringHelper _shortStringHelper;
public UsersController(
IGlobalSettings globalSettings,
@@ -56,10 +55,9 @@ namespace Umbraco.Web.Editors
UmbracoHelper umbracoHelper,
IMediaFileSystem mediaFileSystem,
IShortStringHelper shortStringHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, shortStringHelper)
{
_mediaFileSystem = mediaFileSystem;
_shortStringHelper = shortStringHelper;
}
/// <summary>
@@ -80,7 +78,7 @@ namespace Umbraco.Web.Editors
[AdminUsersAuthorize]
public async Task<HttpResponseMessage> PostSetAvatar(int id)
{
return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, _shortStringHelper, id);
return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, ShortStringHelper, id);
}
internal static async Task<HttpResponseMessage> PostSetAvatarInternal(HttpRequestMessage request, IUserService userService, IAppCache cache, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper, int id)
@@ -77,8 +77,8 @@ namespace Umbraco.Web.Macros
/// <param name="content">The content.</param>
/// <param name="variationContextAccessor"></param>
/// <remarks>This is for <see cref="MacroRenderingController"/> usage only.</remarks>
internal PublishedContentHashtableConverter(IContent content, IVariationContextAccessor variationContextAccessor, IUserService userService)
: this(new PagePublishedContent(content, variationContextAccessor, userService))
internal PublishedContentHashtableConverter(IContent content, IVariationContextAccessor variationContextAccessor, IUserService userService, IShortStringHelper shortStringHelper)
: this(new PagePublishedContent(content, variationContextAccessor, userService, shortStringHelper))
{ }
#endregion
@@ -185,6 +185,7 @@ namespace Umbraco.Web.Macros
private readonly IPublishedProperty[] _properties;
private IReadOnlyDictionary<string, PublishedCultureInfo> _cultureInfos;
private readonly IVariationContextAccessor _variationContextAccessor;
private readonly IShortStringHelper _shortStringHelper;
private static readonly IReadOnlyDictionary<string, PublishedCultureInfo> NoCultureInfos = new Dictionary<string, PublishedCultureInfo>();
@@ -193,10 +194,12 @@ namespace Umbraco.Web.Macros
Id = id;
}
public PagePublishedContent(IContent inner, IVariationContextAccessor variationContextAccessor, IUserService userService)
public PagePublishedContent(IContent inner, IVariationContextAccessor variationContextAccessor, IUserService userService, 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;
@@ -243,7 +246,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));
}
}
@@ -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<TTargetPropertyType>(_propertyEditors, _dataTypeService, _logger);
var groupsMapper = new PropertyTypeGroupMapper<TTargetPropertyType>(_propertyEditors, _dataTypeService, _shortStringHelper, _logger);
target.Groups = groupsMapper.Map(source);
}
@@ -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<string>();
// 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);
}
@@ -14,6 +14,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;
@@ -29,9 +30,10 @@ namespace Umbraco.Web.Models.Mapping
private readonly AppCaches _appCaches;
private readonly IGlobalSettings _globalSettings;
private readonly IMediaFileSystem _mediaFileSystem;
private readonly IShortStringHelper _shortStringHelper;
public UserMapDefinition(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService,
AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings, IMediaFileSystem mediaFileSystem)
AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings, IMediaFileSystem mediaFileSystem, IShortStringHelper shortStringHelper)
{
_sectionService = sectionService;
_entityService = entityService;
@@ -41,11 +43,12 @@ namespace Umbraco.Web.Models.Mapping
_appCaches = appCaches;
_globalSettings = globalSettings;
_mediaFileSystem = mediaFileSystem;
_shortStringHelper = shortStringHelper;
}
public void DefineMaps(UmbracoMapper mapper)
{
mapper.Define<UserGroupSave, IUserGroup>((source, context) => new UserGroup(Current.ShortStringHelper) { CreateDate = DateTime.UtcNow }, Map);
mapper.Define<UserGroupSave, IUserGroup>((source, context) => new UserGroup(_shortStringHelper) { CreateDate = DateTime.UtcNow }, Map);
mapper.Define<UserInvite, IUser>(Map);
mapper.Define<IProfile, ContentEditing.UserProfile>((source, context) => new ContentEditing.UserProfile(), Map);
mapper.Define<IReadOnlyUserGroup, UserGroupBasic>((source, context) => new UserGroupBasic(), Map);
+3 -4
View File
@@ -1,19 +1,18 @@
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 Umbraco.Core.Strings;
using Current = Umbraco.Web.Composing.Current;
using Umbraco.Web.Features;
namespace Umbraco.Web.Mvc
{
@@ -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;
}
@@ -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)
{
}
@@ -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 <see cref="DateTimePropertyEditor"/> class.
/// </summary>
/// <param name="logger"></param>
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;
}
@@ -14,8 +14,8 @@ namespace Umbraco.Web.PropertyEditors
/// </summary>
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());
}
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="DecimalPropertyEditor"/> class.
/// </summary>
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)
{ }
/// <inheritdoc />
@@ -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
/// <summary>
/// The constructor will setup the property editor based on the attribute if one is found
/// </summary>
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;
}
@@ -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
/// <returns>The corresponding property value editor.</returns>
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;
}
@@ -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));
}
@@ -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
{
/// <summary>
/// Represents a grid property and parameter editor.
/// </summary>
@@ -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
/// </summary>
/// <returns></returns>
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);
}
/// <summary>
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PropertyEditors
/// Creates the corresponding property value editor.
/// </summary>
/// <returns>The corresponding property value editor.</returns>
protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, _dataTypeService, _localizationService);
protected override IDataValueEditor CreateValueEditor() => new ImageCropperPropertyValueEditor(Attribute, Logger, _mediaFileSystem, _dataTypeService, _localizationService, ShortStringHelper);
/// <summary>
/// Creates the corresponding preValue editor.
@@ -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));
@@ -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 <see cref="ListViewPropertyEditor"/> class.
/// </summary>
/// <param name="logger"></param>
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;
}
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="MarkdownPropertyEditor"/> class.
/// </summary>
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;
}
@@ -49,11 +49,12 @@ namespace Umbraco.Web.PropertyEditors
/// <inheritdoc />
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)
{
}
@@ -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)
{ }
}
}
@@ -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();
@@ -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)
{
}
@@ -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);
}
}
@@ -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));
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="MultipleTextStringPropertyEditor"/> class.
/// </summary>
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
}
/// <inheritdoc />
protected override IDataValueEditor CreateValueEditor() => new MultipleTextStringPropertyValueEditor(_dataTypeService, _localizationService,Attribute, _localizedTextService);
protected override IDataValueEditor CreateValueEditor() => new MultipleTextStringPropertyValueEditor(_dataTypeService, _localizationService, _localizedTextService, ShortStringHelper, Attribute);
/// <inheritdoc />
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;
}
@@ -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;
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="ContentTypeParameterEditor"/> class.
/// </summary>
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);
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="MultipleContentPickerParameterEditor"/> class.
/// </summary>
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");
@@ -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);
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="MultipleMediaPickerParameterEditor"/> class.
/// </summary>
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");
}
@@ -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);
@@ -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");
@@ -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");
@@ -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");
@@ -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
/// <summary>
/// The constructor will setup the property editor based on the attribute if one is found
/// </summary>
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;
@@ -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;
/// <summary>
/// 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;
}
/// <summary>
/// Create a custom value editor
/// </summary>
/// <returns></returns>
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;
@@ -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
/// <summary>
/// Initializes a new instance of the <see cref="SliderPropertyEditor"/> class.
/// </summary>
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;
}
@@ -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)
{ }
/// <inheritdoc />
@@ -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();
@@ -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;
@@ -84,7 +83,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)
@@ -103,6 +103,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
@@ -1406,7 +1407,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
};
@@ -1418,7 +1419,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
@@ -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.Core.Strings;
using Umbraco.Web.Install;
@@ -177,7 +178,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(),shortStringHelper);
defaultRoute.RouteHandler = new RenderRouteHandler(umbracoContextAccessor, ControllerBuilder.Current.GetControllerFactory(), shortStringHelper);
// register install routes
RouteTable.Routes.RegisterArea<UmbracoInstallArea>();
+7 -3
View File
@@ -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();
@@ -1,20 +1,16 @@
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.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.Core.Strings;
using Umbraco.Web.Macros;
using Current = Umbraco.Web.Composing.Current;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
using Umbraco.Core.Strings;
namespace Umbraco.Web.Templates
{
@@ -40,7 +36,7 @@ namespace Umbraco.Web.Templates
_fileService = fileService ?? throw new ArgumentNullException(nameof(fileService));
_languageService = textService ?? throw new ArgumentNullException(nameof(textService));
_webRoutingSection = webRoutingSection ?? throw new ArgumentNullException(nameof(webRoutingSection));
_shortStringHelper = shortStringHelper;
_shortStringHelper = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
}
public void Render(int pageId, int? altTemplateId, StringWriter writer)