diff --git a/PeachPied.WordPress.AspNet/PeachPied.WordPress.AspNet.csproj b/PeachPied.WordPress.AspNet/PeachPied.WordPress.AspNet.csproj new file mode 100644 index 000000000..0b0d00fed --- /dev/null +++ b/PeachPied.WordPress.AspNet/PeachPied.WordPress.AspNet.csproj @@ -0,0 +1,15 @@ + + + + net461 + + + + + + + + + + + diff --git a/PeachPied.WordPress.AspNet/RequestHandler.cs b/PeachPied.WordPress.AspNet/RequestHandler.cs new file mode 100644 index 000000000..2563a6f65 --- /dev/null +++ b/PeachPied.WordPress.AspNet/RequestHandler.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Specialized; +using System.Diagnostics; +using System.IO; +using System.Web; +using Pchp.Core; +using Pchp.Core.Utilities; +using PeachPied.WordPress.Standard; + +namespace PeachPied.WordPress.AspNet +{ + /// + /// Request handling for wordpress scripts. + /// + public class RequestHandler : Peachpie.RequestHandler.RequestHandler + { + /// + /// Creates request context for a WordPress application. + /// + protected override Context InitializeRequestContext(HttpContext context) + { + var ctx = base.InitializeRequestContext(context); + + ctx.RootPath = ctx.WorkingDirectory = + // where the nuget package resolves the contentFiles, + // this should be placed outside the bin folder tho: + Path.Combine(context.Request.PhysicalApplicationPath, "bin/wordpress"); + + ApplySettings(ctx, context.GetSection("wordpress") as NameValueCollection); + + return ctx; + } + + void ApplySettings(Context ctx, NameValueCollection configuration) + { + WpStandard.WP_DEBUG = Debugger.IsAttached; + + var table_prefix = "wp_"; + + if (configuration != null) + { + for (int i = 0; i < configuration.Count; i++) + { + var key = configuration.GetKey(i); + var value = configuration.Get(i); + + switch (key.ToUpperInvariant()) + { + case "TABLE_PREFIX": table_prefix = value; break; + case "DB_HOST": WpStandard.DB_HOST = value; break; + case "DB_NAME": WpStandard.DB_NAME = value; break; + case "DB_USER": WpStandard.DB_USER = value; break; + case "DB_PASSWORD": WpStandard.DB_PASSWORD = value; break; + case "WP_DEBUG": WpStandard.WP_DEBUG = bool.Parse(value); break; + //case "DISABLE_WP_CRON": WpStandard.DISABLE_WP_CRON = bool.Parse(value); break; + // TODO: WP_CONTENT_DIR: resolve absolute path relatively to app root + default: + ctx.DefineConstant(key, value); + break; + } + } + } + + // required global variables: + ctx.Globals["table_prefix"] = table_prefix; + } + } +} diff --git a/app-aspnet/Properties/AssemblyInfo.cs b/app-aspnet/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..341371ea9 --- /dev/null +++ b/app-aspnet/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("app_aspnet")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("app_aspnet")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("87ea2cb3-1513-4a5d-b223-895dc26be8f1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/app-aspnet/Web.Debug.config b/app-aspnet/Web.Debug.config new file mode 100644 index 000000000..fae9cfefa --- /dev/null +++ b/app-aspnet/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app-aspnet/Web.Release.config b/app-aspnet/Web.Release.config new file mode 100644 index 000000000..da6e960b8 --- /dev/null +++ b/app-aspnet/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app-aspnet/Web.config b/app-aspnet/Web.config new file mode 100644 index 000000000..817ec62d1 --- /dev/null +++ b/app-aspnet/Web.config @@ -0,0 +1,176 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app-aspnet/WebForm1.aspx b/app-aspnet/WebForm1.aspx new file mode 100644 index 000000000..979910906 --- /dev/null +++ b/app-aspnet/WebForm1.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="app_aspnet.WebForm1" %> + + + + + + + + +
+
+
+
+ + diff --git a/app-aspnet/WebForm1.aspx.cs b/app-aspnet/WebForm1.aspx.cs new file mode 100644 index 000000000..52b1aa304 --- /dev/null +++ b/app-aspnet/WebForm1.aspx.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace app_aspnet +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/app-aspnet/WebForm1.aspx.designer.cs b/app-aspnet/WebForm1.aspx.designer.cs new file mode 100644 index 000000000..8cf042c3f --- /dev/null +++ b/app-aspnet/WebForm1.aspx.designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace app_aspnet +{ + + + public partial class WebForm1 + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/app-aspnet/app-aspnet.csproj b/app-aspnet/app-aspnet.csproj new file mode 100644 index 000000000..6201b9cc6 --- /dev/null +++ b/app-aspnet/app-aspnet.csproj @@ -0,0 +1,149 @@ + + + + + + + Debug + AnyCPU + + + 2.0 + {87EA2CB3-1513-4A5D-B223-895DC26BE8F1} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + app_aspnet + app-aspnet + v4.6.1 + true + + + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + ..\packages\Mono.Posix.NETStandard.1.0.0\lib\net40\Mono.Posix.NETStandard.dll + + + + + + + + + + + + + + + WebForm1.aspx + ASPXCodeBehind + + + WebForm1.aspx + + + + + + Web.config + + + Web.config + + + + + {9cc88fce-17c1-474c-b669-a660b334f98b} + PeachPied.WordPress.AspNet + + + {297e2b76-ab54-4de5-afaa-17bdd9d6f1db} + PeachPied.WordPress.Standard + + + {0e51d101-0992-4aa6-a134-26ea3f2e3934} + PeachPied.WordPress + + + + + + + + + 1.0.0-dev + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 52312 + / + http://localhost:52312/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + \ No newline at end of file diff --git a/app-aspnet/packages.config b/app-aspnet/packages.config new file mode 100644 index 000000000..cc862a6e0 --- /dev/null +++ b/app-aspnet/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file