mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Merge branch '1.9.x' into 1.9.3
This commit is contained in:
@@ -399,7 +399,8 @@ namespace Orchard.Core.Shapes {
|
||||
break;
|
||||
default:
|
||||
Debug.Assert(site.ResourceDebugMode == ResourceDebugMode.FromAppSetting, "Unknown ResourceDebugMode value.");
|
||||
debugMode = _httpContextAccessor.Value.Current().IsDebuggingEnabled;
|
||||
var context = _httpContextAccessor.Value.Current();
|
||||
debugMode = context != null && context.IsDebuggingEnabled;
|
||||
break;
|
||||
}
|
||||
var defaultSettings = new RequireSettings {
|
||||
@@ -408,7 +409,11 @@ namespace Orchard.Core.Shapes {
|
||||
Culture = _workContext.Value.CurrentCulture,
|
||||
};
|
||||
var requiredResources = _resourceManager.Value.BuildRequiredResources(resourceType);
|
||||
var appPath = _httpContextAccessor.Value.Current().Request.ApplicationPath;
|
||||
var httpContext = _httpContextAccessor.Value.Current();
|
||||
var appPath = httpContext == null || httpContext.Request == null
|
||||
? null
|
||||
: httpContext.Request.ApplicationPath;
|
||||
|
||||
foreach (var context in requiredResources.Where(r =>
|
||||
(includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) &&
|
||||
(excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) {
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace Orchard.Autoroute.Handlers {
|
||||
|
||||
OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));
|
||||
|
||||
// Remove alias if removed or unpublished
|
||||
// Remove alias if destroyed, removed or unpublished
|
||||
OnDestroyed<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||
OnRemoved<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||
OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Orchard.Packaging {
|
||||
|
||||
public void Installed(Feature feature) {
|
||||
if (feature.Descriptor.Id == "Gallery") {
|
||||
_packagingSourceManager.AddSource("Orchard Gallery", "http://packages.orchardproject.net/FeedService.svc");
|
||||
_packagingSourceManager.AddSource("Orchard Gallery", "https://gallery.orchardproject.net/api/FeedService");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,4 @@ namespace Orchard.Packaging {
|
||||
public void Uninstalled(Feature feature) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,17 +14,19 @@ namespace Orchard.Localization.Services {
|
||||
};
|
||||
|
||||
public void ParseLocalizationStream(string text, IDictionary<string, string> translations, bool merge) {
|
||||
StringReader reader = new StringReader(text);
|
||||
string poLine, id, scope;
|
||||
id = scope = String.Empty;
|
||||
var reader = new StringReader(text);
|
||||
string poLine;
|
||||
var scopes = new List<string>();
|
||||
var id = string.Empty;
|
||||
|
||||
while ((poLine = reader.ReadLine()) != null) {
|
||||
if (poLine.StartsWith("#:")) {
|
||||
scope = ParseScope(poLine);
|
||||
scopes.Add(ParseScope(poLine));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (poLine.StartsWith("msgctxt")) {
|
||||
scope = ParseContext(poLine);
|
||||
scopes.Add(ParseContext(poLine));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -34,20 +36,24 @@ namespace Orchard.Localization.Services {
|
||||
}
|
||||
|
||||
if (poLine.StartsWith("msgstr")) {
|
||||
string translation = ParseTranslation(poLine);
|
||||
var translation = ParseTranslation(poLine);
|
||||
// ignore incomplete localizations (empty msgid or msgstr)
|
||||
if (!String.IsNullOrWhiteSpace(id) && !String.IsNullOrWhiteSpace(translation)) {
|
||||
string scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||
if (!translations.ContainsKey(scopedKey)) {
|
||||
translations.Add(scopedKey, translation);
|
||||
}
|
||||
else {
|
||||
if (merge) {
|
||||
translations[scopedKey] = translation;
|
||||
if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(translation)) {
|
||||
foreach (var scope in scopes) {
|
||||
var scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||
if (!translations.ContainsKey(scopedKey)) {
|
||||
translations.Add(scopedKey, translation);
|
||||
}
|
||||
else {
|
||||
if (merge) {
|
||||
translations[scopedKey] = translation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id = scope = String.Empty;
|
||||
|
||||
id = string.Empty;
|
||||
scopes = new List<string>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Mvc.Extensions;
|
||||
|
||||
namespace Orchard.Themes
|
||||
{
|
||||
@@ -16,9 +17,12 @@ namespace Orchard.Themes
|
||||
|
||||
public Func<WorkContext, T> Get<T>(string name)
|
||||
{
|
||||
if (name == "CurrentTheme")
|
||||
{
|
||||
var currentTheme = _themeManager.GetRequestTheme(_httpContextAccessor.Current().Request.RequestContext);
|
||||
if (name == "CurrentTheme") {
|
||||
var context = _httpContextAccessor.Current();
|
||||
var currentTheme = context != null && context.Request != null
|
||||
? _themeManager.GetRequestTheme(context.Request.RequestContext)
|
||||
: null;
|
||||
|
||||
return ctx => (T)(object)currentTheme;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -204,7 +204,9 @@ namespace Orchard.UI.Resources {
|
||||
url = VirtualPathUtility.Combine(BasePath, url);
|
||||
}
|
||||
if (VirtualPathUtility.IsAppRelative(url)) {
|
||||
url = VirtualPathUtility.ToAbsolute(url, applicationPath);
|
||||
url = applicationPath != null
|
||||
? VirtualPathUtility.ToAbsolute(url, applicationPath)
|
||||
: VirtualPathUtility.ToAbsolute(url);
|
||||
}
|
||||
_urlResolveCache[settings] = url;
|
||||
return url;
|
||||
|
||||
Reference in New Issue
Block a user