diff --git a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs
index 552c16a5ac..83d0f25543 100644
--- a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs
+++ b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs
@@ -32,14 +32,14 @@ namespace Umbraco.Core.Strings
}
const string UmbracoValidAliasCharacters = "_-abcdefghijklmnopqrstuvwxyz1234567890";
- const string UmbracoInvalidFirstCharacters = "01234567890";
+ const string UmbracoInvalidFirstCharacters = "0123456789";
#endregion
#region Short string services JavaScript
const string SssjsValidCharacters = "_-abcdefghijklmnopqrstuvwxyz1234567890";
- const string SssjsInvalidFirstCharacters = "01234567890";
+ const string SssjsInvalidFirstCharacters = "0123456789";
private const string SssjsFormat = @"
var UMBRACO_FORCE_SAFE_ALIAS = {0};
diff --git a/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs b/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs
index 29d6ba6ee4..fe65aa25e4 100644
--- a/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs
+++ b/src/Umbraco.Web/umbraco.presentation/UmbracoContext.cs
@@ -68,65 +68,27 @@ namespace umbraco.presentation
///
/// Gets the current page ID, or null if no page ID is available (e.g. a custom page).
///
- public virtual int? PageId
- {
- get
- {
- try
- {
- return int.Parse(_httpContext.Items["pageID"].ToString());
- }
- catch
- {
- return null;
- }
- }
- }
+ public virtual int? PageId { get { return Umbraco.Web.UmbracoContext.Current.PageId; } }
///
/// Gets the current logged in Umbraco user (editor).
///
/// The Umbraco user object or null
- public virtual User UmbracoUser
- {
- get
- {
- return BasePages.UmbracoEnsuredPage.CurrentUser;
- }
-
- }
+ public virtual User UmbracoUser { get { return Umbraco.Web.UmbracoContext.Current.UmbracoUser; } }
///
/// Determines whether the current user is in a preview mode and browsing the site (ie. not in the admin UI)
///
- public virtual bool InPreviewMode
- {
- get
- {
- string currentUrl = Request.Url.AbsolutePath;
- // zb-00004 #29956 : refactor cookies names & handling
- return
- StateHelper.Cookies.Preview.HasValue // has preview cookie
- && UmbracoUser != null // has user
- && !currentUrl.StartsWith(IO.IOHelper.ResolveUrl(IO.SystemDirectories.Umbraco)); // is not in admin UI
- }
- }
+ public virtual bool InPreviewMode { get { return Umbraco.Web.UmbracoContext.Current.InPreviewMode; } }
public XmlDocument GetXml()
{
- if (InPreviewMode)
- {
- if (_previewContent == null)
- {
- _previewContent = new PreviewContent(UmbracoUser, new Guid(StateHelper.Cookies.Preview.GetValue()), true);
- if (_previewContent.ValidPreviewSet)
- _previewContent.LoadPreviewset();
- }
- if (_previewContent.ValidPreviewSet)
- return _previewContent.XmlContent;
- }
- return content.Instance.XmlContent;
+ var umbracoContext = Umbraco.Web.UmbracoContext.Current;
+ var cache = umbracoContext.ContentCache.InnerCache as Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedContentCache;
+ if (cache == null)
+ throw new InvalidOperationException("ContentCache is not XmlPublishedCache.PublishedContentCache.");
+ return cache.GetXml(umbracoContext);
}
///
diff --git a/src/umbraco.cms/helpers/Casing.cs b/src/umbraco.cms/helpers/Casing.cs
index 4e06d1d7ab..1cf6eaf698 100644
--- a/src/umbraco.cms/helpers/Casing.cs
+++ b/src/umbraco.cms/helpers/Casing.cs
@@ -15,7 +15,7 @@ namespace umbraco.cms.helpers
public const string VALID_ALIAS_CHARACTERS = "_-abcdefghijklmnopqrstuvwxyz1234567890";
[Obsolete("Use Umbraco.Core.StringExtensions.UmbracoInvalidFirstCharacters instead")]
- public const string INVALID_FIRST_CHARACTERS = "01234567890";
+ public const string INVALID_FIRST_CHARACTERS = "0123456789";
///
/// A helper method to ensure that an Alias string doesn't contains any illegal characters