mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -104,6 +104,10 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
// Can be moved somewhere else once we have IoC enabled body text filters.
|
||||
private static string BbcodeReplace(string bodyText) {
|
||||
|
||||
if ( string.IsNullOrEmpty(bodyText) )
|
||||
return string.Empty;
|
||||
|
||||
Regex urlRegex = new Regex(@"\[url\]([^\]]+)\[\/url\]");
|
||||
Regex urlRegexWithLink = new Regex(@"\[url=([^\]]+)\]([^\]]+)\[\/url\]");
|
||||
Regex imgRegex = new Regex(@"\[img\]([^\]]+)\[\/img\]");
|
||||
|
38
src/Orchard/Mvc/ViewEngines/ThemeViewLocationCache.cs
Normal file
38
src/Orchard/Mvc/ViewEngines/ThemeViewLocationCache.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Caching;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
|
||||
namespace Orchard.Mvc.ViewEngines {
|
||||
public class ThemeViewLocationCache : IViewLocationCache {
|
||||
private readonly string _requestTheme;
|
||||
|
||||
public ThemeViewLocationCache(string requestTheme) {
|
||||
_requestTheme = requestTheme;
|
||||
}
|
||||
|
||||
private string AlterKey(string key) {
|
||||
return key + ":" + _requestTheme;
|
||||
}
|
||||
|
||||
public string GetViewLocation(HttpContextBase httpContext, string key) {
|
||||
if (httpContext == null) {
|
||||
throw new ArgumentNullException("httpContext");
|
||||
}
|
||||
|
||||
return (string)httpContext.Cache[AlterKey(key)];
|
||||
}
|
||||
|
||||
public void InsertViewLocation(HttpContextBase httpContext, string key, string virtualPath) {
|
||||
if (httpContext == null) {
|
||||
throw new ArgumentNullException("httpContext");
|
||||
}
|
||||
|
||||
httpContext.Cache.Insert(AlterKey(key), virtualPath, new CacheDependency(HostingEnvironment.MapPath("~/Themes")));
|
||||
}
|
||||
}
|
||||
}
|
@@ -31,6 +31,8 @@ namespace Orchard.Mvc.ViewEngines {
|
||||
AreaPartialViewLocationFormats = DisabledFormats,
|
||||
};
|
||||
|
||||
viewEngine.ViewLocationCache = new ThemeViewLocationCache(parameters.VirtualPath);
|
||||
|
||||
// enable /Views/{partialName}
|
||||
// enable /Views/"DisplayTemplates/"+{templateName}
|
||||
// enable /Views/"EditorTemplates/+{templateName}
|
||||
|
@@ -235,6 +235,7 @@
|
||||
<Compile Include="Mvc\Routes\UrlPrefix.cs" />
|
||||
<Compile Include="Mvc\Routes\UrlPrefixAdjustedHttpContext.cs" />
|
||||
<Compile Include="Mvc\Routes\ShellRoute.cs" />
|
||||
<Compile Include="Mvc\ViewEngines\ThemeViewLocationCache.cs" />
|
||||
<Compile Include="Mvc\ViewModels\AdaptedViewModel.cs" />
|
||||
<Compile Include="Mvc\ViewUserControl.cs">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
Reference in New Issue
Block a user