merge
This commit is contained in:
@@ -239,8 +239,15 @@ namespace Umbraco.Core
|
||||
PropertyEditorValueConvertersResolver.Current.AddType<TinyMcePropertyEditorValueConverter>();
|
||||
PropertyEditorValueConvertersResolver.Current.AddType<YesNoPropertyEditorValueConverter>();
|
||||
|
||||
ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
// 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
|
||||
ShortStringHelperResolver.Current = new ShortStringHelperResolver(
|
||||
new LegacyShortStringHelper());
|
||||
|
||||
UrlSegmentProviderResolver.Current = new UrlSegmentProviderResolver(
|
||||
typeof (DefaultUrlSegmentProvider));
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace Umbraco.Core.Strings
|
||||
{
|
||||
#region Ctor and vars
|
||||
|
||||
static DefaultShortStringHelper()
|
||||
{
|
||||
InitializeLegacyUrlReplaceCharacters();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Freezes the helper so it can prevents its configuration from being modified.
|
||||
/// </summary>
|
||||
@@ -46,6 +51,33 @@ namespace Umbraco.Core.Strings
|
||||
|
||||
#endregion
|
||||
|
||||
#region Legacy UrlReplaceCharacters
|
||||
|
||||
static readonly Dictionary<string, string> UrlReplaceCharacters = new Dictionary<string, string>();
|
||||
|
||||
static void InitializeLegacyUrlReplaceCharacters()
|
||||
{
|
||||
var replaceChars = UmbracoSettings.UrlReplaceCharacters;
|
||||
foreach (var node in replaceChars.SelectNodes("char").Cast<System.Xml.XmlNode>())
|
||||
{
|
||||
var org = node.Attributes.GetNamedItem("org");
|
||||
if (org != null && org.Value != "")
|
||||
UrlReplaceCharacters[org.Value] = XmlHelper.GetNodeValue(node);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a new string in which characters have been replaced according to the Umbraco settings UrlReplaceCharacters.
|
||||
/// </summary>
|
||||
/// <param name="s">The string to filter.</param>
|
||||
/// <returns>The filtered string.</returns>
|
||||
public static string ApplyUrlReplaceCharacters(string s)
|
||||
{
|
||||
return s.ReplaceMany(UrlReplaceCharacters);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Configuration
|
||||
|
||||
private void EnsureNotFrozen()
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Umbraco.Core.Strings
|
||||
internal ShortStringHelperResolver(IShortStringHelper helper)
|
||||
: base(helper)
|
||||
{
|
||||
Resolution.Frozen += (sender, args) => helper.Freeze();
|
||||
Resolution.Frozen += (sender, args) => Value.Freeze();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user