update and cleanup, added response compression
This commit is contained in:
Родитель
87ea335bbb
Коммит
41eb0863c2
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Composition;
|
||||||
|
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
||||||
|
using Pchp.Core;
|
||||||
|
using PeachPied.WordPress.Sdk;
|
||||||
|
|
||||||
|
namespace PeachPied.Demo.Plugins
|
||||||
|
{
|
||||||
|
[Export(typeof(IWpPluginProvider))]
|
||||||
|
class Provider : IWpPluginProvider
|
||||||
|
{
|
||||||
|
public IEnumerable<IWpPlugin> GetPlugins(IServiceProvider provider)
|
||||||
|
{
|
||||||
|
// provide plugins that will be loaded into wpdotnet:
|
||||||
|
|
||||||
|
yield return new DashboardPlugin();
|
||||||
|
yield return new ShortcodePlugin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ using PeachPied.WordPress.Sdk;
|
||||||
|
|
||||||
namespace PeachPied.Demo.Plugins
|
namespace PeachPied.Demo.Plugins
|
||||||
{
|
{
|
||||||
public class ShortcodePlugin : IWpPlugin
|
class ShortcodePlugin : IWpPlugin
|
||||||
{
|
{
|
||||||
public ShortcodePlugin()
|
public ShortcodePlugin()
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace PeachPied.Demo
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
services.AddResponseCompression();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IConfiguration configuration)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IConfiguration configuration)
|
||||||
|
@ -40,10 +41,8 @@ namespace PeachPied.Demo
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseWordPress(plugins: new WpPluginContainer()
|
app.UseResponseCompression();
|
||||||
.Add<DashboardPlugin>()
|
app.UseWordPress();
|
||||||
.Add<ShortcodePlugin>());
|
|
||||||
|
|
||||||
app.UseDefaultFiles();
|
app.UseDefaultFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче