Core.StringExtensions - switch over to the new DefaultShortStringHelper
This commit is contained in:
@@ -264,14 +264,17 @@ namespace Umbraco.Core
|
||||
PropertyEditorValueConvertersResolver.Current.AddType<TinyMcePropertyEditorValueConverter>();
|
||||
PropertyEditorValueConvertersResolver.Current.AddType<YesNoPropertyEditorValueConverter>();
|
||||
|
||||
// this is how we'd switch over to DefaultShortStringHelper _and_ still use
|
||||
// UmbracoSettings UrlReplaceCharacters...
|
||||
//ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
// new DefaultShortStringHelper().WithConfig(DefaultShortStringHelper.ApplyUrlReplaceCharacters));
|
||||
|
||||
// use the Legacy one for now
|
||||
// use the new DefaultShortStringHelper but sort-of remain compatible
|
||||
// - use UmbracoSettings UrlReplaceCharacters
|
||||
// - allow underscores in terms, allow leading digits
|
||||
ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
new LegacyShortStringHelper());
|
||||
new DefaultShortStringHelper()
|
||||
.WithConfig(CleanStringType.Url, DefaultShortStringHelper.ApplyUrlReplaceCharacters,
|
||||
allowUnderscoreInTerm: true, allowLeadingDigits: true));
|
||||
|
||||
// that was the old one
|
||||
//ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
// new LegacyShortStringHelper());
|
||||
|
||||
UrlSegmentProviderResolver.Current = new UrlSegmentProviderResolver(
|
||||
typeof (DefaultUrlSegmentProvider));
|
||||
|
||||
@@ -781,8 +781,21 @@ namespace Umbraco.Core
|
||||
/// does initialise the resolver.</remarks>
|
||||
private static IShortStringHelper ShortStringHelper
|
||||
{
|
||||
get { return ShortStringHelperResolver.HasCurrent ? ShortStringHelperResolver.Current.Helper : new LegacyShortStringHelper(); }
|
||||
get
|
||||
{
|
||||
if (ShortStringHelperResolver.HasCurrent)
|
||||
return ShortStringHelperResolver.Current.Helper;
|
||||
if (_helper != null)
|
||||
return _helper;
|
||||
|
||||
// there *has* to be a short string helper, even if the resolver has not
|
||||
// been initialized - used the default one with default configuration.
|
||||
_helper = new DefaultShortStringHelper().WithConfig(allowLeadingDigits: true);
|
||||
_helper.Freeze();
|
||||
return _helper;
|
||||
}
|
||||
}
|
||||
private static IShortStringHelper _helper;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new string in which all occurences of specified strings are replaced by other specified strings.
|
||||
|
||||
Reference in New Issue
Block a user