| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\PaymentGateways\PayPalCommerce\Banners; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class GatewaySettingPageBanner |
| 7 |
* |
| 8 |
* This class is used to render banner on gateway settings page. |
| 9 |
* |
| 10 |
* @since 2.33.0 |
| 11 |
*/ |
| 12 |
class GatewaySettingPageBanner |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Setup hook. |
| 16 |
* @since 2.33.0 |
| 17 |
* @return void |
| 18 |
*/ |
| 19 |
public function setupHook() |
| 20 |
{ |
| 21 |
// Set highest priority to render banner at the end. |
| 22 |
add_action('give-settings_settings_gateways_page', [$this, 'render'], 999); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Render banner. |
| 27 |
* @since 2.33.0 |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function render() |
| 31 |
{ |
| 32 |
// Bailout if: |
| 33 |
// - not on the gateway settings page, or |
| 34 |
// - PayPal Standard is not active. |
| 35 |
if ( |
| 36 |
'gateways-settings' !== give_get_current_setting_section() || |
| 37 |
! give_is_gateway_active('paypal') |
| 38 |
) { |
| 39 |
return; |
| 40 |
} |
| 41 |
|
| 42 |
printf( |
| 43 |
'<div class="give-paypal-migration-banner gateway-settiing-page"> |
| 44 |
<p class="message"> |
| 45 |
<span class="label">%1$s</span>%2$s <a href="https://docs.givewp.com/paypal-migrate" target="_blank">%3$s</a> |
| 46 |
<p> |
| 47 |
</div>', |
| 48 |
esc_html__('Important', 'give'), |
| 49 |
esc_html__( |
| 50 |
'PayPal Standard is no longer supported by PayPal. It is recommended to migrate to PayPal Donations.', |
| 51 |
'give' |
| 52 |
), |
| 53 |
esc_html__('How to migrate safely', 'give') |
| 54 |
); |
| 55 |
} |
| 56 |
} |
| 57 |
|