diff --git a/src/Umbraco.Core/ApplicationContext.cs b/src/Umbraco.Core/ApplicationContext.cs index 45901847eb..e73bdb9e46 100644 --- a/src/Umbraco.Core/ApplicationContext.cs +++ b/src/Umbraco.Core/ApplicationContext.cs @@ -65,10 +65,9 @@ namespace Umbraco.Core // note - the original umbraco module checks on content.Instance in umbraco.dll // now, the boot task that setup the content store ensures that it is ready bool _isReady = false; - readonly System.Threading.ManualResetEventSlim _isReadyEvent = new System.Threading.ManualResetEventSlim(false); + readonly ManualResetEventSlim _isReadyEvent = new ManualResetEventSlim(false); private DatabaseContext _databaseContext; private ServiceContext _services; - private UmbracoConfiguration _umbracoConfiguration; public bool IsReady { diff --git a/src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs b/src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs index 5ded474d83..9838f8d1e6 100644 --- a/src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs +++ b/src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Linq; using System.Threading; using System.Web; @@ -23,6 +24,11 @@ namespace Umbraco.Core.Cache } protected override DictionaryCacheWrapper DictionaryCache + { + get { return _wrapper; } + } + + /// /// Clears all objects in the System.Web.Cache with the System.Type specified that satisfy the predicate /// public override void ClearCacheObjectTypes(Func predicate) @@ -49,11 +55,6 @@ namespace Umbraco.Core.Cache } } - /// - { - get { return _wrapper; } - } - /// /// Gets (and adds if necessary) an item from the cache with all of the default parameters /// diff --git a/src/Umbraco.Core/Configuration/UmbracoConfig.cs b/src/Umbraco.Core/Configuration/UmbracoConfig.cs new file mode 100644 index 0000000000..4bdadc0a29 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoConfig.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Threading; +using Umbraco.Core.Configuration.BaseRest; +using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Core.Logging; + +namespace Umbraco.Core.Configuration +{ + /// + /// The gateway to all umbraco configuration + /// + public class UmbracoConfig + { + #region Singleton + + private static readonly Lazy Lazy = new Lazy(() => new UmbracoConfig()); + + public static UmbracoConfig For + { + get { return Lazy.Value; } + } + + #endregion + + /// + /// Default constructor + /// + private UmbracoConfig() + { + if (UmbracoSettings() == null) + { + var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection; + if (umbracoSettings == null) + { + LogHelper.Warn("Could not load the " + typeof(IUmbracoSettingsSection) + " from config file!"); + } + SetUmbracoSettings(umbracoSettings); + } + + if (BaseRestExtensions() == null) + { + var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection; + if (baseRestExtensions == null) + { + LogHelper.Warn("Could not load the " + typeof(IBaseRestSection) + " from config file!"); + } + SetBaseRestExtensions(baseRestExtensions); + } + } + + /// + /// Constructor - can be used for testing + /// + /// + /// + public UmbracoConfig(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings) + { + SetUmbracoSettings(umbracoSettings); + SetBaseRestExtensions(baseRestSettings); + } + + private IUmbracoSettingsSection _umbracoSettings; + + //ONLY for unit testing + internal void SetUmbracoSettings(IUmbracoSettingsSection value) + { + _umbracoSettings = value; + } + + /// + /// Gets the IUmbracoSettings + /// + public IUmbracoSettingsSection UmbracoSettings() + { + return _umbracoSettings; + } + + private IBaseRestSection _baseRestExtensions; + + //ONLY for unit testing + public void SetBaseRestExtensions(IBaseRestSection value) + { + _baseRestExtensions = value; + } + + /// + /// Gets the IBaseRestSection + /// + public IBaseRestSection BaseRestExtensions() + { + return _baseRestExtensions; + } + + //TODO: Add other configurations here ! + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoConfiguration.cs b/src/Umbraco.Core/Configuration/UmbracoConfiguration.cs deleted file mode 100644 index 1400aad2f2..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoConfiguration.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using System.Threading; -using Umbraco.Core.Configuration.BaseRest; -using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Core.Logging; - -namespace Umbraco.Core.Configuration -{ - /// - /// The gateway to all umbraco configuration - /// - public class UmbracoConfiguration - { - #region Singleton - - private static readonly Lazy Lazy = new Lazy(() => new UmbracoConfiguration()); - - public static UmbracoConfiguration Current - { - get { return Lazy.Value; } - } - - #endregion - - #region Extensible settings - - private static readonly ConcurrentDictionary Sections = new ConcurrentDictionary(); - - - /// - /// Used for unit tests to explicitly associate an IUmbracoConfigurationSection to an implementation - /// - /// - /// - internal static void Set(T implementation) - where T : IUmbracoConfigurationSection - { - Sections.AddOrUpdate(typeof (T), type => implementation, (type, section) => implementation); - } - - /// - /// Used for unit tests to reset the resolved sections - /// - internal static void Reset() - { - Sections.Clear(); - } - - /// - /// Gets the specified UmbracoConfigurationSection. - /// - /// The type of the UmbracoConfigurationSectiont. - /// The UmbracoConfigurationSection of the specified type. - public static T For(System.Configuration.Configuration config = null) - where T : IUmbracoConfigurationSection - { - var sectionType = typeof(T); - return (T)Sections.GetOrAdd(sectionType, type => - { - //if there is no entry for this type - var configurationSections = PluginManager.Current.ResolveUmbracoConfigurationSections(); - var implementationType = configurationSections.FirstOrDefault(TypeHelper.IsTypeAssignableFrom); - if (implementationType == null) - { - throw new InvalidOperationException("Could not find an implementation for " + typeof(T)); - } - - var attr = implementationType.GetCustomAttribute(false); - if (attr == null) - throw new InvalidOperationException(string.Format("Type \"{0}\" is missing attribute ConfigurationKeyAttribute.", sectionType.FullName)); - - var sectionKey = attr.ConfigurationKey; - if (string.IsNullOrWhiteSpace(sectionKey)) - throw new InvalidOperationException(string.Format("Type \"{0}\" {1} value is null or empty.", sectionType.FullName, typeof(ConfigurationKeyAttribute))); - - var section = GetSection(sectionType, sectionKey, config); - - return (T)section; - }); - } - - private static IUmbracoConfigurationSection GetSection(Type sectionType, string key, System.Configuration.Configuration config = null) - { - var section = config == null - ? ConfigurationManager.GetSection(key) - : config.GetSection(key); - - if (section == null) - { - throw new KeyNotFoundException("Could not find/load config section: " + key); - } - - var result = section as IUmbracoConfigurationSection; - if (result == null) - { - throw new InvalidOperationException(string.Format("The section type requested '{0}' does not match the resulting section type '{1}", sectionType, section.GetType())); - } - return result; - } - - #endregion - - /// - /// Default constructor - /// - private UmbracoConfiguration() - { - if (UmbracoSettings == null) - { - var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection; - if (umbracoSettings == null) - { - LogHelper.Warn("Could not load the " + typeof(IUmbracoSettingsSection) + " from config file!"); - } - UmbracoSettings = umbracoSettings; - } - - if (BaseRestExtensions == null) - { - var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection; - if (baseRestExtensions == null) - { - LogHelper.Warn("Could not load the " + typeof(IBaseRestSection) + " from config file!"); - } - BaseRestExtensions = baseRestExtensions; - } - } - - /// - /// Constructor - can be used for testing - /// - /// - /// - public UmbracoConfiguration(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings) - { - UmbracoSettings = umbracoSettings; - BaseRestExtensions = baseRestSettings; - } - - /// - /// Gets the IUmbracoSettings - /// - public IUmbracoSettingsSection UmbracoSettings - { - get; - //This is purely for setting for Unit tests ONLY - internal set; - } - - public IBaseRestSection BaseRestExtensions { get; private set; } - - //TODO: Add other configurations here ! - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 578dd1c859..32e8660c4b 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.IO [Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")] internal static string ResolveUrlsFromTextString(string text) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString) + if (UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString) { using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete")) { diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs index c6877baf3f..4c2d0adbc6 100644 --- a/src/Umbraco.Core/IO/MediaFileSystem.cs +++ b/src/Umbraco.Core/IO/MediaFileSystem.cs @@ -16,7 +16,7 @@ namespace Umbraco.Core.IO private readonly IContentSection _contentConfig; public MediaFileSystem(IFileSystem wrapped) - : this(wrapped, UmbracoConfiguration.Current.UmbracoSettings.Content) + : this(wrapped, UmbracoConfig.For.UmbracoSettings().Content) { } diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index 1754a9b1a8..fafcf32dc3 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -135,7 +135,7 @@ namespace Umbraco.Core.IO { get { - return UmbracoConfiguration.Current.UmbracoSettings.Content.ImageFileTypes.InvariantContains(Extension); + return UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(Extension); } } diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index 7e3f5d6d1d..87af20790a 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -403,7 +403,7 @@ namespace Umbraco.Core.Models return; var numberedFolder = MediaSubfolderCounter.Current.Increment(); - var fileName = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var fileName = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? Path.Combine(numberedFolder.ToString(CultureInfo.InvariantCulture), name) : numberedFolder + "-" + name; @@ -416,15 +416,15 @@ namespace Umbraco.Core.Models fs.AddFile(fileName, fileStream); //Check if file supports resizing and create thumbnails - var supportsResizing = UmbracoConfiguration.Current.UmbracoSettings.Content.ImageFileTypes.InvariantContains(extension); + var supportsResizing = UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(extension); //the config section used to auto-fill properties IImagingAutoFillUploadField uploadFieldConfigNode = null; //Check for auto fill of additional properties - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties != null) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties != null) { - uploadFieldConfigNode = UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties + uploadFieldConfigNode = UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties .FirstOrDefault(x => x.Alias == propertyTypeAlias); } diff --git a/src/Umbraco.Core/Models/PropertyExtensions.cs b/src/Umbraco.Core/Models/PropertyExtensions.cs index a0db710ae7..d013c3d88c 100644 --- a/src/Umbraco.Core/Models/PropertyExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyExtensions.cs @@ -22,13 +22,13 @@ namespace Umbraco.Core.Models internal static XElement ToXml(this Property property, IDataTypeService dataTypeService) { - var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); + var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); var xd = new XmlDocument(); var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, ""); //Add the property alias to the legacy schema - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { var alias = xd.CreateAttribute("alias"); alias.Value = property.Alias.ToSafeAlias(); diff --git a/src/Umbraco.Core/Models/Script.cs b/src/Umbraco.Core/Models/Script.cs index b83cc245a5..431fecaebc 100644 --- a/src/Umbraco.Core/Models/Script.cs +++ b/src/Umbraco.Core/Models/Script.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.Models private readonly IContentSection _contentConfig; public Script(string path) - : this(path, UmbracoConfiguration.Current.UmbracoSettings.Content) + : this(path, UmbracoConfig.For.UmbracoSettings().Content) { } diff --git a/src/Umbraco.Core/Models/Template.cs b/src/Umbraco.Core/Models/Template.cs index 5c30b80187..bb8ff3b011 100644 --- a/src/Umbraco.Core/Models/Template.cs +++ b/src/Umbraco.Core/Models/Template.cs @@ -157,18 +157,18 @@ namespace Umbraco.Core.Models public override bool IsValid() { var exts = new List(); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc) { exts.Add("cshtml"); exts.Add("vbhtml"); } else { - exts.Add(UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages ? "master" : "aspx"); + exts.Add(UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages ? "master" : "aspx"); } var dirs = SystemDirectories.Masterpages; - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc) dirs += "," + SystemDirectories.MvcViews; //Validate file diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index 2695f1ee03..c47dc552f0 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -464,7 +464,7 @@ namespace Umbraco.Core.Persistence.Repositories var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs index f1b3324ea3..bfa22429dd 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs @@ -342,7 +342,7 @@ namespace Umbraco.Core.Persistence.Repositories var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs index 414062e211..6f060fc2e3 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs @@ -345,7 +345,7 @@ namespace Umbraco.Core.Persistence.Repositories var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs index 246845da0f..83c685d3fa 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs @@ -132,7 +132,7 @@ namespace Umbraco.Core.Persistence.Repositories var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); Parallel.ForEach(files, file => { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories) + if (UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories) { var relativeFilePath = fs.GetRelativePath(file); var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); diff --git a/src/Umbraco.Core/Persistence/RepositoryFactory.cs b/src/Umbraco.Core/Persistence/RepositoryFactory.cs index 72ed34aeb2..dc36fd1483 100644 --- a/src/Umbraco.Core/Persistence/RepositoryFactory.cs +++ b/src/Umbraco.Core/Persistence/RepositoryFactory.cs @@ -15,13 +15,13 @@ namespace Umbraco.Core.Persistence private readonly IUmbracoSettingsSection _settings; public RepositoryFactory() - : this(false, UmbracoConfiguration.Current.UmbracoSettings) + : this(false, UmbracoConfig.For.UmbracoSettings()) { } internal RepositoryFactory(bool disableAllCache) - : this(disableAllCache, UmbracoConfiguration.Current.UmbracoSettings) + : this(disableAllCache, UmbracoConfig.For.UmbracoSettings()) { } diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index b9f6b75172..71046e943e 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -453,17 +453,6 @@ namespace Umbraco.Core return ResolveTypes(); } - /// - /// Returns all classes of type IUmbracoConfigurationSection - /// - /// - internal IEnumerable ResolveUmbracoConfigurationSections() - { - //don't cache the result since it's a one time lookup for a type anyways - //ONLY look in the CORE assembly for performance. - return ResolveTypes(false, new[] { typeof(IUmbracoConfigurationSection).Assembly }); - } - /// /// Returns all classes of type ICacheRefresher /// diff --git a/src/Umbraco.Core/PublishedContentHelper.cs b/src/Umbraco.Core/PublishedContentHelper.cs index b663f3f904..a6a3c1cadc 100644 --- a/src/Umbraco.Core/PublishedContentHelper.cs +++ b/src/Umbraco.Core/PublishedContentHelper.cs @@ -174,7 +174,7 @@ namespace Umbraco.Core var documentElement = e.Name.LocalName; //TODO: See note against this setting, pretty sure we don't need this - if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.NotDynamicXmlDocumentElements.Any( + if (UmbracoConfig.For.UmbracoSettings().Scripting.NotDynamicXmlDocumentElements.Any( tag => string.Equals(tag.Element, documentElement, StringComparison.CurrentCultureIgnoreCase)) == false) { return Attempt.Succeed(new DynamicXml(e)); diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index ad20b90477..01b7639cdc 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Security /// public static void UmbracoLogout(this HttpContextBase http) { - Logout(http, UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName); + Logout(http, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName); } internal static void UmbracoLogout(this HttpContext http) @@ -43,8 +43,8 @@ namespace Umbraco.Core.Security public static bool RenewUmbracoAuthTicket(this HttpContextBase http, int timeoutInMinutes = 60) { return RenewAuthTicket(http, - UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName, - UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieDomain, + UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName, + UmbracoConfig.For.UmbracoSettings().Security.AuthCookieDomain, timeoutInMinutes); } @@ -69,8 +69,8 @@ namespace Umbraco.Core.Security //Umbraco has always persisted it's original cookie for 1 day so we'll keep it that way 1440, "/", - UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName, - UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieDomain); + UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName, + UmbracoConfig.For.UmbracoSettings().Security.AuthCookieDomain); } internal static void CreateUmbracoAuthTicket(this HttpContext http, UserData userdata) @@ -85,7 +85,7 @@ namespace Umbraco.Core.Security /// public static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContextBase http) { - return GetAuthTicket(http, UmbracoConfiguration.Current.UmbracoSettings.Security.AuthCookieName); + return GetAuthTicket(http, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName); } internal static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContext http) diff --git a/src/Umbraco.Core/Services/ContentTypeService.cs b/src/Umbraco.Core/Services/ContentTypeService.cs index b54db28170..f3017089d7 100644 --- a/src/Umbraco.Core/Services/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/ContentTypeService.cs @@ -567,7 +567,7 @@ namespace Umbraco.Core.Services public string GetContentTypesDtd() { var dtd = new StringBuilder(); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { dtd.AppendLine(" "); } diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index 979cced5ac..7d182e153e 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -108,7 +108,7 @@ namespace Umbraco.Core.Services internal XElement Export(IContent content, bool deep = false) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Export(content, nodeName); xml.Add(new XAttribute("nodeType", content.ContentType.Id)); @@ -862,7 +862,7 @@ namespace Umbraco.Core.Services internal XElement Export(IMedia media, bool deep = false) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Export(media, nodeName); xml.Add(new XAttribute("nodeType", media.ContentType.Id)); diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index 40a71d8d25..fe37350767 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -958,7 +958,7 @@ namespace Umbraco.Core /// Checks UmbracoSettings.ForceSafeAliases to determine whether it should filter the text. public static string ToSafeAliasWithForcingCheck(this string alias) { - return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? alias.ToSafeAlias() : alias; + return UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases ? alias.ToSafeAlias() : alias; } /// @@ -970,7 +970,7 @@ namespace Umbraco.Core /// Checks UmbracoSettings.ForceSafeAliases to determine whether it should filter the text. public static string ToSafeAliasWithForcingCheck(this string alias, CultureInfo culture) { - return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias; + return UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias; } // note: LegacyShortStringHelper will produce a 100% backward-compatible output for ToUmbracoAlias. diff --git a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs index d834d0f81b..547cf6090d 100644 --- a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs +++ b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs @@ -57,7 +57,7 @@ namespace Umbraco.Core.Strings static void InitializeLegacyUrlReplaceCharacters() { - foreach (var node in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.CharCollection) + foreach (var node in UmbracoConfig.For.UmbracoSettings().RequestHandler.CharCollection) { if (node.Char.IsNullOrWhiteSpace() == false) UrlReplaceCharacters[node.Char] = node.Replacement; @@ -227,7 +227,7 @@ function validateSafeAlias(id, value, immediate, callback) {{ public string GetShortStringServicesJavaScript(string controllerPath) { return string.Format(SssjsFormat, - UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? "true" : "false", controllerPath); + UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases ? "true" : "false", controllerPath); } #endregion diff --git a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs index 9d8f03427e..1c780703f4 100644 --- a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs +++ b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs @@ -94,7 +94,7 @@ function isValidAlias(alias) {{ public string GetShortStringServicesJavaScript(string controllerPath) { return string.Format(SssjsFormat, - UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters); + UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters); } #endregion @@ -205,7 +205,7 @@ function isValidAlias(alias) {{ var ext = filePath.Substring(filePath.LastIndexOf('.')); //Because the file usually is downloadable as well we check characters against 'UmbracoSettings.UrlReplaceCharacters' - foreach (var n in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.CharCollection) + foreach (var n in UmbracoConfig.For.UmbracoSettings().RequestHandler.CharCollection) { if (n.Char.IsNullOrWhiteSpace() == false) fileNamePart = fileNamePart.Replace(n.Char, n.Replacement); @@ -468,14 +468,14 @@ function isValidAlias(alias) {{ public string LegacyFormatUrl(string url) { var newUrl = url.ToLowerInvariant(); - foreach (var n in UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.CharCollection) + foreach (var n in UmbracoConfig.For.UmbracoSettings().RequestHandler.CharCollection) { if (n.Char != "") newUrl = newUrl.Replace(n.Char, n.Replacement); } // check for double dashes - if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.RemoveDoubleDashes) + if (UmbracoConfig.For.UmbracoSettings().RequestHandler.RemoveDoubleDashes) { newUrl = Regex.Replace(newUrl, @"[-]{2,}", "-"); } diff --git a/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs b/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs index 99575ab0e6..69f54fcab7 100644 --- a/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs +++ b/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.Sync private readonly IEnumerable _servers; public ConfigServerRegistrar() - : this(UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Servers) + : this(UmbracoConfig.For.UmbracoSettings().DistributedCall.Servers) { } diff --git a/src/Umbraco.Core/Sync/DefaultServerMessenger.cs b/src/Umbraco.Core/Sync/DefaultServerMessenger.cs index c15ff006f1..f14e7ad442 100644 --- a/src/Umbraco.Core/Sync/DefaultServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DefaultServerMessenger.cs @@ -39,7 +39,7 @@ namespace Umbraco.Core.Sync /// /// internal DefaultServerMessenger(string login, string password) - : this(login, password, UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled) + : this(login, password, UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled) { } @@ -226,7 +226,7 @@ namespace Umbraco.Core.Sync { Login = result.Item1; Password = result.Item2; - _useDistributedCalls = UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled; + _useDistributedCalls = UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled; } } catch (Exception ex) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 1c931e7b7c..6cda6187ce 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -157,7 +157,7 @@ - + diff --git a/src/Umbraco.Core/XmlHelper.cs b/src/Umbraco.Core/XmlHelper.cs index e432c237ba..260bb5b86d 100644 --- a/src/Umbraco.Core/XmlHelper.cs +++ b/src/Umbraco.Core/XmlHelper.cs @@ -86,7 +86,7 @@ namespace Umbraco.Core if (nav.MoveToFirstChild()) { var name = nav.LocalName; // must not match an excluded tag - if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.NotDynamicXmlDocumentElements.All(x => x.Element.InvariantEquals(name) == false)) return true; + if (UmbracoConfig.For.UmbracoSettings().Scripting.NotDynamicXmlDocumentElements.All(x => x.Element.InvariantEquals(name) == false)) return true; } doc = null; @@ -121,7 +121,7 @@ namespace Umbraco.Core } var name = elt.Name.LocalName; // must not match an excluded tag - if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.NotDynamicXmlDocumentElements.All(x => x.Element.InvariantEquals(name) == false)) return true; + if (UmbracoConfig.For.UmbracoSettings().Scripting.NotDynamicXmlDocumentElements.All(x => x.Element.InvariantEquals(name) == false)) return true; elt = null; return false; diff --git a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs index 8342ff0f32..f1b98c53e6 100644 --- a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs +++ b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs @@ -311,7 +311,7 @@ namespace Umbraco.Tests.CodeFirst.Definitions private static IEnumerable AllowedTemplatesConvention(IEnumerable templateNames) { var templates = new List(); - var engine = UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine; + var engine = UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine; foreach (var templateName in templateNames) { var @alias = engine == RenderingEngine.Mvc diff --git a/src/Umbraco.Tests/Configurations/FileSystemProviderTests.cs b/src/Umbraco.Tests/Configurations/FileSystemProviderTests.cs index 58c576a7e8..bbd584b117 100644 --- a/src/Umbraco.Tests/Configurations/FileSystemProviderTests.cs +++ b/src/Umbraco.Tests/Configurations/FileSystemProviderTests.cs @@ -8,39 +8,7 @@ using Umbraco.Core.Configuration.UmbracoSettings; namespace Umbraco.Tests.Configurations { - [TestFixture] - public class UmbracoConfigurationTests - { - [TearDown] - public void TearDown() - { - UmbracoConfiguration.Reset(); - } - - [Test] - public void Can_Set_Custom_Implementation() - { - var mockedContent = new Mock(); - mockedContent.Setup(section => section.NotificationEmailAddress).Returns("test@test.com"); - UmbracoConfiguration.Set(mockedContent.Object); - - Assert.AreEqual("test@test.com", UmbracoConfiguration.For().NotificationEmailAddress); - } - - [Test] - public void Can_Reset() - { - var mockedContent = new Mock(); - mockedContent.Setup(section => section.NotificationEmailAddress).Returns("test@test.com"); - UmbracoConfiguration.Set(mockedContent.Object); - - UmbracoConfiguration.Reset(); - - Assert.Throws(() => UmbracoConfiguration.For()); - } - - } - + [TestFixture] public class FileSystemProviderTests { diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs index 11e792a4db..8342bd13a3 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs @@ -29,7 +29,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings } else { - SettingsSection = UmbracoConfiguration.For(configuration); + SettingsSection = configuration.GetSection("umbracoConfiguration/settings") as UmbracoSettingsSection; } diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs index 39d0b8be7f..fbade43b74 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings [Test] public virtual void UrlProviderMode() { - Assert.IsTrue(SettingsSection.WebRouting.UrlProviderMode == "Auto"); + Assert.IsTrue(SettingsSection.WebRouting.UrlProviderMode == "AutoLegacy"); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 100e7b8b34..20456f4853 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -87,7 +87,7 @@ namespace Umbraco.Tests if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var umbracoXML = cache.GetXml(UmbracoContext.Current, UmbracoContext.Current.InPreviewMode); - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "./data [@alias='{0}']" : "./{0}"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias='{0}']" : "./{0}"; if (umbracoXML.GetElementById(nodeId.ToString()) != null) if ( ",id,parentID,level,writerID,template,sortOrder,createDate,updateDate,nodeName,writerName,path," diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index 068d8f20a6..4e5249b194 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -18,18 +18,7 @@ namespace Umbraco.Tests.TestHelpers /// public static void ConfigureSettings(IUmbracoSettingsSection settings) { - UmbracoConfiguration.Current.UmbracoSettings = settings; - } - - /// - /// Used for unit tests to explicitly associate an IUmbracoConfigurationSection to an implementation - /// - /// - /// - public static void SetSetting(T implementation) - where T : IUmbracoConfigurationSection - { - UmbracoConfiguration.Set(implementation); + UmbracoConfig.For.SetUmbracoSettings(settings); } /// diff --git a/src/Umbraco.Tests/XmlHelperTests.cs b/src/Umbraco.Tests/XmlHelperTests.cs index dfb7abc46f..ad00a364e6 100644 --- a/src/Umbraco.Tests/XmlHelperTests.cs +++ b/src/Umbraco.Tests/XmlHelperTests.cs @@ -152,7 +152,7 @@ namespace Umbraco.Tests XmlNode n = parentNode.CloneNode(true); // remove all children from original node - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "./node" : "./* [@id]"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./node" : "./* [@id]"; foreach (XmlNode child in parentNode.SelectNodes(xpath)) parentNode.RemoveChild(child); diff --git a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs b/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs index 5407c7c52d..295b11b8f5 100644 --- a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs +++ b/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs @@ -22,16 +22,16 @@ namespace Umbraco.Web.UI.Install.Steps if (Page.IsValid) { var u = User.GetUser(0); - var user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].GetUser(0, true); + var user = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].GetUser(0, true); user.ChangePassword(u.GetPassword(), tb_password.Text.Trim()); // Is it using the default membership provider - if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider] is UsersMembershipProvider) + if (Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] is UsersMembershipProvider) { // Save user in membership provider var umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = tb_name.Text.Trim(); - Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].UpdateUser(umbracoUser); + Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].UpdateUser(umbracoUser); // Save user details u.Email = tb_email.Text.Trim(); @@ -39,7 +39,7 @@ namespace Umbraco.Web.UI.Install.Steps else { u.Name = tb_name.Text.Trim(); - if (!(Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].UpdateUser(user); + if (!(Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].UpdateUser(user); } // we need to update the login name here as it's set to the old name when saving the user via the membership provider! diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx index 88b62a4e2b..93447605b3 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx @@ -14,7 +14,7 @@ (function($) { $(document).ready(function () { Umbraco.Dialogs.EditMacro.getInstance().init({ - useAspNetMasterPages: <%=UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower() %>, + useAspNetMasterPages: <%=UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages.ToString().ToLower() %>, codeEditorElementId: "<%=Request.GetItemAsString("objectId")%>", renderingEngine: "<%=Request.GetItemAsString("renderingEngine", "Mvc")%>", macroAlias: '<%= _macroAlias %>' diff --git a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx index 0356f4fe07..a6f25da43e 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx +++ b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx @@ -24,7 +24,7 @@ restServiceLocation: "<%= Url.GetSaveFileServicePath() %>", umbracoPath: '<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>', editorClientId: '<%= editorSource.ClientID %>', - useMasterPages: <%=UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower()%>, + useMasterPages: <%=UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages.ToString().ToLower()%>, templateId: <%= Request.QueryString["templateID"] %>, masterTemplateId: jQuery('#<%= MasterTemplate.ClientID %>').val(), masterPageDropDown: $("#<%= MasterTemplate.ClientID %>"), diff --git a/src/Umbraco.Web/BaseRest/BaseRestHandler.cs b/src/Umbraco.Web/BaseRest/BaseRestHandler.cs index ff468c3847..147f45da70 100644 --- a/src/Umbraco.Web/BaseRest/BaseRestHandler.cs +++ b/src/Umbraco.Web/BaseRest/BaseRestHandler.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web.BaseRest /// A value indicating whether the specified Uri should be routed to the BaseRestHandler. public static bool IsBaseRestRequest(Uri uri) { - return UmbracoConfiguration.Current.BaseRestExtensions.Enabled + return UmbracoConfig.For.BaseRestExtensions().Enabled && uri.AbsolutePath.ToLowerInvariant().StartsWith(BaseUrl); } diff --git a/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs b/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs index 4db612836a..7227091262 100644 --- a/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs +++ b/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs @@ -89,7 +89,7 @@ namespace Umbraco.Web.BaseRest // static RestExtensionMethodInfo GetFromConfiguration(string extensionAlias, string methodName, int paramsCount) { - var config = UmbracoConfiguration.Current.BaseRestExtensions; + var config = UmbracoConfig.For.BaseRestExtensions(); var configExtension = config.Items[extensionAlias]; if (configExtension == null) diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs index 04ddd7e696..a8958b35c5 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs @@ -527,7 +527,7 @@ namespace Umbraco.Web.Cache public static void ClearXsltCacheOnCurrentServer(this DistributedCache dc) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration > 0) + if (UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration > 0) { ApplicationContext.Current.ApplicationCache.ClearCacheObjectTypes("MS.Internal.Xml.XPath.XPathSelectionIterator"); } diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index af49f1b861..471bfffccf 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -73,7 +73,7 @@ namespace Umbraco.Web.Editors { {"umbracoPath", GlobalSettings.Path}, {"imageFileTypes", - string.Join(",",UmbracoConfiguration.Current.UmbracoSettings.Content.ImageFileTypes)}, + string.Join(",",UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes)}, } }, { "isDebuggingEnabled", HttpContext.IsDebuggingEnabled } diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 2a8539bec9..3b4e5b3146 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web if (UmbracoContext.Current.InPreviewMode) { var htmlBadge = - String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge, + String.Format(UmbracoConfig.For.UmbracoSettings().Content.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), UmbracoContext.Current.HttpContext.Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/LegacyScheduledTasks.cs b/src/Umbraco.Web/LegacyScheduledTasks.cs index 7c2557a872..cb5166ff7e 100644 --- a/src/Umbraco.Web/LegacyScheduledTasks.cs +++ b/src/Umbraco.Web/LegacyScheduledTasks.cs @@ -55,8 +55,8 @@ namespace Umbraco.Web int interval = 24 * 60 * 60; //24 hours try { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds > -1) - interval = UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds; + if (UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds > -1) + interval = UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds; } catch (Exception e) { @@ -70,8 +70,8 @@ namespace Umbraco.Web int maximumAge = 24 * 60 * 60; try { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge > -1) - maximumAge = UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge; + if (UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge > -1) + maximumAge = UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge; } catch (Exception e) { diff --git a/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs b/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs index c8606e8897..9777e39fe6 100644 --- a/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs +++ b/src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs @@ -78,7 +78,7 @@ namespace Umbraco.Web.Media.ImageUrlProviders private static string GetProperty(XPathNodeIterator nodeIterator, string fileProp) { - var xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema + var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? string.Format(".//data[@alias = '{0}']", fileProp) : string.Format(".//{0}", fileProp); diff --git a/src/Umbraco.Web/Models/XmlPublishedContent.cs b/src/Umbraco.Web/Models/XmlPublishedContent.cs index a0e1b10539..a34a19ce5e 100644 --- a/src/Umbraco.Web/Models/XmlPublishedContent.cs +++ b/src/Umbraco.Web/Models/XmlPublishedContent.cs @@ -317,7 +317,7 @@ namespace Umbraco.Web.Models if (_pageXmlNode.Attributes.GetNamedItem("writerID") != null) _writerId = int.Parse(_pageXmlNode.Attributes.GetNamedItem("writerID").Value); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { if (_pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null) _docTypeAlias = _pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value; @@ -343,12 +343,12 @@ namespace Umbraco.Web.Models } // load data - var dataXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; + var dataXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath)) _properties.Add(new XmlPublishedContentProperty(n)); // load children - var childXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + var childXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; var nav = _pageXmlNode.CreateNavigator(); var expr = nav.Compile(childXPath); expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); diff --git a/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs b/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs index b900ca6ee8..11326210a5 100644 --- a/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs +++ b/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.Models // For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes) if (propertyXmlData.Attributes.GetNamedItem("versionID") != null) _version = new Guid(propertyXmlData.Attributes.GetNamedItem("versionID").Value); - _alias = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? + _alias = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? propertyXmlData.Attributes.GetNamedItem("alias").Value : propertyXmlData.Name; _value = XmlHelper.GetNodeValue(propertyXmlData); diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index 27823aef3e..618e656182 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -139,7 +139,7 @@ namespace Umbraco.Web.Mvc { // creating previewBadge markup markupToInject = - String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge, + String.Format(UmbracoConfig.For.UmbracoSettings().Content.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index 18da7cbcee..76be4d07b4 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web.PropertyEditors foreach (var p in model.Properties) { var uploadFieldConfigNode = - UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties + UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties .FirstOrDefault(x => x.Alias == p.Alias); if (uploadFieldConfigNode != null) diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs index aa000a4a76..c62d5716a7 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs @@ -93,7 +93,7 @@ namespace Umbraco.Web.PropertyEditors var name = IOHelper.SafeFileName(file.FileName.Substring(file.FileName.LastIndexOf(IOHelper.DirSepChar) + 1, file.FileName.Length - file.FileName.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower()); - var subfolder = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var subfolder = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? currentPersistedFile.Replace(fs.GetUrl("/"), "").Split('/')[0] : currentPersistedFile.Substring(currentPersistedFile.LastIndexOf("/", StringComparison.Ordinal) + 1).Split('-')[0]; @@ -102,7 +102,7 @@ namespace Umbraco.Web.PropertyEditors ? subfolderId.ToString(CultureInfo.InvariantCulture) : MediaSubfolderCounter.Current.Increment().ToString(CultureInfo.InvariantCulture); - var fileName = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var fileName = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? Path.Combine(numberedFolder, name) : numberedFolder + "-" + name; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index 613abf8dfc..f0d467723f 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -226,7 +226,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // that switch schemas fail - so cache and refresh when needed, // ie never when running the actual site - var version = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? 0 : 1; + var version = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? 0 : 1; if (_xPathStringsValue == null || _xPathStringsValue.Version != version) _xPathStringsValue = new XPathStringsDefinition(version); return _xPathStringsValue; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index fff4528a2c..e62dff9bc0 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -253,7 +253,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (xpath == null) throw new ArgumentNullException("xpath"); var values = new Dictionary {{"nodeName", xpath.GetAttribute("nodeName", "")}}; - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { values.Add("nodeTypeAlias", xpath.Name); } diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index 23b12fe614..e0121a4b3c 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -124,7 +124,7 @@ namespace Umbraco.Web.Routing // that switch schemas fail - so cache and refresh when needed, // ie never when running the actual site - var version = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? 0 : 1; + var version = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? 0 : 1; if (_xPathStringsValue == null || _xPathStringsValue.Version != version) _xPathStringsValue = new XPathStringsDefinition(version); return _xPathStringsValue; diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index 922f9fa595..5a9dd9123c 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -106,7 +106,7 @@ namespace Umbraco.Web.Routing if (mode == UrlProviderMode.AutoLegacy) { - mode = UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes + mode = UmbracoConfig.For.UmbracoSettings().RequestHandler.UseDomainPrefixes ? UrlProviderMode.Absolute : UrlProviderMode.Auto; } diff --git a/src/Umbraco.Web/Routing/PublishedContentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs index 85dc0c53c1..1ee01a72ab 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -164,7 +164,7 @@ namespace Umbraco.Web.Routing IsInternalRedirectPublishedContent = isInternalRedirect; // must restore the template if it's an internal redirect & the config option is set - if (isInternalRedirect && UmbracoConfiguration.Current.UmbracoSettings.WebRouting.InternalRedirectPreservesTemplate) + if (isInternalRedirect && UmbracoConfig.For.UmbracoSettings().WebRouting.InternalRedirectPreservesTemplate) { // restore _template = template; diff --git a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs index d9769c8474..fb6aca88b3 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs @@ -532,7 +532,7 @@ namespace Umbraco.Web.Routing // does not apply // + optionnally, apply the alternate template on internal redirects var useAltTemplate = _pcr.IsInitialPublishedContent - || (UmbracoConfiguration.Current.UmbracoSettings.WebRouting.InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent); + || (UmbracoConfig.For.UmbracoSettings().WebRouting.InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent); string altTemplate = useAltTemplate ? _routingContext.UmbracoContext.HttpContext.Request[Constants.Conventions.Url.AltTemplate] : null; diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index 9235248d54..69c56603fa 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -28,7 +28,7 @@ namespace Umbraco.Web.Routing var provider = UrlProviderMode.Auto; Mode = provider; - if (Enum.TryParse(UmbracoConfiguration.Current.UmbracoSettings.WebRouting.UrlProviderMode, out provider)) + if (Enum.TryParse(UmbracoConfig.For.UmbracoSettings().WebRouting.UrlProviderMode, out provider)) { Mode = provider; } diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 2c0c8b1176..adf1caa1e2 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -177,7 +177,7 @@ namespace Umbraco.Web.Security /// internal bool ValidateBackOfficeCredentials(string username, string password) { - var membershipProvider = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider]; + var membershipProvider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; return membershipProvider != null && membershipProvider.ValidateUser(username, password); } @@ -189,7 +189,7 @@ namespace Umbraco.Web.Security /// internal bool ChangePassword(string oldpassword, string newpassword) { - var membershipProvider = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider]; + var membershipProvider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; return membershipProvider.GetUser(CurrentUser.Username, true).ChangePassword(oldpassword, newpassword); } diff --git a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs index e814726a08..a5b1942e1e 100644 --- a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs +++ b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Strategies.DataTypes void DocumentBeforeSave(global::umbraco.cms.businesslogic.web.Document sender, global::umbraco.cms.businesslogic.SaveEventArgs e) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.Any()) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any()) { var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField)); if (property == null) @@ -40,7 +40,7 @@ namespace Umbraco.Web.Strategies.DataTypes void MediaBeforeSave(global::umbraco.cms.businesslogic.media.Media sender, global::umbraco.cms.businesslogic.SaveEventArgs e) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.Any()) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any()) { var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField)); if (property == null) @@ -53,7 +53,7 @@ namespace Umbraco.Web.Strategies.DataTypes private void FillProperties(global::umbraco.cms.businesslogic.Content content, global::umbraco.cms.businesslogic.property.Property property) { - var uploadFieldConfigNode = UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties + var uploadFieldConfigNode = UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties .FirstOrDefault(x => x.Alias == property.PropertyType.Alias); if (uploadFieldConfigNode != null) @@ -77,7 +77,7 @@ namespace Umbraco.Web.Strategies.DataTypes ? fileSystem.GetExtension(path).Substring(1).ToLowerInvariant() : ""; - var isImageType = UmbracoConfiguration.Current.UmbracoSettings.Content.ImageFileTypes.InvariantContains(extension); + var isImageType = UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.InvariantContains(extension); var dimensions = isImageType ? GetDimensions(path, fileSystem) : null; diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs index 114cb0de28..fea65fa321 100644 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ b/src/Umbraco.Web/Templates/TemplateUtilities.cs @@ -56,7 +56,7 @@ namespace Umbraco.Web.Templates /// public static string ResolveUrlsFromTextString(string text) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString) + if (UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString) { using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete")) { diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 008013b7f5..ea0f861921 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -320,7 +320,7 @@ namespace Umbraco.Web { LogHelper.Warn("Umbraco is not ready"); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading == false) + if (UmbracoConfig.For.UmbracoSettings().Content.EnableSplashWhileLoading == false) { // let requests pile up and wait for 10s then show the splash anyway ready = ApplicationContext.Current.WaitForReady(10 * 1000); @@ -398,7 +398,7 @@ namespace Umbraco.Web else if (pcr.Is404) { response.StatusCode = 404; - response.TrySkipIisCustomErrors = UmbracoConfiguration.Current.UmbracoSettings.WebRouting.TrySkipIisCustomErrors; + response.TrySkipIisCustomErrors = UmbracoConfig.For.UmbracoSettings().WebRouting.TrySkipIisCustomErrors; } if (pcr.ResponseStatusCode > 0) diff --git a/src/Umbraco.Web/UriUtility.cs b/src/Umbraco.Web/UriUtility.cs index ae3a95f132..86a97e2857 100644 --- a/src/Umbraco.Web/UriUtility.cs +++ b/src/Umbraco.Web/UriUtility.cs @@ -68,7 +68,7 @@ namespace Umbraco.Web { if (!GlobalSettings.UseDirectoryUrls) path += ".aspx"; - else if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.AddTrailingSlash) + else if (UmbracoConfig.For.UmbracoSettings().RequestHandler.AddTrailingSlash) path += "/"; } diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index e3ef5d5e04..7a5ed69163 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -262,7 +262,7 @@ namespace Umbraco.Web { try { - var user = User.GetUser(UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.UserId); + var user = User.GetUser(UmbracoConfig.For.UmbracoSettings().DistributedCall.UserId); return new System.Tuple(user.LoginName, user.GetPassword()); } catch (Exception e) diff --git a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs index 9106fcfc4d..032f08586a 100644 --- a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs +++ b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs @@ -75,7 +75,7 @@ namespace umbraco { string langXpath = CreateXPathQuery(domainUrl + "/" + url, false); if (content.Instance.XmlContent.DocumentElement.SelectSingleNode(langXpath) != null) return langXpath; - else if (UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes) + else if (UmbracoConfig.For.UmbracoSettings().RequestHandler.UseDomainPrefixes) return "/domainprefixes-are-used-so-i-do-not-work"; } } @@ -143,7 +143,7 @@ namespace umbraco { string currentDomain = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; string prefixXPath = ""; if (Domain.Exists(currentDomain)) { - string xpathDomain = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "//node [@id = '{0}']" : "//* [@isDoc and @id = '{0}']"; + string xpathDomain = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "//node [@id = '{0}']" : "//* [@isDoc and @id = '{0}']"; prefixXPath = string.Format(xpathDomain, Domain.GetRootFromDomain(currentDomain)); _cacheUrl = false; } @@ -151,7 +151,7 @@ namespace umbraco { // the reason we have almost two identical queries in the xpath is to support scenarios where the user have // entered "/my-url" instead of "my-url" (ie. added a beginning slash) - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "//node [contains(concat(',',translate(data [@alias = 'umbracoUrlAlias'], ' ', ''),','),',{0},') or contains(concat(',',translate(data [@alias = 'umbracoUrlAlias'], ' ', ''),','),',{1},')]" : + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "//node [contains(concat(',',translate(data [@alias = 'umbracoUrlAlias'], ' ', ''),','),',{0},') or contains(concat(',',translate(data [@alias = 'umbracoUrlAlias'], ' ', ''),','),',{1},')]" : "//* [@isDoc and (contains(concat(',',translate(umbracoUrlAlias, ' ', ''),','),',{0},') or contains(concat(',',translate(umbracoUrlAlias, ' ', ''),','),',{1},'))]"; string query = String.Format(prefixXPath + xpath, tempUrl, "/" + tempUrl); XmlNode redir = diff --git a/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs b/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs index 612427d18a..1cf985503e 100644 --- a/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs +++ b/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs @@ -110,7 +110,7 @@ namespace umbraco.presentation { get { - return !UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema; + return !UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; } } diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 15ab10b4a4..9bf99a3b15 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -143,7 +143,7 @@ namespace umbraco { _xmlContent = value; - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled && UmbracoConfiguration.Current.UmbracoSettings.Content.ContinouslyUpdateXmlDiskCache) + if (!UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled && UmbracoConfig.For.UmbracoSettings().Content.ContinouslyUpdateXmlDiskCache) QueueXmlForPersistence(); else // Clear cache... @@ -160,7 +160,7 @@ namespace umbraco /// private void CheckDiskCacheForUpdate() { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled) + if (UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled) return; lock (TimestampSyncLock) @@ -187,7 +187,7 @@ namespace umbraco /// Returns true of the XML was not populated, returns false if it was already populated private bool CheckXmlContentPopulation() { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.XmlContentCheckForDiskChanges) + if (UmbracoConfig.For.UmbracoSettings().Content.XmlContentCheckForDiskChanges) CheckDiskCacheForUpdate(); if (_xmlContent == null) @@ -208,7 +208,7 @@ namespace umbraco // Only save new XML cache to disk if we just repopulated it // TODO: Re-architect this so that a call to this method doesn't invoke a new thread for saving disk cache - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled && !IsValidDiskCachePresent()) + if (!UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled && !IsValidDiskCachePresent()) { QueueXmlForPersistence(); } @@ -310,7 +310,7 @@ namespace umbraco // queues this up, because this delegate is executing on a different thread and may complete // after the request which invoked it (which would normally persist the file on completion) // So we are responsible for ensuring the content is persisted in this case. - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled && UmbracoConfiguration.Current.UmbracoSettings.Content.ContinouslyUpdateXmlDiskCache) + if (!UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled && UmbracoConfig.For.UmbracoSettings().Content.ContinouslyUpdateXmlDiskCache) PersistXmlToFile(xmlDoc); }); @@ -322,7 +322,7 @@ namespace umbraco { // Remove all attributes and data nodes from the published node PublishedNode.Attributes.RemoveAll(); - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "./data" : "./* [not(@id)]"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data" : "./* [not(@id)]"; foreach (XmlNode n in PublishedNode.SelectNodes(xpath)) PublishedNode.RemoveChild(n); @@ -386,7 +386,7 @@ namespace umbraco // if the document is not there already then it's a new document // we must make sure that its document type exists in the schema var xmlContentCopy2 = xmlContentCopy; - if (currentNode == null && UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema == false) + if (currentNode == null && UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema == false) { xmlContentCopy = ValidateSchema(docNode.Name, xmlContentCopy); if (xmlContentCopy != xmlContentCopy2) @@ -428,7 +428,7 @@ namespace umbraco } // TODO: Update with new schema! - var xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema + var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./node" : "./* [@id]"; @@ -471,7 +471,7 @@ namespace umbraco /// The parent node. public static void SortNodes(ref XmlNode parentNode) { - var xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema + var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./node" : "./* [@id]"; @@ -510,7 +510,7 @@ namespace umbraco { // modify a clone of the cache because even though we're into the write-lock // we may have threads reading at the same time. why is this an option? - XmlDocument wip = UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent + XmlDocument wip = UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent ? CloneXmlDoc(XmlContentInternal) : XmlContentInternal; @@ -993,7 +993,7 @@ namespace umbraco /// private XmlDocument LoadContent() { - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled && IsValidDiskCachePresent()) + if (!UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled && IsValidDiskCachePresent()) { try { @@ -1195,13 +1195,13 @@ order by umbracoNode.level, umbracoNode.sortOrder"; if (hierarchy.TryGetValue(parentId, out children)) { - XmlNode childContainer = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema || + XmlNode childContainer = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME) ? parentNode : parentNode.SelectSingleNode( UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME); - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema && + if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema && !String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) { if (childContainer == null) @@ -1217,7 +1217,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; { XmlNode childNode = nodeIndex[childId]; - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema || + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema || String.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME)) { parentNode.AppendChild(childNode); @@ -1320,7 +1320,7 @@ order by umbracoNode.level, umbracoNode.sortOrder"; else { //// Save copy of content - if (UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent) + if (UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent) { XmlDocument xmlContentCopy = CloneXmlDoc(_xmlContent); diff --git a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs index 8a44676516..575d9da0e1 100644 --- a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs @@ -57,7 +57,7 @@ namespace umbraco _upage = _docRequest.UmbracoPage; //we need to check this for backwards compatibility in case people still arent' using master pages - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { var args = new RequestInitEventArgs() { @@ -90,7 +90,7 @@ namespace umbraco //This is only here for legacy if people arent' using master pages... //TODO: We need to test that this still works!! Or do we ?? - if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (!UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { var args = new RequestInitEventArgs() { @@ -153,7 +153,7 @@ namespace umbraco if (pos > -1) { string htmlBadge = - String.Format(UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge, + String.Format(UmbracoConfig.For.UmbracoSettings().Content.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/umbraco.presentation/helper.cs b/src/Umbraco.Web/umbraco.presentation/helper.cs index f5ff53624b..5b05f52b82 100644 --- a/src/Umbraco.Web/umbraco.presentation/helper.cs +++ b/src/Umbraco.Web/umbraco.presentation/helper.cs @@ -121,7 +121,7 @@ namespace umbraco XmlNode element = umbracoXML.GetElementById(splitpath[splitpath.Length - i - 1].ToString()); if (element == null) continue; - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "{0}"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "{0}"; XmlNode currentNode = element.SelectSingleNode(string.Format(xpath, keyName)); if (currentNode != null && currentNode.FirstChild != null && diff --git a/src/Umbraco.Web/umbraco.presentation/item.cs b/src/Umbraco.Web/umbraco.presentation/item.cs index 168abe3213..09cb19fced 100644 --- a/src/Umbraco.Web/umbraco.presentation/item.cs +++ b/src/Umbraco.Web/umbraco.presentation/item.cs @@ -114,7 +114,7 @@ namespace umbraco if (element == null) continue; - var xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "./{0}"; + var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "./data [@alias = '{0}']" : "./{0}"; var currentNode = element.SelectSingleNode(string.Format(xpath, _fieldName)); //continue if all is null @@ -184,7 +184,7 @@ namespace umbraco // OTHER FORMATTING FUNCTIONS // If we use masterpages, this is moved to the ItemRenderer to add support for before/after in inline XSLT - if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (!UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { if (_fieldContent != "" && helper.FindAttribute(attributes, "insertTextBefore") != "") _fieldContent = HttpContext.Current.Server.HtmlDecode(helper.FindAttribute(attributes, "insertTextBefore")) + diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 111d62cde5..0b6c35e394 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -455,12 +455,12 @@ namespace umbraco { try { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration > 0) + if (UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration > 0) { XPathNodeIterator retVal = ApplicationContext.Current.ApplicationCache.GetCacheItem( string.Format( "{0}_{1}_{2}", CacheKeys.MediaCacheKey, MediaId, Deep), - TimeSpan.FromSeconds(UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration), + TimeSpan.FromSeconds(UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration), () => getMediaDo(MediaId, Deep)); if (retVal != null) @@ -489,7 +489,7 @@ namespace umbraco XmlDocument mXml = new XmlDocument(); mXml.LoadXml(m.ToXml(mXml, Deep).OuterXml); XPathNavigator xp = mXml.CreateNavigator(); - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "/node" : String.Format("/{0}", Casing.SafeAliasWithForcingCheck(m.ContentType.Alias)); + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "/node" : String.Format("/{0}", Casing.SafeAliasWithForcingCheck(m.ContentType.Alias)); return xp.Select(xpath); } return null; @@ -506,12 +506,12 @@ namespace umbraco { try { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration > 0) + if (UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration > 0) { var retVal = ApplicationContext.Current.ApplicationCache.GetCacheItem( string.Format( "{0}_{1}", CacheKeys.MemberLibraryCacheKey, MemberId), - TimeSpan.FromSeconds(UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration), + TimeSpan.FromSeconds(UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration), () => getMemberDo(MemberId)); if (retVal != null) @@ -980,7 +980,7 @@ namespace umbraco /// The rendered template as a string public static string RenderTemplate(int PageId, int TemplateId) { - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { using (var sw = new StringWriter()) { @@ -1860,7 +1860,7 @@ namespace umbraco internal static string GetCurrentNotFoundPageId() { //XmlNode error404Node = UmbracoSettings.GetKeyAsNode("/settings/content/errors/error404"); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.Error404Collection.Count() > 1) + if (UmbracoConfig.For.UmbracoSettings().Content.Error404Collection.Count() > 1) { // try to get the 404 based on current culture (via domain) IContentErrorPage cultureErr; @@ -1869,7 +1869,7 @@ namespace umbraco var d = Domain.GetDomain(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]); // test if a 404 page exists with current culture - cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Error404Collection + cultureErr = UmbracoConfig.For.UmbracoSettings().Content.Error404Collection .FirstOrDefault(x => x.Culture == d.Language.CultureAlias); if (cultureErr != null) @@ -1880,7 +1880,7 @@ namespace umbraco } // test if a 404 page exists with current culture thread - cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Error404Collection + cultureErr = UmbracoConfig.For.UmbracoSettings().Content.Error404Collection .FirstOrDefault(x => x.Culture == System.Threading.Thread.CurrentThread.CurrentUICulture.Name); if (cultureErr != null) { @@ -1888,7 +1888,7 @@ namespace umbraco } // there should be a default one! - cultureErr = UmbracoConfiguration.Current.UmbracoSettings.Content.Error404Collection + cultureErr = UmbracoConfig.For.UmbracoSettings().Content.Error404Collection .FirstOrDefault(x => x.Culture == "default"); if (cultureErr != null) { @@ -1898,7 +1898,7 @@ namespace umbraco else { - return UmbracoConfiguration.Current.UmbracoSettings.Content.Error404Collection.First().ContentId.ToInvariantString(); + return UmbracoConfig.For.UmbracoSettings().Content.Error404Collection.First().ContentId.ToInvariantString(); } return ""; diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index 3653098d07..087853f0aa 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -295,7 +295,7 @@ namespace umbraco Alias = Model.Alias, ItemKey = Model.ScriptName, Exception = e, - Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour + Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; return GetControlForErrorBehavior("Error loading Partial View script (file: " + ScriptFile + ")", macroErrorEventArgs); }; @@ -363,7 +363,7 @@ namespace umbraco Alias = Model.Alias, ItemKey = Model.TypeName, Exception = e, - Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour + Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; macroControl = GetControlForErrorBehavior("Error loading userControl '" + Model.TypeName + "'", macroErrorEventArgs); @@ -404,7 +404,7 @@ namespace umbraco Alias = Model.Alias, ItemKey = Model.TypeAssembly, Exception = e, - Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour + Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; macroControl = GetControlForErrorBehavior("Error loading customControl (Assembly: " + Model.TypeAssembly + ", Type: '" + Model.TypeName + "'", macroErrorEventArgs); @@ -436,7 +436,7 @@ namespace umbraco Alias = Model.Alias, ItemKey = ScriptFile, Exception = e, - Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour + Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; return GetControlForErrorBehavior("Error loading MacroEngine script (file: " + ScriptFile + ")", macroErrorEventArgs); @@ -892,7 +892,7 @@ namespace umbraco Exceptions.Add(e); LogHelper.WarnWithException("Error parsing XSLT file", e); - var macroErrorEventArgs = new MacroErrorEventArgs { Name = Model.Name, Alias = Model.Alias, ItemKey = Model.Xslt, Exception = e, Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour }; + var macroErrorEventArgs = new MacroErrorEventArgs { Name = Model.Name, Alias = Model.Alias, ItemKey = Model.Xslt, Exception = e, Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; var macroControl = GetControlForErrorBehavior("Error parsing XSLT file: \\xslt\\" + XsltFile, macroErrorEventArgs); //if it is null, then we are supposed to throw the (original) exception // see: http://issues.umbraco.org/issue/U4-497 at the end @@ -910,7 +910,7 @@ namespace umbraco LogHelper.WarnWithException("Error loading XSLT " + Model.Xslt, true, e); // Invoke any error handlers for this macro - var macroErrorEventArgs = new MacroErrorEventArgs { Name = Model.Name, Alias = Model.Alias, ItemKey = Model.Xslt, Exception = e, Behaviour = UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour }; + var macroErrorEventArgs = new MacroErrorEventArgs { Name = Model.Name, Alias = Model.Alias, ItemKey = Model.Xslt, Exception = e, Behaviour = UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour }; var macroControl = GetControlForErrorBehavior("Error reading XSLT file: \\xslt\\" + XsltFile, macroErrorEventArgs); //if it is null, then we are supposed to throw the (original) exception // see: http://issues.umbraco.org/issue/U4-497 at the end diff --git a/src/Umbraco.Web/umbraco.presentation/publishingService.cs b/src/Umbraco.Web/umbraco.presentation/publishingService.cs index 3555c6a368..af88c472cb 100644 --- a/src/Umbraco.Web/umbraco.presentation/publishingService.cs +++ b/src/Umbraco.Web/umbraco.presentation/publishingService.cs @@ -62,7 +62,7 @@ namespace umbraco.presentation // run scheduled url tasks try { - foreach (var t in UmbracoConfiguration.Current.UmbracoSettings.ScheduledTasks.Tasks) + foreach (var t in UmbracoConfig.For.UmbracoSettings().ScheduledTasks.Tasks) { bool runTask = false; if (!ScheduledTaskTimes.ContainsKey(t.Alias)) diff --git a/src/Umbraco.Web/umbraco.presentation/requestModule.cs b/src/Umbraco.Web/umbraco.presentation/requestModule.cs index 3f830aca21..14fe89193e 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestModule.cs @@ -157,7 +157,7 @@ namespace umbraco.presentation } // show splash? - else if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading && content.Instance.isInitializing) + else if (UmbracoConfig.For.UmbracoSettings().Content.EnableSplashWhileLoading && content.Instance.isInitializing) context.RewritePath(string.Format("{0}/splashes/booting.aspx", SystemDirectories.Config)); // rewrite page path else @@ -361,7 +361,7 @@ namespace umbraco.presentation { LogHelper.Info(string.Format("Application started at {0}", DateTime.Now)); - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.AutoCleanLogs) + if (UmbracoConfig.For.UmbracoSettings().Logging.AutoCleanLogs) { AddTask(LOG_SCRUBBER_TASK_NAME, GetLogScrubbingInterval()); } @@ -421,8 +421,8 @@ namespace umbraco.presentation int interval = 24 * 60 * 60; //24 hours try { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds > -1) - interval = UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds; + if (UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds > -1) + interval = UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds; } catch (Exception) { @@ -436,8 +436,8 @@ namespace umbraco.presentation int maximumAge = 24 * 60 * 60; try { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge > -1) - maximumAge = UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge; + if (UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge > -1) + maximumAge = UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge; } catch (Exception) { diff --git a/src/Umbraco.Web/umbraco.presentation/template.cs b/src/Umbraco.Web/umbraco.presentation/template.cs index 65c8b514b4..1b51a735ca 100644 --- a/src/Umbraco.Web/umbraco.presentation/template.cs +++ b/src/Umbraco.Web/umbraco.presentation/template.cs @@ -265,7 +265,7 @@ namespace umbraco pageContent.Controls.Add(new LiteralControl("
")); // NH: Switching to custom controls for macros - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { umbraco.presentation.templateControls.Macro macroControl = new umbraco.presentation.templateControls.Macro(); macroControl.Alias = helper.FindAttribute(attributes, "macroalias"); @@ -311,7 +311,7 @@ namespace umbraco { // NH: Switching to custom controls for items - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { umbraco.presentation.templateControls.Item itemControl = new umbraco.presentation.templateControls.Item(); itemControl.Field = helper.FindAttribute(attributes, "field"); @@ -525,7 +525,7 @@ namespace umbraco this._templateName = t._templateName; // Only check for master on legacy templates - can show error when using master pages. - if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (!UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { checkForMaster(tId); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs index ed922a8709..8a311aae44 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs @@ -38,7 +38,7 @@ namespace umbraco.ActionHandlers public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.EnsureUniqueNaming) + if (UmbracoConfig.For.UmbracoSettings().Content.EnsureUniqueNaming) { string currentName = documentObject.Text; int uniqueNumber = 1; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs index b313b200ac..5056d970e7 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs @@ -72,7 +72,7 @@ namespace umbraco RenderTemplateFolderItems(folder, folderPath, ref tree); else { - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.EnableTemplateFolders) + if (UmbracoConfig.For.UmbracoSettings().Templates.EnableTemplateFolders) RenderTemplateFolders(ref tree); RenderTemplates(ref tree); @@ -195,7 +195,7 @@ namespace umbraco xNode.Source = GetTreeServiceUrl(t.Id); xNode.HasChildren = t.HasChildren; - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t)) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t)) { xNode.Action = "javascript:openView(" + t.Id + ");"; xNode.Icon = "icon-newspaper-alt"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs index 57b8cbd86a..5db7a06dab 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs @@ -72,8 +72,8 @@ function openUser(id) { bool currUserIsAdmin = currUser.IsAdmin(); foreach (User u in users.OrderBy(x => x.Disabled)) { - if (!UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice - || (UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice && !u.Disabled)) + if (!UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice + || (UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice && !u.Disabled)) { XmlTreeNode xNode = XmlTreeNode.Create(this); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs index 348e4ffb81..c048ada53b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs @@ -76,7 +76,7 @@ namespace umbraco.presentation.channels doc.getProperty(userChannel.FieldExcerptAlias).Value = removeLeftUrl(post.mt_excerpt); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) + if (UmbracoConfig.For.UmbracoSettings().Content.TidyEditorContent) doc.getProperty(userChannel.FieldDescriptionAlias).Value = library.Tidy(removeLeftUrl(post.description), false); else doc.getProperty(userChannel.FieldDescriptionAlias).Value = removeLeftUrl(post.description); @@ -387,7 +387,7 @@ namespace umbraco.presentation.channels // Description - if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) + if (UmbracoConfig.For.UmbracoSettings().Content.TidyEditorContent) doc.getProperty(userChannel.FieldDescriptionAlias).Value = library.Tidy(removeLeftUrl(post.description), false); else doc.getProperty(userChannel.FieldDescriptionAlias).Value = removeLeftUrl(post.description); @@ -517,7 +517,7 @@ namespace umbraco.presentation.channels private static bool validateUser(string username, string password) { - return Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].ValidateUser(username, password); + return Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].ValidateUser(username, password); } [XmlRpcMethod("blogger.getUsersBlogs", diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs index 25905a8a40..7ebe703486 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs @@ -527,7 +527,7 @@ namespace umbraco.controls { string caption = p.PropertyType.Name; if (p.PropertyType.Description != null && p.PropertyType.Description != String.Empty) - switch (UmbracoConfiguration.Current.UmbracoSettings.Content.PropertyContextHelpOption) + switch (UmbracoConfig.For.UmbracoSettings().Content.PropertyContextHelpOption) { case "icon": caption += " \"""; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs index 9040931eba..af0986aee0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs @@ -247,7 +247,7 @@ namespace umbraco.controls.GenericProperties private void SetDefaultDocumentTypeProperty() { var itemToSelect = ddlTypes.Items.Cast() - .FirstOrDefault(item => item.Text.ToLowerInvariant() == UmbracoConfiguration.Current.UmbracoSettings.Content.DefaultDocumentTypeProperty.ToLowerInvariant()); + .FirstOrDefault(item => item.Text.ToLowerInvariant() == UmbracoConfig.For.UmbracoSettings().Content.DefaultDocumentTypeProperty.ToLowerInvariant()); if (itemToSelect != null) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/macroParameterControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/macroParameterControl.cs index 3048eea2cf..cbabf377fd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/macroParameterControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/macroParameterControl.cs @@ -75,7 +75,7 @@ namespace umbraco.controls /// The correct syntax for the macro including all parameters public string GetMacroTag() { string tag = ""; - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { tag = " 0) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs index 17d17a5dc5..bd9443fb3a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs @@ -37,10 +37,10 @@ namespace umbraco try { // Password is auto-generated. They are they required to change the password by editing the user information. - var u = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].CreateUser(Alias, + var u = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].CreateUser(Alias, Membership.GeneratePassword( - Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].MinRequiredPasswordLength, - Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].MinRequiredNonAlphanumericCharacters), + Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].MinRequiredPasswordLength, + Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].MinRequiredNonAlphanumericCharacters), "", "", "", true, null, out status); _returnUrl = string.Format("users/EditUser.aspx?id={0}", u.ProviderUserKey); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs index b6d1929764..db7cdd79c8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/xslt.ascx.cs @@ -60,7 +60,7 @@ namespace umbraco.presentation.create private static string getXsltTemplatePath() { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) { + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { return "/xslt/templates"; } else { return "/xslt/templates/schema2"; @@ -75,7 +75,7 @@ namespace umbraco.presentation.create if (createMacro.Checked) createMacroVal = 1; - var xsltName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? xsltTemplate.SelectedValue : + var xsltName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? xsltTemplate.SelectedValue : Path.Combine("schema2", xsltTemplate.SelectedValue); var returnUrl = LegacyDialogHandler.Create( diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs index 3364a8e42a..5ac63185d6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/ChangePassword.ascx.cs @@ -20,7 +20,7 @@ namespace umbraco.presentation.umbraco.dashboard protected void changePassword_Click(object sender, EventArgs e) { User u = User.GetCurrent(); - MembershipProvider provider = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider]; + MembershipProvider provider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; MembershipUser user = provider.GetUser(u.LoginName, true); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs index 95471ece48..6085caeb48 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs @@ -56,7 +56,7 @@ namespace umbraco.presentation.developer.packages { UmbracoVersion.Current.Major, UmbracoVersion.Current.Minor, UmbracoVersion.Current.Build, - UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema.ToString(), Environment.Version, + UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema.ToString(), Environment.Version, Umbraco.Core.SystemUtilities.GetCurrentTrustLevel()); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs index 59ff27b0ec..f258ecf323 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/LoadNitros.ascx.cs @@ -177,7 +177,7 @@ namespace umbraco.presentation.developer.packages { try { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version4); else rep_nitros.DataSource = repo.Webservice.NitrosCategorizedByVersion(cms.businesslogic.packager.repositories.Version.Version41); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs index 9c6c693cd3..b8fbdf25a5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltInsertValueOf.aspx.cs @@ -38,7 +38,7 @@ namespace umbraco.developer foreach (PropertyType pt in PropertyType.GetAll()) if (!existingGenProps.Contains("," + pt.Alias + ",")) { - if(UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if(UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) preValuesSource.Add(string.Format("data [@alias = '{0}']", pt.Alias)); else preValuesSource.Add(pt.Alias); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs index 0317d64f13..6666898a6d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs @@ -43,7 +43,7 @@ namespace umbraco.dialogs pp_removePTags.Text = ui.Text("templateEditor", "removeParagraph"); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { tagName.Value = "umbraco:Item"; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs index 62c3f32b70..f5bb290d47 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs @@ -70,10 +70,10 @@ namespace umbraco.cms.presentation protected void Button1_Click(object sender, System.EventArgs e) { // Authenticate users by using the provider specified in umbracoSettings.config - if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].ValidateUser(lname.Text, passw.Text)) + if (Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].ValidateUser(lname.Text, passw.Text)) { - if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider) - ActiveDirectoryMapping(lname.Text, Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].GetUser(lname.Text, false).Email); + if (Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider) + ActiveDirectoryMapping(lname.Text, Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].GetUser(lname.Text, false).Email); var u = new User(lname.Text); doLogin(u); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs index 35cdf50281..db5046d196 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs @@ -489,7 +489,7 @@ namespace umbraco.NodeFactory if (_pageXmlNode.Attributes.GetNamedItem("writerID") != null) _writerID = int.Parse(_pageXmlNode.Attributes.GetNamedItem("writerID").Value); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { if (_pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null) _nodeTypeAlias = _pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value; @@ -513,12 +513,12 @@ namespace umbraco.NodeFactory } // load data - string dataXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; + string dataXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath)) _properties.Add(new Property(n)); // load children - string childXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + string childXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; XPathNavigator nav = _pageXmlNode.CreateNavigator(); XPathExpression expr = nav.Compile(childXPath); expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Page_Legacy.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Page_Legacy.cs index 6e900df610..a779d4bcdd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Page_Legacy.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Page_Legacy.cs @@ -465,7 +465,7 @@ namespace umbraco.presentation.nodeFactory if (_pageXmlNode.Attributes.GetNamedItem("writerID") != null) _writerID = int.Parse(_pageXmlNode.Attributes.GetNamedItem("writerID").Value); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { if (_pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null) _nodeTypeAlias = _pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value; @@ -486,12 +486,12 @@ namespace umbraco.presentation.nodeFactory } // load data - string dataXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; + string dataXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath)) _properties.Add(new Property(n)); // load children - string childXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + string childXPath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; XPathNavigator nav = _pageXmlNode.CreateNavigator(); XPathExpression expr = nav.Compile(childXPath); expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); @@ -569,7 +569,7 @@ namespace umbraco.presentation.nodeFactory // For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes) if (PropertyXmlData.Attributes.GetNamedItem("versionID") != null) _version = new Guid(PropertyXmlData.Attributes.GetNamedItem("versionID").Value); - _alias = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? + _alias = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? PropertyXmlData.Attributes.GetNamedItem("alias").Value : PropertyXmlData.Name; _value = xmlHelper.GetNodeValue(PropertyXmlData); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Property.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Property.cs index a5b85bfc2f..b44a4882b2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Property.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Property.cs @@ -48,7 +48,7 @@ namespace umbraco.NodeFactory // For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes) if (PropertyXmlData.Attributes.GetNamedItem("versionID") != null) _version = new Guid(PropertyXmlData.Attributes.GetNamedItem("versionID").Value); - _alias = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? + _alias = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? PropertyXmlData.Attributes.GetNamedItem("alias").Value : PropertyXmlData.Name; _value = xmlHelper.GetNodeValue(PropertyXmlData); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs index 0b8a8f1e7f..91835f44ab 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs @@ -132,7 +132,7 @@ namespace umbraco.cms.presentation.settings editorSource.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { MenuIconI umbContainer = editorSource.Menu.NewIcon(); umbContainer.ImageURL = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs index dae8ad16d6..850cc5eb33 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs @@ -57,15 +57,15 @@ namespace umbraco.cms.presentation.settings.scripts lttPath.Text = "" + path + ""; - var exts = UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptFileTypes.ToList(); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc) + var exts = UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes.ToList(); + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc) { exts.Add("cshtml"); exts.Add("vbhtml"); } var dirs = SystemDirectories.Scripts; - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc) dirs += "," + SystemDirectories.MvcViews; // validate file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs index 78da6d2d4f..8064dd3627 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs @@ -188,7 +188,7 @@ namespace umbraco.presentation.translation foreach (XmlNode taskXml in tasks) { - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; XmlNode taskNode = taskXml.SelectSingleNode(xpath); // validate file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs index 6352041dbd..cd070e0a5a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs @@ -69,7 +69,7 @@ namespace umbraco.presentation.translation while (ide.MoveNext()) { var x = (XmlElement)ide.Value; - var parentXpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" : + var parentXpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "//node [@id = '" + x.SelectSingleNode("//node").Attributes.GetNamedItem("parentID").Value + "']" : "//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']"; var parent = _xd.SelectSingleNode(parentXpath); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs index e96fade2b6..0e17c0400f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/uQuery.cs @@ -107,7 +107,7 @@ namespace umbraco try { - isLegacyXmlSchema = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema; + isLegacyXmlSchema = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; } catch (MissingMethodException) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index a3679e4a22..cdafda1c0a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -302,7 +302,7 @@ namespace umbraco.cms.presentation.user if (!IsPostBack) { - MembershipUser user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].GetUser(u.LoginName, true); + MembershipUser user = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].GetUser(u.LoginName, true); uname.Text = u.Name; lname.Text = (user == null) ? u.LoginName : user.UserName; email.Text = (user == null) ? u.Email : user.Email; @@ -367,7 +367,7 @@ namespace umbraco.cms.presentation.user { try { - MembershipUser user = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].GetUser(u.LoginName, true); + MembershipUser user = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].GetUser(u.LoginName, true); string tempPassword = ((controls.passwordChanger)passw.Controls[0]).Password; @@ -379,14 +379,14 @@ namespace umbraco.cms.presentation.user } // Is it using the default membership provider - if (Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider] is UsersMembershipProvider) + if (Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] is UsersMembershipProvider) { // Save user in membership provider UsersMembershipUser umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = uname.Text.Trim(); umbracoUser.Language = userLanguage.SelectedValue; umbracoUser.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); - Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].UpdateUser(umbracoUser); + Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].UpdateUser(umbracoUser); // Save user details u.Email = email.Text.Trim(); @@ -397,7 +397,7 @@ namespace umbraco.cms.presentation.user u.Name = uname.Text.Trim(); u.Language = userLanguage.SelectedValue; u.UserType = UserType.GetUserType(int.Parse(userType.SelectedValue)); - if (!(Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider].UpdateUser(user); + if (!(Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider].UpdateUser(user); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs index 6746f15407..403b8e4816 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MediaUploader.ashx.cs @@ -223,7 +223,7 @@ namespace umbraco.presentation.umbraco.webservices if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { - var mp = Membership.Providers[UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider]; + var mp = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; if (mp != null && mp.ValidateUser(username, password)) { var user = new User(username); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs index 3f820c1aa4..5a6061e5f1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs @@ -99,7 +99,7 @@ namespace umbraco.presentation.webservices try { // Check if there's any documents yet - string xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "/root/node" : "/root/*"; + string xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "/root/node" : "/root/*"; if (content.Instance.XmlContent.SelectNodes(xpath).Count > 0) { var macroXML = new XmlDocument(); @@ -282,7 +282,7 @@ namespace umbraco.presentation.webservices { var engine = MacroEngineFactory.GetByFilename(tempFileName); var tempErrorMessage = ""; - var xpath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "/root/node" : "/root/*"; + var xpath = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "/root/node" : "/root/*"; if ( !engine.Validate(fileContents, tempFileName, Node.GetNodeByXpath(xpath), out tempErrorMessage)) @@ -380,7 +380,7 @@ namespace umbraco.presentation.webservices SystemDirectories.Scripts); // validate extension IOHelper.ValidateFileExtension(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename), - UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptFileTypes.ToList()); + UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes.ToList()); var val = contents; diff --git a/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs b/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs index 0e110d9759..e2b0cd62ed 100644 --- a/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/viewstateMoverModule.cs @@ -27,7 +27,7 @@ namespace umbraco.presentation void IHttpModule.Init(HttpApplication context) { - if (UmbracoConfiguration.Current.UmbracoSettings.ViewStateMoverModule.Enable) + if (UmbracoConfig.For.UmbracoSettings().ViewStateMoverModule.Enable) { context.BeginRequest += new EventHandler(context_BeginRequest); } diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs index 2359e2eb9c..c4ee935461 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicNode.cs @@ -486,7 +486,7 @@ namespace umbraco.MacroEngines var dataType = GetDataType(propResult.ContextAlias, propResult.Alias); //now we need to map to the old object until we can clean all this nonsense up - var configMapping = UmbracoConfiguration.Current.UmbracoSettings.Scripting.DataTypeModelStaticMappings + var configMapping = UmbracoConfig.For.UmbracoSettings().Scripting.DataTypeModelStaticMappings .Select(x => new RazorDataTypeModelStaticMappingItem() { DataTypeGuid = x.DataTypeGuid, @@ -812,7 +812,7 @@ namespace umbraco.MacroEngines //check that the document element is not one of the disallowed elements //allows RTE to still return as html if it's valid xhtml string documentElement = e.Name.LocalName; - if (UmbracoConfiguration.Current.UmbracoSettings.Scripting.NotDynamicXmlDocumentElements.Any(tag => + if (UmbracoConfig.For.UmbracoSettings().Scripting.NotDynamicXmlDocumentElements.Any(tag => string.Equals(tag.Element, documentElement, StringComparison.CurrentCultureIgnoreCase)) == false) { result = new DynamicXml(e); diff --git a/src/umbraco.businesslogic/Log.cs b/src/umbraco.businesslogic/Log.cs index 7bdfe01c73..4803bf5dcc 100644 --- a/src/umbraco.businesslogic/Log.cs +++ b/src/umbraco.businesslogic/Log.cs @@ -31,13 +31,13 @@ namespace umbraco.BusinessLogic if (_externalLoggerInitiated == false) { _externalLoggerInitiated = true; - if (string.IsNullOrEmpty(UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerAssembly) == false - && string.IsNullOrEmpty(UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerType) == false) + if (string.IsNullOrEmpty(UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerAssembly) == false + && string.IsNullOrEmpty(UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerType) == false) { try { - var assemblyPath = IOHelper.MapPath(UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerAssembly); - _externalLogger = Assembly.LoadFrom(assemblyPath).CreateInstance(UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerType) as Interfaces.ILog; + var assemblyPath = IOHelper.MapPath(UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerAssembly); + _externalLogger = Assembly.LoadFrom(assemblyPath).CreateInstance(UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerType) as Interfaces.ILog; } catch (Exception ee) { @@ -78,21 +78,21 @@ namespace umbraco.BusinessLogic { Instance.ExternalLogger.Add(type, user, nodeId, comment); - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerEnableAuditTrail == false) + if (UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerEnableAuditTrail == false) { AddLocally(type, user, nodeId, comment); } } else { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableLogging == false) return; + if (UmbracoConfig.For.UmbracoSettings().Logging.EnableLogging == false) return; - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.DisabledLogTypes.Any(x => x.LogTypeAlias.InvariantEquals(type.ToString())) == false) + if (UmbracoConfig.For.UmbracoSettings().Logging.DisabledLogTypes.Any(x => x.LogTypeAlias.InvariantEquals(type.ToString())) == false) { if (comment != null && comment.Length > 3999) comment = comment.Substring(0, 3955) + "..."; - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableAsyncLogging) + if (UmbracoConfig.For.UmbracoSettings().Logging.EnableAsyncLogging) { ThreadPool.QueueUserWorkItem( delegate { AddSynced(type, user == null ? 0 : user.Id, nodeId, comment); }); @@ -135,7 +135,7 @@ namespace umbraco.BusinessLogic if (comment.Length > 3999) comment = comment.Substring(0, 3955) + "..."; - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableAsyncLogging) + if (UmbracoConfig.For.UmbracoSettings().Logging.EnableAsyncLogging) { ThreadPool.QueueUserWorkItem( delegate { AddSynced(type, user == null ? 0 : user.Id, nodeId, comment); }); @@ -199,7 +199,7 @@ namespace umbraco.BusinessLogic public List GetAuditLogItems(int NodeId) { - if (UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerEnableAuditTrail && ExternalLogger != null) + if (UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerEnableAuditTrail && ExternalLogger != null) return ExternalLogger.GetAuditLogReader(NodeId); return LogItem.ConvertIRecordsReader(SqlHelper.ExecuteReader( diff --git a/src/umbraco.businesslogic/UmbracoSettings.cs b/src/umbraco.businesslogic/UmbracoSettings.cs index 3b5af36d9f..904c35fc4b 100644 --- a/src/umbraco.businesslogic/UmbracoSettings.cs +++ b/src/umbraco.businesslogic/UmbracoSettings.cs @@ -42,7 +42,7 @@ namespace umbraco /// public static bool UploadAllowDirectories { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories; } + get { return UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories; } } /// @@ -51,7 +51,7 @@ namespace umbraco /// true if logging is enabled; otherwise, false. public static bool EnableLogging { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableLogging; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.EnableLogging; } } /// @@ -60,7 +60,7 @@ namespace umbraco /// true if async logging is enabled; otherwise, false. public static bool EnableAsyncLogging { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.EnableAsyncLogging; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.EnableAsyncLogging; } } /// @@ -68,14 +68,14 @@ namespace umbraco /// public static string ExternalLoggerAssembly { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerAssembly; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerAssembly; } } /// /// Gets the type of an external logger that can be used to store log items in 3rd party systems /// public static string ExternalLoggerType { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerType; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerType; } } /// @@ -83,7 +83,7 @@ namespace umbraco /// public static bool ExternalLoggerLogAuditTrail { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.ExternalLoggerEnableAuditTrail; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.ExternalLoggerEnableAuditTrail; } } /// @@ -91,7 +91,7 @@ namespace umbraco /// public static bool KeepUserLoggedIn { - get { return UmbracoConfiguration.Current.UmbracoSettings.Security.KeepUserLoggedIn; } + get { return UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn; } } /// @@ -99,7 +99,7 @@ namespace umbraco /// public static bool HideDisabledUsersInBackoffice { - get { return UmbracoConfiguration.Current.UmbracoSettings.Security.HideDisabledUsersInBackoffice; } + get { return UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice; } } /// @@ -108,7 +108,7 @@ namespace umbraco /// true if logs are to be automatically cleaned; otherwise, false public static bool AutoCleanLogs { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.AutoCleanLogs; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.AutoCleanLogs; } } /// @@ -116,12 +116,12 @@ namespace umbraco /// public static int CleaningMiliseconds { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.CleaningMiliseconds; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.CleaningMiliseconds; } } public static int MaxLogAge { - get { return UmbracoConfiguration.Current.UmbracoSettings.Logging.MaxLogAge; } + get { return UmbracoConfig.For.UmbracoSettings().Logging.MaxLogAge; } } /// @@ -148,7 +148,7 @@ namespace umbraco /// true if umbraco will use domain prefixes; otherwise, false. public static bool UseDomainPrefixes { - get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.UseDomainPrefixes; } + get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.UseDomainPrefixes; } } /// @@ -157,7 +157,7 @@ namespace umbraco /// public static bool AddTrailingSlash { - get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.AddTrailingSlash; } + get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.AddTrailingSlash; } } /// @@ -166,7 +166,7 @@ namespace umbraco /// true if umbraco will use ASP.NET MasterPages; otherwise, false. public static bool UseAspNetMasterPages { - get { return UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages; } + get { return UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages; } } @@ -176,7 +176,7 @@ namespace umbraco /// true if umbraco will override templates with skins if present and configured false. public static bool EnableTemplateFolders { - get { return UmbracoConfiguration.Current.UmbracoSettings.Templates.EnableTemplateFolders; } + get { return UmbracoConfig.For.UmbracoSettings().Templates.EnableTemplateFolders; } } /// @@ -184,14 +184,14 @@ namespace umbraco /// public static List NotDynamicXmlDocumentElements { - get { return UmbracoConfiguration.Current.UmbracoSettings.Scripting.NotDynamicXmlDocumentElements.Select(x => x.Element).ToList(); } + get { return UmbracoConfig.For.UmbracoSettings().Scripting.NotDynamicXmlDocumentElements.Select(x => x.Element).ToList(); } } public static List RazorDataTypeModelStaticMapping { get { - var mapping = UmbracoConfiguration.Current.UmbracoSettings.Scripting.DataTypeModelStaticMappings; + var mapping = UmbracoConfig.For.UmbracoSettings().Scripting.DataTypeModelStaticMappings; //now we need to map to the old object until we can clean all this nonsense up return mapping.Select(x => new RazorDataTypeModelStaticMappingItem() @@ -213,7 +213,7 @@ namespace umbraco /// public static bool CloneXmlCacheOnPublish { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.CloneXmlContent; } + get { return UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent; } } /// @@ -222,7 +222,7 @@ namespace umbraco /// true if content is parsed; otherwise, false. public static bool TidyEditorContent { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent; } + get { return UmbracoConfig.For.UmbracoSettings().Content.TidyEditorContent; } } /// @@ -231,7 +231,7 @@ namespace umbraco /// The encoding type as string. public static string TidyCharEncoding { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.TidyCharEncoding; } + get { return UmbracoConfig.For.UmbracoSettings().Content.TidyCharEncoding; } } /// @@ -240,12 +240,12 @@ namespace umbraco /// The property context help option. public static string PropertyContextHelpOption { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.PropertyContextHelpOption; } + get { return UmbracoConfig.For.UmbracoSettings().Content.PropertyContextHelpOption; } } public static string DefaultBackofficeProvider { - get { return UmbracoConfiguration.Current.UmbracoSettings.Providers.DefaultBackOfficeUserProvider; } + get { return UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider; } } /// @@ -253,7 +253,7 @@ namespace umbraco /// public static bool ForceSafeAliases { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ForceSafeAliases; } + get { return UmbracoConfig.For.UmbracoSettings().Content.ForceSafeAliases; } } /// @@ -261,7 +261,7 @@ namespace umbraco /// public static IEnumerable DisallowedUploadFiles { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.DisallowedUploadFiles; } + get { return UmbracoConfig.For.UmbracoSettings().Content.DisallowedUploadFiles; } } /// @@ -270,7 +270,7 @@ namespace umbraco /// The allowed image file types. public static string ImageFileTypes { - get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.ImageFileTypes.Select(x => x.ToLowerInvariant())); } + get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes.Select(x => x.ToLowerInvariant())); } } /// @@ -279,7 +279,7 @@ namespace umbraco /// The allowed script file types. public static string ScriptFileTypes { - get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptFileTypes); } + get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes); } } /// @@ -288,7 +288,7 @@ namespace umbraco /// public static int UmbracoLibraryCacheDuration { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UmbracoLibraryCacheDuration; } + get { return UmbracoConfig.For.UmbracoSettings().Content.UmbracoLibraryCacheDuration; } } /// @@ -297,7 +297,7 @@ namespace umbraco /// The script folder path. public static string ScriptFolderPath { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptFolderPath; } + get { return UmbracoConfig.For.UmbracoSettings().Content.ScriptFolderPath; } } /// @@ -305,7 +305,7 @@ namespace umbraco /// public static bool ScriptDisableEditor { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditorDisable; } + get { return UmbracoConfig.For.UmbracoSettings().Content.ScriptEditorDisable; } } /// @@ -316,7 +316,7 @@ namespace umbraco /// true if umbraco ensures unique node naming; otherwise, false. public static bool EnsureUniqueNaming { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.EnsureUniqueNaming; } + get { return UmbracoConfig.For.UmbracoSettings().Content.EnsureUniqueNaming; } } /// @@ -325,7 +325,7 @@ namespace umbraco /// The notification email sender. public static string NotificationEmailSender { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.NotificationEmailAddress; } + get { return UmbracoConfig.For.UmbracoSettings().Content.NotificationEmailAddress; } } /// @@ -336,7 +336,7 @@ namespace umbraco /// public static bool NotificationDisableHtmlEmail { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.DisableHtmlEmail; } + get { return UmbracoConfig.For.UmbracoSettings().Content.DisableHtmlEmail; } } /// @@ -345,7 +345,7 @@ namespace umbraco /// The allowed attributes on images. public static string ImageAllowedAttributes { - get { return string.Join(",", UmbracoConfiguration.Current.UmbracoSettings.Content.ImageTagAllowedAttributes); } + get { return string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageTagAllowedAttributes); } } public static XmlNode ImageAutoFillImageProperties @@ -376,7 +376,7 @@ namespace umbraco /// public static bool RemoveDoubleDashesFromUrlReplacing { - get { return UmbracoConfiguration.Current.UmbracoSettings.RequestHandler.RemoveDoubleDashes; } + get { return UmbracoConfig.For.UmbracoSettings().RequestHandler.RemoveDoubleDashes; } } /// @@ -387,7 +387,7 @@ namespace umbraco /// true if umbraco uses distributed calls; otherwise, false. public static bool UseDistributedCalls { - get { return UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.Enabled; } + get { return UmbracoConfig.For.UmbracoSettings().DistributedCall.Enabled; } } @@ -397,7 +397,7 @@ namespace umbraco /// The distributed call user. public static int DistributedCallUser { - get { return UmbracoConfiguration.Current.UmbracoSettings.DistributedCall.UserId; } + get { return UmbracoConfig.For.UmbracoSettings().DistributedCall.UserId; } } /// @@ -405,7 +405,7 @@ namespace umbraco /// public static string PreviewBadge { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.PreviewBadge; } + get { return UmbracoConfig.For.UmbracoSettings().Content.PreviewBadge; } } /// @@ -481,7 +481,7 @@ namespace umbraco /// public static bool UseViewstateMoverModule { - get { return UmbracoConfiguration.Current.UmbracoSettings.ViewStateMoverModule.Enable; } + get { return UmbracoConfig.For.UmbracoSettings().ViewStateMoverModule.Enable; } } @@ -491,7 +491,7 @@ namespace umbraco /// public static bool isXmlContentCacheDisabled { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.XmlCacheEnabled; } + get { return UmbracoConfig.For.UmbracoSettings().Content.XmlCacheEnabled; } } /// @@ -501,7 +501,7 @@ namespace umbraco /// public static bool XmlContentCheckForDiskChanges { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.XmlContentCheckForDiskChanges; } + get { return UmbracoConfig.For.UmbracoSettings().Content.XmlContentCheckForDiskChanges; } } /// @@ -511,7 +511,7 @@ namespace umbraco /// public static bool EnableGlobalPreviewStorage { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.GlobalPreviewStorageEnabled; } + get { return UmbracoConfig.For.UmbracoSettings().Content.GlobalPreviewStorageEnabled; } } /// @@ -522,12 +522,12 @@ namespace umbraco /// public static bool UseLegacyXmlSchema { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema; } + get { return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; } } public static IEnumerable AppCodeFileExtensionsList { - get { return UmbracoConfiguration.Current.UmbracoSettings.Developer.AppCodeFileExtensions.Select(x => x.Extension); } + get { return UmbracoConfig.For.UmbracoSettings().Developer.AppCodeFileExtensions.Select(x => x.Extension); } } [Obsolete("Use AppCodeFileExtensionsList instead")] @@ -555,7 +555,7 @@ namespace umbraco /// public static bool continouslyUpdateXmlDiskCache { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ContinouslyUpdateXmlDiskCache; } + get { return UmbracoConfig.For.UmbracoSettings().Content.ContinouslyUpdateXmlDiskCache; } } /// @@ -566,12 +566,12 @@ namespace umbraco /// public static bool EnableSplashWhileLoading { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.EnableSplashWhileLoading; } + get { return UmbracoConfig.For.UmbracoSettings().Content.EnableSplashWhileLoading; } } public static bool ResolveUrlsFromTextString { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.ResolveUrlsFromTextString; } + get { return UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString; } } /// @@ -583,7 +583,7 @@ namespace umbraco /// MacroErrorBehaviour enum defining how to handle macro errors. public static MacroErrorBehaviour MacroErrorBehaviour { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.MacroErrorBehaviour; } + get { return UmbracoConfig.For.UmbracoSettings().Content.MacroErrorBehaviour; } } /// @@ -595,7 +595,7 @@ namespace umbraco /// MacroErrorBehaviour enum defining how to show icons in the document type editor. public static IconPickerBehaviour IconPickerBehaviour { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.IconPickerBehaviour; } + get { return UmbracoConfig.For.UmbracoSettings().Content.IconPickerBehaviour; } } /// @@ -605,7 +605,7 @@ namespace umbraco /// If undefined, 'Textstring' is the default public static string DefaultDocumentTypeProperty { - get { return UmbracoConfiguration.Current.UmbracoSettings.Content.DefaultDocumentTypeProperty; } + get { return UmbracoConfig.For.UmbracoSettings().Content.DefaultDocumentTypeProperty; } } private static string _path; diff --git a/src/umbraco.cms/businesslogic/Content.cs b/src/umbraco.cms/businesslogic/Content.cs index b262017553..acd47d0dba 100644 --- a/src/umbraco.cms/businesslogic/Content.cs +++ b/src/umbraco.cms/businesslogic/Content.cs @@ -534,7 +534,7 @@ namespace umbraco.cms.businesslogic protected virtual XmlNode generateXmlWithoutSaving(XmlDocument xd) { - string nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : Casing.SafeAliasWithForcingCheck(ContentType.Alias); + string nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "node" : Casing.SafeAliasWithForcingCheck(ContentType.Alias); XmlNode x = xd.CreateNode(XmlNodeType.Element, nodeName, ""); XmlPopulate(xd, ref x, false); return x; @@ -595,7 +595,7 @@ namespace umbraco.cms.businesslogic var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs index 6ca7086919..a96f2fc893 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs @@ -36,7 +36,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions string value = xmlHelper.GetNodeValue(xmlData); template.Template tmp = template.Template.GetByAlias(templateAlias); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) value = tmp.EnsureMasterPageSyntax(value); _addStringToHtmlElement(tmp, value, templateAlias, htmlElementId, position); @@ -58,7 +58,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions string value = xmlHelper.GetNodeValue(xmlData); template.Template tmp = template.Template.GetByAlias(templateAlias); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) value = tmp.EnsureMasterPageSyntax(value); _removeStringFromHtmlElement(tmp, value, templateAlias, htmlElementId); diff --git a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs index 726bc01437..d7165557fa 100644 --- a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs +++ b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs @@ -69,7 +69,7 @@ namespace umbraco.cms.businesslogic.packager.repositories var repositories = new List(); - foreach (var r in UmbracoConfiguration.Current.UmbracoSettings.PackageRepositories.Repositories) + foreach (var r in UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories) { var repository = new Repository { @@ -107,7 +107,7 @@ namespace umbraco.cms.businesslogic.packager.repositories throw new FormatException("The repositoryGuid is not a valid GUID"); } - var found = UmbracoConfiguration.Current.UmbracoSettings.PackageRepositories.Repositories.FirstOrDefault(x => x.Id == id); + var found = UmbracoConfig.For.UmbracoSettings().PackageRepositories.Repositories.FirstOrDefault(x => x.Id == id); if (found == null) { return null; @@ -196,7 +196,7 @@ namespace umbraco.cms.businesslogic.packager.repositories if (key == string.Empty) { - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) fileByteArray = this.Webservice.fetchPackage(packageGuid); else fileByteArray = this.Webservice.fetchPackageByVersion(packageGuid, Version.Version41); diff --git a/src/umbraco.cms/businesslogic/Property/Property.cs b/src/umbraco.cms/businesslogic/Property/Property.cs index 654215c342..b7450612bd 100644 --- a/src/umbraco.cms/businesslogic/Property/Property.cs +++ b/src/umbraco.cms/businesslogic/Property/Property.cs @@ -110,11 +110,11 @@ namespace umbraco.cms.businesslogic.property } public XmlNode ToXml(XmlDocument xd) { - string nodeName = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : helpers.Casing.SafeAlias(PropertyType.Alias); + string nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : helpers.Casing.SafeAlias(PropertyType.Alias); XmlNode x = xd.CreateNode(XmlNodeType.Element, nodeName, ""); // Alias - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { XmlAttribute alias = xd.CreateAttribute("alias"); alias.Value = this.PropertyType.Alias; diff --git a/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs b/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs index 3949441dfc..fad101b596 100644 --- a/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs +++ b/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs @@ -66,7 +66,7 @@ namespace umbraco.cms.businesslogic.datatype { var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); - var subfolder = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var subfolder = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? currentValue.Replace(fs.GetUrl("/"), "").Split('/')[0] : currentValue.Substring(currentValue.LastIndexOf("/", StringComparison.Ordinal) + 1).Split('-')[0]; @@ -75,7 +75,7 @@ namespace umbraco.cms.businesslogic.datatype ? subfolderId.ToString(CultureInfo.InvariantCulture) : MediaSubfolderCounter.Current.Increment().ToString(CultureInfo.InvariantCulture); - var fileName = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var fileName = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? Path.Combine(numberedFolder, name) : numberedFolder + "-" + name; @@ -103,10 +103,10 @@ namespace umbraco.cms.businesslogic.datatype } // check for auto fill of other properties (width, height, extension and filesize) - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.Any()) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any()) { var uploadFieldConfigNode = - UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.FirstOrDefault(x => x.Alias == PropertyTypeAlias); + UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.FirstOrDefault(x => x.Alias == PropertyTypeAlias); if (uploadFieldConfigNode != null) { @@ -139,10 +139,10 @@ namespace umbraco.cms.businesslogic.datatype if (PropertyId == default(int)) return; - if (UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.Any()) + if (UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.Any()) { var uploadFieldConfigNode = - UmbracoConfiguration.Current.UmbracoSettings.Content.ImageAutoFillProperties.FirstOrDefault(x => x.Alias == PropertyTypeAlias); + UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties.FirstOrDefault(x => x.Alias == PropertyTypeAlias); if (uploadFieldConfigNode != null) { // get the current document diff --git a/src/umbraco.cms/businesslogic/media/Media.cs b/src/umbraco.cms/businesslogic/media/Media.cs index fb9b46fc84..00ec1efb0b 100644 --- a/src/umbraco.cms/businesslogic/media/Media.cs +++ b/src/umbraco.cms/businesslogic/media/Media.cs @@ -290,7 +290,7 @@ namespace umbraco.cms.businesslogic.media XmlGenerate(xd); // generate preview for blame history? - if (UmbracoConfiguration.Current.UmbracoSettings.Content.GlobalPreviewStorageEnabled) + if (UmbracoConfig.For.UmbracoSettings().Content.GlobalPreviewStorageEnabled) { // Version as new guid to ensure different versions are generated as media are not versioned currently! SavePreviewXml(generateXmlWithoutSaving(xd), Guid.NewGuid()); diff --git a/src/umbraco.cms/businesslogic/media/UmbracoMediaFactory.cs b/src/umbraco.cms/businesslogic/media/UmbracoMediaFactory.cs index c2ed052c4f..29743031fd 100644 --- a/src/umbraco.cms/businesslogic/media/UmbracoMediaFactory.cs +++ b/src/umbraco.cms/businesslogic/media/UmbracoMediaFactory.cs @@ -92,7 +92,7 @@ namespace umbraco.cms.businesslogic.media int subfolderId; var currentValue = prop.Value.ToString(); - var subfolder = UmbracoConfiguration.Current.UmbracoSettings.Content.UploadAllowDirectories + var subfolder = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories ? currentValue.Replace(FileSystem.GetUrl("/"), "").Split('/')[0] : currentValue.Substring(currentValue.LastIndexOf("/", StringComparison.Ordinal) + 1).Split('-')[0]; diff --git a/src/umbraco.cms/businesslogic/member/Member.cs b/src/umbraco.cms/businesslogic/member/Member.cs index 0c09194686..26497187c5 100644 --- a/src/umbraco.cms/businesslogic/member/Member.cs +++ b/src/umbraco.cms/businesslogic/member/Member.cs @@ -682,7 +682,7 @@ namespace umbraco.cms.businesslogic.member XmlGenerate(xd); // generate preview for blame history? - if (UmbracoConfiguration.Current.UmbracoSettings.Content.GlobalPreviewStorageEnabled) + if (UmbracoConfig.For.UmbracoSettings().Content.GlobalPreviewStorageEnabled) { // Version as new guid to ensure different versions are generated as members are not versioned currently! SavePreviewXml(generateXmlWithoutSaving(xd), Guid.NewGuid()); diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index 9bacc2e410..beb191067b 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -155,7 +155,7 @@ namespace umbraco.cms.businesslogic.template } dr.Close(); - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this)) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this)) _design = ViewHelper.GetFileContents(this); else _design = MasterPageHelper.GetFileContents(this); @@ -266,13 +266,13 @@ namespace umbraco.cms.businesslogic.template _design = value.Trim(NewLineChars); //we only switch to MVC View editing if the template has a view file, and MVC editing is enabled - if (UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design)) + if (UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design)) { MasterPageHelper.RemoveMasterPageFile(this.Alias); MasterPageHelper.RemoveMasterPageFile(_oldAlias); _design = ViewHelper.UpdateViewFile(this, _oldAlias); } - else if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) + else if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) { ViewHelper.RemoveViewFile(this.Alias); ViewHelper.RemoveViewFile(_oldAlias); @@ -352,7 +352,7 @@ namespace umbraco.cms.businesslogic.template /// private static RenderingEngine DetermineRenderingEngine(Template t, string design = null) { - var engine = UmbracoConfiguration.Current.UmbracoSettings.Templates.DefaultRenderingEngine; + var engine = UmbracoConfig.For.UmbracoSettings().Templates.DefaultRenderingEngine; if (!design.IsNullOrWhiteSpace() && MasterPageHelper.IsMasterPageSyntax(design)) { diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index d24a7dc439..eb5b97160e 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -1314,11 +1314,11 @@ namespace umbraco.cms.businesslogic.web x.Attributes.Append(addAttribute(xd, "urlName", urlName)); x.Attributes.Append(addAttribute(xd, "writerName", Writer.Name)); x.Attributes.Append(addAttribute(xd, "creatorName", Creator.Name.ToString())); - if (ContentType != null && UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (ContentType != null && UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) x.Attributes.Append(addAttribute(xd, "nodeTypeAlias", ContentType.Alias)); x.Attributes.Append(addAttribute(xd, "path", Path)); - if (!UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (!UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { x.Attributes.Append(addAttribute(xd, "isDoc", "")); } diff --git a/src/umbraco.cms/businesslogic/web/DocumentType.cs b/src/umbraco.cms/businesslogic/web/DocumentType.cs index b12943fd53..c2cb87aa9d 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentType.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentType.cs @@ -87,7 +87,7 @@ namespace umbraco.cms.businesslogic.web public static string GenerateXmlDocumentType() { StringBuilder dtd = new StringBuilder(); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema) + if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { dtd.AppendLine(" "); } diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs index 837ff3da01..4814eff551 100644 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs @@ -158,11 +158,11 @@ namespace umbraco.cms.businesslogic.workflow }; // create the mail message - var mail = new MailMessage(UmbracoConfiguration.Current.UmbracoSettings.Content.NotificationEmailAddress, mailingUser.Email); + var mail = new MailMessage(UmbracoConfig.For.UmbracoSettings().Content.NotificationEmailAddress, mailingUser.Email); // populate the message mail.Subject = ui.Text("notifications", "mailSubject", subjectVars, mailingUser); - if (UmbracoConfiguration.Current.UmbracoSettings.Content.DisableHtmlEmail) + if (UmbracoConfig.For.UmbracoSettings().Content.DisableHtmlEmail) { mail.IsBodyHtml = false; mail.Body = ui.Text("notifications", "mailBody", bodyVars, mailingUser); diff --git a/src/umbraco.cms/helpers/xhtml.cs b/src/umbraco.cms/helpers/xhtml.cs index 2c6d7bbf4a..3ca90d886b 100644 --- a/src/umbraco.cms/helpers/xhtml.cs +++ b/src/umbraco.cms/helpers/xhtml.cs @@ -40,7 +40,7 @@ namespace umbraco.cms.helpers tidy.Options.TidyMark = false; // To avoid entity encoding - tidy.Options.CharEncoding = (TidyNet.CharEncoding)Enum.Parse(typeof(TidyNet.CharEncoding), UmbracoConfiguration.Current.UmbracoSettings.Content.TidyCharEncoding); + tidy.Options.CharEncoding = (TidyNet.CharEncoding)Enum.Parse(typeof(TidyNet.CharEncoding), UmbracoConfig.For.UmbracoSettings().Content.TidyCharEncoding); /* Declare the parameters that is needed */ diff --git a/src/umbraco.controls/CodeArea.cs b/src/umbraco.controls/CodeArea.cs index cbad1a14d8..1d273e32f3 100644 --- a/src/umbraco.controls/CodeArea.cs +++ b/src/umbraco.controls/CodeArea.cs @@ -58,7 +58,7 @@ namespace umbraco.uicontrols { get { - return UmbracoConfiguration.Current.UmbracoSettings.Content.ScriptEditorDisable == false; + return UmbracoConfig.For.UmbracoSettings().Content.ScriptEditorDisable == false; } } diff --git a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs index 64d859e45e..b9c5ace6c1 100644 --- a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs +++ b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs @@ -326,7 +326,7 @@ namespace umbraco.editorControls.tinyMCE3 parsedString = replaceMacroTags(parsedString).Trim(); // tidy html - refactored, see #30534 - if (UmbracoConfiguration.Current.UmbracoSettings.Content.TidyEditorContent) + if (UmbracoConfig.For.UmbracoSettings().Content.TidyEditorContent) { // always wrap in a
- using

was a bad idea parsedString = "

" + parsedString + "
"; diff --git a/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs b/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs index 5072726efc..23da99829f 100644 --- a/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs +++ b/src/umbraco.editorControls/tinymce/tinyMCEImageHelper.cs @@ -14,7 +14,7 @@ namespace umbraco.editorControls.tinymce { public static string cleanImages(string html) { - var allowedAttributes = UmbracoConfiguration.Current.UmbracoSettings.Content.ImageTagAllowedAttributes.Select(x => x.ToLower()).ToList(); + var allowedAttributes = UmbracoConfig.For.UmbracoSettings().Content.ImageTagAllowedAttributes.Select(x => x.ToLower()).ToList(); //Always add src as it's essential to output any image at all if (allowedAttributes.Contains("src") == false) diff --git a/src/umbraco.editorControls/uploadfield/uploadField.cs b/src/umbraco.editorControls/uploadfield/uploadField.cs index 472a094977..747febe57b 100644 --- a/src/umbraco.editorControls/uploadfield/uploadField.cs +++ b/src/umbraco.editorControls/uploadfield/uploadField.cs @@ -90,7 +90,7 @@ namespace umbraco.editorControls //now check the file type var extension = Path.GetExtension(postedFile.FileName).TrimStart("."); - return UmbracoConfiguration.Current.UmbracoSettings.Content.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false; + return UmbracoConfig.For.UmbracoSettings().Content.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false; } public string Text