Core.Strings - go public
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using Umbraco.Core.CodeAnnotations;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
[UmbracoWillObsolete("This enumeration should be removed. Use Umbraco.Core.Strings.CleanStringType instead.")]
|
||||
public enum StringAliasCaseType
|
||||
{
|
||||
PascalCase,
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Umbraco.Core.Strings
|
||||
/// <para>Full-unicode support is probably not so good.</para>
|
||||
/// <para>NOTE: pre-filters run _before_ the string is re-encoded.</para>
|
||||
/// </remarks>
|
||||
internal class DefaultShortStringHelper : IShortStringHelper
|
||||
public class DefaultShortStringHelper : IShortStringHelper
|
||||
{
|
||||
#region Ctor and vars
|
||||
|
||||
@@ -200,7 +200,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <para>The string will be cleaned in the context of the default culture.</para>
|
||||
/// <para>Safe aliases are Ascii only.</para>
|
||||
/// </remarks>
|
||||
public string CleanStringForSafeAlias(string text)
|
||||
public virtual string CleanStringForSafeAlias(string text)
|
||||
{
|
||||
return CleanString(text, CleanStringType.Ascii | CleanStringType.CamelCase | CleanStringType.Alias);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <remarks>
|
||||
/// <para>Safe aliases are Ascii only.</para>
|
||||
/// </remarks>
|
||||
public string CleanStringForSafeAlias(string text, CultureInfo culture)
|
||||
public virtual string CleanStringForSafeAlias(string text, CultureInfo culture)
|
||||
{
|
||||
return CleanString(text, CleanStringType.Ascii | CleanStringType.CamelCase | CleanStringType.Alias, culture);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <para>The string will be cleaned in the context of the default culture.</para>
|
||||
/// <para>Url segments are Ascii only (no accents...).</para>
|
||||
/// </remarks>
|
||||
public string CleanStringForUrlSegment(string text)
|
||||
public virtual string CleanStringForUrlSegment(string text)
|
||||
{
|
||||
return CleanString(text, CleanStringType.Ascii | CleanStringType.LowerCase | CleanStringType.Url, '-');
|
||||
}
|
||||
@@ -242,7 +242,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <remarks>
|
||||
/// <para>Url segments are Ascii only (no accents...).</para>
|
||||
/// </remarks>
|
||||
public string CleanStringForUrlSegment(string text, CultureInfo culture)
|
||||
public virtual string CleanStringForUrlSegment(string text, CultureInfo culture)
|
||||
{
|
||||
return CleanString(text, CleanStringType.Ascii | CleanStringType.LowerCase | CleanStringType.Url, '-', culture);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <param name="separator">The separator.</param>
|
||||
/// <param name="culture">The culture.</param>
|
||||
/// <returns>The clean string.</returns>
|
||||
public string CleanString(string text, CleanStringType stringType, char separator, CultureInfo culture)
|
||||
public virtual string CleanString(string text, CleanStringType stringType, char separator, CultureInfo culture)
|
||||
{
|
||||
var config = GetConfig(stringType & CleanStringType.RoleMask, culture);
|
||||
return CleanString(text, stringType, separator, culture, config);
|
||||
@@ -801,7 +801,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <param name="separator">The separator, which defaults to a whitespace.</param>
|
||||
/// <returns>The splitted text.</returns>
|
||||
/// <remarks>Supports Utf8 and Ascii strings, not Unicode strings.</remarks>
|
||||
public string SplitPascalCasing(string text, char separator)
|
||||
public virtual string SplitPascalCasing(string text, char separator)
|
||||
{
|
||||
// be safe
|
||||
if (text == null)
|
||||
@@ -855,7 +855,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <returns>The filtered string.</returns>
|
||||
/// <remarks>If <paramref name="stringType"/> is not <c>Unicode</c> then non-utf8 characters are
|
||||
/// removed. If it is <c>Ascii</c> we try to do some intelligent replacement of accents, etc.</remarks>
|
||||
public string Recode(string text, CleanStringType stringType)
|
||||
public virtual string Recode(string text, CleanStringType stringType)
|
||||
{
|
||||
// be safe
|
||||
if (text == null)
|
||||
@@ -902,7 +902,7 @@ function validateSafeAlias(id, value, immediate, callback) {{
|
||||
/// <param name="text">The string to filter.</param>
|
||||
/// <param name="replacements">The replacements definition.</param>
|
||||
/// <returns>The filtered string.</returns>
|
||||
public string ReplaceMany(string text, IDictionary<string, string> replacements)
|
||||
public virtual string ReplaceMany(string text, IDictionary<string, string> replacements)
|
||||
{
|
||||
// be safe
|
||||
if (text == null)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Strings
|
||||
/// <summary>
|
||||
/// Default implementation of IUrlSegmentProvider.
|
||||
/// </summary>
|
||||
internal class DefaultUrlSegmentProvider : IUrlSegmentProvider
|
||||
public class DefaultUrlSegmentProvider : IUrlSegmentProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the default url segment for a specified content.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Strings
|
||||
/// Provides string functions for short strings such as aliases or url segments.
|
||||
/// </summary>
|
||||
/// <remarks>Not necessarily optimized to work on large bodies of text.</remarks>
|
||||
internal interface IShortStringHelper
|
||||
public interface IShortStringHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Freezes the helper so it can prevents its configuration from being modified.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Strings
|
||||
/// Provides url segments for content.
|
||||
/// </summary>
|
||||
/// <remarks>Url segments should comply with IETF RFCs regarding content, encoding, etc.</remarks>
|
||||
internal interface IUrlSegmentProvider
|
||||
public interface IUrlSegmentProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the default url segment for a specified content.
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Strings
|
||||
/// <summary>
|
||||
/// Resolves the IShortStringHelper object
|
||||
/// </summary>
|
||||
internal sealed class ShortStringHelperResolver : SingleObjectResolverBase<ShortStringHelperResolver, IShortStringHelper>
|
||||
public sealed class ShortStringHelperResolver : SingleObjectResolverBase<ShortStringHelperResolver, IShortStringHelper>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ShortStringHelperResolver"/> class with an instance of a helper.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// Provides extension methods to StringAliasCaseType to facilitate migration to CleanStringType.
|
||||
/// </summary>
|
||||
internal static class StringAliasCaseTypeExtensions
|
||||
public static class StringAliasCaseTypeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the CleanStringType value corresponding to the StringAliasCaseType value.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Strings
|
||||
/// <summary>
|
||||
/// Resolves IUrlSegmentProvider objects.
|
||||
/// </summary>
|
||||
internal sealed class UrlSegmentProviderResolver : ManyObjectsResolverBase<UrlSegmentProviderResolver, IUrlSegmentProvider>
|
||||
public sealed class UrlSegmentProviderResolver : ManyObjectsResolverBase<UrlSegmentProviderResolver, IUrlSegmentProvider>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UrlSegmentProviderResolver"/> class with an initial list of provider types.
|
||||
|
||||
Reference in New Issue
Block a user