jakubmisek on master
Set PHP version to 8.0.0 Set "… (compare)
jakubmisek on master
sqlsrv: quote functionality fi… (compare)
@_LORDofDOOM__twitter regarding the bugs with Elementor - that's totally possible, lots of things have changed in PeachPie since we last tested it and who knows what changed in Elementor itself. I definitely didn't get an exception back when I tried about missing classes, so they might have added something. It would be really great if you could submit these exceptions in issues with some detailed info (stack trace, how to reproduce or something like that) and we'll take a look at them. The adding an image definitely sounds like a bug on our side.
Regarding the first part of your question, I'll leave that up to @jakubmisek .
app.Map(new PathString("/content"), wp =>
{
wp.UseWordPress(path: "wordpress");
});
To disallow the anonyous access on wordpress content, there is something in the asp.net core config (I don't remember the configuration option for that)
For overriding wordpress authentication you may need to write a WordPress plugin that overrides the wp-login and authenticates a wp user using aspnet core identity instead of querying wp database.
@amilcar34706591_twitter is wanting to do exactly what I'm doing or close to what I'm doing - make the content management of pages available via wordpress so developers aren't spending their time updating pages, text, images, etc. I'm in an office of marketing folks myself and there's a lot of day-to-day changes required on many of our webpages - change this date, swap picture, etc. There's enough of it that it can be very distracting and a waste of developer resources.
I think the first thing you should do is get your app updated to at least 2.1 if not 2.2. Then look at the github projects available where wordpress is already set up in an asp.net core solution. Then look at porting it over to your own app - that's what I did anyway. I'm not done yet as I'd really like these pages edited from wordpress yet viewable seamlessly within my asp.net app - ie. pages shown with existing _Layout menus and other elements surrounding the wordpress pages, requiring authentication via identity before they can view those pages, show wordpress pages within razor views as a more seamless alternative to an iframe, etc.
For my own question, I'm wondering how to pull in a WordPress page into a razor page? I found this article (https://www.peachpie.io/2018/07/render-php-file-in-razor-view.html) explaining how to load a php script into a razor view but I'm not sure how that translates into pulling a complete WordPress page into a razor page? Wordpress tends to use pretty links vs. a viewcontent.php?Page=1 or something similar that might work in this context. But I'm not a WordPress expert so maybe there's already a wordpress 'script' way of loading a page that would work with @Html.Php?
TIA!
I deleted my ramblings before and am summarizing my solution here. Btw do you have any sort of documentation wiki or discussion forum or something where you can centralize all questions and solutions?
I used jquery's .load to pull in a page based on its relative path and adding the id of the div I wanted to include (I used #content).
To protect wordpress so only an authenticated user could see the content or log in as admin, I used the below:
app.MapWhen(context => context.User.Identity.IsAuthenticated && context.Request.Path.Value.StartsWith("/content"), wp =>
{
wp.Map(new PathString("/content"), wpMapper =>
{
wpMapper.UseWordPress();
});
});
@medvedy nice! The issue is you have to make <PackageReference>
from wordpress to your C# plugin project (that's why PHP code does not see the C# class)
Also you may take a look on a complete sample e.g. at https://github.com/iolevel/peachpie-wordpress/blob/master/app/Plugins/ShortcodePlugin.cs
@medvedy actually the C# plugin is always enabled (it is so called must-use plugin).
In order to "see" it in Dashboard / Plugins, you'd need to make a little hack - You have to create a dummy WordPress plugin; e.g. a PHP file "shortcodesomething.php
" with standard WordPress commentery at the beigning of the file, and place it into wp-content/plugins
folder. ... (still the C# plugin would be always enabled; so you would have to check in the C# code through WordPress API, that shortcodesomething
has been enabled :)
@dataProvider
is found 270 times in the unit tests of laravel, so all those tests fail as well@jakubmisek I’m getting this error now: PHPUnit\Framework\WrappedException: System.ArgumentException: Enum underlying type and the object must be same type or object must be a String. Type passed in was 'System.Int64'; the enum underlying type was 'System.Int32'.
1961 at System.RuntimeType.IsEnumDefined(Object value)
1962 at System.Enum.IsDefined(Type enumType, Object value)
1963 at Peachpie.Library.PDO.PDO.setAttribute(Int32 attribute, PhpValue value)
1964 at Doctrine.DBAL.Driver.PDOConnection.__construct(PhpValue dsn, PhpValue user, PhpValue password, PhpValue options) in /home/travis/build/calvinbaart/laravel-peachpie-sample/Laravel/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:line 29
The only setAttribute the constructor does is for the statement class and the errmode. I’m guessing the errmode causes this exception
@calvinbaart commit peachpiecompiler/peachpie@874376a fixes variables not being passed by reference. So few more tests should pass now.
Also I see there is a lot of syntax errors in SQL queries?
Then some exceptions when reflecting closure's parameter I guess?
Feel free to post new issues :) we are getting closer to 1.0 release and it would be cool to have laravel at least partially working