Compare commits
15 commits
main
...
custom_sum
Author | SHA1 | Date | |
---|---|---|---|
e7d686071f | |||
f4985b2ab2 | |||
dcea23a27d | |||
c8d766e2a7 | |||
b65efe3845 | |||
164140cd60 | |||
4140d36a1d | |||
6499d32d0e | |||
dddfa70f1f | |||
f50ee7441b | |||
1b3e772d00 | |||
9fa705576f | |||
dc24f292be | |||
b7b36d355e | |||
02a3eb7cef |
33 changed files with 589 additions and 332 deletions
|
@ -4,6 +4,7 @@
|
|||
.wordpress-org
|
||||
.wp-env.json
|
||||
bin
|
||||
CHANGELOG.md
|
||||
CODE_OF_CONDUCT.md
|
||||
composer.json
|
||||
composer.lock
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
name: Plugin asset/readme update on WordPress.org
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
trunk:
|
||||
name: Push assets to trunk on WordPress.org
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Install and cache rsync
|
||||
uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: rsync subversion
|
||||
version: 1.0
|
||||
|
||||
- name: WordPress.org plugin asset/readme update
|
||||
uses: https://github.com/10up/action-wordpress-plugin-asset-update@stable
|
||||
env:
|
||||
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
|
||||
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
|
||||
SLUG: event-bridge-for-activitypub
|
|
@ -1,27 +0,0 @@
|
|||
name: Deploy to WordPress.org
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
name: New tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Install and cache rsync
|
||||
uses: https://github.com/awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: rsync subversion
|
||||
version: 1.0
|
||||
|
||||
- name: WordPress Plugin Deploy
|
||||
uses: https://github.com/10up/action-wordpress-plugin-deploy@stable
|
||||
env:
|
||||
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
|
||||
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
|
||||
SLUG: event-bridge-for-activitypub
|
|
@ -115,6 +115,11 @@ jobs:
|
|||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for EventPrime
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=eventprime
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for Event Organiser
|
||||
run: cd /workspace/Event-Federation/wordpress-event-bridge-for-activitypub/ && ./vendor/bin/phpunit --filter=event_organiser
|
||||
env:
|
||||
|
|
|
@ -5,13 +5,13 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.3.5] - 2025-01-03
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
### Added
|
||||
|
||||
* Images of Acknowledgements in Admin UI
|
||||
* Add custom summary via shortcodes
|
||||
|
||||
## [0.3.4] - 2024-12-21
|
||||
## [0.3.1] - 2024-11-16
|
||||
|
||||
* Initial release on WordPress.org
|
||||
|
||||
|
|
46
README.md
46
README.md
|
@ -3,7 +3,7 @@
|
|||
**Tags:** events, fediverse, activitypub, calendar
|
||||
**Requires at least:** 6.5
|
||||
**Tested up to:** 6.7
|
||||
**Stable tag:** 0.3.5
|
||||
**Stable tag:** 0.3.1
|
||||
**Requires PHP:** 7.4
|
||||
**License:** AGPL-3.0-or-later
|
||||
**License URI:** https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
@ -21,31 +21,20 @@ This plugin is not an event managing plugin but an add-on to popular event plugi
|
|||
With the ActivityPub plugin people can follow your website directly and engage with your events just as they would on social media: liking, boosting and even commenting if you enable it.
|
||||
You retain full ownership of your content. By integrating into your existing setup, it ensures no extra work is needed while enhancing your events' visibility across the web.
|
||||
|
||||
### Supported Event Plugins
|
||||
|
||||
* [The Events Calendar](https://de.wordpress.org/plugins/the-events-calendar/)
|
||||
* [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/)
|
||||
* [Events Manager](https://de.wordpress.org/plugins/events-manager/)
|
||||
* [WP Event Manager](https://de.wordpress.org/plugins/wp-event-manager/)
|
||||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
|
||||
### How It Works ###
|
||||
|
||||
With the Event Bridge for ActivityPub WordPress plugin, sharing your events is effortless and automatic!
|
||||
Once you create an event on your WordPress site, it is seamlessly shared across the decentralized web using the ActivityPub protocol.
|
||||
|
||||
<p align="center">
|
||||
<img src="./.wordpress-org/event-activitypub-publishing.gif" alt="An animation that shows how WordPress events federate to users of different applications via ActivityPub." width="300"/>
|
||||
<img src="./.wordpress-org/event-activitypub-publishing.gif" alt="Logo" width="300"/>
|
||||
</p>
|
||||
|
||||
Your events can be automatically delivered to platforms that fully support events, such as [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/).
|
||||
These platforms create public event calendars by pulling in events from various sources, including your website. Any updates you make to your events are synced across these platforms—so you only need to manage your events on your own site, with no extra work required.
|
||||
|
||||
<p align="center">
|
||||
<img src="./.wordpress-org/decentralized-event-calenders.gif" alt="An animation that shows how a decentralized event calendar gets build via ActivityPub including an WordPress site as a source of events." width="250"/>
|
||||
<img src="./.wordpress-org/decentralized-event-calenders.gif" alt="Logo" width="250"/>
|
||||
</p>
|
||||
|
||||
Even platforms that don't yet fully support events, like [Mastodon](https://joinmastodon.org), will still receive a detailed, well-composed summary of your event.
|
||||
|
@ -55,7 +44,7 @@ The Event Federation plugin ensures that users from those platforms are provided
|
|||
|
||||
**ActivityPub-Enabled Event Sharing:** Your WordPress events are now compatible with the Fediverse, using the ActivityStreams format. This means your events can be easily discovered and followed by users on platforms like Mastodon and other ActivityPub-compatible services.
|
||||
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page. Advanced users can create custom summaries via a set of shortcodes.
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page.
|
||||
|
||||
**Improved Event Discoverability:** Your custom event categories are mapped to a set of default categories used in the Fediverse, helping your events reach a wider audience. This improves the chances that users searching for similar events on other platforms will find yours.
|
||||
|
||||
|
@ -65,6 +54,18 @@ The Event Federation plugin ensures that users from those platforms are provided
|
|||
|
||||
This plugin depends on the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/). Additionally, you need to use one of the supported event Plugins.
|
||||
|
||||
### Supported Event Plugins ###
|
||||
|
||||
* [The Events Calendar](https://de.wordpress.org/plugins/the-events-calendar/)
|
||||
* [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/)
|
||||
* [Events Manager](https://de.wordpress.org/plugins/events-manager/)
|
||||
* [WP Event Manager](https://de.wordpress.org/plugins/wp-event-manager/)
|
||||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [EventPrime – Events Calendar, Bookings and Tickets](https://wordpress.org/plugins/eventprime-event-calendar-management/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
|
||||
## Configuration ##
|
||||
|
||||
If you're new to the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/), it’s recommended to spend a few minutes reading through its documentation to familiarize yourself with its setup and functionality.
|
||||
|
@ -99,9 +100,16 @@ If you know about coding have a look at the documentation of how to add your plu
|
|||
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues).
|
||||
|
||||
## Acknowledgement
|
||||
## Changelog ##
|
||||
|
||||
### Unreleased
|
||||
|
||||
#### Added
|
||||
|
||||
* Add custom summary via shortcodes
|
||||
|
||||
### [0.3.1] 2024-12-05 ###
|
||||
|
||||
* Initial release on https://wordpress.org/
|
||||
|
||||
[<img src="./assets/img/acknowledgement-NLnet.svg" alt="NLnet foundation logo" width="20%" style="margin: 10px 5% 10px 5%;"/>](https://nlnet.nl)
|
||||
[<img src="./assets/img/acknowledgement-NGI0Entrust.svg" alt="NGI Zero Logo" width="20%" style="margin: 10px 5% 10px 5%;"/>](https://nlnet.nl/entrust)
|
||||
|
||||
The development of this WordPress plugin was funded through the [NGI0 Entrust](https://NLnet.nl/entrust) Fund, a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) programme, under the aegis of [Communications Networks, Content and Technology](https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en) under grant agreement number 101069594.
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-page .logo-center {
|
||||
width: 25%;
|
||||
margin: 10px 5% 10px 5%;
|
||||
}
|
||||
|
||||
.event-bridge-for-activitypub-settings-page .box ul.event-bridge-for-activitypub-list {
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
xml:space="preserve"
|
||||
width="1600.5095"
|
||||
height="502.77777"
|
||||
viewBox="0 0 480.15286 150.83333"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
|
||||
id="metadata8"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs6"><linearGradient
|
||||
id="linearGradient1220"><stop
|
||||
id="stop1216"
|
||||
offset="0"
|
||||
style="stop-color:#98bf00;stop-opacity:1;" /><stop
|
||||
id="stop1218"
|
||||
offset="1"
|
||||
style="stop-color:#98bf00;stop-opacity:0.51" /></linearGradient><linearGradient
|
||||
x1="0"
|
||||
y1="0"
|
||||
x2="1"
|
||||
y2="0"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(-139.45511,-135.52185,-135.52185,139.45511,177.4727,131.75308)"
|
||||
spreadMethod="pad"
|
||||
id="linearGradient28"><stop
|
||||
style="stop-opacity:1;stop-color:#00afbc"
|
||||
offset="0"
|
||||
id="stop24" /><stop
|
||||
style="stop-opacity:1;stop-color:#205374"
|
||||
offset="1"
|
||||
id="stop26" /></linearGradient><clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath38"><path
|
||||
d="M 0,127.984 H 415.474 V 0 H 0 Z"
|
||||
id="path36" /></clipPath><linearGradient
|
||||
xlink:href="#linearGradient1220"
|
||||
id="linearGradient947"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="14.915152"
|
||||
y1="14.167241"
|
||||
x2="214.11908"
|
||||
y2="111.76186"
|
||||
gradientTransform="matrix(4.4444443,0,0,-4.4444443,-33.008887,535.8)" /><clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath38-9"><path
|
||||
d="M 0,127.984 H 415.474 V 0 H 0 Z"
|
||||
id="path36-1" /></clipPath></defs><g
|
||||
id="g10"
|
||||
transform="matrix(1.3333333,0,0,-1.3333333,-9.9026662,160.74)"><g
|
||||
id="g40"
|
||||
transform="translate(175.9982,95.8645)" /><g
|
||||
id="g44"
|
||||
transform="translate(152.1193,64.9934)" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<g
|
||||
id="NGI0Entrust"><title
|
||||
id="title12661">NGI Zero Entrust</title><path
|
||||
id="path7692"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.999999"
|
||||
d="m 133.10651,96.933602 c -6.67899,0 -12.68988,-1.41201 -18.02988,-4.23501 -5.344,-2.822 -9.51678,-6.73803 -12.52178,-11.74702 -3.004994,-5.008 -4.507906,-10.66967 -4.507906,-16.982669 0,-6.314995 1.502912,-11.974991 4.507906,-16.983985 3.005,-5.008995 7.14794,-8.924024 12.42993,-11.747021 5.282,-2.823998 11.23084,-4.23501 17.84883,-4.23501 4.613,0 9.19693,0.698875 13.75093,2.094873 0.045,0.014 0.0912,0.02819 0.13623,0.04219 7.10399,2.201999 11.88413,8.859686 11.88413,16.29668 v 9.047022 c 0,3.581996 -2.90333,6.485889 -6.48633,6.485889 h -0.50581 c -0.064,0 -0.12704,-0.0077 -0.19204,-0.0097 -0.064,0.002 -0.12704,0.0097 -0.19204,0.0097 h -7.28306 c -3.92899,0 -7.35908,-2.964914 -7.61308,-6.884912 -0.278,-4.295996 3.12428,-7.86709 7.36128,-7.86709 0.776,0 1.34293,-0.753702 1.11093,-1.493702 -0.65799,-2.087998 -2.34102,-3.751009 -4.54702,-4.333008 -2.07399,-0.546999 -4.27598,-0.820898 -6.60498,-0.820898 -4.00699,0 -7.57381,0.864972 -10.6998,2.594971 -3.127,1.729999 -5.5704,4.143993 -7.3314,7.23999 -1.761,3.095997 -2.64067,6.617018 -2.64067,10.564014 0,4.005996 0.87967,7.557666 2.64067,10.653656 1.761,3.097 4.2191,5.49317 7.3771,7.19517 3.156,1.698 6.76804,2.54883 10.83604,2.54883 4.68099,0 8.8649,-1.26899 12.5499,-3.80699 2.341,-1.61199 5.52423,-1.58761 7.75723,0.17139 3.47999,2.741 3.2889,8.04495 -0.31509,10.45196 -1.7,1.13599 -3.53807,2.11163 -5.51206,2.92763 -4.553,1.881 -9.62316,2.82305 -15.20816,2.82305 z m -93.706345,-1.09248 c -4.022996,0 -7.284815,-3.26081 -7.284815,-7.28482 v -49.17612 c 0,-4.022993 3.261819,-7.284815 7.284815,-7.284815 4.023996,0 7.284814,3.261822 7.284814,7.284815 V 62.34029 c 0,2.842996 3.564362,4.118722 5.36836,1.921728 L 76.282148,34.757135 c 1.383999,-1.685 3.450155,-2.661768 5.631153,-2.661768 h 1.380761 c 4.023997,0 7.286133,3.261822 7.286133,7.284815 v 49.17612 c 0,4.02401 -3.262136,7.28482 -7.286133,7.28482 -4.023995,0 -7.284815,-3.26081 -7.284815,-7.28482 V 65.615095 c 0,-2.844997 -3.568118,-4.119773 -5.370117,-1.917774 L 46.503925,93.172322 c -1.382997,1.69 -3.45199,2.6688 -5.635987,2.6688 z m 136.597415,-4.4e-4 c -4.074,0 -7.37578,-3.30178 -7.37578,-7.37578 V 39.472027 c 0,-4.073996 3.30178,-7.37622 7.37578,-7.37622 4.074,0 7.37622,3.302224 7.37622,7.37622 v 48.992875 c 0,4.074 -3.30222,7.37578 -7.37622,7.37578 z" /><path
|
||||
id="path30"
|
||||
style="fill:url(#linearGradient947);fill-opacity:1;stroke:none;stroke-width:4.44444"
|
||||
d="M 79.115234 30 C 52.097457 30 30 52.101902 30 79.115234 L 30 423.66211 C 30 450.67989 52.097457 472.77734 79.115234 472.77734 L 812.60352 472.77734 C 839.61685 472.77734 861.7207 450.67544 861.7207 423.66211 L 861.7207 342.50586 C 861.7207 333.51919 865.28844 324.89711 871.64844 318.53711 L 912.07617 278.11133 C 923.36506 266.82688 923.33313 248.52428 912.01758 237.27539 L 871.7207 197.19922 C 865.3207 190.83922 861.7207 182.18238 861.7207 173.16016 L 861.7207 79.115234 C 861.7207 52.101902 839.61685 30 812.60352 30 L 79.115234 30 z M 558.57812 104.87891 C 583.40035 104.87891 605.93437 109.06578 626.16992 117.42578 C 634.94325 121.05245 643.11241 125.38861 650.66797 130.4375 C 666.68575 141.13528 667.53503 164.7084 652.06836 176.89062 C 642.14392 184.7084 627.99624 184.81679 617.5918 177.65234 C 601.21402 166.37234 582.6189 160.73242 561.81445 160.73242 C 543.73445 160.73242 527.68096 164.51388 513.6543 172.06055 C 499.61874 179.62499 488.69385 190.27462 480.86719 204.03906 C 473.04052 217.79906 469.13086 233.58423 469.13086 251.38867 C 469.13086 268.93089 473.04052 284.57984 480.86719 298.33984 C 488.69385 312.09984 499.55339 322.82869 513.45117 330.51758 C 527.3445 338.20647 543.19697 342.05078 561.00586 342.05078 C 571.35697 342.05078 581.14355 340.83345 590.36133 338.40234 C 600.16577 335.81568 607.64587 328.42453 610.57031 319.14453 C 611.60142 315.85564 609.0817 312.50586 605.63281 312.50586 C 586.8017 312.50586 571.68046 296.63435 572.91602 277.54102 C 574.0449 260.11879 589.28973 246.94141 606.75195 246.94141 L 639.12109 246.94141 C 639.40998 246.94141 639.69016 246.97549 639.97461 246.98438 C 640.2635 246.97549 640.54368 246.94141 640.82812 246.94141 L 643.07617 246.94141 C 659.00062 246.94141 671.9043 259.84758 671.9043 275.76758 L 671.9043 315.97656 C 671.9043 349.0299 650.65927 378.61958 619.08594 388.40625 C 618.88594 388.46847 618.68047 388.53153 618.48047 388.59375 C 598.24047 394.79819 577.86746 397.9043 557.36523 397.9043 C 527.9519 397.9043 501.51266 391.63314 478.03711 379.08203 C 454.56155 366.53536 436.14852 349.13527 422.79297 326.87305 C 409.43741 304.61083 402.75781 279.45534 402.75781 251.38867 C 402.75781 223.33089 409.43741 198.16793 422.79297 175.91016 C 436.14852 153.64793 454.6942 136.24339 478.44531 123.70117 C 502.17865 111.15451 528.89368 104.87891 558.57812 104.87891 z M 142.10547 109.73438 L 148.62891 109.73438 C 158.33557 109.73438 167.53107 114.08459 173.67773 121.5957 L 280.94531 252.5957 C 288.9542 262.38237 304.8125 256.71671 304.8125 244.07227 L 304.8125 142.11133 C 304.8125 124.22688 319.30501 109.73438 337.18945 109.73438 C 355.0739 109.73438 369.57227 124.22688 369.57227 142.11133 L 369.57227 360.67188 C 369.57227 378.55187 355.0739 393.04883 337.18945 393.04883 L 331.05273 393.04883 C 321.3594 393.04883 312.1765 388.70764 306.02539 381.21875 L 198.3418 250.08594 C 190.32402 240.32149 174.48242 245.9914 174.48242 258.62695 L 174.48242 360.67188 C 174.48242 378.55187 159.98991 393.04883 142.10547 393.04883 C 124.22547 393.04883 109.72852 378.55187 109.72852 360.67188 L 109.72852 142.11133 C 109.72852 124.22688 124.22547 109.73438 142.10547 109.73438 z M 749.20508 109.73633 C 767.31174 109.73633 781.98828 124.41091 781.98828 142.51758 L 781.98828 360.26367 C 781.98828 378.37034 767.31174 393.04688 749.20508 393.04688 C 731.09841 393.04688 716.42383 378.37034 716.42383 360.26367 L 716.42383 142.51758 C 716.42383 124.41091 731.09841 109.73633 749.20508 109.73633 z "
|
||||
transform="matrix(0.22500001,0,0,-0.22500001,7.4269998,120.555)" /><g
|
||||
aria-label="Z E R O"
|
||||
transform="scale(1,-1)"
|
||||
id="text56"
|
||||
style="font-weight:600;font-size:31.76px;font-family:'Montserrat SemiBold';-inkscape-font-specification:Montserrat-SemiBold;fill:#6f9aa8"><path
|
||||
d="m 261.75384,-85.665085 -13.08512,15.97528 h 13.498 v 3.4936 H 243.206 v -2.76312 l 13.08512,-15.97528 h -12.8628 v -3.4936 h 18.32552 z"
|
||||
id="path12603" /><path
|
||||
d="m 278.84063,-75.787725 v 6.12968 h 12.5452 v 3.46184 h -16.674 v -22.232 h 16.22936 v 3.46184 h -12.10056 v 5.78032 h 10.73488 v 3.39832 z"
|
||||
id="path12605" /><path
|
||||
d="m 323.74919,-66.196205 h -4.4464 l -4.54168,-6.5108 q -0.28584,0.03176 -0.85752,0.03176 h -5.01808 v 6.47904 h -4.1288 v -22.232 h 9.14688 q 2.89016,0 5.01808,0.9528 2.15968,0.9528 3.30304,2.73136 1.14336,1.77856 1.14336,4.22408 0,2.50904 -1.23864,4.31936 -1.20688,1.81032 -3.4936,2.6996 z m -4.54168,-14.32376 q 0,-2.12792 -1.39744,-3.27128 -1.39744,-1.14336 -4.09704,-1.14336 h -4.82752 v 8.86104 h 4.82752 q 2.6996,0 4.09704,-1.14336 1.39744,-1.17512 1.39744,-3.30304 z"
|
||||
id="path12607" /><path
|
||||
d="m 347.12448,-65.878605 q -3.39832,0 -6.12968,-1.46096 -2.73136,-1.49272 -4.2876,-4.09704 -1.55624,-2.63608 -1.55624,-5.8756 0,-3.23952 1.55624,-5.84384 1.55624,-2.63608 4.2876,-4.09704 2.73136,-1.49272 6.12968,-1.49272 3.39832,0 6.12968,1.49272 2.73136,1.46096 4.2876,4.06528 1.55624,2.60432 1.55624,5.8756 0,3.27128 -1.55624,5.8756 -1.55624,2.60432 -4.2876,4.09704 -2.73136,1.46096 -6.12968,1.46096 z m 0,-3.62064 q 2.2232,0 4.00176,-0.98456 1.77856,-1.01632 2.79488,-2.79488 1.01632,-1.81032 1.01632,-4.03352 0,-2.2232 -1.01632,-4.00176 -1.01632,-1.81032 -2.79488,-2.79488 -1.77856,-1.01632 -4.00176,-1.01632 -2.2232,0 -4.00176,1.01632 -1.77856,0.98456 -2.79488,2.79488 -1.01632,1.77856 -1.01632,4.00176 0,2.2232 1.01632,4.03352 1.01632,1.77856 2.79488,2.79488 1.77856,0.98456 4.00176,0.98456 z"
|
||||
id="path12609" /></g><g
|
||||
aria-label="ENTRUST"
|
||||
transform="scale(0.99994801,-1.000052)"
|
||||
id="Entrust"
|
||||
style="font-weight:bold;font-size:20.009px;font-family:'Montserrat SemiBold';-inkscape-font-specification:'Montserrat SemiBold, Bold';letter-spacing:3.55932px;fill:#6f9aa8;stroke-width:0.999947"><path
|
||||
d="m 245.81989,-41.935548 v 3.861737 h 7.90356 v 2.180981 h -10.50473 v -14.0063 h 10.2246 v 2.180981 h -7.62343 v 3.641638 h 6.76304 v 2.140963 z"
|
||||
id="path12612" /><path
|
||||
d="m 270.04847,-40.414864 v -9.484266 h 2.58116 v 14.0063 h -2.14096 l -7.72347,-9.484266 v 9.484266 h -2.58117 v -14.0063 h 2.14097 z"
|
||||
id="path12614" /><path
|
||||
d="m 285.39308,-35.89283 h -2.60117 v -11.80531 h -4.64209 v -2.20099 h 11.88535 v 2.20099 h -4.64209 z"
|
||||
id="path12616" /><path
|
||||
d="m 307.52074,-35.89283 h -2.80126 l -2.86129,-4.101845 q -0.18008,0.02001 -0.54024,0.02001 h -3.16142 v 4.081836 h -2.60117 v -14.0063 h 5.76259 q 1.82082,0 3.16142,0.60027 1.36061,0.60027 2.08094,1.720774 0.72032,1.120504 0.72032,2.661197 0,1.580711 -0.78035,2.721224 -0.76034,1.140513 -2.20099,1.700765 z m -2.86129,-9.024059 q 0,-1.340603 -0.88039,-2.060927 -0.8804,-0.720324 -2.58116,-0.720324 h -3.04137 v 5.582511 h 3.04137 q 1.70076,0 2.58116,-0.720324 0.88039,-0.740333 0.88039,-2.080936 z"
|
||||
id="path12618" /><path
|
||||
d="m 319.76395,-35.69274 q -2.90131,0 -4.52204,-1.620729 -1.62073,-1.640738 -1.62073,-4.682106 v -7.903555 h 2.60117 v 7.80351 q 0,4.121854 3.5616,4.121854 3.5416,0 3.5416,-4.121854 v -7.80351 h 2.56115 v 7.903555 q 0,3.041368 -1.62073,4.682106 -1.60072,1.620729 -4.50202,1.620729 z"
|
||||
id="path12620" /><path
|
||||
d="m 337.4296,-35.69274 q -1.62073,0 -3.14141,-0.460207 -1.50068,-0.460207 -2.38107,-1.220549 l 0.9004,-2.020909 q 0.86039,0.680306 2.10095,1.120504 1.26056,0.420189 2.52113,0.420189 1.5607,0 2.32105,-0.500225 0.78035,-0.500225 0.78035,-1.320594 0,-0.60027 -0.4402,-0.980441 -0.42019,-0.40018 -1.08049,-0.620279 -0.66029,-0.220099 -1.80081,-0.500225 -1.60072,-0.380171 -2.60117,-0.760342 -0.98044,-0.380171 -1.70076,-1.180531 -0.70032,-0.820369 -0.70032,-2.20099 0,-1.160522 0.62028,-2.100945 0.64029,-0.960432 1.90086,-1.520684 1.28057,-0.560252 3.1214,-0.560252 1.28058,0 2.52113,0.320144 1.24056,0.320144 2.14097,0.920414 l -0.82037,2.020909 q -0.92042,-0.540243 -1.92087,-0.820369 -1.00045,-0.280126 -1.94087,-0.280126 -1.54069,0 -2.30103,0.520234 -0.74034,0.520234 -0.74034,1.380621 0,0.60027 0.42019,0.980441 0.4402,0.380171 1.1005,0.60027 0.66029,0.220099 1.80081,0.500225 1.5607,0.360162 2.56115,0.760342 1.00045,0.380171 1.70076,1.180531 0.72033,0.80036 0.72033,2.160972 0,1.160522 -0.64029,2.100945 -0.62028,0.940423 -1.90085,1.500675 -1.28058,0.560252 -3.12141,0.560252 z"
|
||||
id="path12622" /><path
|
||||
d="m 354.47498,-35.89283 h -2.60117 v -11.80531 h -4.64209 v -2.20099 h 11.88535 v 2.20099 h -4.64209 z"
|
||||
id="path12624" /></g></g>
|
||||
|
||||
|
||||
|
||||
<text
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:20.01px;font-family:'Montserrat SemiBold';-inkscape-font-specification:'Montserrat SemiBold, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#6f9aa8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1"
|
||||
id="text2843"
|
||||
x="240.16206"
|
||||
y="-35.894695"
|
||||
transform="scale(1,-1)"><tspan
|
||||
id="tspan2841"
|
||||
x="240.16206"
|
||||
y="-35.894695" /></text></g></svg>
|
Before Width: | Height: | Size: 14 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 16 KiB |
|
@ -3,7 +3,7 @@
|
|||
* Plugin Name: Event Bridge for ActivityPub
|
||||
* Description: Integrating popular event plugins with the ActivityPub plugin.
|
||||
* Plugin URI: https://event-federation.eu/
|
||||
* Version: 0.3.5
|
||||
* Version: 0.3.1.1
|
||||
* Author: André Menrath
|
||||
* Author URI: https://graz.social/@linos
|
||||
* Text Domain: event-bridge-for-activitypub
|
||||
|
|
78
includes/activitypub/transformer/class-eventprime.php
Normal file
78
includes/activitypub/transformer/class-eventprime.php
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Transformer for the plugin EventPrime.
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @license AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Activitypub\Transformer;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
use Event_Bridge_For_ActivityPub\Activitypub\Transformer\Event;
|
||||
|
||||
/**
|
||||
* ActivityPub Transformer for VS Event
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class EventPrime extends Event {
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_end_time(): ?string {
|
||||
$timestamp = get_post_meta( $this->wp_object->ID, 'em_end_date', true );
|
||||
if ( $timestamp ) {
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $timestamp );
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
public function get_start_time(): string {
|
||||
$timestamp = get_post_meta( $this->wp_object->ID, 'em_start_date', true );
|
||||
if ( $timestamp ) {
|
||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $timestamp );
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get location from the event object.
|
||||
*/
|
||||
public function get_location(): ?Place {
|
||||
$venue_term_id = get_post_meta( $this->wp_object->ID, 'em_venue', true );
|
||||
if ( ! $venue_term_id ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$venue = wp_get_post_terms( $this->wp_object->ID, 'em_venue' );
|
||||
|
||||
if ( empty( $venue ) ) {
|
||||
return null;
|
||||
} else {
|
||||
$venue = $venue[0];
|
||||
}
|
||||
|
||||
$place = new Place();
|
||||
|
||||
$place->set_name( $venue->name );
|
||||
$place->set_content( $venue->description );
|
||||
|
||||
$address = get_term_meta( $venue->term_id, 'em_address', true );
|
||||
$display_address = get_term_meta( $venue->term_id, 'em_display_address_on_frontend', true );
|
||||
|
||||
if ( $address && $display_address ) {
|
||||
$place->set_address( get_term_meta( $venue->term_id, 'em_address', true ) );
|
||||
}
|
||||
|
||||
return $place;
|
||||
}
|
||||
}
|
|
@ -69,15 +69,7 @@ class Event_Plugin_Admin_Notices {
|
|||
* @return void
|
||||
*/
|
||||
private function do_admin_notice_post_type_not_activitypub_enabled(): void {
|
||||
$all_plugins = get_plugins();
|
||||
$event_plugin_file = $this->event_plugin::get_relative_plugin_file();
|
||||
if ( isset( $all_plugins[ $event_plugin_file ]['Name'] ) ) {
|
||||
$event_plugin_name = $all_plugins[ $event_plugin_file ]['Name'];
|
||||
} elseif ( isset( get_mu_plugins()[ $event_plugin_file ]['Name'] ) ) {
|
||||
$event_plugin_name = get_mu_plugins()[ $event_plugin_file ]['Name'];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
$event_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $this->event_plugin::get_plugin_file() );
|
||||
$activitypub_plugin_data = get_plugin_data( ACTIVITYPUB_PLUGIN_FILE );
|
||||
$notice = sprintf(
|
||||
/* translators: 1: the name of the event plugin a admin notice is shown. 2: The name of the ActivityPub plugin. */
|
||||
|
@ -87,7 +79,7 @@ class Event_Plugin_Admin_Notices {
|
|||
'event-bridge-for-activitypub'
|
||||
),
|
||||
esc_html( $activitypub_plugin_data['Name'] ),
|
||||
esc_html( $event_plugin_name ),
|
||||
esc_html( $event_plugin_data['Name'] ),
|
||||
admin_url( 'options-general.php?page=activitypub&tab=settings' )
|
||||
);
|
||||
$allowed_html = array(
|
||||
|
|
|
@ -29,7 +29,7 @@ class General_Admin_Notices {
|
|||
*/
|
||||
const ACTIVITYPUB_PLUGIN_URL = 'https://wordpress.org/plugins/activitypub';
|
||||
|
||||
const EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub#supported-event-plugins';
|
||||
const EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL = 'https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub#events-plugin-that-will-be-supported-at-first';
|
||||
|
||||
/**
|
||||
* Allowed HTML for admin notices.
|
||||
|
@ -38,9 +38,8 @@ class General_Admin_Notices {
|
|||
*/
|
||||
const ALLOWED_HTML = array(
|
||||
'a' => array(
|
||||
'href' => true,
|
||||
'title' => true,
|
||||
'target' => true,
|
||||
'href' => true,
|
||||
'title' => true,
|
||||
),
|
||||
'br',
|
||||
'i',
|
||||
|
@ -91,11 +90,11 @@ class General_Admin_Notices {
|
|||
/* translators: 1: An URL to the list of supported event plugins. */
|
||||
_x(
|
||||
'The Plugin <i>Event Bridge for ActivityPub</i> is of no use, because you do not have installed and activated a supported Event Plugin.
|
||||
<br> For a list of supported Event Plugins see <a href="%1$s" target="_blank">here</a>.',
|
||||
<br> For a list of supported Event Plugins see <a href="%1$s">here</a>.',
|
||||
'admin notice',
|
||||
'event-bridge-for-activitypub'
|
||||
),
|
||||
esc_url( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
esc_html( self::EVENT_BRIDGE_FOR_ACTIVITYPUB_SUPPORTED_EVENT_PLUGINS_URL )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,12 +114,7 @@ class Health_Check {
|
|||
*/
|
||||
public static function get_most_recent_event_posts( $event_post_type = null, $number_of_posts = 5 ) {
|
||||
if ( ! $event_post_type ) {
|
||||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$active_event_plugin = reset( $active_event_plugins );
|
||||
if ( ! $active_event_plugin ) {
|
||||
return false;
|
||||
}
|
||||
$event_post_type = $active_event_plugin->get_post_type();
|
||||
$event_post_type = Setup::get_instance()->get_active_event_plugins()[0]->get_post_type();
|
||||
}
|
||||
|
||||
$args = array(
|
||||
|
@ -153,7 +148,7 @@ class Health_Check {
|
|||
$active_event_plugins = Setup::get_instance()->get_active_event_plugins();
|
||||
$info = array();
|
||||
foreach ( $active_event_plugins as $active_event_plugin ) {
|
||||
$event_plugin_file = $active_event_plugin->get_relative_plugin_file();
|
||||
$event_plugin_file = $active_event_plugin->get_plugin_file();
|
||||
$event_plugin_data = \get_plugin_data( $event_plugin_file );
|
||||
$event_plugin_name = isset( $event_plugin_data['Plugin Name'] ) ? $event_plugin_data['Plugin Name'] : 'Name not found';
|
||||
$event_plugin_version = isset( $event_plugin_version['Plugin Version'] ) ? $event_plugin_version['Plugin Version'] : 'Version not found';
|
||||
|
|
|
@ -97,9 +97,6 @@ class Settings_Page {
|
|||
$tab = sanitize_key( $_GET['tab'] );
|
||||
}
|
||||
|
||||
// Fallback to always re-scan active event plugins, when user visits admin area of this plugin.
|
||||
Setup::get_instance()->redetect_active_event_plugins();
|
||||
|
||||
switch ( $tab ) {
|
||||
case 'settings':
|
||||
$plugin_setup = Setup::get_instance();
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace Event_Bridge_For_ActivityPub;
|
|||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Activitypub\Activity\Extended_Object\Event;
|
||||
|
||||
/**
|
||||
* Class responsible for the ActivityPui Event Extension related Settings.
|
||||
*
|
||||
|
@ -131,8 +133,7 @@ class Settings {
|
|||
* @return bool True if allowed, false otherwise.
|
||||
*/
|
||||
private static function is_allowed_event_category( $event_category ): bool {
|
||||
require_once EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/includes/event-categories.php';
|
||||
$allowed_event_categories = array_keys( EVENT_BRIDGE_FOR_ACTIVITYPUB_EVENT_CATEGORIES );
|
||||
$allowed_event_categories = Event::DEFAULT_EVENT_CATEGORIES;
|
||||
return in_array( $event_category, $allowed_event_categories, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,8 +67,9 @@ class Setup {
|
|||
// deactivate_plugins( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE );
|
||||
// return;
|
||||
// }.
|
||||
$this->active_event_plugins = self::detect_active_event_plugins();
|
||||
$this->activitypub_plugin_version = self::get_activitypub_plugin_version();
|
||||
add_action( 'plugins_loaded', array( $this, 'setup_hooks' ) );
|
||||
$this->setup_hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +106,8 @@ class Setup {
|
|||
if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) {
|
||||
return constant( 'ACTIVITYPUB_PLUGIN_VERSION' );
|
||||
}
|
||||
return '0.0.0';
|
||||
$version = get_file_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php', array( 'Version' ) )[0];
|
||||
return $version ?? '0.0.0';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,50 +132,27 @@ class Setup {
|
|||
'\Event_Bridge_For_ActivityPub\Integrations\WP_Event_Manager',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Eventin',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Modern_Events_Calendar_Lite',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\EventPrime',
|
||||
'\Event_Bridge_For_ActivityPub\Integrations\Event_Organiser',
|
||||
);
|
||||
|
||||
/**
|
||||
* Force the re-scan for active event plugins without using the cached transient.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redetect_active_event_plugins(): void {
|
||||
delete_transient( 'event_bridge_for_activitypub_active_event_plugins' );
|
||||
$this->detect_active_event_plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that checks for supported activated event plugins.
|
||||
*
|
||||
* @return array List of supported event plugins as keys from the SUPPORTED_EVENT_PLUGINS const.
|
||||
*/
|
||||
public function detect_active_event_plugins(): array {
|
||||
$active_event_plugins = get_transient( 'event_bridge_for_activitypub_active_event_plugins' );
|
||||
|
||||
if ( $active_event_plugins ) {
|
||||
$this->active_event_plugins = $active_event_plugins;
|
||||
return $active_event_plugins;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$all_plugins = array_merge( get_plugins(), get_mu_plugins() );
|
||||
|
||||
public static function detect_active_event_plugins(): array {
|
||||
$active_event_plugins = array();
|
||||
|
||||
foreach ( self::EVENT_PLUGIN_CLASSES as $event_plugin_class ) {
|
||||
$event_plugin_file = call_user_func( array( $event_plugin_class, 'get_relative_plugin_file' ) );
|
||||
if ( ! $event_plugin_file ) {
|
||||
if ( ! class_exists( $event_plugin_class ) || ! method_exists( $event_plugin_class, 'get_plugin_file' ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( array_key_exists( $event_plugin_file, $all_plugins ) && \is_plugin_active( $event_plugin_file ) ) {
|
||||
$active_event_plugins[ $event_plugin_file ] = new $event_plugin_class();
|
||||
$event_plugin_file = call_user_func( array( $event_plugin_class, 'get_plugin_file' ) );
|
||||
if ( \is_plugin_active( $event_plugin_file ) ) {
|
||||
$active_event_plugins[] = new $event_plugin_class();
|
||||
}
|
||||
}
|
||||
set_transient( 'event_bridge_for_activitypub_active_event_plugins', $active_event_plugins );
|
||||
$this->active_event_plugins = $active_event_plugins;
|
||||
return $active_event_plugins;
|
||||
}
|
||||
|
||||
|
@ -186,14 +165,9 @@ class Setup {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup_hooks(): void {
|
||||
$this->detect_active_event_plugins();
|
||||
|
||||
protected function setup_hooks(): void {
|
||||
register_activation_hook( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE, array( $this, 'activate' ) );
|
||||
|
||||
add_action( 'activated_plugin', array( $this, 'redetect_active_event_plugins' ) );
|
||||
add_action( 'deactivated_plugin', array( $this, 'redetect_active_event_plugins' ) );
|
||||
|
||||
add_action( 'admin_init', array( $this, 'do_admin_notices' ) );
|
||||
add_action( 'admin_init', array( Settings::class, 'register_settings' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_styles' ) );
|
||||
|
@ -329,7 +303,6 @@ class Setup {
|
|||
* @return void
|
||||
*/
|
||||
public function activate(): void {
|
||||
$this->redetect_active_event_plugins();
|
||||
// Don't allow plugin activation, when the ActivityPub plugin is not activated yet.
|
||||
if ( ! $this->activitypub_plugin_is_active ) {
|
||||
deactivate_plugins( plugin_basename( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) );
|
||||
|
|
|
@ -27,7 +27,7 @@ final class Event_Organiser extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'event-organiser/event-organiser.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
|||
*/
|
||||
abstract class Event_Plugin {
|
||||
/**
|
||||
* Returns the plugin file relative to the plugins dir.
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_relative_plugin_file(): string;
|
||||
abstract public static function get_plugin_file(): string;
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
|
@ -57,9 +57,9 @@ abstract class Event_Plugin {
|
|||
* Get the plugins name from the main plugin-file's top-level-file-comment.
|
||||
*/
|
||||
final public static function get_plugin_name(): string {
|
||||
$all_plugins = array_merge( get_plugins(), get_mu_plugins() );
|
||||
if ( isset( $all_plugins[ static::get_relative_plugin_file() ]['Name'] ) ) {
|
||||
return $all_plugins[ static::get_relative_plugin_file() ]['Name'];
|
||||
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . static::get_plugin_file() );
|
||||
if ( isset( $plugin_data['Name'] ) ) {
|
||||
return $plugin_data['Name'];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ final class Eventin extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'wp-event-solution/eventin.php';
|
||||
}
|
||||
|
||||
|
|
218
includes/integrations/class-eventprime.php
Normal file
218
includes/integrations/class-eventprime.php
Normal file
|
@ -0,0 +1,218 @@
|
|||
<?php
|
||||
/**
|
||||
* EventPrime – Events Calendar, Bookings and Tickets
|
||||
*
|
||||
* @link https://wordpress.org/plugins/eventprime-event-calendar-management/
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace Event_Bridge_For_ActivityPub\Integrations;
|
||||
|
||||
use Activitypub\Signature;
|
||||
use Eventprime_Basic_Functions;
|
||||
|
||||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
/**
|
||||
* This class defines which information is necessary for the EventPrime event plugin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class EventPrime extends Event_Plugin {
|
||||
/**
|
||||
* Add filter for the template inclusion.
|
||||
*/
|
||||
public function __construct() {
|
||||
\add_filter( 'template_include', array( self::class, 'render_activitypub_template' ), 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full plugin file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_plugin_file(): string {
|
||||
return 'eventprime-event-calendar-management/event-prime.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event post type of the plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_post_type(): string {
|
||||
return 'em_event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of the admin pages of the plugin.
|
||||
*
|
||||
* @return array The settings page urls.
|
||||
*/
|
||||
public static function get_settings_pages(): array {
|
||||
return array( 'ep-settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ActivityPub transformer class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_activitypub_transformer_class_name(): string {
|
||||
return 'EventPrime';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the taxonomy used for the plugin's event categories.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_event_category_taxonomy(): string {
|
||||
return 'em_event_type';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the current request is an EventPrime ActivityPub request.
|
||||
*/
|
||||
private static function is_eventprime_activitypub_request() {
|
||||
global $wp_query;
|
||||
|
||||
/*
|
||||
* ActivityPub requests are currently only made for
|
||||
* author archives, singular posts, and the homepage.
|
||||
*/
|
||||
if ( ! \is_author() && ! \is_singular() && ! \is_home() && ! defined( '\REST_REQUEST' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the current post type supports ActivityPub.
|
||||
if ( \is_singular() ) {
|
||||
$queried_object = \get_queried_object();
|
||||
|
||||
if ( ! $queried_object instanceof \WP_Post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( '[em_event]' !== $queried_object->post_content && '[em_events]' !== $queried_object->post_content ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if header already sent.
|
||||
if ( ! \headers_sent() && ACTIVITYPUB_SEND_VARY_HEADER ) {
|
||||
// Send Vary header for Accept header.
|
||||
\header( 'Vary: Accept' );
|
||||
}
|
||||
|
||||
// One can trigger an ActivityPub request by adding ?activitypub to the URL.
|
||||
if ( isset( $wp_query->query_vars['activitypub'] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* The other (more common) option to make an ActivityPub request
|
||||
* is to send an Accept header.
|
||||
*/
|
||||
if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
|
||||
$accept = sanitize_text_field( wp_unslash( $_SERVER['HTTP_ACCEPT'] ) );
|
||||
|
||||
/*
|
||||
* $accept can be a single value, or a comma separated list of values.
|
||||
* We want to support both scenarios,
|
||||
* and return true when the header includes at least one of the following:
|
||||
* - application/activity+json
|
||||
* - application/ld+json
|
||||
* - application/json
|
||||
*/
|
||||
if ( preg_match( '/(application\/(ld\+json|activity\+json|json))/i', $accept ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the post id of the event for an EventPrime event query.
|
||||
*
|
||||
* @return bool|int The post ID if an event could be identified, false otherwise.
|
||||
*/
|
||||
private static function get_eventprime_post_id() {
|
||||
$event = get_query_var( 'event' );
|
||||
if ( ! $event ) {
|
||||
if ( ! empty( filter_input( INPUT_GET, 'event', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ) ) {
|
||||
$event = rtrim( filter_input( INPUT_GET, 'event', FILTER_SANITIZE_FULL_SPECIAL_CHARS ), '/\\' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $event ) {
|
||||
$ep_basic_functions = new Eventprime_Basic_Functions();
|
||||
return $ep_basic_functions->ep_get_id_by_slug( $event, 'em_event' );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the ActivityPub template for EventPrime.
|
||||
*
|
||||
* @param string $template The path to the template object.
|
||||
* @return string The new path to the JSON template.
|
||||
*/
|
||||
public static function render_activitypub_template( $template ) {
|
||||
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
// Check if the request is a page with (solely) the eventprime shortcode in it.
|
||||
if ( ! self::is_eventprime_activitypub_request() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ( ! \is_singular() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$post_id = self::get_eventprime_post_id();
|
||||
|
||||
if ( $post_id ) {
|
||||
$preview = \get_query_var( 'preview' );
|
||||
if ( $preview ) {
|
||||
$activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/post-preview.php';
|
||||
} else {
|
||||
$activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/post-json.php';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the request is authorized.
|
||||
*
|
||||
* @see https://www.w3.org/wiki/SocialCG/ActivityPub/Primer/Authentication_Authorization#Authorized_fetch
|
||||
* @see https://swicg.github.io/activitypub-http-signature/#authorized-fetch
|
||||
*/
|
||||
if ( $activitypub_template && ACTIVITYPUB_AUTHORIZED_FETCH ) {
|
||||
$verification = Signature::verify_http_signature( $_SERVER );
|
||||
if ( \is_wp_error( $verification ) ) {
|
||||
header( 'HTTP/1.1 401 Unauthorized' );
|
||||
|
||||
// Fallback as template_loader can't return http headers.
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $activitypub_template ) {
|
||||
global $post;
|
||||
|
||||
$post = get_post( $post_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Ensure WordPress functions use the new post data.
|
||||
setup_postdata( $post );
|
||||
// Return the default ActivityPub template.
|
||||
return $activitypub_template;
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ final class Events_Manager extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'events-manager/events-manager.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ final class GatherPress extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'gatherpress/gatherpress.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ final class Modern_Events_Calendar_Lite extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'modern-events-calendar-lite/modern-events-calendar-lite.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ final class The_Events_Calendar extends Event_plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'the-events-calendar/the-events-calendar.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ final class VS_Event_List extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'very-simple-event-list/vsel.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ final class WP_Event_Manager extends Event_Plugin {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_relative_plugin_file(): string {
|
||||
public static function get_plugin_file(): string {
|
||||
return 'wp-event-manager/wp-event-manager.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
<properties>
|
||||
<property name="text_domain" type="array">
|
||||
<element value="event-bridge-for-activitypub"/>
|
||||
<element value="activitypub"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
|
51
readme.txt
51
readme.txt
|
@ -3,7 +3,7 @@ Contributors: andremenrath
|
|||
Tags: events, fediverse, activitypub, calendar
|
||||
Requires at least: 6.5
|
||||
Tested up to: 6.7
|
||||
Stable tag: 0.3.5
|
||||
Stable tag: 0.3.1
|
||||
Requires PHP: 7.4
|
||||
License: AGPL-3.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
@ -11,38 +11,34 @@ Integrating popular event plugins with the ActivityPub plugin.
|
|||
|
||||
== Description ==
|
||||
|
||||
Make your events more discoverable, expand your reach effortlessly while being independent of other (commercial) platforms, and be a part of the growing decentralized web (the Fediverse). With the Event Bridge for ActivityPub Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work. Forget the hassle of managing multiple social media accounts just to keep your audience informed.
|
||||
Make your events more discoverable, expand your reach effortlessly while being independent of other (commercial) platforms, and be a part of the growing decentralized web (the Fediverse).
|
||||
With the Event Bridge for ActivityPub Plugin for WordPress, your events can be automatically followed, aggregated and displayed across decentralized platforms like [Mastodon](https://joinmastodon.org) or [Gancio](https://gancio.org), without any extra work.
|
||||
Forget the hassle of managing multiple social media accounts just to keep your audience informed.
|
||||
|
||||
This plugin is not an event managing plugin but an add-on to popular event plugins. It extends their functionality to fully support the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/). With the ActivityPub plugin people can follow your website directly and engage with your events just as they would on social media: liking, boosting and even commenting if you enable it. You retain full ownership of your content. By integrating into your existing setup, it ensures no extra work is needed while enhancing your events' visibility across the web.
|
||||
|
||||
= Supported Event Plugins =
|
||||
|
||||
* [The Events Calendar](https://de.wordpress.org/plugins/the-events-calendar/)
|
||||
* [VS Event List](https://de.wordpress.org/plugins/very-simple-event-list/)
|
||||
* [Events Manager](https://de.wordpress.org/plugins/events-manager/)
|
||||
* [WP Event Manager](https://de.wordpress.org/plugins/wp-event-manager/)
|
||||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
This plugin is not an event managing plugin but an add-on to popular event plugins. It extends their functionality to fully support the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/).
|
||||
With the ActivityPub plugin people can follow your website directly and engage with your events just as they would on social media: liking, boosting and even commenting if you enable it.
|
||||
You retain full ownership of your content. By integrating into your existing setup, it ensures no extra work is needed while enhancing your events' visibility across the web.
|
||||
|
||||
= How It Works =
|
||||
|
||||
With the Event Bridge for ActivityPub WordPress plugin, sharing your events is effortless and automatic! Once you create an event on your WordPress site, it is seamlessly shared across the decentralized web using the ActivityPub protocol.
|
||||
With the Event Bridge for ActivityPub WordPress plugin, sharing your events is effortless and automatic!
|
||||
Once you create an event on your WordPress site, it is seamlessly shared across the decentralized web using the ActivityPub protocol.
|
||||
|
||||
[vimeo https://vimeo.com/1043105544 ]
|
||||
![](./.wordpress-org/event-activitypub-publishing.gif)
|
||||
|
||||
Your events can be automatically delivered to platforms that fully support events, such as [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/). These platforms create public event calendars by pulling in events from various sources, including your website. Any updates you make to your events are synced across these platforms—so you only need to manage your events on your own site, with no extra work required.
|
||||
Your events can be automatically delivered to platforms that fully support events, such as [Mobilizon](https://joinmobilizon.org/), [Gancio](https://gancio.org), [Friendica](https://friendi.ca), [Hubzilla](https://hubzilla.org), and [Pleroma](https://pleroma.social/).
|
||||
These platforms create public event calendars by pulling in events from various sources, including your website. Any updates you make to your events are synced across these platforms—so you only need to manage your events on your own site, with no extra work required.
|
||||
|
||||
[vimeo https://vimeo.com/1043104445 ]
|
||||
![](./.wordpress-org/decentralized-event-calenders.gif)
|
||||
|
||||
Even platforms that don't yet fully support events, like [Mastodon](https://joinmastodon.org), will still receive a detailed, well-composed summary of your event. The Event Federation plugin ensures that users from those platforms are provided with all important information about an event.
|
||||
Even platforms that don't yet fully support events, like [Mastodon](https://joinmastodon.org), will still receive a detailed, well-composed summary of your event.
|
||||
The Event Federation plugin ensures that users from those platforms are provided with all important information about an event.
|
||||
|
||||
= Features for Your WordPress Events and the Fediverse =
|
||||
|
||||
**ActivityPub-Enabled Event Sharing:** Your WordPress events are now compatible with the Fediverse, using the ActivityStreams format. This means your events can be easily discovered and followed by users on platforms like Mastodon and other ActivityPub-compatible services.
|
||||
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page. Advanced users can create custom summaries via a set of shortcodes.
|
||||
**Automatic Event Summaries:** When your event is shared on the Fediverse, platforms like Mastodon that don't fully support events will display a brief HTML summary of key details — such as the event's title, start time, and location. This ensures that even if someone can't view the full event on their platform, they still get the important info at a glance, with a link to your WordPress event page.
|
||||
|
||||
**Improved Event Discoverability:** Your custom event categories are mapped to a set of default categories used in the Fediverse, helping your events reach a wider audience. This improves the chances that users searching for similar events on other platforms will find yours.
|
||||
|
||||
|
@ -61,11 +57,12 @@ This plugin depends on the [ActivityPub plugin](https://wordpress.org/plugins/ac
|
|||
* [Eventin](https://de.wordpress.org/plugins/wp-event-solution/)
|
||||
* [Modern Events Calendar Lite](https://webnus.net/modern-events-calendar/)
|
||||
* [GatherPress](https://gatherpress.org/)
|
||||
* [EventPrime – Events Calendar, Bookings and Tickets](https://wordpress.org/plugins/eventprime-event-calendar-management/)
|
||||
* [Event Organiser](https://wordpress.org/plugins/event-organiser/)
|
||||
|
||||
= Configuration =
|
||||
== Configuration ==
|
||||
|
||||
If you're new to the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/), it's recommended to spend a few minutes reading through its documentation to familiarize yourself with its setup and functionality.
|
||||
If you're new to the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/), it’s recommended to spend a few minutes reading through its documentation to familiarize yourself with its setup and functionality.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
|
@ -97,16 +94,8 @@ If you know about coding have a look at the documentation of how to add your plu
|
|||
|
||||
We're always interested in your feedback. Feel free to reach out to us via [E-Mail](https://event-federation.eu/contact/) or create an [issue](https://code.event-federation.eu/Event-Federation/wordpress-event-bridge-for-activitypub/issues).
|
||||
|
||||
== Acknowledgement ==
|
||||
|
||||
The development of this WordPress plugin was funded through the [NGI0 Entrust](https://NLnet.nl/entrust) Fund, a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) programme, under the aegis of [Communications Networks, Content and Technology](https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en) under grant agreement number 101069594.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= [0.3.5] - 2025-01-03 =
|
||||
|
||||
* Fixed: Images of Acknowledgements in Admin UI
|
||||
|
||||
= [0.3.4] 2024-12-21 =
|
||||
= [0.3.1] 2024-12-05 =
|
||||
|
||||
* Initial release on https://wordpress.org/
|
||||
|
|
|
@ -48,7 +48,7 @@ $current_category_mapping = \get_option( 'event_bridge_for_activitypub_ev
|
|||
<p>
|
||||
<label for="event_bridge_for_activitypub_summary_type_preset">
|
||||
<input type="radio" name="event_bridge_for_activitypub_summary_type" id="event_bridge_for_activitypub_summary_type_preset" value="preset" <?php echo \checked( 'preset', \get_option( 'event_bridge_for_activitypub_summary_type', EVENT_BRIDGE_FOR_ACTIVITYPUB_DEFAULT_SUMMARY_TYPE ) ); ?> />
|
||||
<?php \esc_html_e( 'Automatic (default)', 'event-bridge-for-activitypub' ); ?>
|
||||
<?php \esc_html_e( 'Automatic (default)', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Let the plugin compose a summary for you. ', 'event-bridge-for-activitypub' ); ?>
|
||||
|
@ -68,7 +68,7 @@ $current_category_mapping = \get_option( 'event_bridge_for_activitypub_ev
|
|||
<div id="event_bridge_for_activitypub_summary_type_custom-details">
|
||||
<textarea name="event_bridge_for_activitypub_custom_summary" id="event_bridge_for_activitypub_custom_summary" rows="10" cols="50" class="large-text" placeholder="<?php echo wp_kses( EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY, 'post' ); ?>"><?php echo esc_textarea( wp_kses( \get_option( 'event_bridge_for_activitypub_custom_summary', EVENT_BRIDGE_FOR_ACTIVITYPUB_CUSTOM_SUMMARY ), 'post' ) ); ?></textarea>
|
||||
<details>
|
||||
<summary><?php esc_html_e( 'See a list Template Tags available for the summary.', 'event-bridge-for-activitypub' ); ?></summary>
|
||||
<summary><?php esc_html_e( 'See a list Template Tags available for the summary.', 'activitypub' ); ?></summary>
|
||||
<div class="description">
|
||||
<dl>
|
||||
<dt><code>[ap_start_time]</code><dt>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||
|
||||
use Event_Bridge_For_ActivityPub\Setup;
|
||||
use Event_Bridge_For_ActivityPub\Admin\General_Admin_Notices;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Settings_Page;
|
||||
use Event_Bridge_For_ActivityPub\Admin\Health_Check;
|
||||
|
||||
|
@ -42,12 +41,6 @@ WP_Filesystem();
|
|||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'Status', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<p><?php \esc_html_e( 'The Event Bridge for ActivityPub detected the following (activated) event plugins:', 'event-bridge-for-activitypub' ); ?></p>
|
||||
<?php
|
||||
if ( empty( $active_event_plugins ) ) {
|
||||
$notice = General_Admin_Notices::get_admin_notice_no_supported_event_plugin_active();
|
||||
echo '<p>⚠' . \wp_kses( $notice, General_Admin_Notices::ALLOWED_HTML ) . '</p>';
|
||||
}
|
||||
?>
|
||||
<?php foreach ( $active_event_plugins as $active_event_plugin ) { ?>
|
||||
<h3><?php echo esc_html( $active_event_plugin->get_plugin_name() ); ?>:</h3>
|
||||
<ul class="event-bridge-for-activitypub-list">
|
||||
|
@ -230,13 +223,15 @@ WP_Filesystem();
|
|||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'Acknowledgement', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<p><a href="https://NLnet.nl"><img src="<?php echo esc_url( plugins_url( '/assets/img/acknowledgement-NLnet.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Logo NLnet: abstract logo of four people seen from above" class="logo-center"></a> <a href="https://NLnet.nl/NGI0"><img src="<?php echo esc_url( plugins_url( '/assets/img/acknowledgement-NGI0Entrust.svg', EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_FILE ) ); ?>" alt="Logo NGI Zero: letterlogo shaped like a tag" class="logo-center"> </a></p>
|
||||
<p>The development of this plugin was funded through the <a href="https://NLnet.nl/entrust">NGI0 Entrust</a> Fund, a fund established by <a href="https://nlnet.nl">NLnet</a> with financial support from the European Commission's <a href="https://ngi.eu">Next Generation Internet</a> programme, under the aegis of <a href="https://commission.europa.eu/about-european-commission/departments-and-executive-agencies/communications-networks-content-and-technology_en">DG Communications Networks, Content and Technology</a> under grant agreement N<sup>o</sup> 101069594.</p>
|
||||
<h2><?php \esc_html_e( 'Changelog', 'event-bridge-for-activitypub' ); ?></h2>
|
||||
<pre>
|
||||
<?php
|
||||
$changelog = $wp_filesystem->get_contents( EVENT_BRIDGE_FOR_ACTIVITYPUB_PLUGIN_DIR . '/CHANGELOG.md' );
|
||||
echo esc_html( substr( $changelog, strpos( $changelog, "\n", 180 ) + 1 ) );
|
||||
?>
|
||||
</pre>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
186
tests/test-class-plugin-eventprime.php
Normal file
186
tests/test-class-plugin-eventprime.php
Normal file
|
@ -0,0 +1,186 @@
|
|||
<?php
|
||||
/**
|
||||
* Class SampleTest
|
||||
*
|
||||
* @package Event_Bridge_For_ActivityPub
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sample test case.
|
||||
*/
|
||||
class Test_EventPrime extends WP_UnitTestCase {
|
||||
/**
|
||||
* Mockup venues of certain complexity.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $mockup_venue = array();
|
||||
|
||||
/**
|
||||
* Mockup events for tests.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $mockup_events = array();
|
||||
|
||||
/**
|
||||
* Override the setup function, so that tests don't run if the Events Calendar is not active.
|
||||
*/
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
if ( ! class_exists( '\Eventprime_Basic_Functions' ) ) {
|
||||
self::markTestSkipped( 'The EventPrime Calendar management plugin is not active.' );
|
||||
}
|
||||
|
||||
// Make sure that ActivityPub support is enabled for The Events Calendar.
|
||||
$aeb = \Event_Bridge_For_ActivityPub\Setup::get_instance();
|
||||
$aeb->activate_activitypub_support_for_active_event_plugins();
|
||||
|
||||
// Delete all posts afterwards.
|
||||
_delete_all_posts();
|
||||
|
||||
$this->setup_mockup_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup mockup events.
|
||||
*/
|
||||
private function setup_mockup_data() {
|
||||
$this->mockup_events = array(
|
||||
'minimal_event' => array(
|
||||
'name' => 'EventPrime Event title',
|
||||
'description' => 'EventPrime event description',
|
||||
'status' => 'Publish',
|
||||
'em_event_type' => '',
|
||||
'em_venue' => '',
|
||||
'em_organizer' => '',
|
||||
'em_performer' => '',
|
||||
'em_start_date' => strtotime( '+10 days 15:00:00' ),
|
||||
'em_end_date' => strtotime( '+10 days 16:00:00' ),
|
||||
'em_enable_booking' => 'bookings_off',
|
||||
'em_ticket_price' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
$this->mockup_venue = array(
|
||||
'name' => 'Test Venue',
|
||||
'address' => 'Fediverse-street 1337, 1234 Fediverse-town',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the right transformer gets applied.
|
||||
*/
|
||||
public function test_the_events_calendar_transformer_class() {
|
||||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
$active_event_plugins = \Event_Bridge_For_ActivityPub\Setup::get_instance()->get_active_event_plugins();
|
||||
$this->assertEquals( 1, count( $active_event_plugins ) );
|
||||
|
||||
// Enable ActivityPub support for the event plugin.
|
||||
$this->assertContains( 'em_event', get_option( 'activitypub_support_post_types' ) );
|
||||
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $this->mockup_events['minimal_event'] );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
|
||||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \Event_Bridge_For_ActivityPub\Activitypub\Transformer\EventPrime::class, $transformer );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $this->mockup_events['minimal_event'] );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'EventPrime Event title', $event_array['name'] );
|
||||
$this->assertEquals( 'EventPrime event description', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertTrue( $event_array['commentsEnabled'] );
|
||||
$this->assertEquals( 'allow_all', $event_array['repliesModerationOption'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertArrayNotHasKey( 'location', $event_array );
|
||||
$this->assertEquals( 'MEETING', $event_array['category'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event_with_venue() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$venue_term_id = wp_insert_term( $this->mockup_venue['name'], 'em_venue' )['term_id'];
|
||||
add_term_meta( $venue_term_id, 'em_address', $this->mockup_venue['address'], true );
|
||||
add_term_meta( $venue_term_id, 'em_display_address_on_frontend', true, true );
|
||||
|
||||
$event_data = $this->mockup_events['minimal_event'];
|
||||
$event_data['em_venue'] = $venue_term_id;
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $event_data );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertEquals( 'Event', $event_array['type'] );
|
||||
$this->assertEquals( 'EventPrime Event title', $event_array['name'] );
|
||||
$this->assertEquals( 'EventPrime event description', wp_strip_all_tags( $event_array['content'] ) );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
|
||||
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
|
||||
$this->assertTrue( $event_array['commentsEnabled'] );
|
||||
$this->assertEquals( 'allow_all', $event_array['repliesModerationOption'] );
|
||||
$this->assertEquals( 'external', $event_array['joinMode'] );
|
||||
$this->assertEquals( $this->mockup_venue['name'], $event_array['location']['name'] );
|
||||
$this->assertEquals( $this->mockup_venue['address'], $event_array['location']['address'] );
|
||||
|
||||
$this->assertEquals( 'MEETING', $event_array['category'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test transformation of minimal event with venue which has a hidden address.
|
||||
*/
|
||||
public function test_transformation_of_minimal_event_with_venue_with_hidden_address() {
|
||||
// Create an EventPrime Event without content.
|
||||
$ep_functions = new Eventprime_Basic_Functions();
|
||||
|
||||
$venue_term_id = wp_insert_term( $this->mockup_venue['name'], 'em_venue' )['term_id'];
|
||||
add_term_meta( $venue_term_id, 'em_address', $this->mockup_venue['address'], true );
|
||||
add_term_meta( $venue_term_id, 'em_display_address_on_frontend', false, true );
|
||||
|
||||
$event_data = $this->mockup_events['minimal_event'];
|
||||
$event_data['em_venue'] = $venue_term_id;
|
||||
|
||||
$post_id = $ep_functions->insert_event_post_data( $event_data );
|
||||
|
||||
$wp_object = get_post( $post_id );
|
||||
|
||||
// Call the transformer Factory.
|
||||
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();
|
||||
|
||||
// Check that the event ActivityStreams representation contains everything as expected.
|
||||
$this->assertArrayNotHasKey( 'address', $event_array['location'] );
|
||||
}
|
||||
}
|
|
@ -56,7 +56,7 @@ class Test_GatherPress extends WP_UnitTestCase {
|
|||
$params = array(
|
||||
'datetime_start' => '+10 days 15:00:00',
|
||||
'datetime_end' => '+10 days 16:00:00',
|
||||
'timezone' => \wp_timezone_string(),
|
||||
'timezone' => 'America/New_York',
|
||||
);
|
||||
|
||||
$event->save_datetimes( $params );
|
||||
|
@ -85,7 +85,7 @@ class Test_GatherPress extends WP_UnitTestCase {
|
|||
$params = array(
|
||||
'datetime_start' => '+10 days 15:00:00',
|
||||
'datetime_end' => '+10 days 16:00:00',
|
||||
'timezone' => \wp_timezone_string(),
|
||||
'timezone' => 'America/New_York',
|
||||
);
|
||||
$event->save_datetimes( $params );
|
||||
|
||||
|
|
Loading…
Reference in a new issue