| 1 |
<?php |
| 2 |
/** |
| 3 |
* OpenStation — feedback module bootstrap. |
| 4 |
* |
| 5 |
* The deactivation feedback dialog: one optional question asked when a |
| 6 |
* site admin deactivates OpenStation, forwarded server-side to the |
| 7 |
* intake plugin on openstation.blog. Nothing in this module writes to the site — no |
| 8 |
* option, no user meta, no transient, no table — which is why |
| 9 |
* `docs/data-model.md` has no row for it. The only state is the |
| 10 |
* submission itself, and it leaves the site the moment it is sent. |
| 11 |
* |
| 12 |
* Consent is per submission: nothing goes out unless the admin clicks |
| 13 |
* "Send", and both dialog buttons deactivate the plugin either way. |
| 14 |
* |
| 15 |
* Loaded unconditionally from `desktop-mode.php` (not inside the |
| 16 |
* admin-modules gate) so the REST route registers on REST requests. |
| 17 |
* |
| 18 |
* @package OpenStation |
| 19 |
*/ |
| 20 |
|
| 21 |
defined( 'ABSPATH' ) || exit; |
| 22 |
|
| 23 |
/** |
| 24 |
* Where a submission is forwarded: the OpenStation Feedback Intake |
| 25 |
* plugin on openstation.blog, the site the About tab already reads |
| 26 |
* (`OPENSTATION_ABOUT_SITE_URL` in `includes/about-feed.php`), so the |
| 27 |
* disclosure names a host users have already seen named. Filterable |
| 28 |
* through `openstation_deactivation_feedback_endpoint` for hosts that |
| 29 |
* run their own intake. |
| 30 |
*/ |
| 31 |
const OPENSTATION_FEEDBACK_ENDPOINT = 'https://openstation.blog/wp-json/openstation-feedback/v1/deactivation'; |
| 32 |
|
| 33 |
/** |
| 34 |
* Whether the deactivation feedback dialog is on for this site. |
| 35 |
* |
| 36 |
* Gates everything: the script on the Plugins screen, the Plugins |
| 37 |
* app's config block, and the REST route's permission callback. A |
| 38 |
* host that returns `false` here ships no dialog and answers 403 on |
| 39 |
* the route. |
| 40 |
* |
| 41 |
* @return bool |
| 42 |
*/ |
| 43 |
function openstation_deactivation_feedback_enabled() { |
| 44 |
/** |
| 45 |
* Filters whether the deactivation feedback dialog is enabled. |
| 46 |
* |
| 47 |
* @param bool $enabled Default true. |
| 48 |
*/ |
| 49 |
return (bool) apply_filters( 'openstation_deactivation_feedback_enabled', true ); |
| 50 |
} |
| 51 |
|
| 52 |
require_once __DIR__ . '/deactivation.php'; |
| 53 |
require_once __DIR__ . '/rest.php'; |
| 54 |
|