diff --git a/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs b/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs
index e32d1d4b51..c9b1c2347c 100644
--- a/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs
+++ b/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs
@@ -1,1613 +1,1428 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Web;
-using System.Web.Caching;
-using System.Web.Security;
-using System.Xml;
-using System.Configuration;
-
-using System.Collections.Generic;
-using Umbraco.Core.Logging;
-using Umbraco.Core.CodeAnnotations;
-
-
-namespace Umbraco.Core.Configuration
-{
- //NOTE: Do not expose this class ever until we cleanup all configuration including removal of static classes, etc...
- // we have this two tasks logged:
- // http://issues.umbraco.org/issue/U4-58
- // http://issues.umbraco.org/issue/U4-115
-
- //TODO: Re-enable logging !!!!
-
- //TODO: We need to convert this to a real section, it's currently using HttpRuntime.Cache to detect cahnges, this is real poor, especially in a console app
-
- ///
- /// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file
- ///
- internal class LegacyUmbracoSettings
- {
- private static bool GetKeyValue(string key, bool defaultValue)
- {
- bool value;
- string stringValue = GetKey(key);
-
- if (string.IsNullOrWhiteSpace(stringValue))
- return defaultValue;
- if (bool.TryParse(stringValue, out value))
- return value;
- return defaultValue;
- }
-
- private static int GetKeyValue(string key, int defaultValue)
- {
- int value;
- string stringValue = GetKey(key);
-
- if (string.IsNullOrWhiteSpace(stringValue))
- return defaultValue;
- if (int.TryParse(stringValue, out value))
- return value;
- return defaultValue;
- }
-
- ///
- /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config)
- ///
- private static void ResetInternal()
- {
- _addTrailingSlash = null;
- _forceSafeAliases = null;
- _useLegacySchema = null;
- _useDomainPrefixes = null;
- _umbracoLibraryCacheDuration = null;
- SettingsFilePath = null;
- }
-
- internal const string TempFriendlyXmlChildContainerNodename = ""; // "children";
-
- ///
- /// Gets the umbraco settings document.
- ///
- /// The _umbraco settings.
- internal static XmlDocument UmbracoSettingsXmlDoc
- {
- get
- {
- var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument();
- return us;
- }
- }
-
- private static string _path;
-
- ///
- /// Gets/sets the settings file path, the setter can be used in unit tests
- ///
- internal static string SettingsFilePath
- {
- get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); }
- set { _path = value; }
- }
-
- internal const string Filename = "umbracoSettings.config";
-
- internal static XmlDocument EnsureSettingsDocument()
- {
- var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"];
-
- // Check for language file in cache
- if (settingsFile == null)
- {
- var temp = new XmlDocument();
- var settingsReader = new XmlTextReader(SettingsFilePath + Filename);
- try
- {
- temp.Load(settingsReader);
- HttpRuntime.Cache.Insert("umbracoSettingsFile", temp,
- new CacheDependency(SettingsFilePath + Filename));
- }
- catch (XmlException e)
- {
- throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e);
- }
- catch (Exception e)
- {
- LogHelper.Error("Error reading umbracoSettings file: " + e.ToString(), e);
- }
- settingsReader.Close();
- return temp;
- }
- else
- return (XmlDocument)settingsFile;
- }
-
- internal static void Save()
- {
- UmbracoSettingsXmlDoc.Save(SettingsFilePath + Filename);
- }
-
-
- ///
- /// Selects a xml node in the umbraco settings config file.
- ///
- /// The xpath query to the specific node.
- /// If found, it returns the specific configuration xml node.
- internal static XmlNode GetKeyAsNode(string key)
- {
- if (key == null)
- throw new ArgumentException("Key cannot be null");
- EnsureSettingsDocument();
- if (UmbracoSettingsXmlDoc == null || UmbracoSettingsXmlDoc.DocumentElement == null)
- return null;
- return UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key);
- }
-
- ///
- /// Gets the value of configuration xml node with the specified key.
- ///
- /// The key.
- ///
- internal static string GetKey(string key)
- {
- EnsureSettingsDocument();
-
- string attrName = null;
- var pos = key.IndexOf('@');
- if (pos > 0)
- {
- attrName = key.Substring(pos + 1);
- key = key.Substring(0, pos - 1);
- }
-
- var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key);
- if (node == null)
- return string.Empty;
-
- if (pos < 0)
- {
- if (node.FirstChild == null || node.FirstChild.Value == null)
- return string.Empty;
- return node.FirstChild.Value;
- }
- else
- {
- var attr = node.Attributes[attrName];
- if (attr == null)
- return string.Empty;
- return attr.Value;
- }
- }
-
- ///
- /// Gets a value indicating whether the media library will create new directories in the /media directory.
- ///
- ///
- /// true if new directories are allowed otherwise, false.
- ///
- internal static bool UploadAllowDirectories
- {
- get { return bool.Parse(GetKey("/settings/content/UploadAllowDirectories")); }
- }
-
- ///
- /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is
- /// here for future purposes since we check for thsi settings in the module.
- ///
- internal static bool EnableBaseRestHandler
- {
- get { return true; }
- }
-
- ///
- /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is
- /// here for future purposes since we check for thsi settings in the module.
- ///
- internal static string BootSplashPage
- {
- get { return "~/config/splashes/booting.aspx"; }
- }
-
- ///
- /// Gets a value indicating whether logging is enabled in umbracoSettings.config (/settings/logging/enableLogging).
- ///
- /// true if logging is enabled; otherwise, false.
- internal static bool EnableLogging
- {
- get
- {
- // We return true if no enable logging element is present in
- // umbracoSettings (to enable default behaviour when upgrading)
- var enableLogging = GetKey("/settings/logging/enableLogging");
- return String.IsNullOrEmpty(enableLogging) || bool.Parse(enableLogging);
- }
- }
-
- ///
- /// Gets a value indicating whether logging happens async.
- ///
- /// true if async logging is enabled; otherwise, false.
- internal static bool EnableAsyncLogging
- {
- get
- {
- string value = GetKey("/settings/logging/enableAsyncLogging");
- bool result;
- if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
- return result;
- return false;
- }
- }
-
- ///
- /// Gets the assembly of an external logger that can be used to store log items in 3rd party systems
- ///
- internal static string ExternalLoggerAssembly
- {
- get
- {
- var value = GetKeyAsNode("/settings/logging/externalLogger");
- return value != null ? value.Attributes["assembly"].Value : "";
- }
- }
-
- ///
- /// Gets the type of an external logger that can be used to store log items in 3rd party systems
- ///
- internal static string ExternalLoggerType
- {
- get
- {
- var value = GetKeyAsNode("/settings/logging/externalLogger");
- return value != null ? value.Attributes["type"].Value : "";
- }
- }
-
- ///
- /// Long Audit Trail to external log too
- ///
- internal static bool ExternalLoggerLogAuditTrail
- {
- get
- {
- var value = GetKeyAsNode("/settings/logging/externalLogger");
- if (value != null)
- {
- var logAuditTrail = value.Attributes["logAuditTrail"].Value;
- bool result;
- if (!string.IsNullOrEmpty(logAuditTrail) && bool.TryParse(logAuditTrail, out result))
- return result;
- }
- return false;
- }
- }
-
- ///
- /// Keep user alive as long as they have their browser open? Default is true
- ///
- internal static bool KeepUserLoggedIn
- {
- get
- {
- var value = GetKey("/settings/security/keepUserLoggedIn");
- bool result;
- if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
- return result;
- return true;
- }
- }
-
- internal static string AuthCookieName
- {
- get
- {
- var value = GetKey("/settings/security/authCookieName");
- if (string.IsNullOrEmpty(value) == false)
- {
- return value;
- }
- return "UMB_UCONTEXT";
- }
- }
-
- internal static string AuthCookieDomain
- {
- get
- {
- var value = GetKey("/settings/security/authCookieDomain");
- if (string.IsNullOrEmpty(value) == false)
- {
- return value;
- }
- return FormsAuthentication.CookieDomain;
- }
- }
-
- ///
- /// Enables the experimental canvas (live) editing on the frontend of the website
- ///
- internal static bool EnableCanvasEditing
- {
- get
- {
- var value = GetKey("/settings/content/EnableCanvasEditing");
- bool result;
- if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
- return result;
- return true;
- }
- }
-
- ///
- /// Show disabled users in the tree in the Users section in the backoffice
- ///
- internal static bool HideDisabledUsersInBackoffice
- {
- get
- {
- string value = GetKey("/settings/security/hideDisabledUsersInBackoffice");
- bool result;
- if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
- return result;
- return false;
- }
- }
-
- ///
- /// Gets a value indicating whether the logs will be auto cleaned
- ///
- /// true if logs are to be automatically cleaned; otherwise, false
- internal static bool AutoCleanLogs
- {
- get
- {
- string value = GetKey("/settings/logging/autoCleanLogs");
- bool result;
- if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
- return result;
- return false;
- }
- }
-
- ///
- /// Gets the value indicating the log cleaning frequency (in miliseconds)
- ///
- internal static int CleaningMiliseconds
- {
- get
- {
- string value = GetKey("/settings/logging/cleaningMiliseconds");
- int result;
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result))
- return result;
- return -1;
- }
- }
-
- internal static int MaxLogAge
- {
- get
- {
- string value = GetKey("/settings/logging/maxLogAge");
- int result;
- if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result))
- return result;
- return -1;
- }
- }
-
- ///
- /// Gets the disabled log types.
- ///
- /// The disabled log types.
- internal static XmlNode DisabledLogTypes
- {
- get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); }
- }
-
- ///
- /// Gets the package server url.
- ///
- /// The package server url.
- internal static string PackageServer
- {
- get { return "packages.umbraco.org"; }
- }
-
- static bool? _useDomainPrefixes = null;
-
- ///
- /// Gets a value indicating whether umbraco will use domain prefixes.
- ///
- /// true if umbraco will use domain prefixes; otherwise, false.
- internal static bool UseDomainPrefixes
- {
- get
- {
- // default: false
- return _useDomainPrefixes ?? GetKeyValue("/settings/requestHandler/useDomainPrefixes", false);
- }
- /*internal*/ set
- {
- // for unit tests only
- _useDomainPrefixes = value;
- }
- }
-
- static bool? _addTrailingSlash = null;
-
- ///
- /// This will add a trailing slash (/) to urls when in directory url mode
- /// NOTICE: This will always return false if Directory Urls in not active
- ///
- internal static bool AddTrailingSlash
- {
- get
- {
- // default: false
- return GlobalSettings.UseDirectoryUrls
- && (_addTrailingSlash ?? GetKeyValue("/settings/requestHandler/addTrailingSlash", false));
- }
- /*internal*/ set
- {
- // for unit tests only
- _addTrailingSlash = value;
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system.
- ///
- /// true if umbraco will use ASP.NET MasterPages; otherwise, false.
- internal static bool UseAspNetMasterPages
- {
- get
- {
- try
- {
- bool result;
- if (bool.TryParse(GetKey("/settings/templates/useAspNetMasterPages"), out result))
- return result;
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will attempt to load any skins to override default template files
- ///
- /// true if umbraco will override templates with skins if present and configured false.
- internal static bool EnableTemplateFolders
- {
- get
- {
- try
- {
- bool result;
- if (bool.TryParse(GetKey("/settings/templates/enableTemplateFolders"), out result))
- return result;
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- //TODO: I"m not sure why we need this, need to ask Gareth what the deal is, pretty sure we can remove it or change it, seems like
- // massive overkill.
-
- ///
- /// razor DynamicNode typecasting detects XML and returns DynamicXml - Root elements that won't convert to DynamicXml
- ///
- internal static IEnumerable NotDynamicXmlDocumentElements
- {
- get
- {
- try
- {
- List items = new List();
- XmlNode root = GetKeyAsNode("/settings/scripting/razor/notDynamicXmlDocumentElements");
- foreach (XmlNode element in root.SelectNodes(".//element"))
- {
- items.Add(element.InnerText);
- }
- return items;
- }
- catch
- {
- return new List() { "p", "div" };
- }
- }
- }
-
- private static IEnumerable _razorDataTypeModelStaticMapping;
- private static readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim();
-
- internal static IEnumerable RazorDataTypeModelStaticMapping
- {
- get
- {
- /*
-
- DigibizAdvancedMediaPicker.RazorModel.ModelBinder
- DigibizAdvancedMediaPicker.RazorModel.ModelBinder
-
- */
-
- using (var l = new UpgradeableReadLock(Lock))
- {
- if (_razorDataTypeModelStaticMapping == null)
- {
- l.UpgradeToWriteLock();
-
- List items = new List();
- XmlNode root = GetKeyAsNode("/settings/scripting/razor/dataTypeModelStaticMappings");
- if (root != null)
- {
- foreach (XmlNode element in root.SelectNodes(".//mapping"))
- {
- string propertyTypeAlias = null, nodeTypeAlias = null;
- Guid? dataTypeGuid = null;
- if (!string.IsNullOrEmpty(element.InnerText))
- {
- if (element.Attributes["dataTypeGuid"] != null)
- {
- dataTypeGuid = (Guid?)new Guid(element.Attributes["dataTypeGuid"].Value);
- }
- if (element.Attributes["propertyTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["propertyTypeAlias"].Value))
- {
- propertyTypeAlias = element.Attributes["propertyTypeAlias"].Value;
- }
- if (element.Attributes["nodeTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["nodeTypeAlias"].Value))
- {
- nodeTypeAlias = element.Attributes["nodeTypeAlias"].Value;
- }
- items.Add(new RazorDataTypeModelStaticMappingItem()
- {
- DataTypeGuid = dataTypeGuid,
- PropertyTypeAlias = propertyTypeAlias,
- NodeTypeAlias = nodeTypeAlias,
- TypeName = element.InnerText,
- Raw = element.OuterXml
- });
- }
- }
- }
-
- _razorDataTypeModelStaticMapping = items;
- }
-
- return _razorDataTypeModelStaticMapping;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will clone XML cache on publish.
- ///
- ///
- /// true if umbraco will clone XML cache on publish; otherwise, false.
- ///
- internal static bool CloneXmlCacheOnPublish
- {
- get
- {
- try
- {
- bool result;
- if (bool.TryParse(GetKey("/settings/content/cloneXmlContent"), out result))
- return result;
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether rich text editor content should be parsed by tidy.
- ///
- /// true if content is parsed; otherwise, false.
- internal static bool TidyEditorContent
- {
- get { return bool.Parse(GetKey("/settings/content/TidyEditorContent")); }
- }
-
- ///
- /// Gets the encoding type for the tidyied content.
- ///
- /// The encoding type as string.
- internal static string TidyCharEncoding
- {
- get
- {
- string encoding = GetKey("/settings/content/TidyCharEncoding");
- if (String.IsNullOrEmpty(encoding))
- {
- encoding = "UTF8";
- }
- return encoding;
- }
- }
-
- ///
- /// Gets the property context help option, this can either be 'text', 'icon' or 'none'
- ///
- /// The property context help option.
- internal static string PropertyContextHelpOption
- {
- get { return GetKey("/settings/content/PropertyContextHelpOption").ToLower(); }
- }
-
- internal static string DefaultBackofficeProvider
- {
- get
- {
- string defaultProvider = GetKey("/settings/providers/users/DefaultBackofficeProvider");
- if (String.IsNullOrEmpty(defaultProvider))
- defaultProvider = "UsersMembershipProvider";
-
- return defaultProvider;
- }
- }
-
- private static bool? _forceSafeAliases;
-
- ///
- /// Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes
- ///
- internal static bool ForceSafeAliases
- {
- get
- {
- // default: true
- return _forceSafeAliases ?? GetKeyValue("/settings/content/ForceSafeAliases", true);
- }
- /*internal*/ set
- {
- // used for unit testing
- _forceSafeAliases = value;
- }
- }
-
- ///
- /// Gets a value indicating whether to try to skip IIS custom errors.
- ///
- [UmbracoWillObsolete("Use UmbracoSettings.For.TrySkipIisCustomErrors instead.")]
- internal static bool TrySkipIisCustomErrors
- {
- get { return GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); }
- }
-
- ///
- /// Gets a value indicating whether internal redirect preserves the template.
- ///
- [UmbracoWillObsolete("Use UmbracoSettings.For.InternalRedirectPerservesTemplate instead.")]
- internal static bool InternalRedirectPreservesTemplate
- {
- get { return GetKeyValue("/settings/web.routing/@internalRedirectPreservesTemplate", false); }
- }
-
- ///
- /// File types that will not be allowed to be uploaded via the content/media upload control
- ///
- public static IEnumerable DisallowedUploadFiles
- {
- get
- {
- var val = GetKey("/settings/content/disallowedUploadFiles");
- return val.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
- }
- }
-
- ///
- /// Gets the allowed image file types.
- ///
- /// The allowed image file types.
- internal static string ImageFileTypes
- {
- get { return GetKey("/settings/content/imaging/imageFileTypes").ToLowerInvariant(); }
- }
-
- ///
- /// Gets the allowed script file types.
- ///
- /// The allowed script file types.
- internal static string ScriptFileTypes
- {
- get { return GetKey("/settings/content/scripteditor/scriptFileTypes"); }
- }
-
- private static int? _umbracoLibraryCacheDuration;
-
- ///
- /// Gets the duration in seconds to cache queries to umbraco library member and media methods
- /// Default is 1800 seconds (30 minutes)
- ///
- internal static int UmbracoLibraryCacheDuration
- {
- get
- {
- // default: 1800
- return _umbracoLibraryCacheDuration ?? GetKeyValue("/settings/content/UmbracoLibraryCacheDuration", 1800);
- }
- /*internal*/ set
- {
- // for unit tests only
- _umbracoLibraryCacheDuration = value;
- }
- }
-
- ///
- /// Gets the path to the scripts folder used by the script editor.
- ///
- /// The script folder path.
- internal static string ScriptFolderPath
- {
- get { return GetKey("/settings/content/scripteditor/scriptFolderPath"); }
- }
-
- ///
- /// Enabled or disable the script/code editor
- ///
- internal static bool ScriptDisableEditor
- {
- get
- {
- string _tempValue = GetKey("/settings/content/scripteditor/scriptDisableEditor");
- if (_tempValue != String.Empty)
- return bool.Parse(_tempValue);
- else
- return false;
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will ensure unique node naming.
- /// This will ensure that nodes cannot have the same url, but will add extra characters to a url.
- /// ex: existingnodename.aspx would become existingnodename(1).aspx if a node with the same name is found
- ///
- /// true if umbraco ensures unique node naming; otherwise, false.
- internal static bool EnsureUniqueNaming
- {
- get
- {
- try
- {
- return bool.Parse(GetKey("/settings/content/ensureUniqueNaming"));
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Gets the notification email sender.
- ///
- /// The notification email sender.
- internal static string NotificationEmailSender
- {
- get { return GetKey("/settings/content/notifications/email"); }
- }
-
- ///
- /// Gets a value indicating whether notification-emails are HTML.
- ///
- ///
- /// true if html notification-emails are disabled; otherwise, false.
- ///
- internal static bool NotificationDisableHtmlEmail
- {
- get
- {
- var tempValue = GetKey("/settings/content/notifications/disableHtmlEmail");
- return tempValue != String.Empty && bool.Parse(tempValue);
- }
- }
-
- ///
- /// Gets the allowed attributes on images.
- ///
- /// The allowed attributes on images.
- internal static string ImageAllowedAttributes
- {
- get { return GetKey("/settings/content/imaging/allowedAttributes"); }
- }
-
- internal static XmlNode ImageAutoFillImageProperties
- {
- get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); }
- }
-
- ///
- /// Gets the scheduled tasks as XML
- ///
- /// The scheduled tasks.
- internal static XmlNode ScheduledTasks
- {
- get { return GetKeyAsNode("/settings/scheduledTasks"); }
- }
-
- ///
- /// Gets a list of characters that will be replaced when generating urls
- ///
- /// The URL replacement characters.
- internal static XmlNode UrlReplaceCharacters
- {
- get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); }
- }
-
- ///
- /// Whether to replace double dashes from url (ie my--story----from--dash.aspx caused by multiple url replacement chars
- ///
- internal static bool RemoveDoubleDashesFromUrlReplacing
- {
- get
- {
- try
- {
- return bool.Parse(UrlReplaceCharacters.Attributes.GetNamedItem("removeDoubleDashes").Value);
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will use distributed calls.
- /// This enables umbraco to share cache and content across multiple servers.
- /// Used for load-balancing high-traffic sites.
- ///
- /// true if umbraco uses distributed calls; otherwise, false.
- internal static bool UseDistributedCalls
- {
- get
- {
- try
- {
- return bool.Parse(GetKeyAsNode("/settings/distributedCall").Attributes.GetNamedItem("enable").Value);
- }
- catch
- {
- return false;
- }
- }
- }
-
-
- ///
- /// Gets the ID of the user with access rights to perform the distributed calls.
- ///
- /// The distributed call user.
- internal static int DistributedCallUser
- {
- get
- {
- try
- {
- return int.Parse(GetKey("/settings/distributedCall/user"));
- }
- catch
- {
- return -1;
- }
- }
- }
-
- ///
- /// Gets the html injected into a (x)html page if Umbraco is running in preview mode
- ///
- internal static string PreviewBadge
- {
- get
- {
- try
- {
- return GetKey("/settings/content/PreviewBadge");
- }
- catch
- {
- return "In Preview Mode - click to end";
- }
- }
- }
-
- ///
- /// Gets IP or hostnames of the distribution servers.
- /// These servers will receive a call everytime content is created/deleted/removed
- /// and update their content cache accordingly, ensuring a consistent cache on all servers
- ///
- /// The distribution servers.
- internal static XmlNode DistributionServers
- {
- get
- {
- try
- {
- return GetKeyAsNode("/settings/distributedCall/servers");
- }
- catch
- {
- return null;
- }
- }
- }
-
- ///
- /// Gets HelpPage configurations.
- /// A help page configuration specify language, user type, application, application url and
- /// the target help page url.
- ///
- internal static XmlNode HelpPages
- {
- get
- {
- try
- {
- return GetKeyAsNode("/settings/help");
- }
- catch
- {
- return null;
- }
- }
- }
-
- ///
- /// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url.
- /// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates.
- /// All repositories should have a unique alias.
- /// All packages installed from a repository gets the repository alias included in the install information
- ///
- /// The repository servers.
- internal static XmlNode Repositories
- {
- get
- {
- try
- {
- return GetKeyAsNode("/settings/repositories");
- }
- catch
- {
- return null;
- }
- }
- }
-
- ///
- /// Gets a value indicating whether umbraco will use the viewstate mover module.
- /// The viewstate mover will move all asp.net viewstate information to the bottom of the aspx page
- /// to ensure that search engines will index text instead of javascript viewstate information.
- ///
- ///
- /// true if umbraco will use the viewstate mover module; otherwise, false.
- ///
- internal static bool UseViewstateMoverModule
- {
- get
- {
- try
- {
- return
- bool.Parse(
- GetKeyAsNode("/settings/viewstateMoverModule").Attributes.GetNamedItem("enable").Value);
- }
- catch
- {
- return false;
- }
- }
- }
-
-
- ///
- /// Tells us whether the Xml Content cache is disabled or not
- /// Default is enabled
- ///
- internal static bool IsXmlContentCacheDisabled
- {
- get
- {
- try
- {
- bool xmlCacheEnabled;
- string value = GetKey("/settings/content/XmlCacheEnabled");
- if (bool.TryParse(value, out xmlCacheEnabled))
- return !xmlCacheEnabled;
- // Return default
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// Check if there's changes to the umbraco.config xml file cache on disk on each request
- /// Makes it possible to updates environments by syncing the umbraco.config file across instances
- /// Relates to http://umbraco.codeplex.com/workitem/30722
- ///
- internal static bool XmlContentCheckForDiskChanges
- {
- get
- {
- try
- {
- bool checkForDiskChanges;
- string value = GetKey("/settings/content/XmlContentCheckForDiskChanges");
- if (bool.TryParse(value, out checkForDiskChanges))
- return checkForDiskChanges;
- // Return default
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- ///
- /// If this is enabled, all Umbraco objects will generate data in the preview table (cmsPreviewXml).
- /// If disabled, only documents will generate data.
- /// This feature is useful if anyone would like to see how data looked at a given time
- ///
- internal static bool EnableGlobalPreviewStorage
- {
- get
- {
- try
- {
- bool globalPreviewEnabled = false;
- string value = GetKey("/settings/content/GlobalPreviewStorageEnabled");
- if (bool.TryParse(value, out globalPreviewEnabled))
- return !globalPreviewEnabled;
- // Return default
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- private static bool? _useLegacySchema;
-
- ///
- /// Whether to use the new 4.1 schema or the old legacy schema
- ///
- ///
- /// true if yes, use the old node/data model; otherwise, false.
- ///
- internal static bool UseLegacyXmlSchema
- {
- get
- {
- // default: true
- return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false);
- }
- /*internal*/ set
- {
- // used for unit testing
- _useLegacySchema = value;
- }
- }
-
- [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")]
- internal static IEnumerable AppCodeFileExtensionsList
- {
- get
- {
- return (from XmlNode x in AppCodeFileExtensions
- where !String.IsNullOrEmpty(x.InnerText)
- select x.InnerText).ToList();
- }
- }
-
- [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")]
- internal static XmlNode AppCodeFileExtensions
- {
- get
- {
- XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions");
- if (value != null)
- {
- return value;
- }
-
- // default is .cs and .vb
- value = UmbracoSettingsXmlDoc.CreateElement("appCodeFileExtensions");
- value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "cs"));
- value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "vb"));
- return value;
- }
- }
-
- ///
- /// Tells us whether the Xml to always update disk cache, when changes are made to content
- /// Default is enabled
- ///
- internal static bool ContinouslyUpdateXmlDiskCache
- {
- get
- {
- try
- {
- bool updateDiskCache;
- string value = GetKey("/settings/content/ContinouslyUpdateXmlDiskCache");
- if (bool.TryParse(value, out updateDiskCache))
- return updateDiskCache;
- // Return default
- return false;
- }
- catch
- {
- return true;
- }
- }
- }
-
- ///
- /// Tells us whether to use a splash page while umbraco is initializing content.
- /// If not, requests are queued while umbraco loads content. For very large sites (+10k nodes) it might be usefull to
- /// have a splash page
- /// Default is disabled
- ///
- internal static bool EnableSplashWhileLoading
- {
- get
- {
- try
- {
- bool updateDiskCache;
- string value = GetKey("/settings/content/EnableSplashWhileLoading");
- if (bool.TryParse(value, out updateDiskCache))
- return updateDiskCache;
- // Return default
- return false;
- }
- catch
- {
- return false;
- }
- }
- }
-
- private static bool? _resolveUrlsFromTextString;
- internal static bool ResolveUrlsFromTextString
- {
- get
- {
- if (_resolveUrlsFromTextString == null)
- {
- try
- {
- bool enableDictionaryFallBack;
- var value = GetKey("/settings/content/ResolveUrlsFromTextString");
- if (value != null)
- if (bool.TryParse(value, out enableDictionaryFallBack))
- _resolveUrlsFromTextString = enableDictionaryFallBack;
- }
- catch (Exception ex)
- {
- Trace.WriteLine("Could not load /settings/content/ResolveUrlsFromTextString from umbracosettings.config:\r\n {0}",
- ex.Message);
-
- // set url resolving to true (default (legacy) behavior) to ensure we don't keep writing to trace
- _resolveUrlsFromTextString = true;
- }
- }
- return _resolveUrlsFromTextString == true;
- }
- }
-
-
- private static RenderingEngine? _defaultRenderingEngine;
-
- ///
- /// Enables MVC, and at the same time disable webform masterpage templates.
- /// This ensure views are automaticly created instead of masterpages.
- /// Views are display in the tree instead of masterpages and a MVC template editor
- /// is used instead of the masterpages editor
- ///
- /// true if umbraco defaults to using MVC views for templating, otherwise false.
- internal static RenderingEngine DefaultRenderingEngine
- {
- get
- {
- if (_defaultRenderingEngine == null)
- {
- try
- {
- var engine = RenderingEngine.WebForms;
- var value = GetKey("/settings/templates/defaultRenderingEngine");
- if (value != null)
- {
- Enum.TryParse(value, true, out engine);
- }
- _defaultRenderingEngine = engine;
- }
- catch (Exception ex)
- {
- LogHelper.Error("Could not load /settings/templates/defaultRenderingEngine from umbracosettings.config", ex);
- _defaultRenderingEngine = RenderingEngine.WebForms;
- }
- }
- return _defaultRenderingEngine.Value;
- }
- //internal set
- //{
- // _defaultRenderingEngine = value;
- // var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine");
- // node.InnerText = value.ToString();
- //}
- }
-
- private static MacroErrorBehaviour? _macroErrorBehaviour;
-
- ///
- /// This configuration setting defines how to handle macro errors:
- /// - Inline - Show error within macro as text (default and current Umbraco 'normal' behavior)
- /// - Silent - Suppress error and hide macro
- /// - Throw - Throw an exception and invoke the global error handler (if one is defined, if not you'll get a YSOD)
- ///
- /// MacroErrorBehaviour enum defining how to handle macro errors.
- internal static MacroErrorBehaviour MacroErrorBehaviour
- {
- get
- {
- if (_macroErrorBehaviour == null)
- {
- try
- {
- var behaviour = MacroErrorBehaviour.Inline;
- var value = GetKey("/settings/content/MacroErrors");
- if (value != null)
- {
- Enum.TryParse(value, true, out behaviour);
- }
- _macroErrorBehaviour = behaviour;
- }
- catch (Exception ex)
- {
- LogHelper.Error("Could not load /settings/content/MacroErrors from umbracosettings.config", ex);
- _macroErrorBehaviour = MacroErrorBehaviour.Inline;
- }
- }
- return _macroErrorBehaviour.Value;
- }
- }
-
- private static IconPickerBehaviour? _iconPickerBehaviour;
-
- ///
- /// This configuration setting defines how to show icons in the document type editor.
- /// - ShowDuplicates - Show duplicates in files and sprites. (default and current Umbraco 'normal' behaviour)
- /// - HideSpriteDuplicates - Show files on disk and hide duplicates from the sprite
- /// - HideFileDuplicates - Show files in the sprite and hide duplicates on disk
- ///
- /// MacroErrorBehaviour enum defining how to show icons in the document type editor.
- internal static IconPickerBehaviour IconPickerBehaviour
- {
- get
- {
- if (_iconPickerBehaviour == null)
- {
- try
- {
- var behaviour = IconPickerBehaviour.ShowDuplicates;
- var value = GetKey("/settings/content/DocumentTypeIconList");
- if (value != null)
- {
- Enum.TryParse(value, true, out behaviour);
- }
- _iconPickerBehaviour = behaviour;
- }
- catch (Exception ex)
- {
- LogHelper.Error("Could not load /settings/content/DocumentTypeIconList from umbracosettings.config", ex);
- _iconPickerBehaviour = IconPickerBehaviour.ShowDuplicates;
- }
- }
- return _iconPickerBehaviour.Value;
- }
- }
-
- ///
- /// Gets the default document type property used when adding new properties through the back-office
- ///
- /// Configured text for the default document type property
- /// If undefined, 'Textstring' is the default
- public static string DefaultDocumentTypeProperty
- {
- get
- {
- var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty");
- if (string.IsNullOrEmpty(defaultDocumentTypeProperty))
- {
- defaultDocumentTypeProperty = "Textstring";
- }
-
- return defaultDocumentTypeProperty;
- }
- }
-
- ///
- /// Configuration regarding webservices
- ///
- /// Put in seperate class for more logik/seperation
- internal class WebServices
- {
- ///
- /// Gets a value indicating whether this is enabled.
- ///
- /// true if enabled; otherwise, false.
- public static bool Enabled
- {
- get
- {
- try
- {
- return
- bool.Parse(GetKeyAsNode("/settings/webservices").Attributes.GetNamedItem("enabled").Value);
- }
- catch
- {
- return false;
- }
- }
- }
-
- #region "Webservice configuration"
-
- ///
- /// Gets the document service users who have access to use the document web service
- ///
- /// The document service users.
- public static string[] DocumentServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/documentServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- ///
- /// Gets the file service users who have access to use the file web service
- ///
- /// The file service users.
- public static string[] FileServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/fileServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
-
- ///
- /// Gets the folders used by the file web service
- ///
- /// The file service folders.
- public static string[] FileServiceFolders
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/fileServiceFolders").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- ///
- /// Gets the member service users who have access to use the member web service
- ///
- /// The member service users.
- public static string[] MemberServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/memberServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- ///
- /// Gets the stylesheet service users who have access to use the stylesheet web service
- ///
- /// The stylesheet service users.
- public static string[] StylesheetServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/stylesheetServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- ///
- /// Gets the template service users who have access to use the template web service
- ///
- /// The template service users.
- public static string[] TemplateServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/templateServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- ///
- /// Gets the media service users who have access to use the media web service
- ///
- /// The media service users.
- public static string[] MediaServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/mediaServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
-
- ///
- /// Gets the maintenance service users who have access to use the maintance web service
- ///
- /// The maintenance service users.
- public static string[] MaintenanceServiceUsers
- {
- get
- {
- try
- {
- return GetKey("/settings/webservices/maintenanceServiceUsers").Split(',');
- }
- catch
- {
- return new string[0];
- }
- }
- }
-
- #endregion
- }
-
- #region Extensible settings
-
- ///
- /// Resets settings that were set programmatically, to their initial values.
- ///
- /// To be used in unit tests.
- internal static void Reset()
- {
- ResetInternal();
-
- using (new WriteLock(SectionsLock))
- {
- foreach (var section in Sections.Values)
- section.ResetSection();
- }
- }
-
- private static readonly ReaderWriterLockSlim SectionsLock = new ReaderWriterLockSlim();
- private static readonly Dictionary Sections = new Dictionary();
-
- ///
- /// Gets the specified UmbracoConfigurationSection.
- ///
- /// The type of the UmbracoConfigurationSectiont.
- /// The UmbracoConfigurationSection of the specified type.
- public static T For()
- where T : UmbracoConfigurationSection, new()
- {
- var sectionType = typeof (T);
- using (new WriteLock(SectionsLock))
- {
- if (Sections.ContainsKey(sectionType)) return Sections[sectionType] as T;
-
- var attr = sectionType.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}\" ConfigurationKeyAttribute value is null or empty.", sectionType.FullName));
-
- var section = GetSection(sectionType, sectionKey);
-
- Sections[sectionType] = section;
- return section as T;
- }
- }
-
- private static UmbracoConfigurationSection GetSection(Type sectionType, string key)
- {
- if (!sectionType.Inherits())
- throw new ArgumentException(string.Format(
- "Type \"{0}\" does not inherit from UmbracoConfigurationSection.", sectionType.FullName), "sectionType");
-
- var section = ConfigurationManager.GetSection(key);
-
- if (section != null && section.GetType() != sectionType)
- throw new InvalidCastException(string.Format("Section at key \"{0}\" is of type \"{1}\" and not \"{2}\".",
- key, section.GetType().FullName, sectionType.FullName));
-
- if (section != null) return section as UmbracoConfigurationSection;
-
- section = Activator.CreateInstance(sectionType) as UmbracoConfigurationSection;
-
- if (section == null)
- throw new NullReferenceException(string.Format(
- "Activator failed to create an instance of type \"{0}\" for key\"{1}\" and returned null.",
- sectionType.FullName, key));
-
- return section as UmbracoConfigurationSection;
- }
-
- #endregion
- }
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Web;
+using System.Web.Caching;
+using System.Web.Security;
+using System.Xml;
+using System.Configuration;
+
+using System.Collections.Generic;
+using Umbraco.Core.Logging;
+using Umbraco.Core.CodeAnnotations;
+
+
+namespace Umbraco.Core.Configuration
+{
+ //NOTE: Do not expose this class ever until we cleanup all configuration including removal of static classes, etc...
+ // we have this two tasks logged:
+ // http://issues.umbraco.org/issue/U4-58
+ // http://issues.umbraco.org/issue/U4-115
+
+ //TODO: Re-enable logging !!!!
+
+ //TODO: We need to convert this to a real section, it's currently using HttpRuntime.Cache to detect cahnges, this is real poor, especially in a console app
+
+ ///
+ /// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file
+ ///
+ internal class LegacyUmbracoSettings
+ {
+ private static bool GetKeyValue(string key, bool defaultValue)
+ {
+ bool value;
+ string stringValue = GetKey(key);
+
+ if (string.IsNullOrWhiteSpace(stringValue))
+ return defaultValue;
+ if (bool.TryParse(stringValue, out value))
+ return value;
+ return defaultValue;
+ }
+
+ private static int GetKeyValue(string key, int defaultValue)
+ {
+ int value;
+ string stringValue = GetKey(key);
+
+ if (string.IsNullOrWhiteSpace(stringValue))
+ return defaultValue;
+ if (int.TryParse(stringValue, out value))
+ return value;
+ return defaultValue;
+ }
+
+ ///
+ /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config)
+ ///
+ private static void ResetInternal()
+ {
+ _addTrailingSlash = null;
+ _forceSafeAliases = null;
+ _useLegacySchema = null;
+ _useDomainPrefixes = null;
+ _umbracoLibraryCacheDuration = null;
+ SettingsFilePath = null;
+ }
+
+ internal const string TempFriendlyXmlChildContainerNodename = ""; // "children";
+
+ ///
+ /// Gets the umbraco settings document.
+ ///
+ /// The _umbraco settings.
+ internal static XmlDocument UmbracoSettingsXmlDoc
+ {
+ get
+ {
+ var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument();
+ return us;
+ }
+ }
+
+ private static string _path;
+
+ ///
+ /// Gets/sets the settings file path, the setter can be used in unit tests
+ ///
+ internal static string SettingsFilePath
+ {
+ get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); }
+ set { _path = value; }
+ }
+
+ internal const string Filename = "umbracoSettings.config";
+
+ internal static XmlDocument EnsureSettingsDocument()
+ {
+ var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"];
+
+ // Check for language file in cache
+ if (settingsFile == null)
+ {
+ var temp = new XmlDocument();
+ var settingsReader = new XmlTextReader(SettingsFilePath + Filename);
+ try
+ {
+ temp.Load(settingsReader);
+ HttpRuntime.Cache.Insert("umbracoSettingsFile", temp,
+ new CacheDependency(SettingsFilePath + Filename));
+ }
+ catch (XmlException e)
+ {
+ throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e);
+ }
+ catch (Exception e)
+ {
+ LogHelper.Error("Error reading umbracoSettings file: " + e.ToString(), e);
+ }
+ settingsReader.Close();
+ return temp;
+ }
+ else
+ return (XmlDocument)settingsFile;
+ }
+
+ internal static void Save()
+ {
+ UmbracoSettingsXmlDoc.Save(SettingsFilePath + Filename);
+ }
+
+
+ ///
+ /// Selects a xml node in the umbraco settings config file.
+ ///
+ /// The xpath query to the specific node.
+ /// If found, it returns the specific configuration xml node.
+ internal static XmlNode GetKeyAsNode(string key)
+ {
+ if (key == null)
+ throw new ArgumentException("Key cannot be null");
+ EnsureSettingsDocument();
+ if (UmbracoSettingsXmlDoc == null || UmbracoSettingsXmlDoc.DocumentElement == null)
+ return null;
+ return UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key);
+ }
+
+ ///
+ /// Gets the value of configuration xml node with the specified key.
+ ///
+ /// The key.
+ ///
+ internal static string GetKey(string key)
+ {
+ EnsureSettingsDocument();
+
+ string attrName = null;
+ var pos = key.IndexOf('@');
+ if (pos > 0)
+ {
+ attrName = key.Substring(pos + 1);
+ key = key.Substring(0, pos - 1);
+ }
+
+ var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key);
+ if (node == null)
+ return string.Empty;
+
+ if (pos < 0)
+ {
+ if (node.FirstChild == null || node.FirstChild.Value == null)
+ return string.Empty;
+ return node.FirstChild.Value;
+ }
+ else
+ {
+ var attr = node.Attributes[attrName];
+ if (attr == null)
+ return string.Empty;
+ return attr.Value;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the media library will create new directories in the /media directory.
+ ///
+ ///
+ /// true if new directories are allowed otherwise, false.
+ ///
+ internal static bool UploadAllowDirectories
+ {
+ get { return bool.Parse(GetKey("/settings/content/UploadAllowDirectories")); }
+ }
+
+ ///
+ /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is
+ /// here for future purposes since we check for thsi settings in the module.
+ ///
+ internal static bool EnableBaseRestHandler
+ {
+ get { return true; }
+ }
+
+ ///
+ /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is
+ /// here for future purposes since we check for thsi settings in the module.
+ ///
+ internal static string BootSplashPage
+ {
+ get { return "~/config/splashes/booting.aspx"; }
+ }
+
+ ///
+ /// Gets a value indicating whether logging is enabled in umbracoSettings.config (/settings/logging/enableLogging).
+ ///
+ /// true if logging is enabled; otherwise, false.
+ internal static bool EnableLogging
+ {
+ get
+ {
+ // We return true if no enable logging element is present in
+ // umbracoSettings (to enable default behaviour when upgrading)
+ var enableLogging = GetKey("/settings/logging/enableLogging");
+ return String.IsNullOrEmpty(enableLogging) || bool.Parse(enableLogging);
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether logging happens async.
+ ///
+ /// true if async logging is enabled; otherwise, false.
+ internal static bool EnableAsyncLogging
+ {
+ get
+ {
+ string value = GetKey("/settings/logging/enableAsyncLogging");
+ bool result;
+ if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
+ return result;
+ return false;
+ }
+ }
+
+ ///
+ /// Gets the assembly of an external logger that can be used to store log items in 3rd party systems
+ ///
+ internal static string ExternalLoggerAssembly
+ {
+ get
+ {
+ var value = GetKeyAsNode("/settings/logging/externalLogger");
+ return value != null ? value.Attributes["assembly"].Value : "";
+ }
+ }
+
+ ///
+ /// Gets the type of an external logger that can be used to store log items in 3rd party systems
+ ///
+ internal static string ExternalLoggerType
+ {
+ get
+ {
+ var value = GetKeyAsNode("/settings/logging/externalLogger");
+ return value != null ? value.Attributes["type"].Value : "";
+ }
+ }
+
+ ///
+ /// Long Audit Trail to external log too
+ ///
+ internal static bool ExternalLoggerLogAuditTrail
+ {
+ get
+ {
+ var value = GetKeyAsNode("/settings/logging/externalLogger");
+ if (value != null)
+ {
+ var logAuditTrail = value.Attributes["logAuditTrail"].Value;
+ bool result;
+ if (!string.IsNullOrEmpty(logAuditTrail) && bool.TryParse(logAuditTrail, out result))
+ return result;
+ }
+ return false;
+ }
+ }
+
+ ///
+ /// Keep user alive as long as they have their browser open? Default is true
+ ///
+ internal static bool KeepUserLoggedIn
+ {
+ get
+ {
+ var value = GetKey("/settings/security/keepUserLoggedIn");
+ bool result;
+ if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
+ return result;
+ return true;
+ }
+ }
+
+ internal static string AuthCookieName
+ {
+ get
+ {
+ var value = GetKey("/settings/security/authCookieName");
+ if (string.IsNullOrEmpty(value) == false)
+ {
+ return value;
+ }
+ return "UMB_UCONTEXT";
+ }
+ }
+
+ internal static string AuthCookieDomain
+ {
+ get
+ {
+ var value = GetKey("/settings/security/authCookieDomain");
+ if (string.IsNullOrEmpty(value) == false)
+ {
+ return value;
+ }
+ return FormsAuthentication.CookieDomain;
+ }
+ }
+
+ ///
+ /// Enables the experimental canvas (live) editing on the frontend of the website
+ ///
+ internal static bool EnableCanvasEditing
+ {
+ get
+ {
+ var value = GetKey("/settings/content/EnableCanvasEditing");
+ bool result;
+ if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
+ return result;
+ return true;
+ }
+ }
+
+ ///
+ /// Show disabled users in the tree in the Users section in the backoffice
+ ///
+ internal static bool HideDisabledUsersInBackoffice
+ {
+ get
+ {
+ string value = GetKey("/settings/security/hideDisabledUsersInBackoffice");
+ bool result;
+ if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
+ return result;
+ return false;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the logs will be auto cleaned
+ ///
+ /// true if logs are to be automatically cleaned; otherwise, false
+ internal static bool AutoCleanLogs
+ {
+ get
+ {
+ string value = GetKey("/settings/logging/autoCleanLogs");
+ bool result;
+ if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result))
+ return result;
+ return false;
+ }
+ }
+
+ ///
+ /// Gets the value indicating the log cleaning frequency (in miliseconds)
+ ///
+ internal static int CleaningMiliseconds
+ {
+ get
+ {
+ string value = GetKey("/settings/logging/cleaningMiliseconds");
+ int result;
+ if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result))
+ return result;
+ return -1;
+ }
+ }
+
+ internal static int MaxLogAge
+ {
+ get
+ {
+ string value = GetKey("/settings/logging/maxLogAge");
+ int result;
+ if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result))
+ return result;
+ return -1;
+ }
+ }
+
+ ///
+ /// Gets the disabled log types.
+ ///
+ /// The disabled log types.
+ internal static XmlNode DisabledLogTypes
+ {
+ get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); }
+ }
+
+ ///
+ /// Gets the package server url.
+ ///
+ /// The package server url.
+ internal static string PackageServer
+ {
+ get { return "packages.umbraco.org"; }
+ }
+
+ static bool? _useDomainPrefixes = null;
+
+ ///
+ /// Gets a value indicating whether umbraco will use domain prefixes.
+ ///
+ /// true if umbraco will use domain prefixes; otherwise, false.
+ internal static bool UseDomainPrefixes
+ {
+ get
+ {
+ // default: false
+ return _useDomainPrefixes ?? GetKeyValue("/settings/requestHandler/useDomainPrefixes", false);
+ }
+ /*internal*/ set
+ {
+ // for unit tests only
+ _useDomainPrefixes = value;
+ }
+ }
+
+ static bool? _addTrailingSlash = null;
+
+ ///
+ /// This will add a trailing slash (/) to urls when in directory url mode
+ /// NOTICE: This will always return false if Directory Urls in not active
+ ///
+ internal static bool AddTrailingSlash
+ {
+ get
+ {
+ // default: false
+ return GlobalSettings.UseDirectoryUrls
+ && (_addTrailingSlash ?? GetKeyValue("/settings/requestHandler/addTrailingSlash", false));
+ }
+ /*internal*/ set
+ {
+ // for unit tests only
+ _addTrailingSlash = value;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system.
+ ///
+ /// true if umbraco will use ASP.NET MasterPages; otherwise, false.
+ internal static bool UseAspNetMasterPages
+ {
+ get
+ {
+ try
+ {
+ bool result;
+ if (bool.TryParse(GetKey("/settings/templates/useAspNetMasterPages"), out result))
+ return result;
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will attempt to load any skins to override default template files
+ ///
+ /// true if umbraco will override templates with skins if present and configured false.
+ internal static bool EnableTemplateFolders
+ {
+ get
+ {
+ try
+ {
+ bool result;
+ if (bool.TryParse(GetKey("/settings/templates/enableTemplateFolders"), out result))
+ return result;
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ //TODO: I"m not sure why we need this, need to ask Gareth what the deal is, pretty sure we can remove it or change it, seems like
+ // massive overkill.
+
+ ///
+ /// razor DynamicNode typecasting detects XML and returns DynamicXml - Root elements that won't convert to DynamicXml
+ ///
+ internal static IEnumerable NotDynamicXmlDocumentElements
+ {
+ get
+ {
+ try
+ {
+ List items = new List();
+ XmlNode root = GetKeyAsNode("/settings/scripting/razor/notDynamicXmlDocumentElements");
+ foreach (XmlNode element in root.SelectNodes(".//element"))
+ {
+ items.Add(element.InnerText);
+ }
+ return items;
+ }
+ catch
+ {
+ return new List() { "p", "div" };
+ }
+ }
+ }
+
+ private static IEnumerable _razorDataTypeModelStaticMapping;
+ private static readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim();
+
+ internal static IEnumerable RazorDataTypeModelStaticMapping
+ {
+ get
+ {
+ /*
+
+ DigibizAdvancedMediaPicker.RazorModel.ModelBinder
+ DigibizAdvancedMediaPicker.RazorModel.ModelBinder
+
+ */
+
+ using (var l = new UpgradeableReadLock(Lock))
+ {
+ if (_razorDataTypeModelStaticMapping == null)
+ {
+ l.UpgradeToWriteLock();
+
+ List items = new List();
+ XmlNode root = GetKeyAsNode("/settings/scripting/razor/dataTypeModelStaticMappings");
+ if (root != null)
+ {
+ foreach (XmlNode element in root.SelectNodes(".//mapping"))
+ {
+ string propertyTypeAlias = null, nodeTypeAlias = null;
+ Guid? dataTypeGuid = null;
+ if (!string.IsNullOrEmpty(element.InnerText))
+ {
+ if (element.Attributes["dataTypeGuid"] != null)
+ {
+ dataTypeGuid = (Guid?)new Guid(element.Attributes["dataTypeGuid"].Value);
+ }
+ if (element.Attributes["propertyTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["propertyTypeAlias"].Value))
+ {
+ propertyTypeAlias = element.Attributes["propertyTypeAlias"].Value;
+ }
+ if (element.Attributes["nodeTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["nodeTypeAlias"].Value))
+ {
+ nodeTypeAlias = element.Attributes["nodeTypeAlias"].Value;
+ }
+ items.Add(new RazorDataTypeModelStaticMappingItem()
+ {
+ DataTypeGuid = dataTypeGuid,
+ PropertyTypeAlias = propertyTypeAlias,
+ NodeTypeAlias = nodeTypeAlias,
+ TypeName = element.InnerText,
+ Raw = element.OuterXml
+ });
+ }
+ }
+ }
+
+ _razorDataTypeModelStaticMapping = items;
+ }
+
+ return _razorDataTypeModelStaticMapping;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will clone XML cache on publish.
+ ///
+ ///
+ /// true if umbraco will clone XML cache on publish; otherwise, false.
+ ///
+ internal static bool CloneXmlCacheOnPublish
+ {
+ get
+ {
+ try
+ {
+ bool result;
+ if (bool.TryParse(GetKey("/settings/content/cloneXmlContent"), out result))
+ return result;
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether rich text editor content should be parsed by tidy.
+ ///
+ /// true if content is parsed; otherwise, false.
+ internal static bool TidyEditorContent
+ {
+ get { return bool.Parse(GetKey("/settings/content/TidyEditorContent")); }
+ }
+
+ ///
+ /// Gets the encoding type for the tidyied content.
+ ///
+ /// The encoding type as string.
+ internal static string TidyCharEncoding
+ {
+ get
+ {
+ string encoding = GetKey("/settings/content/TidyCharEncoding");
+ if (String.IsNullOrEmpty(encoding))
+ {
+ encoding = "UTF8";
+ }
+ return encoding;
+ }
+ }
+
+ ///
+ /// Gets the property context help option, this can either be 'text', 'icon' or 'none'
+ ///
+ /// The property context help option.
+ internal static string PropertyContextHelpOption
+ {
+ get { return GetKey("/settings/content/PropertyContextHelpOption").ToLower(); }
+ }
+
+ internal static string DefaultBackofficeProvider
+ {
+ get
+ {
+ string defaultProvider = GetKey("/settings/providers/users/DefaultBackofficeProvider");
+ if (String.IsNullOrEmpty(defaultProvider))
+ defaultProvider = "UsersMembershipProvider";
+
+ return defaultProvider;
+ }
+ }
+
+ private static bool? _forceSafeAliases;
+
+ ///
+ /// Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes
+ ///
+ internal static bool ForceSafeAliases
+ {
+ get
+ {
+ // default: true
+ return _forceSafeAliases ?? GetKeyValue("/settings/content/ForceSafeAliases", true);
+ }
+ /*internal*/ set
+ {
+ // used for unit testing
+ _forceSafeAliases = value;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether to try to skip IIS custom errors.
+ ///
+ [UmbracoWillObsolete("Use UmbracoSettings.For.TrySkipIisCustomErrors instead.")]
+ internal static bool TrySkipIisCustomErrors
+ {
+ get { return GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); }
+ }
+
+ ///
+ /// Gets a value indicating whether internal redirect preserves the template.
+ ///
+ [UmbracoWillObsolete("Use UmbracoSettings.For.InternalRedirectPerservesTemplate instead.")]
+ internal static bool InternalRedirectPreservesTemplate
+ {
+ get { return GetKeyValue("/settings/web.routing/@internalRedirectPreservesTemplate", false); }
+ }
+
+ ///
+ /// File types that will not be allowed to be uploaded via the content/media upload control
+ ///
+ public static IEnumerable DisallowedUploadFiles
+ {
+ get
+ {
+ var val = GetKey("/settings/content/disallowedUploadFiles");
+ return val.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
+ }
+ }
+
+ ///
+ /// Gets the allowed image file types.
+ ///
+ /// The allowed image file types.
+ internal static string ImageFileTypes
+ {
+ get { return GetKey("/settings/content/imaging/imageFileTypes").ToLowerInvariant(); }
+ }
+
+ ///
+ /// Gets the allowed script file types.
+ ///
+ /// The allowed script file types.
+ internal static string ScriptFileTypes
+ {
+ get { return GetKey("/settings/content/scripteditor/scriptFileTypes"); }
+ }
+
+ private static int? _umbracoLibraryCacheDuration;
+
+ ///
+ /// Gets the duration in seconds to cache queries to umbraco library member and media methods
+ /// Default is 1800 seconds (30 minutes)
+ ///
+ internal static int UmbracoLibraryCacheDuration
+ {
+ get
+ {
+ // default: 1800
+ return _umbracoLibraryCacheDuration ?? GetKeyValue("/settings/content/UmbracoLibraryCacheDuration", 1800);
+ }
+ /*internal*/ set
+ {
+ // for unit tests only
+ _umbracoLibraryCacheDuration = value;
+ }
+ }
+
+ ///
+ /// Gets the path to the scripts folder used by the script editor.
+ ///
+ /// The script folder path.
+ internal static string ScriptFolderPath
+ {
+ get { return GetKey("/settings/content/scripteditor/scriptFolderPath"); }
+ }
+
+ ///
+ /// Enabled or disable the script/code editor
+ ///
+ internal static bool ScriptDisableEditor
+ {
+ get
+ {
+ string _tempValue = GetKey("/settings/content/scripteditor/scriptDisableEditor");
+ if (_tempValue != String.Empty)
+ return bool.Parse(_tempValue);
+ else
+ return false;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will ensure unique node naming.
+ /// This will ensure that nodes cannot have the same url, but will add extra characters to a url.
+ /// ex: existingnodename.aspx would become existingnodename(1).aspx if a node with the same name is found
+ ///
+ /// true if umbraco ensures unique node naming; otherwise, false.
+ internal static bool EnsureUniqueNaming
+ {
+ get
+ {
+ try
+ {
+ return bool.Parse(GetKey("/settings/content/ensureUniqueNaming"));
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// Gets the notification email sender.
+ ///
+ /// The notification email sender.
+ internal static string NotificationEmailSender
+ {
+ get { return GetKey("/settings/content/notifications/email"); }
+ }
+
+ ///
+ /// Gets a value indicating whether notification-emails are HTML.
+ ///
+ ///
+ /// true if html notification-emails are disabled; otherwise, false.
+ ///
+ internal static bool NotificationDisableHtmlEmail
+ {
+ get
+ {
+ var tempValue = GetKey("/settings/content/notifications/disableHtmlEmail");
+ return tempValue != String.Empty && bool.Parse(tempValue);
+ }
+ }
+
+ ///
+ /// Gets the allowed attributes on images.
+ ///
+ /// The allowed attributes on images.
+ internal static string ImageAllowedAttributes
+ {
+ get { return GetKey("/settings/content/imaging/allowedAttributes"); }
+ }
+
+ internal static XmlNode ImageAutoFillImageProperties
+ {
+ get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); }
+ }
+
+ ///
+ /// Gets the scheduled tasks as XML
+ ///
+ /// The scheduled tasks.
+ internal static XmlNode ScheduledTasks
+ {
+ get { return GetKeyAsNode("/settings/scheduledTasks"); }
+ }
+
+ ///
+ /// Gets a list of characters that will be replaced when generating urls
+ ///
+ /// The URL replacement characters.
+ internal static XmlNode UrlReplaceCharacters
+ {
+ get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); }
+ }
+
+ ///
+ /// Whether to replace double dashes from url (ie my--story----from--dash.aspx caused by multiple url replacement chars
+ ///
+ internal static bool RemoveDoubleDashesFromUrlReplacing
+ {
+ get
+ {
+ try
+ {
+ return bool.Parse(UrlReplaceCharacters.Attributes.GetNamedItem("removeDoubleDashes").Value);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will use distributed calls.
+ /// This enables umbraco to share cache and content across multiple servers.
+ /// Used for load-balancing high-traffic sites.
+ ///
+ /// true if umbraco uses distributed calls; otherwise, false.
+ internal static bool UseDistributedCalls
+ {
+ get
+ {
+ try
+ {
+ return bool.Parse(GetKeyAsNode("/settings/distributedCall").Attributes.GetNamedItem("enable").Value);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+
+ ///
+ /// Gets the ID of the user with access rights to perform the distributed calls.
+ ///
+ /// The distributed call user.
+ internal static int DistributedCallUser
+ {
+ get
+ {
+ try
+ {
+ return int.Parse(GetKey("/settings/distributedCall/user"));
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+ }
+
+ ///
+ /// Gets the html injected into a (x)html page if Umbraco is running in preview mode
+ ///
+ internal static string PreviewBadge
+ {
+ get
+ {
+ try
+ {
+ return GetKey("/settings/content/PreviewBadge");
+ }
+ catch
+ {
+ return "In Preview Mode - click to end";
+ }
+ }
+ }
+
+ ///
+ /// Gets IP or hostnames of the distribution servers.
+ /// These servers will receive a call everytime content is created/deleted/removed
+ /// and update their content cache accordingly, ensuring a consistent cache on all servers
+ ///
+ /// The distribution servers.
+ internal static XmlNode DistributionServers
+ {
+ get
+ {
+ try
+ {
+ return GetKeyAsNode("/settings/distributedCall/servers");
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+
+ ///
+ /// Gets HelpPage configurations.
+ /// A help page configuration specify language, user type, application, application url and
+ /// the target help page url.
+ ///
+ internal static XmlNode HelpPages
+ {
+ get
+ {
+ try
+ {
+ return GetKeyAsNode("/settings/help");
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+
+ ///
+ /// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url.
+ /// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates.
+ /// All repositories should have a unique alias.
+ /// All packages installed from a repository gets the repository alias included in the install information
+ ///
+ /// The repository servers.
+ internal static XmlNode Repositories
+ {
+ get
+ {
+ try
+ {
+ return GetKeyAsNode("/settings/repositories");
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether umbraco will use the viewstate mover module.
+ /// The viewstate mover will move all asp.net viewstate information to the bottom of the aspx page
+ /// to ensure that search engines will index text instead of javascript viewstate information.
+ ///
+ ///
+ /// true if umbraco will use the viewstate mover module; otherwise, false.
+ ///
+ internal static bool UseViewstateMoverModule
+ {
+ get
+ {
+ try
+ {
+ return
+ bool.Parse(
+ GetKeyAsNode("/settings/viewstateMoverModule").Attributes.GetNamedItem("enable").Value);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+
+ ///
+ /// Tells us whether the Xml Content cache is disabled or not
+ /// Default is enabled
+ ///
+ internal static bool IsXmlContentCacheDisabled
+ {
+ get
+ {
+ try
+ {
+ bool xmlCacheEnabled;
+ string value = GetKey("/settings/content/XmlCacheEnabled");
+ if (bool.TryParse(value, out xmlCacheEnabled))
+ return !xmlCacheEnabled;
+ // Return default
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// Check if there's changes to the umbraco.config xml file cache on disk on each request
+ /// Makes it possible to updates environments by syncing the umbraco.config file across instances
+ /// Relates to http://umbraco.codeplex.com/workitem/30722
+ ///
+ internal static bool XmlContentCheckForDiskChanges
+ {
+ get
+ {
+ try
+ {
+ bool checkForDiskChanges;
+ string value = GetKey("/settings/content/XmlContentCheckForDiskChanges");
+ if (bool.TryParse(value, out checkForDiskChanges))
+ return checkForDiskChanges;
+ // Return default
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// If this is enabled, all Umbraco objects will generate data in the preview table (cmsPreviewXml).
+ /// If disabled, only documents will generate data.
+ /// This feature is useful if anyone would like to see how data looked at a given time
+ ///
+ internal static bool EnableGlobalPreviewStorage
+ {
+ get
+ {
+ try
+ {
+ bool globalPreviewEnabled = false;
+ string value = GetKey("/settings/content/GlobalPreviewStorageEnabled");
+ if (bool.TryParse(value, out globalPreviewEnabled))
+ return !globalPreviewEnabled;
+ // Return default
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ private static bool? _useLegacySchema;
+
+ ///
+ /// Whether to use the new 4.1 schema or the old legacy schema
+ ///
+ ///
+ /// true if yes, use the old node/data model; otherwise, false.
+ ///
+ internal static bool UseLegacyXmlSchema
+ {
+ get
+ {
+ // default: true
+ return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false);
+ }
+ /*internal*/ set
+ {
+ // used for unit testing
+ _useLegacySchema = value;
+ }
+ }
+
+ [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")]
+ internal static IEnumerable AppCodeFileExtensionsList
+ {
+ get
+ {
+ return (from XmlNode x in AppCodeFileExtensions
+ where !String.IsNullOrEmpty(x.InnerText)
+ select x.InnerText).ToList();
+ }
+ }
+
+ [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")]
+ internal static XmlNode AppCodeFileExtensions
+ {
+ get
+ {
+ XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions");
+ if (value != null)
+ {
+ return value;
+ }
+
+ // default is .cs and .vb
+ value = UmbracoSettingsXmlDoc.CreateElement("appCodeFileExtensions");
+ value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "cs"));
+ value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "vb"));
+ return value;
+ }
+ }
+
+ ///
+ /// Tells us whether the Xml to always update disk cache, when changes are made to content
+ /// Default is enabled
+ ///
+ internal static bool ContinouslyUpdateXmlDiskCache
+ {
+ get
+ {
+ try
+ {
+ bool updateDiskCache;
+ string value = GetKey("/settings/content/ContinouslyUpdateXmlDiskCache");
+ if (bool.TryParse(value, out updateDiskCache))
+ return updateDiskCache;
+ // Return default
+ return false;
+ }
+ catch
+ {
+ return true;
+ }
+ }
+ }
+
+ ///
+ /// Tells us whether to use a splash page while umbraco is initializing content.
+ /// If not, requests are queued while umbraco loads content. For very large sites (+10k nodes) it might be usefull to
+ /// have a splash page
+ /// Default is disabled
+ ///
+ internal static bool EnableSplashWhileLoading
+ {
+ get
+ {
+ try
+ {
+ bool updateDiskCache;
+ string value = GetKey("/settings/content/EnableSplashWhileLoading");
+ if (bool.TryParse(value, out updateDiskCache))
+ return updateDiskCache;
+ // Return default
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ private static bool? _resolveUrlsFromTextString;
+ internal static bool ResolveUrlsFromTextString
+ {
+ get
+ {
+ if (_resolveUrlsFromTextString == null)
+ {
+ try
+ {
+ bool enableDictionaryFallBack;
+ var value = GetKey("/settings/content/ResolveUrlsFromTextString");
+ if (value != null)
+ if (bool.TryParse(value, out enableDictionaryFallBack))
+ _resolveUrlsFromTextString = enableDictionaryFallBack;
+ }
+ catch (Exception ex)
+ {
+ Trace.WriteLine("Could not load /settings/content/ResolveUrlsFromTextString from umbracosettings.config:\r\n {0}",
+ ex.Message);
+
+ // set url resolving to true (default (legacy) behavior) to ensure we don't keep writing to trace
+ _resolveUrlsFromTextString = true;
+ }
+ }
+ return _resolveUrlsFromTextString == true;
+ }
+ }
+
+
+ private static RenderingEngine? _defaultRenderingEngine;
+
+ ///
+ /// Enables MVC, and at the same time disable webform masterpage templates.
+ /// This ensure views are automaticly created instead of masterpages.
+ /// Views are display in the tree instead of masterpages and a MVC template editor
+ /// is used instead of the masterpages editor
+ ///
+ /// true if umbraco defaults to using MVC views for templating, otherwise false.
+ internal static RenderingEngine DefaultRenderingEngine
+ {
+ get
+ {
+ if (_defaultRenderingEngine == null)
+ {
+ try
+ {
+ var engine = RenderingEngine.WebForms;
+ var value = GetKey("/settings/templates/defaultRenderingEngine");
+ if (value != null)
+ {
+ Enum.TryParse(value, true, out engine);
+ }
+ _defaultRenderingEngine = engine;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Error("Could not load /settings/templates/defaultRenderingEngine from umbracosettings.config", ex);
+ _defaultRenderingEngine = RenderingEngine.WebForms;
+ }
+ }
+ return _defaultRenderingEngine.Value;
+ }
+ //internal set
+ //{
+ // _defaultRenderingEngine = value;
+ // var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine");
+ // node.InnerText = value.ToString();
+ //}
+ }
+
+ private static MacroErrorBehaviour? _macroErrorBehaviour;
+
+ ///
+ /// This configuration setting defines how to handle macro errors:
+ /// - Inline - Show error within macro as text (default and current Umbraco 'normal' behavior)
+ /// - Silent - Suppress error and hide macro
+ /// - Throw - Throw an exception and invoke the global error handler (if one is defined, if not you'll get a YSOD)
+ ///
+ /// MacroErrorBehaviour enum defining how to handle macro errors.
+ internal static MacroErrorBehaviour MacroErrorBehaviour
+ {
+ get
+ {
+ if (_macroErrorBehaviour == null)
+ {
+ try
+ {
+ var behaviour = MacroErrorBehaviour.Inline;
+ var value = GetKey("/settings/content/MacroErrors");
+ if (value != null)
+ {
+ Enum.TryParse(value, true, out behaviour);
+ }
+ _macroErrorBehaviour = behaviour;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Error("Could not load /settings/content/MacroErrors from umbracosettings.config", ex);
+ _macroErrorBehaviour = MacroErrorBehaviour.Inline;
+ }
+ }
+ return _macroErrorBehaviour.Value;
+ }
+ }
+
+ private static IconPickerBehaviour? _iconPickerBehaviour;
+
+ ///
+ /// This configuration setting defines how to show icons in the document type editor.
+ /// - ShowDuplicates - Show duplicates in files and sprites. (default and current Umbraco 'normal' behaviour)
+ /// - HideSpriteDuplicates - Show files on disk and hide duplicates from the sprite
+ /// - HideFileDuplicates - Show files in the sprite and hide duplicates on disk
+ ///
+ /// MacroErrorBehaviour enum defining how to show icons in the document type editor.
+ internal static IconPickerBehaviour IconPickerBehaviour
+ {
+ get
+ {
+ if (_iconPickerBehaviour == null)
+ {
+ try
+ {
+ var behaviour = IconPickerBehaviour.ShowDuplicates;
+ var value = GetKey("/settings/content/DocumentTypeIconList");
+ if (value != null)
+ {
+ Enum.TryParse(value, true, out behaviour);
+ }
+ _iconPickerBehaviour = behaviour;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Error("Could not load /settings/content/DocumentTypeIconList from umbracosettings.config", ex);
+ _iconPickerBehaviour = IconPickerBehaviour.ShowDuplicates;
+ }
+ }
+ return _iconPickerBehaviour.Value;
+ }
+ }
+
+ ///
+ /// Gets the default document type property used when adding new properties through the back-office
+ ///
+ /// Configured text for the default document type property
+ /// If undefined, 'Textstring' is the default
+ public static string DefaultDocumentTypeProperty
+ {
+ get
+ {
+ var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty");
+ if (string.IsNullOrEmpty(defaultDocumentTypeProperty))
+ {
+ defaultDocumentTypeProperty = "Textstring";
+ }
+
+ return defaultDocumentTypeProperty;
+ }
+ }
+
+ #region Extensible settings
+
+ ///
+ /// Resets settings that were set programmatically, to their initial values.
+ ///
+ /// To be used in unit tests.
+ internal static void Reset()
+ {
+ ResetInternal();
+
+ using (new WriteLock(SectionsLock))
+ {
+ foreach (var section in Sections.Values)
+ section.ResetSection();
+ }
+ }
+
+ private static readonly ReaderWriterLockSlim SectionsLock = new ReaderWriterLockSlim();
+ private static readonly Dictionary Sections = new Dictionary();
+
+ ///
+ /// Gets the specified UmbracoConfigurationSection.
+ ///
+ /// The type of the UmbracoConfigurationSectiont.
+ /// The UmbracoConfigurationSection of the specified type.
+ public static T For()
+ where T : UmbracoConfigurationSection, new()
+ {
+ var sectionType = typeof (T);
+ using (new WriteLock(SectionsLock))
+ {
+ if (Sections.ContainsKey(sectionType)) return Sections[sectionType] as T;
+
+ var attr = sectionType.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}\" ConfigurationKeyAttribute value is null or empty.", sectionType.FullName));
+
+ var section = GetSection(sectionType, sectionKey);
+
+ Sections[sectionType] = section;
+ return section as T;
+ }
+ }
+
+ private static UmbracoConfigurationSection GetSection(Type sectionType, string key)
+ {
+ if (!sectionType.Inherits())
+ throw new ArgumentException(string.Format(
+ "Type \"{0}\" does not inherit from UmbracoConfigurationSection.", sectionType.FullName), "sectionType");
+
+ var section = ConfigurationManager.GetSection(key);
+
+ if (section != null && section.GetType() != sectionType)
+ throw new InvalidCastException(string.Format("Section at key \"{0}\" is of type \"{1}\" and not \"{2}\".",
+ key, section.GetType().FullName, sectionType.FullName));
+
+ if (section != null) return section as UmbracoConfigurationSection;
+
+ section = Activator.CreateInstance(sectionType) as UmbracoConfigurationSection;
+
+ if (section == null)
+ throw new NullReferenceException(string.Format(
+ "Activator failed to create an instance of type \"{0}\" for key\"{1}\" and returned null.",
+ sectionType.FullName, key));
+
+ return section as UmbracoConfigurationSection;
+ }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs
index ab4e51a946..a52c0dde56 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs
@@ -1,31 +1,36 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class AppCodeFileExtensionsCollection : ConfigurationElementCollection, IEnumerable
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new FileExtensionElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((FileExtensionElement)element).Value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as FileExtensionElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class AppCodeFileExtensionsCollection : ConfigurationElementCollection, IEnumerable
+ {
+ internal void Add(FileExtensionElement element)
+ {
+ base.BaseAdd(element);
+ }
+
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new FileExtensionElement();
+ }
+
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return ((FileExtensionElement)element).Value;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (var i = 0; i < Count; i++)
+ {
+ yield return BaseGet(i) as FileExtensionElement;
+ }
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs
index 707b83d638..ad839de174 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs
@@ -1,14 +1,15 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class AppCodeFileExtensionsElement : ConfigurationElement
- {
- [ConfigurationCollection(typeof(AppCodeFileExtensionsCollection), AddItemName = "ext")]
- [ConfigurationProperty("", IsDefaultCollection = true)]
- public AppCodeFileExtensionsCollection AppCodeFileExtensionsCollection
- {
- get { return (AppCodeFileExtensionsCollection)base[""]; }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class AppCodeFileExtensionsElement : ConfigurationElement
+ {
+ [ConfigurationCollection(typeof(AppCodeFileExtensionsCollection), AddItemName = "ext")]
+ [ConfigurationProperty("", IsDefaultCollection = true)]
+ public AppCodeFileExtensionsCollection AppCodeFileExtensionsCollection
+ {
+ get { return (AppCodeFileExtensionsCollection)base[""]; }
+ set { base[""] = value; }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs
index bdc69754c3..0dbaae019a 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs
@@ -1,31 +1,31 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class CharCollection : ConfigurationElementCollection, IEnumerable
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new CharElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((CharElement)element).Char;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as CharElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class CharCollection : ConfigurationElementCollection, IEnumerable
+ {
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new CharElement();
+ }
+
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return ((CharElement)element).Char;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (var i = 0; i < Count; i++)
+ {
+ yield return BaseGet(i) as CharElement;
+ }
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs
index e94f015974..d6ec9fe890 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs
@@ -1,10 +1,10 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class CharElement : InnerTextConfigurationElement
- {
- internal string Char
- {
- get { return RawXml.Attribute("org").Value; }
- }
- }
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class CharElement : InnerTextConfigurationElement
+ {
+ internal string Char
+ {
+ get { return RawXml.Attribute("org").Value; }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs
index 514a0ab37a..03a31fc1fd 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs
@@ -1,70 +1,70 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- ///
- /// Defines a configuration section that contains inner text that is comma delimited
- ///
- internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement, IEnumerable
- {
- public override CommaDelimitedStringCollection Value
- {
- get
- {
- var converter = new CommaDelimitedStringCollectionConverter();
- return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue);
- }
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return new InnerEnumerator(Value.GetEnumerator());
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return new InnerEnumerator(Value.GetEnumerator());
- }
-
- ///
- /// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable
- ///
- private class InnerEnumerator : IEnumerator
- {
- private readonly StringEnumerator _stringEnumerator;
-
- public InnerEnumerator(StringEnumerator stringEnumerator)
- {
- _stringEnumerator = stringEnumerator;
- }
-
- public bool MoveNext()
- {
- return _stringEnumerator.MoveNext();
- }
-
- public void Reset()
- {
- _stringEnumerator.Reset();
- }
-
- string IEnumerator.Current
- {
- get { return _stringEnumerator.Current; }
- }
-
- public object Current
- {
- get { return _stringEnumerator.Current; }
- }
-
- public void Dispose()
- {
- _stringEnumerator.DisposeIfDisposable();
- }
- }
- }
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ ///
+ /// Defines a configuration section that contains inner text that is comma delimited
+ ///
+ internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement, IEnumerable
+ {
+ public override CommaDelimitedStringCollection Value
+ {
+ get
+ {
+ var converter = new CommaDelimitedStringCollectionConverter();
+ return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue);
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new InnerEnumerator(Value.GetEnumerator());
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new InnerEnumerator(Value.GetEnumerator());
+ }
+
+ ///
+ /// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable
+ ///
+ private class InnerEnumerator : IEnumerator
+ {
+ private readonly StringEnumerator _stringEnumerator;
+
+ public InnerEnumerator(StringEnumerator stringEnumerator)
+ {
+ _stringEnumerator = stringEnumerator;
+ }
+
+ public bool MoveNext()
+ {
+ return _stringEnumerator.MoveNext();
+ }
+
+ public void Reset()
+ {
+ _stringEnumerator.Reset();
+ }
+
+ string IEnumerator.Current
+ {
+ get { return _stringEnumerator.Current; }
+ }
+
+ public object Current
+ {
+ get { return _stringEnumerator.Current; }
+ }
+
+ public void Dispose()
+ {
+ _stringEnumerator.DisposeIfDisposable();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
index 1b316e496a..3b3e7233f0 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs
@@ -1,286 +1,286 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentElement : ConfigurationElement
- {
- [ConfigurationProperty("imaging")]
- internal ContentImagingElement Imaging
- {
- get { return (ContentImagingElement)this["imaging"]; }
- }
-
- [ConfigurationProperty("scripteditor")]
- internal ContentScriptEditorElement ScriptEditor
- {
- get { return (ContentScriptEditorElement)this["scripteditor"]; }
- }
-
- [ConfigurationProperty("EnableCanvasEditing")]
- internal InnerTextConfigurationElement EnableCanvasEditing
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["EnableCanvasEditing"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("ResolveUrlsFromTextString")]
- internal InnerTextConfigurationElement ResolveUrlsFromTextString
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["ResolveUrlsFromTextString"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("UploadAllowDirectories")]
- internal InnerTextConfigurationElement UploadAllowDirectories
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["UploadAllowDirectories"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("errors")]
- public ContentErrorsElement Errors
- {
- get { return (ContentErrorsElement)base["errors"]; }
- }
-
- [ConfigurationProperty("notifications")]
- public NotificationsElement Notifications
- {
- get { return (NotificationsElement)base["notifications"]; }
- }
-
- [ConfigurationProperty("ensureUniqueNaming")]
- public InnerTextConfigurationElement EnsureUniqueNaming
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["ensureUniqueNaming"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("TidyEditorContent")]
- public InnerTextConfigurationElement TidyEditorContent
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["TidyEditorContent"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("TidyCharEncoding")]
- public InnerTextConfigurationElement TidyCharEncoding
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["TidyCharEncoding"],
- //set the default
- "UTF8");
- }
- }
-
- [ConfigurationProperty("XmlCacheEnabled")]
- public InnerTextConfigurationElement XmlCacheEnabled
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["XmlCacheEnabled"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("ContinouslyUpdateXmlDiskCache")]
- public InnerTextConfigurationElement ContinouslyUpdateXmlDiskCache
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["ContinouslyUpdateXmlDiskCache"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("XmlContentCheckForDiskChanges")]
- public InnerTextConfigurationElement XmlContentCheckForDiskChanges
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["XmlContentCheckForDiskChanges"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("EnableSplashWhileLoading")]
- public InnerTextConfigurationElement EnableSplashWhileLoading
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["EnableSplashWhileLoading"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("PropertyContextHelpOption")]
- public InnerTextConfigurationElement PropertyContextHelpOption
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["PropertyContextHelpOption"],
- //set the default
- "text");
- }
- }
-
- [ConfigurationProperty("UseLegacyXmlSchema")]
- public InnerTextConfigurationElement UseLegacyXmlSchema
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["UseLegacyXmlSchema"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("ForceSafeAliases")]
- public InnerTextConfigurationElement ForceSafeAliases
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["ForceSafeAliases"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("PreviewBadge")]
- public InnerTextConfigurationElement PreviewBadge
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["PreviewBadge"],
- //set the default
- @"In Preview Mode - click to end");
- }
- }
-
- [ConfigurationProperty("UmbracoLibraryCacheDuration")]
- public InnerTextConfigurationElement UmbracoLibraryCacheDuration
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["UmbracoLibraryCacheDuration"],
- //set the default
- 1800);
-
- }
- }
-
- [ConfigurationProperty("MacroErrors")]
- public InnerTextConfigurationElement MacroErrors
- {
- get
- {
-
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["MacroErrors"],
- //set the default
- MacroErrorBehaviour.Inline);
- }
- }
-
- [ConfigurationProperty("DocumentTypeIconList")]
- public InnerTextConfigurationElement DocumentTypeIconList
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["DocumentTypeIconList"],
- //set the default
- IconPickerBehaviour.HideFileDuplicates);
- }
- }
-
- [ConfigurationProperty("disallowedUploadFiles")]
- public OptionalCommaDelimitedConfigurationElement DisallowedUploadFiles
- {
- get
- {
- return new OptionalCommaDelimitedConfigurationElement(
- (CommaDelimitedConfigurationElement)this["disallowedUploadFiles"],
- //set the default
- new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" });
-
- }
- }
-
- [ConfigurationProperty("cloneXmlContent")]
- internal InnerTextConfigurationElement CloneXmlContent
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["cloneXmlContent"],
- //set the default
- true);
- }
- }
-
- [ConfigurationProperty("GlobalPreviewStorageEnabled")]
- internal InnerTextConfigurationElement GlobalPreviewStorageEnabled
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["GlobalPreviewStorageEnabled"],
- //set the default
- false);
- }
- }
-
- [ConfigurationProperty("defaultDocumentTypeProperty")]
- internal InnerTextConfigurationElement DefaultDocumentTypeProperty
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["defaultDocumentTypeProperty"],
- //set the default
- "Textstring");
- }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentElement : ConfigurationElement
+ {
+ [ConfigurationProperty("imaging")]
+ internal ContentImagingElement Imaging
+ {
+ get { return (ContentImagingElement)this["imaging"]; }
+ }
+
+ [ConfigurationProperty("scripteditor")]
+ internal ContentScriptEditorElement ScriptEditor
+ {
+ get { return (ContentScriptEditorElement)this["scripteditor"]; }
+ }
+
+ [ConfigurationProperty("EnableCanvasEditing")]
+ internal InnerTextConfigurationElement EnableCanvasEditing
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["EnableCanvasEditing"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("ResolveUrlsFromTextString")]
+ internal InnerTextConfigurationElement ResolveUrlsFromTextString
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["ResolveUrlsFromTextString"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("UploadAllowDirectories")]
+ internal InnerTextConfigurationElement UploadAllowDirectories
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["UploadAllowDirectories"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("errors", IsRequired = true)]
+ public ContentErrorsElement Errors
+ {
+ get { return (ContentErrorsElement) base["errors"]; }
+ }
+
+ [ConfigurationProperty("notifications", IsRequired = true)]
+ public NotificationsElement Notifications
+ {
+ get { return (NotificationsElement)base["notifications"]; }
+ }
+
+ [ConfigurationProperty("ensureUniqueNaming")]
+ public InnerTextConfigurationElement EnsureUniqueNaming
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["ensureUniqueNaming"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("TidyEditorContent")]
+ public InnerTextConfigurationElement TidyEditorContent
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["TidyEditorContent"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("TidyCharEncoding")]
+ public InnerTextConfigurationElement TidyCharEncoding
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["TidyCharEncoding"],
+ //set the default
+ "UTF8");
+ }
+ }
+
+ [ConfigurationProperty("XmlCacheEnabled")]
+ public InnerTextConfigurationElement XmlCacheEnabled
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["XmlCacheEnabled"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("ContinouslyUpdateXmlDiskCache")]
+ public InnerTextConfigurationElement ContinouslyUpdateXmlDiskCache
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["ContinouslyUpdateXmlDiskCache"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("XmlContentCheckForDiskChanges")]
+ public InnerTextConfigurationElement XmlContentCheckForDiskChanges
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["XmlContentCheckForDiskChanges"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("EnableSplashWhileLoading")]
+ public InnerTextConfigurationElement EnableSplashWhileLoading
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["EnableSplashWhileLoading"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("PropertyContextHelpOption")]
+ public InnerTextConfigurationElement PropertyContextHelpOption
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["PropertyContextHelpOption"],
+ //set the default
+ "text");
+ }
+ }
+
+ [ConfigurationProperty("UseLegacyXmlSchema")]
+ public InnerTextConfigurationElement UseLegacyXmlSchema
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["UseLegacyXmlSchema"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("ForceSafeAliases")]
+ public InnerTextConfigurationElement ForceSafeAliases
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["ForceSafeAliases"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("PreviewBadge")]
+ public InnerTextConfigurationElement PreviewBadge
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["PreviewBadge"],
+ //set the default
+ @"In Preview Mode - click to end");
+ }
+ }
+
+ [ConfigurationProperty("UmbracoLibraryCacheDuration")]
+ public InnerTextConfigurationElement UmbracoLibraryCacheDuration
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["UmbracoLibraryCacheDuration"],
+ //set the default
+ 1800);
+
+ }
+ }
+
+ [ConfigurationProperty("MacroErrors")]
+ public InnerTextConfigurationElement MacroErrors
+ {
+ get
+ {
+
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["MacroErrors"],
+ //set the default
+ MacroErrorBehaviour.Inline);
+ }
+ }
+
+ [ConfigurationProperty("DocumentTypeIconList")]
+ public InnerTextConfigurationElement DocumentTypeIconList
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["DocumentTypeIconList"],
+ //set the default
+ IconPickerBehaviour.HideFileDuplicates);
+ }
+ }
+
+ [ConfigurationProperty("disallowedUploadFiles")]
+ public OptionalCommaDelimitedConfigurationElement DisallowedUploadFiles
+ {
+ get
+ {
+ return new OptionalCommaDelimitedConfigurationElement(
+ (CommaDelimitedConfigurationElement)this["disallowedUploadFiles"],
+ //set the default
+ new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" });
+
+ }
+ }
+
+ [ConfigurationProperty("cloneXmlContent")]
+ internal InnerTextConfigurationElement CloneXmlContent
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["cloneXmlContent"],
+ //set the default
+ true);
+ }
+ }
+
+ [ConfigurationProperty("GlobalPreviewStorageEnabled")]
+ internal InnerTextConfigurationElement GlobalPreviewStorageEnabled
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["GlobalPreviewStorageEnabled"],
+ //set the default
+ false);
+ }
+ }
+
+ [ConfigurationProperty("defaultDocumentTypeProperty")]
+ internal InnerTextConfigurationElement DefaultDocumentTypeProperty
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["defaultDocumentTypeProperty"],
+ //set the default
+ "Textstring");
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs
index 5d9591997f..6691400cc7 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs
@@ -1,37 +1,37 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentError404Collection : ConfigurationElementCollection, IEnumerable
- {
- internal void Add(ContentErrorPageElement element)
- {
- BaseAdd(element);
- }
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new ContentErrorPageElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((ContentErrorPageElement)element).Culture
- + ((ContentErrorPageElement)element).Value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as ContentErrorPageElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentError404Collection : ConfigurationElementCollection, IEnumerable
+ {
+ internal void Add(ContentErrorPageElement element)
+ {
+ BaseAdd(element);
+ }
+
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new ContentErrorPageElement();
+ }
+
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return ((ContentErrorPageElement)element).Culture
+ + ((ContentErrorPageElement)element).Value;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (var i = 0; i < Count; i++)
+ {
+ yield return BaseGet(i) as ContentErrorPageElement;
+ }
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs
index 7054c90194..70d44cfad1 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs
@@ -1,23 +1,23 @@
-using System.Xml.Linq;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentErrorPageElement : InnerTextConfigurationElement
- {
- public ContentErrorPageElement(XElement rawXml)
- : base(rawXml)
- {
- }
-
- public ContentErrorPageElement()
- {
-
- }
-
- internal string Culture
- {
- get { return (string) RawXml.Attribute("culture"); }
- set { RawXml.Attribute("culture").Value = value; }
- }
- }
+using System.Xml.Linq;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentErrorPageElement : InnerTextConfigurationElement
+ {
+ public ContentErrorPageElement(XElement rawXml)
+ : base(rawXml)
+ {
+ }
+
+ public ContentErrorPageElement()
+ {
+
+ }
+
+ internal string Culture
+ {
+ get { return (string) RawXml.Attribute("culture"); }
+ set { RawXml.Attribute("culture").Value = value; }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs
index 5b45df1608..583a822cdc 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs
@@ -1,43 +1,43 @@
-using System.Linq;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentErrorsElement : RawXmlConfigurationElement
- {
-
- public ContentError404Collection Error404Collection
- {
- get
- {
- var result = new ContentError404Collection();
- if (RawXml != null)
- {
- var e404 = RawXml.Elements("error404").First();
- var ePages = e404.Elements("errorPage").ToArray();
- if (ePages.Any())
- {
- //there are multiple
- foreach (var e in ePages)
- {
- result.Add(new ContentErrorPageElement(e)
- {
- Culture = (string)e.Attribute("culture"),
- RawValue = e.Value
- });
- }
- }
- else
- {
- //there's only one defined
- result.Add(new ContentErrorPageElement(e404)
- {
- RawValue = e404.Value
- });
- }
- }
- return result;
- }
- }
-
- }
+using System.Linq;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentErrorsElement : RawXmlConfigurationElement
+ {
+
+ public ContentError404Collection Error404Collection
+ {
+ get
+ {
+ var result = new ContentError404Collection();
+ if (RawXml != null)
+ {
+ var e404 = RawXml.Elements("error404").First();
+ var ePages = e404.Elements("errorPage").ToArray();
+ if (ePages.Any())
+ {
+ //there are multiple
+ foreach (var e in ePages)
+ {
+ result.Add(new ContentErrorPageElement(e)
+ {
+ Culture = (string)e.Attribute("culture"),
+ RawValue = e.Value
+ });
+ }
+ }
+ else
+ {
+ //there's only one defined
+ result.Add(new ContentErrorPageElement(e404)
+ {
+ RawValue = e404.Value
+ });
+ }
+ }
+ return result;
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs
index 23f5c054e9..88bcc03a63 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs
@@ -1,37 +1,37 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable
- {
-
- protected override ConfigurationElement CreateNewElement()
- {
- return new ContentImagingAutoFillUploadFieldElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((ContentImagingAutoFillUploadFieldElement)element).Alias;
- }
-
- internal void Add(ContentImagingAutoFillUploadFieldElement item)
- {
- BaseAdd(item);
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as ContentImagingAutoFillUploadFieldElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable
+ {
+
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new ContentImagingAutoFillUploadFieldElement();
+ }
+
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return ((ContentImagingAutoFillUploadFieldElement)element).Alias;
+ }
+
+ internal void Add(ContentImagingAutoFillUploadFieldElement item)
+ {
+ BaseAdd(item);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (var i = 0; i < Count; i++)
+ {
+ yield return BaseGet(i) as ContentImagingAutoFillUploadFieldElement;
+ }
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs
index ad4cd8e306..82ce242f4c 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs
@@ -1,61 +1,65 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentImagingAutoFillUploadFieldElement : ConfigurationElement
- {
- [ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
- internal string Alias
- {
- get { return (string)this["alias"]; }
- }
-
- [ConfigurationProperty("widthFieldAlias")]
- internal InnerTextConfigurationElement WidthFieldAlias
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["widthFieldAlias"],
- //set the default
- "umbracoWidth");
- }
- }
-
- [ConfigurationProperty("heightFieldAlias")]
- internal InnerTextConfigurationElement HeightFieldAlias
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["heightFieldAlias"],
- //set the default
- "umbracoHeight");
- }
- }
-
- [ConfigurationProperty("lengthFieldAlias")]
- internal InnerTextConfigurationElement LengthFieldAlias
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["lengthFieldAlias"],
- //set the default
- "umbracoBytes");
- }
- }
-
- [ConfigurationProperty("extensionFieldAlias")]
- internal InnerTextConfigurationElement ExtensionFieldAlias
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["extensionFieldAlias"],
- //set the default
- "umbracoExtension");
- }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentImagingAutoFillUploadFieldElement : ConfigurationElement
+ {
+ ///
+ /// Allow setting internally so we can create a default
+ ///
+ [ConfigurationProperty("alias", IsKey = true, IsRequired = true)]
+ internal string Alias
+ {
+ get { return (string)this["alias"]; }
+ set { this["alias"] = value; }
+ }
+
+ [ConfigurationProperty("widthFieldAlias")]
+ internal InnerTextConfigurationElement WidthFieldAlias
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["widthFieldAlias"],
+ //set the default
+ "umbracoWidth");
+ }
+ }
+
+ [ConfigurationProperty("heightFieldAlias")]
+ internal InnerTextConfigurationElement HeightFieldAlias
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["heightFieldAlias"],
+ //set the default
+ "umbracoHeight");
+ }
+ }
+
+ [ConfigurationProperty("lengthFieldAlias")]
+ internal InnerTextConfigurationElement LengthFieldAlias
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["lengthFieldAlias"],
+ //set the default
+ "umbracoBytes");
+ }
+ }
+
+ [ConfigurationProperty("extensionFieldAlias")]
+ internal InnerTextConfigurationElement ExtensionFieldAlias
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["extensionFieldAlias"],
+ //set the default
+ "umbracoExtension");
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs
index 780cb5f893..3f39c8af05 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs
@@ -1,39 +1,55 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentImagingElement : ConfigurationElement
- {
- [ConfigurationProperty("imageFileTypes")]
- internal CommaDelimitedConfigurationElement ImageFileTypes
- {
- get
- {
- return new OptionalCommaDelimitedConfigurationElement(
- (CommaDelimitedConfigurationElement)this["imageFileTypes"],
- //set the default
- new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" });
- }
- }
-
- [ConfigurationProperty("allowedAttributes")]
- internal CommaDelimitedConfigurationElement AllowedAttributes
- {
- get
- {
- return new OptionalCommaDelimitedConfigurationElement(
- (CommaDelimitedConfigurationElement)this["allowedAttributes"],
- //set the default
- new[] { "src", "alt", "border", "class", "style", "align", "id", "name", "onclick", "usemap" });
- }
- }
-
- [ConfigurationCollection(typeof(ContentImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
- [ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true, IsRequired = true)]
- public ContentImagingAutoFillPropertiesCollection ImageAutoFillProperties
- {
- get { return (ContentImagingAutoFillPropertiesCollection) base["autoFillImageProperties"]; }
- }
-
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentImagingElement : ConfigurationElement
+ {
+ [ConfigurationProperty("imageFileTypes")]
+ internal CommaDelimitedConfigurationElement ImageFileTypes
+ {
+ get
+ {
+ return new OptionalCommaDelimitedConfigurationElement(
+ (CommaDelimitedConfigurationElement)this["imageFileTypes"],
+ //set the default
+ new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" });
+ }
+ }
+
+ [ConfigurationProperty("allowedAttributes")]
+ internal CommaDelimitedConfigurationElement AllowedAttributes
+ {
+ get
+ {
+ return new OptionalCommaDelimitedConfigurationElement(
+ (CommaDelimitedConfigurationElement)this["allowedAttributes"],
+ //set the default
+ new[] { "src", "alt", "border", "class", "style", "align", "id", "name", "onclick", "usemap" });
+ }
+ }
+
+ [ConfigurationCollection(typeof(ContentImagingAutoFillPropertiesCollection), AddItemName = "uploadField")]
+ [ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true)]
+ public ContentImagingAutoFillPropertiesCollection ImageAutoFillProperties
+ {
+ get
+ {
+ //here we need to check if this element is defined, if it is not then we'll setup the defaults
+ var prop = Properties["autoFillImageProperties"];
+ var autoFill = this[prop] as ConfigurationElement;
+ if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
+ {
+ var collection = new ContentImagingAutoFillPropertiesCollection();
+ collection.Add(new ContentImagingAutoFillUploadFieldElement
+ {
+ Alias = "umbracoFile"
+ });
+ base["autoFillImageProperties"] = collection;
+ }
+
+ return (ContentImagingAutoFillPropertiesCollection) base["autoFillImageProperties"];
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs
index cf709b329c..031ae01b7f 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs
@@ -1,43 +1,43 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ContentScriptEditorElement : ConfigurationElement
- {
- [ConfigurationProperty("scriptFolderPath")]
- internal InnerTextConfigurationElement ScriptFolderPath
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement)this["scriptFolderPath"],
- //set the default
- "/scripts");
- }
- }
-
- [ConfigurationProperty("scriptFileTypes")]
- internal OptionalCommaDelimitedConfigurationElement ScriptFileTypes
- {
- get
- {
- return new OptionalCommaDelimitedConfigurationElement(
- (OptionalCommaDelimitedConfigurationElement)this["scriptFileTypes"],
- //set the default
- new[] { "js", "xml" });
- }
- }
-
- [ConfigurationProperty("scriptDisableEditor")]
- internal InnerTextConfigurationElement DisableScriptEditor
- {
- get
- {
- return new OptionalInnerTextConfigurationElement(
- (InnerTextConfigurationElement) this["scriptDisableEditor"],
- //set the default
- false);
- }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ContentScriptEditorElement : ConfigurationElement
+ {
+ [ConfigurationProperty("scriptFolderPath")]
+ internal InnerTextConfigurationElement ScriptFolderPath
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement)this["scriptFolderPath"],
+ //set the default
+ "/scripts");
+ }
+ }
+
+ [ConfigurationProperty("scriptFileTypes")]
+ internal OptionalCommaDelimitedConfigurationElement ScriptFileTypes
+ {
+ get
+ {
+ return new OptionalCommaDelimitedConfigurationElement(
+ (OptionalCommaDelimitedConfigurationElement)this["scriptFileTypes"],
+ //set the default
+ new[] { "js", "xml" });
+ }
+ }
+
+ [ConfigurationProperty("scriptDisableEditor")]
+ internal InnerTextConfigurationElement DisableScriptEditor
+ {
+ get
+ {
+ return new OptionalInnerTextConfigurationElement(
+ (InnerTextConfigurationElement) this["scriptDisableEditor"],
+ //set the default
+ false);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs
index b066b4a876..4ad77f7bb6 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs
@@ -1,32 +1,32 @@
-using System;
-using System.ComponentModel;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- ///
- /// Allows for converting string representations of 0 and 1 to boolean
- ///
- internal class CustomBooleanTypeConverter : BooleanConverter
- {
- public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
- {
- if (sourceType == typeof(string))
- {
- return true;
- }
- return base.CanConvertFrom(context, sourceType);
- }
-
- public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
- {
- if (value is string)
- {
- var str = (string)value;
- if (str == "1") return true;
- if (str == "0" || str == "") return false;
- }
-
- return base.ConvertFrom(context, culture, value);
- }
- }
+using System;
+using System.ComponentModel;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ ///
+ /// Allows for converting string representations of 0 and 1 to boolean
+ ///
+ internal class CustomBooleanTypeConverter : BooleanConverter
+ {
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof(string))
+ {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
+ {
+ if (value is string)
+ {
+ var str = (string)value;
+ if (str == "1") return true;
+ if (str == "0" || str == "") return false;
+ }
+
+ return base.ConvertFrom(context, culture, value);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs
index b18375cbd7..ca16460cc4 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs
@@ -1,13 +1,34 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class DeveloperElement : ConfigurationElement
- {
- [ConfigurationProperty("appCodeFileExtensions")]
- internal AppCodeFileExtensionsElement AppCodeFileExtensions
- {
- get { return (AppCodeFileExtensionsElement)this["appCodeFileExtensions"]; }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class DeveloperElement : ConfigurationElement
+ {
+ [ConfigurationProperty("appCodeFileExtensions")]
+ internal AppCodeFileExtensionsElement AppCodeFileExtensions
+ {
+ get
+ {
+ //here we need to check if this element is defined, if it is not then we'll setup the defaults
+ var prop = Properties["appCodeFileExtensions"];
+ var autoFill = this[prop] as ConfigurationElement;
+ if (autoFill != null && autoFill.ElementInformation.IsPresent == false)
+ {
+ var collection = new AppCodeFileExtensionsCollection
+ {
+ new FileExtensionElement {RawValue = "cs"},
+ new FileExtensionElement {RawValue = "vb"}
+ };
+ var element = new AppCodeFileExtensionsElement
+ {
+ AppCodeFileExtensionsCollection = collection
+ };
+
+ return element;
+ }
+
+ return (AppCodeFileExtensionsElement)base["appCodeFileExtensions"];
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs
index 545ee70622..cab30596b2 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs
@@ -1,31 +1,31 @@
-using System.Collections.Generic;
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class DisabledLogTypesCollection : ConfigurationElementCollection, IEnumerable
- {
- protected override ConfigurationElement CreateNewElement()
- {
- return new LogTypeElement();
- }
-
- protected override object GetElementKey(ConfigurationElement element)
- {
- return ((LogTypeElement)element).Value;
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- for (var i = 0; i < Count; i++)
- {
- yield return BaseGet(i) as LogTypeElement;
- }
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
+using System.Collections.Generic;
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class DisabledLogTypesCollection : ConfigurationElementCollection, IEnumerable
+ {
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new LogTypeElement();
+ }
+
+ protected override object GetElementKey(ConfigurationElement element)
+ {
+ return ((LogTypeElement)element).Value;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ for (var i = 0; i < Count; i++)
+ {
+ yield return BaseGet(i) as LogTypeElement;
+ }
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs
index 2295ffdc94..8889736b9b 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs
@@ -1,26 +1,26 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class DistributedCallElement : ConfigurationElement
- {
- [ConfigurationProperty("enable")]
- public bool Enabled
- {
- get { return (bool)base["enable"]; }
- }
-
- [ConfigurationProperty("user")]
- internal InnerTextConfigurationElement UserId
- {
- get { return (InnerTextConfigurationElement)this["user"]; }
- }
-
- [ConfigurationCollection(typeof(ServerCollection), AddItemName = "server")]
- [ConfigurationProperty("servers", IsDefaultCollection = true)]
- public ServerCollection Servers
- {
- get { return (ServerCollection)base["servers"]; }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class DistributedCallElement : ConfigurationElement
+ {
+ [ConfigurationProperty("enable")]
+ public bool Enabled
+ {
+ get { return (bool)base["enable"]; }
+ }
+
+ [ConfigurationProperty("user")]
+ internal InnerTextConfigurationElement UserId
+ {
+ get { return (InnerTextConfigurationElement)this["user"]; }
+ }
+
+ [ConfigurationCollection(typeof(ServerCollection), AddItemName = "server")]
+ [ConfigurationProperty("servers", IsDefaultCollection = true)]
+ public ServerCollection Servers
+ {
+ get { return (ServerCollection)base["servers"]; }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs
index 231941b49f..8d8d7b3f0d 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs
@@ -1,25 +1,25 @@
-using System.Configuration;
-
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class ExternalLoggerElement : ConfigurationElement
- {
- [ConfigurationProperty("assembly")]
- internal string Assembly
- {
- get { return (string)base["assembly"]; }
- }
-
- [ConfigurationProperty("type")]
- internal string Type
- {
- get { return (string)base["type"]; }
- }
-
- [ConfigurationProperty("logAuditTrail")]
- internal bool LogAuditTrail
- {
- get { return (bool)base["logAuditTrail"]; }
- }
- }
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class ExternalLoggerElement : ConfigurationElement
+ {
+ [ConfigurationProperty("assembly")]
+ internal string Assembly
+ {
+ get { return (string)base["assembly"]; }
+ }
+
+ [ConfigurationProperty("type")]
+ internal string Type
+ {
+ get { return (string)base["type"]; }
+ }
+
+ [ConfigurationProperty("logAuditTrail")]
+ internal bool LogAuditTrail
+ {
+ get { return (bool)base["logAuditTrail"]; }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs
index 85249c3718..76b458fe5b 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs
@@ -1,7 +1,15 @@
-namespace Umbraco.Core.Configuration.UmbracoSettings
-{
- internal class FileExtensionElement : InnerTextConfigurationElement