| 1 |
<?php |
| 2 |
/** |
| 3 |
* OpenStation — feedback module bootstrap. |
| 4 |
* |
| 5 |
* Two dialogs, both forwarded server-side to the intake plugin on |
| 6 |
* openstation.blog: |
| 7 |
* |
| 8 |
* - The deactivation feedback dialog (`deactivation.php`, `rest.php`): |
| 9 |
* one optional question asked when a site admin deactivates |
| 10 |
* OpenStation. Writes nothing to the site — no option, no user meta, |
| 11 |
* no transient, no table — which is why `docs/data-model.md` has no |
| 12 |
* row for it. The only state is the submission itself, and it |
| 13 |
* leaves the site the moment it is sent. |
| 14 |
* - Usage feedback (`usage.php`): once a user has had OpenStation on |
| 15 |
* for a while, the shell asks whether they have two minutes to say |
| 16 |
* how it is going, and a yes opens a short optional form. Its only |
| 17 |
* state on the site is the `usage-feedback` slug in the seen-intros |
| 18 |
* registry. |
| 19 |
* |
| 20 |
* Consent is per submission: nothing goes out unless the user clicks |
| 21 |
* "Send", and every other way out of either dialog sends nothing. |
| 22 |
* |
| 23 |
* Loaded unconditionally from `desktop-mode.php` (not inside the |
| 24 |
* admin-modules gate) so the REST route registers on REST requests. |
| 25 |
* |
| 26 |
* @package OpenStation |
| 27 |
*/ |
| 28 |
|
| 29 |
defined( 'ABSPATH' ) || exit; |
| 30 |
|
| 31 |
/** |
| 32 |
* Where a submission is forwarded: the OpenStation Feedback Intake |
| 33 |
* plugin on openstation.blog, the site the About tab already reads |
| 34 |
* (`OPENSTATION_ABOUT_SITE_URL` in `includes/about-feed.php`), so the |
| 35 |
* disclosure names a host users have already seen named. Filterable |
| 36 |
* through `openstation_deactivation_feedback_endpoint` for hosts that |
| 37 |
* run their own intake. |
| 38 |
*/ |
| 39 |
const OPENSTATION_FEEDBACK_ENDPOINT = 'https://openstation.blog/wp-json/openstation-feedback/v1/deactivation'; |
| 40 |
|
| 41 |
/** |
| 42 |
* Where a usage feedback submission is forwarded: the same intake |
| 43 |
* plugin, its `usage` route. Filterable through |
| 44 |
* `openstation_usage_feedback_endpoint`. |
| 45 |
*/ |
| 46 |
const OPENSTATION_USAGE_FEEDBACK_ENDPOINT = 'https://openstation.blog/wp-json/openstation-feedback/v1/usage'; |
| 47 |
|
| 48 |
/** |
| 49 |
* Whether the deactivation feedback dialog is on for this site. |
| 50 |
* |
| 51 |
* Gates everything: the script on the Plugins screen, the Plugins |
| 52 |
* app's config block, and the REST route's permission callback. A |
| 53 |
* host that returns `false` here ships no dialog and answers 403 on |
| 54 |
* the route. |
| 55 |
* |
| 56 |
* @return bool |
| 57 |
*/ |
| 58 |
function openstation_deactivation_feedback_enabled() { |
| 59 |
/** |
| 60 |
* Filters whether the deactivation feedback dialog is enabled. |
| 61 |
* |
| 62 |
* @param bool $enabled Default true. |
| 63 |
*/ |
| 64 |
return (bool) apply_filters( 'openstation_deactivation_feedback_enabled', true ); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Whether the usage feedback prompt is on for this site. |
| 69 |
* |
| 70 |
* Gates the shell config key that shows the prompt and the REST |
| 71 |
* route's permission callback. A host that returns `false` here |
| 72 |
* ships no prompt and answers 403 on the route. |
| 73 |
* |
| 74 |
* @return bool |
| 75 |
*/ |
| 76 |
function openstation_usage_feedback_enabled() { |
| 77 |
/** |
| 78 |
* Filters whether the usage feedback prompt is enabled. |
| 79 |
* |
| 80 |
* @param bool $enabled Default true. |
| 81 |
*/ |
| 82 |
return (bool) apply_filters( 'openstation_usage_feedback_enabled', true ); |
| 83 |
} |
| 84 |
|
| 85 |
require_once __DIR__ . '/deactivation.php'; |
| 86 |
require_once __DIR__ . '/rest.php'; |
| 87 |
require_once __DIR__ . '/usage.php'; |
| 88 |
|