| @@ -250,9 +250,11 @@ | ||
| 250 | 250 | 'loadedAddons' => $this->getLoadedAddonIds(), |
| 251 | 251 | 'registeredAddons' => $this->getRegisteredAddonIds(), |
| 252 | 252 | 'version' => defined( 'FORGE12_OPTIN_VERSION' ) ? FORGE12_OPTIN_VERSION : '0.0.0', |
| 253 | 253 | 'emailEditorUrl' => admin_url( 'admin.php?page=f12-doi-admin#/email-templates' ), |
| 254 | - 'upgradeUrl' => 'https://www.forge12.com', | |
| 254 | + 'upgradeUrl' => $this->productUrl( 'admin-upgrade', 'https://www.forge12.com' ), | |
| 255 | + 'supportUrl' => $this->supportUrl(), | |
| 256 | + 'feedbackUrl' => $this->feedbackUrl(), | |
| 255 | 257 | 'adminUrl' => admin_url(), |
| 256 | 258 | // Nonce for the legacy admin-ajax `doi_export_consent` |
| 257 | 259 | // handler. The handler hard-requires `_wpnonce` in |
| 258 | 260 | // `$_REQUEST` keyed on action `doi_consent_export`; without |
| @@ -276,8 +278,43 @@ | ||
| 276 | 278 | */ |
| 277 | 279 | $config = apply_filters( 'f12_doi_admin_localize_data', $config ); |
| 278 | 280 | |
| 279 | 281 | wp_localize_script( 'doi-admin-ui', 'doiAdmin', $config ); |
| 282 | + } | |
| 283 | + | |
| 284 | + /** | |
| 285 | + * Product-site link for the SPA. | |
| 286 | + * | |
| 287 | + * The URL builders live in core/feedback.php, a plain-function file in the | |
| 288 | + * legacy namespace rather than an autoloaded class. The guard is not | |
| 289 | + * ceremony: this controller is also exercised by tests that do not load that | |
| 290 | + * file, and a fatal there would be a poor trade for a marketing link. | |
| 291 | + * | |
| 292 | + * @param string $from Entry point recorded on the link. | |
| 293 | + * @param string $fallback Used when core/feedback.php is not loaded. | |
| 294 | + */ | |
| 295 | + private function productUrl( string $from, string $fallback ): string { | |
| 296 | + $fn = '\\forge12\\contactform7\\CF7DoubleOptIn\\get_product_url'; | |
| 297 | + | |
| 298 | + return function_exists( $fn ) ? esc_url_raw( $fn( $from ) ) : $fallback; | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * Support link for the SPA. Empty when unavailable, so the UI can hide it. | |
| 303 | + */ | |
| 304 | + private function supportUrl(): string { | |
| 305 | + $fn = '\\forge12\\contactform7\\CF7DoubleOptIn\\get_support_url'; | |
| 306 | + | |
| 307 | + return function_exists( $fn ) ? esc_url_raw( $fn( 'admin-spa' ) ) : ''; | |
| 308 | + } | |
| 309 | + | |
| 310 | + /** | |
| 311 | + * Feedback link for the SPA. Empty when unavailable, so the UI can hide it. | |
| 312 | + */ | |
| 313 | + private function feedbackUrl(): string { | |
| 314 | + $fn = '\\forge12\\contactform7\\CF7DoubleOptIn\\get_feedback_url'; | |
| 315 | + | |
| 316 | + return function_exists( $fn ) ? esc_url_raw( $fn( 'admin-spa' ) ) : ''; | |
| 280 | 317 | } |
| 281 | 318 | |
| 282 | 319 | /** |
| 283 | 320 | * Feed the active locale's "double-opt-in" translations to wp.i18n so the |