mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Renaming IHtmlFilterRunner to IHtmlFilterProcessor (and its references)
This commit is contained in:
@@ -13,13 +13,13 @@ using Orchard.ContentManagement.Handlers;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
public class BodyPartDriver : ContentPartDriver<BodyPart> {
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
private readonly RequestContext _requestContext;
|
||||
|
||||
private const string TemplateName = "Parts.Common.Body";
|
||||
|
||||
public BodyPartDriver(IOrchardServices services, IHtmlFilterRunner htmlFilterRunner, RequestContext requestContext) {
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
public BodyPartDriver(IOrchardServices services, IHtmlFilterProcessor htmlFilterProcessor, RequestContext requestContext) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
Services = services;
|
||||
_requestContext = requestContext;
|
||||
}
|
||||
@@ -34,12 +34,12 @@ namespace Orchard.Core.Common.Drivers {
|
||||
return Combined(
|
||||
ContentShape("Parts_Common_Body",
|
||||
() => {
|
||||
var bodyText = _htmlFilterRunner.RunFilters(part.Text, GetFlavor(part), part);
|
||||
var bodyText = _htmlFilterProcessor.ProcessFilters(part.Text, GetFlavor(part), part);
|
||||
return shapeHelper.Parts_Common_Body(Html: new HtmlString(bodyText));
|
||||
}),
|
||||
ContentShape("Parts_Common_Body_Summary",
|
||||
() => {
|
||||
var bodyText = _htmlFilterRunner.RunFilters(part.Text, GetFlavor(part), part);
|
||||
var bodyText = _htmlFilterProcessor.ProcessFilters(part.Text, GetFlavor(part), part);
|
||||
return shapeHelper.Parts_Common_Body_Summary(Html: new HtmlString(bodyText));
|
||||
})
|
||||
);
|
||||
|
||||
@@ -13,10 +13,10 @@ using Orchard.Services;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
public class TextFieldDriver : ContentFieldDriver<TextField> {
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public TextFieldDriver(IOrchardServices services, IHtmlFilterRunner htmlFilterRunner) {
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
public TextFieldDriver(IOrchardServices services, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
return ContentShape("Fields_Common_Text", GetDifferentiator(field, part),
|
||||
() => {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>();
|
||||
var fieldValue = new HtmlString(_htmlFilterRunner.RunFilters(field.Value, settings.Flavor, part));
|
||||
var fieldValue = new HtmlString(_htmlFilterProcessor.ProcessFilters(field.Value, settings.Flavor, part));
|
||||
return shapeHelper.Fields_Common_Text(Name: field.Name, Value: fieldValue);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,15 +13,15 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
public class CorePartsFeedItemBuilder : IFeedItemBuilder {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly RouteCollection _routes;
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public CorePartsFeedItemBuilder(
|
||||
IContentManager contentManager,
|
||||
RouteCollection routes,
|
||||
IHtmlFilterRunner htmlFilterRunner) {
|
||||
IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_contentManager = contentManager;
|
||||
_routes = routes;
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
public void Populate(FeedContext context) {
|
||||
@@ -30,7 +30,7 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
var inspector = new ItemInspector(
|
||||
feedItem.Item,
|
||||
_contentManager.GetItemMetadata(feedItem.Item),
|
||||
_htmlFilterRunner);
|
||||
_htmlFilterProcessor);
|
||||
|
||||
// author is intentionally left empty as it could result in unwanted spam
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
public class ItemInspector {
|
||||
private readonly IContent _item;
|
||||
private readonly ContentItemMetadata _metadata;
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
private readonly ICommonPart _common;
|
||||
private readonly ITitleAspect _titleAspect;
|
||||
private readonly BodyPart _body;
|
||||
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata) : this(item, metadata, null) {}
|
||||
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata, IHtmlFilterRunner htmlFilterRunner) {
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_item = item;
|
||||
_metadata = metadata;
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
_common = item.Get<ICommonPart>();
|
||||
_titleAspect = item.Get<ITitleAspect>();
|
||||
_body = item.Get<BodyPart>();
|
||||
@@ -49,8 +49,8 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
|
||||
public string Description {
|
||||
get {
|
||||
if (_htmlFilterRunner != null && _body != null && !string.IsNullOrEmpty(_body.Text)) {
|
||||
return _htmlFilterRunner.RunFilters(_body.Text, GetFlavor(_body), _body);
|
||||
if (_htmlFilterProcessor != null && _body != null && !string.IsNullOrEmpty(_body.Text)) {
|
||||
return _htmlFilterProcessor.ProcessFilters(_body.Text, GetFlavor(_body), _body);
|
||||
}
|
||||
return Title;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace Orchard.Core.Feeds.StandardQueries
|
||||
{
|
||||
public class ContainerFeedQuery : IFeedQueryProvider, IFeedQuery {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public ContainerFeedQuery(IContentManager contentManager, IHtmlFilterRunner htmlFilterRunner) {
|
||||
public ContainerFeedQuery(IContentManager contentManager, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_contentManager = contentManager;
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
public FeedQueryMatch Match(FeedContext context) {
|
||||
@@ -54,7 +54,7 @@ namespace Orchard.Core.Feeds.StandardQueries
|
||||
return;
|
||||
}
|
||||
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilterRunner);
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilterProcessor);
|
||||
if (context.Format == "rss") {
|
||||
var link = new XElement("link");
|
||||
context.Response.Element.SetElementValue("title", inspector.Title);
|
||||
|
||||
@@ -7,10 +7,10 @@ using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
public class HeadingElementDriver : ElementDriver<Heading> {
|
||||
private readonly IHtmlFilterRunner _runner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public HeadingElementDriver(IHtmlFilterRunner runner) {
|
||||
_runner = runner;
|
||||
public HeadingElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Heading element, ElementEditorContext context) {
|
||||
@@ -30,7 +30,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Heading element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _runner.RunFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
context.ElementShape.Level = element.Level;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ using Orchard.Services;
|
||||
namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
public class HtmlElementDriver : ElementDriver<Html> {
|
||||
private readonly IHtmlFilterRunner _runner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public HtmlElementDriver(IHtmlFilterRunner runner) {
|
||||
_runner = runner;
|
||||
public HtmlElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Html element, ElementEditorContext context) {
|
||||
@@ -29,7 +29,7 @@ namespace Orchard.Layouts.Drivers
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Html element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _runner.RunFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
[OrchardFeature("Orchard.Layouts.Markdown")]
|
||||
public class MarkdownElementDriver : ElementDriver<MarkdownElement> {
|
||||
private readonly IHtmlFilterRunner _runner;
|
||||
public MarkdownElementDriver(IHtmlFilterRunner runner) {
|
||||
_runner = runner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
public MarkdownElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(MarkdownElement element, ElementEditorContext context) {
|
||||
@@ -30,7 +30,7 @@ namespace Orchard.Layouts.Drivers
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(MarkdownElement element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _runner.RunFilters(element.Content, new HtmlFilterContext { Flavor = "markdown", Data = context.GetTokenData() });
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "markdown", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
public class ParagraphElementDriver : ElementDriver<Paragraph> {
|
||||
private readonly IHtmlFilterRunner _runner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public ParagraphElementDriver(IHtmlFilterRunner runner) {
|
||||
_runner = runner;
|
||||
public ParagraphElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Paragraph element, ElementEditorContext context) {
|
||||
@@ -28,7 +28,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Paragraph element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _runner.RunFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ using Orchard.Services;
|
||||
namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
public class TextElementDriver : ElementDriver<Text> {
|
||||
private readonly IHtmlFilterRunner _runner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public TextElementDriver(IHtmlFilterRunner runner) {
|
||||
_runner = runner;
|
||||
public TextElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Text element, ElementEditorContext context) {
|
||||
@@ -29,7 +29,7 @@ namespace Orchard.Layouts.Drivers
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Text element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _runner.RunFilters(element.Content, new HtmlFilterContext { Flavor = "textarea", Data = context.GetTokenData() });
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "textarea", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,16 +16,16 @@ namespace Orchard.Projections.StandardQueries
|
||||
public class QueryFeedQuery : IFeedQueryProvider, IFeedQuery {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IProjectionManager _projectionManager;
|
||||
private readonly IHtmlFilterRunner _htmlFilterRunner;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public QueryFeedQuery(
|
||||
IContentManager contentManager,
|
||||
IProjectionManager projectionManager,
|
||||
IHtmlFilterRunner htmlFilterRunner)
|
||||
IHtmlFilterProcessor htmlFilterProcessor)
|
||||
{
|
||||
_contentManager = contentManager;
|
||||
_projectionManager = projectionManager;
|
||||
_htmlFilterRunner = htmlFilterRunner;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
public FeedQueryMatch Match(FeedContext context) {
|
||||
@@ -54,7 +54,7 @@ namespace Orchard.Projections.StandardQueries
|
||||
return;
|
||||
}
|
||||
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilterRunner);
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilterProcessor);
|
||||
if (context.Format == "rss") {
|
||||
var link = new XElement("link");
|
||||
context.Response.Element.SetElementValue("title", inspector.Title);
|
||||
|
||||
@@ -423,10 +423,10 @@
|
||||
<Compile Include="Services\ClientHostAddressAccessor.cs" />
|
||||
<Compile Include="Services\DefaultJsonConverter.cs" />
|
||||
<Compile Include="Services\HtmlFilterContext.cs" />
|
||||
<Compile Include="Services\HtmlFilterRunner.cs" />
|
||||
<Compile Include="Services\HtmlFilterProcessor.cs" />
|
||||
<Compile Include="Services\IClientHostAddressAccessor.cs" />
|
||||
<Compile Include="Services\HtmlFilter.cs" />
|
||||
<Compile Include="Services\IHtmlFilterRunner.cs" />
|
||||
<Compile Include="Services\IHtmlFilterProcessor.cs" />
|
||||
<Compile Include="Services\IJsonConverter.cs" />
|
||||
<Compile Include="Settings\CurrentSiteWorkContext.cs" />
|
||||
<Compile Include="Settings\ResourceDebugMode.cs" />
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Services {
|
||||
public class HtmlFilterRunner : IHtmlFilterRunner {
|
||||
public class HtmlFilterProcessor : IHtmlFilterProcessor {
|
||||
private readonly IEnumerable<IHtmlFilter> _filters;
|
||||
public HtmlFilterRunner(IEnumerable<IHtmlFilter> filters) {
|
||||
public HtmlFilterProcessor(IEnumerable<IHtmlFilter> filters) {
|
||||
_filters = filters;
|
||||
}
|
||||
|
||||
public string RunFilters(string text, HtmlFilterContext context) {
|
||||
public string ProcessFilters(string text, HtmlFilterContext context) {
|
||||
return _filters.Aggregate(text, (current, htmlFilter) => htmlFilter.ProcessContent(current, context));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Services {
|
||||
public interface IHtmlFilterProcessor : IDependency {
|
||||
string ProcessFilters(string text, HtmlFilterContext context);
|
||||
}
|
||||
|
||||
public static class HtmlFilterProcessorExtensions {
|
||||
public static string ProcessFilters(this IHtmlFilterProcessor processor, string text, string flavor, IDictionary<string, object> data) {
|
||||
return processor.ProcessFilters(text, new HtmlFilterContext { Flavor = flavor, Data = data });
|
||||
}
|
||||
|
||||
public static string ProcessFilters(this IHtmlFilterProcessor processor, string text, string flavor) {
|
||||
return processor.ProcessFilters(text, new HtmlFilterContext { Flavor = flavor });
|
||||
}
|
||||
|
||||
public static string ProcessFilters(this IHtmlFilterProcessor processor, string text, string flavor, IContent content) {
|
||||
return processor.ProcessFilters(text, new HtmlFilterContext { Flavor = flavor, Data = new Dictionary<string, object> { { "Content", content.ContentItem } } });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Services {
|
||||
public interface IHtmlFilterRunner : IDependency {
|
||||
string RunFilters(string text, HtmlFilterContext context);
|
||||
}
|
||||
|
||||
public static class HtmlFilterProcessorExtensions {
|
||||
public static string RunFilters(this IHtmlFilterRunner runner, string text, string flavor, IDictionary<string, object> data) {
|
||||
return runner.RunFilters(text, new HtmlFilterContext { Flavor = flavor, Data = data });
|
||||
}
|
||||
|
||||
public static string RunFilters(this IHtmlFilterRunner runner, string text, string flavor) {
|
||||
return runner.RunFilters(text, new HtmlFilterContext { Flavor = flavor });
|
||||
}
|
||||
|
||||
public static string RunFilters(this IHtmlFilterRunner runner, string text, string flavor, IContent content) {
|
||||
return runner.RunFilters(text, new HtmlFilterContext { Flavor = flavor, Data = new Dictionary<string, object> { { "Content", content.ContentItem } } });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user