-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/paypal-standard-to-donations-migration-notice' int…
…o develop
- Loading branch information
Showing
12 changed files
with
412 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
assets/src/css/admin/paypal-donations-migration-banners.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* PayPal Donations Migration Banners | ||
* -------------------------------------------------- | ||
*/ | ||
|
||
// Banners. | ||
.give-paypal-migration-banner{ | ||
padding: 8px 14px; | ||
border-style: solid; | ||
border-width: 1px; | ||
|
||
// Common styles. | ||
.message{ | ||
font-size: 15px; | ||
|
||
.label{ | ||
border-radius: 4px; | ||
font-weight: 600; | ||
} | ||
|
||
a{ | ||
text-decoration: underline; | ||
font-weight: 600; | ||
} | ||
|
||
.icon, .label{ | ||
margin-right: 10px; | ||
} | ||
} | ||
|
||
// Banner for gateways setting page. | ||
&.gateway-settiing-page{ | ||
background-color: #F29718; | ||
border-color: #E48100; | ||
|
||
.message{ | ||
color: white; | ||
|
||
a{ | ||
color: white; | ||
} | ||
|
||
.label{ | ||
text-transform: uppercase; | ||
color: #F29718; | ||
background-color: white; | ||
padding: 3px 7px; | ||
} | ||
} | ||
} | ||
|
||
// Banner for PayPal Donations setting page. | ||
&.paypal-donations-setting-page{ | ||
background-color: #FFF0A6; | ||
color: #594B05; | ||
border-color: #ffea82; | ||
|
||
.icon{ | ||
vertical-align: middle; | ||
background: url(../images/admin/alert-triangle.svg) no-repeat center center; | ||
padding-right: 16px; | ||
} | ||
|
||
a{ | ||
color: #594B05; | ||
} | ||
} | ||
} | ||
|
||
.give-paypal-standard-to-donations-migration-banner{ | ||
p, strong{ | ||
font-size: 15px | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,8 @@ public function highlightAllFormsMenuItem() | |
|
||
/** | ||
* Load scripts | ||
* | ||
* @unreleased Set admin script and style dependencies to display PayPal Standard to Donations Migration banner. | ||
*/ | ||
public function loadScripts() | ||
{ | ||
|
@@ -87,14 +89,15 @@ public function loadScripts() | |
]; | ||
|
||
EnqueueScript::make('give-admin-donation-forms', 'assets/dist/js/give-admin-donation-forms.js') | ||
->dependencies(['give-admin-scripts']) | ||
->loadInFooter() | ||
->registerTranslations() | ||
->registerLocalizeData('GiveDonationForms', $data)->enqueue(); | ||
|
||
wp_enqueue_style( | ||
'give-admin-ui-font', | ||
'https://fonts.googleapis.com/css2?family=Open+Sans:[email protected]&display=swap', | ||
[], | ||
['give-admin-styles'], | ||
null | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/PaymentGateways/PayPalCommerce/Banners/GatewaySettingPageBanner.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Give\PaymentGateways\PayPalCommerce\Banners; | ||
|
||
/** | ||
* Class GatewaySettingPageBanner | ||
* | ||
* This class is used to render banner on gateway settings page. | ||
* | ||
* @unreleased | ||
*/ | ||
class GatewaySettingPageBanner | ||
{ | ||
/** | ||
* Setup hook. | ||
* @unreleased | ||
* @return void | ||
*/ | ||
public function setupHook() | ||
{ | ||
// Set highest priority to render banner at the end. | ||
add_action('give-settings_settings_gateways_page', [$this, 'render'], 999); | ||
} | ||
|
||
/** | ||
* Render banner. | ||
* @unreleased | ||
* @return void | ||
*/ | ||
public function render() | ||
{ | ||
// Bailout if: | ||
// - not on the gateway settings page, or | ||
// - PayPal Standard is not active. | ||
if ( | ||
'gateways-settings' !== give_get_current_setting_section() || | ||
! give_is_gateway_active('paypal') | ||
) { | ||
return; | ||
} | ||
|
||
printf( | ||
'<div class="give-paypal-migration-banner gateway-settiing-page"> | ||
<p class="message"> | ||
<span class="label">%1$s</span>%2$s <a href="https://docs.givewp.com/paypal-migrate" target="_blank">%3$s</a> | ||
<p> | ||
</div>', | ||
esc_html__('Important', 'give'), | ||
esc_html__( | ||
'PayPal Standard is no longer supported by PayPal. It is recommended to migrate to PayPal Donations.', | ||
'give' | ||
), | ||
esc_html__('How to migrate safely', 'give') | ||
); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/PaymentGateways/PayPalCommerce/Banners/PayPalDonationsSettingPageBanner.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Give\PaymentGateways\PayPalCommerce\Banners; | ||
|
||
/** | ||
* Class GatewaySettingPageBanner | ||
* | ||
* @unreleased | ||
*/ | ||
class PayPalDonationsSettingPageBanner | ||
{ | ||
/** | ||
* @unreleased | ||
*/ | ||
public function render(): string | ||
{ | ||
return sprintf( | ||
'<div class="give-paypal-migration-banner paypal-donations-setting-page"> | ||
<p class="message"> | ||
<span class="icon"></span>%1$s <a href="%2$s">%3$s</a> | ||
<p> | ||
</div>', | ||
esc_html__( | ||
'Make sure you enable PayPal Donation in the gateway settings to receive payment on your form.', | ||
'give' | ||
), | ||
esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways')), | ||
esc_html__('Go to gateway settings', 'give') | ||
); | ||
} | ||
} |
Oops, something went wrong.