Skip to content

Commit c4ea1d9

Browse files
authored
Merge pull request #3622 from dparker1005/paypal-wpp-rename-and-ppe-deprecation
Rename WPP gateway slug (paypal → paypalwpp) and deprecate PayPal Express
2 parents 9829c9a + 325ee1f commit c4ea1d9

13 files changed

Lines changed: 194 additions & 52 deletions

adminpages/paymentsettings.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,13 @@
228228
}
229229

230230
// Special case for deprecated gateways.
231-
if ( in_array( $gateway_slug, $deprecated_gateways, true ) && $gateway_slug === pmpro_getOption( 'gateway' ) ) {
232-
$gateway_status_html = '<span class="pmpro_tag pmpro_tag-has_icon pmpro_tag-error">' . esc_html__( 'Enabled (Not Supported)', 'paid-memberships-pro' ) . '</span>';
231+
if ( in_array( $gateway_slug, $deprecated_gateways, true ) ) {
232+
if ( pmpro_getOption( 'gateway' ) === $gateway_slug ) {
233+
$gateway_status_html = '<span class="pmpro_tag pmpro_tag-has_icon pmpro_tag-error">' . esc_html__( 'Enabled (Not Supported)', 'paid-memberships-pro' ) . '</span>';
234+
} elseif ( $gateway_status_html !== esc_html__( '&#8212;', 'paid-memberships-pro' ) ) {
235+
// Gateway is enabled (e.g. via Add PayPal Express Add On) but deprecated.
236+
$gateway_status_html .= ' <span class="pmpro_tag pmpro_tag-has_icon pmpro_tag-error">' . esc_html__( 'Not Supported', 'paid-memberships-pro' ) . '</span>';
237+
}
233238
}
234239

235240
echo wp_kses_post( $gateway_status_html );
@@ -349,6 +354,9 @@
349354
?>
350355
</p>
351356
<p>
357+
<?php if ( 'paypalexpress' === $edit_gateway ) { ?>
358+
<a class="button button-secondary" href="https://www.paidmembershipspro.com/paypal-express-deprecation-hub/?utm_source=plugin&utm_medium=pmpro-paymentsettings&utm_campaign=blog&utm_content=paypal-express-deprecation" target="_blank" rel="nofollow noopener"><?php esc_html_e('Learn More', 'paid-memberships-pro' ); ?></a>
359+
<?php } ?>
352360
<a class="button button-secondary" href="https://www.paidmembershipspro.com/documentation/compatibility/incompatible-deprecated-add-ons/?utm_source=plugin&utm_medium=pmpro-paymentsettings&utm_campaign=documentation&utm_content=deprecated-gateways#deprecated-payment-gateways" target="_blank" rel="nofollow noopener"><?php esc_html_e('About Deprecated Gateways', 'paid-memberships-pro' ); ?></a>
353361
<a class="button" href="https://www.paidmembershipspro.com/switching-payment-gateways/?utm_source=plugin&utm_medium=pmpro-paymentsettings&utm_campaign=blog&utm_content=switching-payment-gateways" target="_blank" rel="nofollow noopener"><?php esc_html_e('How to Switch Payment Gateways', 'paid-memberships-pro' ); ?></a>
354362
</p>

classes/class-pmpro-site-health.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ public function get_constants() {
662662
'braintree' => [
663663
'PMPRO_BRAINTREE_WEBHOOK_DEBUG' => __( 'Braintree Webhook Debug Mode', 'paid-memberships-pro' ),
664664
],
665-
'paypal' => [
665+
'paypalwpp' => [
666666
'PMPRO_IPN_DEBUG' => __( 'PayPal IPN Debug Mode', 'paid-memberships-pro' ),
667667
],
668668
'paypalexpress' => [

classes/class-pmpro-wisdom-integration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public function get_gateway_info() {
420420
'braintree' => get_option( 'pmpro_braintree_merchantid' ),
421421
'cybersource' => get_option( 'pmpro_cybersource_merchantid' ),
422422
'payflowpro' => get_option( 'pmpro_payflow_user' ),
423-
'paypal' => get_option( 'pmpro_apiusername' ),
423+
'paypalwpp' => get_option( 'pmpro_apiusername' ),
424424
'paypalexpress' => get_option( 'paypalexpress_skip_confirmation' ),
425425
'paypalstandard' => get_option( 'gateway_email' ),
426426
'stripe' => $stripe_using_legacy_keys || $stripe_using_api_keys || $stripe_has_connect_credentials,

classes/gateways/class.pmprogateway_paypalexpress.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static function pmpro_payment_option_fields($values, $gateway)
153153
{
154154
_deprecated_function( __METHOD__, '3.5' );
155155
?>
156-
<tr class="pmpro_settings_divider gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypal" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
156+
<tr class="pmpro_settings_divider gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
157157
<td colspan="2">
158158
<hr />
159159
<h2 class="title"><?php esc_html_e( 'PayPal Settings', 'paid-memberships-pro' ); ?></h2>
@@ -177,39 +177,39 @@ static function pmpro_payment_option_fields($values, $gateway)
177177
</div>
178178
</td>
179179
</tr>
180-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypal" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
180+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
181181
<th scope="row" valign="top">
182182
<label for="gateway_email"><?php esc_html_e('Gateway Account Email', 'paid-memberships-pro' );?></label>
183183
</th>
184184
<td>
185185
<input type="text" id="gateway_email" name="gateway_email" value="<?php echo esc_attr($values['gateway_email'])?>" class="regular-text code" />
186186
</td>
187187
</tr>
188-
<tr class="gateway gateway_paypal gateway_paypalexpress" <?php if($gateway != "paypal" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
188+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
189189
<th scope="row" valign="top">
190190
<label for="apiusername"><?php esc_html_e('API Username', 'paid-memberships-pro' );?></label>
191191
</th>
192192
<td>
193193
<input type="text" id="apiusername" name="apiusername" value="<?php echo esc_attr($values['apiusername'])?>" class="regular-text code" />
194194
</td>
195195
</tr>
196-
<tr class="gateway gateway_paypal gateway_paypalexpress" <?php if($gateway != "paypal" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
196+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
197197
<th scope="row" valign="top">
198198
<label for="apipassword"><?php esc_html_e('API Password', 'paid-memberships-pro' );?></label>
199199
</th>
200200
<td>
201201
<input type="text" id="apipassword" name="apipassword" value="<?php echo esc_attr($values['apipassword'])?>" autocomplete="off" class="regular-text code pmpro-admin-secure-key" />
202202
</td>
203203
</tr>
204-
<tr class="gateway gateway_paypal gateway_paypalexpress" <?php if($gateway != "paypal" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
204+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
205205
<th scope="row" valign="top">
206206
<label for="apisignature"><?php esc_html_e('API Signature', 'paid-memberships-pro' );?></label>
207207
</th>
208208
<td>
209209
<input type="text" id="apisignature" name="apisignature" value="<?php echo esc_attr($values['apisignature'])?>" class="regular-text code" />
210210
</td>
211211
</tr>
212-
<tr class="gateway gateway_paypal gateway_paypalexpress" <?php if($gateway != "paypal" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
212+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress") { ?>style="display: none;"<?php } ?>>
213213
<th scope="row" valign="top">
214214
<label for="paypalexpress_skip_confirmation"><?php esc_html_e('Confirmation Step', 'paid-memberships-pro' );?></label>
215215
</th>
@@ -220,7 +220,7 @@ static function pmpro_payment_option_fields($values, $gateway)
220220
</select>
221221
</td>
222222
</tr>
223-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypal" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
223+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard" <?php if($gateway != "paypalwpp" && $gateway != "paypalexpress" && $gateway != "paypalstandard") { ?>style="display: none;"<?php } ?>>
224224
<th scope="row" valign="top">
225225
<label><?php esc_html_e('IPN Handler URL', 'paid-memberships-pro' );?></label>
226226
</th>
@@ -248,7 +248,7 @@ public static function show_settings_fields() {
248248
);
249249
?>
250250
</p>
251-
<div id="pmpro_paypal" class="pmpro_section" data-visibility="shown" data-activated="true">
251+
<div id="pmpro_paypalexpress" class="pmpro_section" data-visibility="shown" data-activated="true">
252252
<div class="pmpro_section_toggle">
253253
<button class="pmpro_section-toggle-button" type="button" aria-expanded="true">
254254
<span class="dashicons dashicons-arrow-up-alt2"></span>
@@ -258,39 +258,39 @@ public static function show_settings_fields() {
258258
<div class="pmpro_section_inside">
259259
<table class="form-table">
260260
<tbody>
261-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard">
261+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard">
262262
<th scope="row" valign="top">
263263
<label for="gateway_email"><?php esc_html_e('Gateway Account Email', 'paid-memberships-pro' );?></label>
264264
</th>
265265
<td>
266266
<input type="text" id="gateway_email" name="gateway_email" value="<?php echo esc_attr( get_option( 'pmpro_gateway_email' ) ); ?>" class="regular-text code" />
267267
</td>
268268
</tr>
269-
<tr class="gateway gateway_paypal gateway_paypalexpress">
269+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress">
270270
<th scope="row" valign="top">
271271
<label for="apiusername"><?php esc_html_e('API Username', 'paid-memberships-pro' );?></label>
272272
</th>
273273
<td>
274274
<input type="text" id="apiusername" name="apiusername" value="<?php echo esc_attr( get_option( 'pmpro_apiusername' ) ); ?>" class="regular-text code" />
275275
</td>
276276
</tr>
277-
<tr class="gateway gateway_paypal gateway_paypalexpress">
277+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress">
278278
<th scope="row" valign="top">
279279
<label for="apipassword"><?php esc_html_e('API Password', 'paid-memberships-pro' );?></label>
280280
</th>
281281
<td>
282282
<input type="text" id="apipassword" name="apipassword" value="<?php echo esc_attr( get_option( 'pmpro_apipassword' ) ); ?>" autocomplete="off" class="regular-text code pmpro-admin-secure-key" />
283283
</td>
284284
</tr>
285-
<tr class="gateway gateway_paypal gateway_paypalexpress">
285+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress">
286286
<th scope="row" valign="top">
287287
<label for="apisignature"><?php esc_html_e('API Signature', 'paid-memberships-pro' );?></label>
288288
</th>
289289
<td>
290290
<input type="text" id="apisignature" name="apisignature" value="<?php echo esc_attr( get_option( 'pmpro_apisignature' ) ); ?>" class="regular-text code" />
291291
</td>
292292
</tr>
293-
<tr class="gateway gateway_paypal gateway_paypalexpress">
293+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress">
294294
<th scope="row" valign="top">
295295
<label for="paypalexpress_skip_confirmation"><?php esc_html_e('Confirmation Step', 'paid-memberships-pro' );?></label>
296296
</th>
@@ -301,7 +301,7 @@ public static function show_settings_fields() {
301301
</select>
302302
</td>
303303
</tr>
304-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard">
304+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard">
305305
<th scope="row" valign="top">
306306
<label><?php esc_html_e('IPN Handler URL', 'paid-memberships-pro' );?></label>
307307
</th>

classes/gateways/class.pmprogateway_paypalstandard.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ static function getGatewayOptions()
9494
static function pmpro_payment_options($options)
9595
{
9696
_deprecated_function( __METHOD__, '3.5' );
97-
//get stripe options
98-
$paypal_options = PMProGateway_paypalexpress::getGatewayOptions();
97+
if ( class_exists( 'PMProGateway_paypalexpress' ) ) {
98+
//get options
99+
$paypal_options = PMProGateway_paypalexpress::getGatewayOptions();
99100

100-
//merge with others.
101-
$options = array_merge($paypal_options, $options);
101+
//merge with others.
102+
$options = array_merge($paypal_options, $options);
103+
}
102104

103105
return $options;
104106
}
@@ -111,7 +113,9 @@ static function pmpro_payment_options($options)
111113
*/
112114
static function pmpro_payment_option_fields($values, $gateway) {
113115
_deprecated_function( __FUNCTION__, '3.1', 'PMProGateway_paypalexpress::pmpro_payment_option_fields()' );
114-
PMProGateway_paypalexpress::pmpro_payment_option_fields( $values, $gateway );
116+
if ( class_exists( 'PMProGateway_paypalexpress' ) ) {
117+
PMProGateway_paypalexpress::pmpro_payment_option_fields( $values, $gateway );
118+
}
115119
}
116120

117121
/**
@@ -149,15 +153,15 @@ public static function show_settings_fields() {
149153
</div>
150154
</td>
151155
</tr>
152-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard">
156+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard">
153157
<th scope="row" valign="top">
154158
<label for="gateway_email"><?php esc_html_e('Gateway Account Email', 'paid-memberships-pro' );?></label>
155159
</th>
156160
<td>
157161
<input type="text" id="gateway_email" name="gateway_email" value="<?php echo esc_attr( get_option( 'pmpro_gateway_email' ) ); ?>" class="regular-text code" />
158162
</td>
159163
</tr>
160-
<tr class="gateway gateway_paypal gateway_paypalexpress gateway_paypalstandard">
164+
<tr class="gateway gateway_paypalwpp gateway_paypalexpress gateway_paypalstandard">
161165
<th scope="row" valign="top">
162166
<label><?php esc_html_e('IPN Handler URL', 'paid-memberships-pro' );?></label>
163167
</th>

0 commit comments

Comments
 (0)