← All changes
|
includes/admin/charitable-core-admin-functions.php
+29
-3
1.8.11.3
→
1.8.13
View file →
| @@ -1133,10 +1133,10 @@ | ||
| 1133 | 1133 | if ( isset( $_POST['plugin'] ) ) { |
| 1134 | 1134 | $download_url = esc_url_raw( wp_unslash( $_POST['plugin'] ) ); |
| 1135 | 1135 | global $hook_suffix; |
| 1136 | 1136 | |
| 1137 | - // If the url doesn't start with 'https://www.wpcharitable.com', then return an error. | |
| 1138 | - if ( 0 !== intval( strpos( $download_url, 'https://www.wpcharitable.com' ) ) ) { | |
| 1137 | + // If the url doesn't start with 'https://www.wpcharitable.com/', then return an error. | |
| 1138 | + if ( strpos( $download_url, 'https://www.wpcharitable.com/' ) !== 0 ) { | |
| 1139 | 1139 | wp_send_json_error( |
| 1140 | 1140 | array( |
| 1141 | 1141 | 'basename' => $download_url, |
| 1142 | 1142 | 'is_activated' => false, |
| @@ -1616,8 +1616,34 @@ | ||
| 1616 | 1616 | } |
| 1617 | 1617 | return $wpchar_site_token; |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | +if ( ! function_exists( 'charitable_onboarding_app_url' ) ) : | |
| 1621 | + | |
| 1622 | + /** | |
| 1623 | + * Base URL of the centrally hosted onboarding wizard, without a trailing slash. | |
| 1624 | + * | |
| 1625 | + * Filterable so a development site can be pointed at a local instance of the | |
| 1626 | + * wizard. The wizard has no staging environment, so without this the only way | |
| 1627 | + * to exercise the hand-off between it and a site is against production. | |
| 1628 | + * | |
| 1629 | + * add_filter( 'charitable_onboarding_app_url', function () { | |
| 1630 | + * return 'http://127.0.0.1:8131'; | |
| 1631 | + * } ); | |
| 1632 | + * | |
| 1633 | + * Unfiltered the return value is unchanged from the previously hardcoded | |
| 1634 | + * literal, so this is a no-op in production. | |
| 1635 | + * | |
| 1636 | + * @since 1.8.12.4 | |
| 1637 | + * | |
| 1638 | + * @return string | |
| 1639 | + */ | |
| 1640 | + function charitable_onboarding_app_url() { | |
| 1641 | + return untrailingslashit( apply_filters( 'charitable_onboarding_app_url', 'https://app.wpcharitable.com' ) ); | |
| 1642 | + } | |
| 1643 | + | |
| 1644 | +endif; | |
| 1645 | + | |
| 1620 | 1646 | if ( ! function_exists( 'charitable_get_onboarding_url' ) ) : |
| 1621 | 1647 | |
| 1622 | 1648 | /** |
| 1623 | 1649 | * Get the URL for the first screen of the onboarding process. |
| @@ -1642,9 +1668,9 @@ | ||
| 1642 | 1668 | base64_encode( get_admin_url( null, 'admin.php') ) // phpcs:ignore |
| 1643 | 1669 | ), |
| 1644 | 1670 | 'update_to_pro_url' => 'https://app.charitable.com/upgrade-free-to-pro?api_token=REPLACE_API_TOKEN&license_key=REPLACE_LICENSE_KEY&oth=11ecbadab9561202d33b5ffb8405f9cb9b783af17b52c4b16e16bd8fbbd6cdccbd2a5445c2cb456cb11cdd555471c19e5e2ad446450df2f4e0fc70e410a814d4&endpoint=&siteurl=' . $current_site_url . '/wp-admin/', |
| 1645 | 1671 | ), |
| 1646 | - 'https://app.wpcharitable.com/setup-wizard-charitable_lite' | |
| 1672 | + charitable_onboarding_app_url() . '/setup-wizard-charitable_lite' | |
| 1647 | 1673 | ); |
| 1648 | 1674 | } |
| 1649 | 1675 | |
| 1650 | 1676 | endif; |