-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DO NOT MERGE | new calendar endpoints #831
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, I'm still a bit brain dead from being off for 2 weeks and trying to get back in the flow of things. I think the |
Preview changes with PlaygroundYou can preview the least recent changes for PR#831 by following one of the links below: |
Hello @mauteri , I've updated the PR description with more relevant info and fixed the simple errors. The remaining CS failures and Unit test failures are kind of intentional, to remind us what needs attention. I will now not be able to add some helping review comments, but open it up for Reviews anyway. |
I'm going to start adding some review-comments for you now @mauteri. Would be cool, if you find the time (or someone else) to go trough all of this me...melange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mauteri I added 16 comments to help navigate to the most problematic parts.
includes/core/classes/endpoints/class-posttype-feed-endpoint.php
Outdated
Show resolved
Hide resolved
includes/core/classes/endpoints/class-posttype-single-endpoint.php
Outdated
Show resolved
Hide resolved
Does this provide a general event feed, listing all events fit the site in iCal e.g. example.org/events/feed/ical/ ? And does this also support taxonomies ? e.g. example.org/events/feed/ical/topic/parents: Pete |
Original PR description
As a proof-of-concept PR, this code needs for sure some orchestration!
The used anonymous functions are my preferred way of experimenting, but not meant to stay.
I can see 3 different ways to go on:
class-add-to-calendar.php
class-rewrite-api.php
that handles all the rewrites stuff and is only used by the currentclass-event.php
class-endpoints.php
, that could also be the future home for Add subscribeable Ical feeds #603Following path number 2 could be interesting for the future, as it could be reused, if GatherPress would want to create
/tickets
or/qr
endpoints on events, for example. Long time ago created a similar abstraction to route AJAX requests, because it was (maybe still is) usually around 10 times faster than the REST API.———
I’ve also tried using
add_rewrite_endpoint()
in the first run, but this would have added the new endpoints to allEP_PERMALINK
rewrites, which would have meant: all non-hierarchical post types. In that case, I would have had to set custom 404s on all non-event post types, which ended up being very tedious and a lot of additional code. That’s why I went withadd_rewrite_rule()
which allows a restriction on one post type.Description of the Change
This PR add several new URL endpoints to events, one per each add-to-calendar link. The new endpoints are:
example.org/event/my-sample-event/
ical
example.org/event/my-sample-event/
iCal
(Alias for/ical
)example.org/event/my-sample-event/
outlook
(Alias for/ical
)example.org/event/my-sample-event/
googlecalendar
example.org/event/my-sample-event/
yahoocalendar
With the original intention to help with #704, this PR also does some more subtle changes to the generated ics file, like changing its default line breaks.
Because this renders into a sites frontend output, this PR additionally introduces a way to overwrite the generated iCal via a theme template. This opens another way of extension and can be used to test this PR.
Can be stated as totally outdated!
Unfortunately, this PR does NOT help with #704,
but instead has grown from 193 to 2607 lines of code and now closes #603 instead.
An extensive description can be found in a new
/docs/developer/custom-url-endpoints
article, that is also part of this PR.This PR introduces the following of new endpoints:
example.org/event/my-sample-event/ical
provides a download-able .ics file in ical format.
example.org/event/my-sample-event/outlook
provides the same download-able file as an alias.
example.org/event/my-sample-event/google-calendar
redirects to create a new event in Google Calendar.
example.org/event/my-sample-event/yahoo-calendar
redirects to create a new event in Yahoo Calendar.
example.org/event/feed/ical
provides a subscribe-able event feed in ical format with all events of the site.
example.org/venue/my-sample-venue/feed/ical
provides a subscribe-able event feed in ical format with all events at that venue.
example.org/topic/my-sample-topic/feed/ical
provides a subscribe-able event feed in ical format with all events grouped into that topic.
How to test the Change
echo ‚hello themed iCal world‘;
into itChangelog Entry
Credits
Props @carstingaxion
Checklist:
/readme.md
/docs/contributor/unit-tests
/docs/developer/custom-url-endpoints
/docs/developer/theme-customizations
Related PRs that can be reviewed & merged after this:
To get the new endpoints into the block-editor, one of the following would be required:
OR