PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.4.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.4.0
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Classes / ProPaymentFormScripts.php

ProPaymentFormScripts.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.4.0, at includes/Classes/ProPaymentFormScripts.php

53 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Classes;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 /**
10 * Lite's copy of the Payment Form quantity total for Pro layouts 4 and 5.
11 *
12 * Transitional copy for Better Payment Pro <= 1.4.3; delete when
13 * ProCompatibility::MIN_PRO_VERSION >= 1.4.4 (with src/js/payment-form-pro-quantity.js
14 * and its Assets entry).
15 * Pro copy: better-payment-pro/src/js/payment-form-quantity.js. Slug: `payment_form_pro_scripts`.
16 *
17 * Only Pro's layouts 4 and 5 render the quantity field
18 * (`.bp-custom-payment-amount-quantity`). better-payment.js used to multiply the
19 * transaction details total by it on every install. It now writes the plain amount
20 * and triggers `better_payment_amount_changed` on the document, and the listener in
21 * src/js/payment-form-pro-quantity.js multiplies. That script is a registration-time
22 * dependency of `better-payment` (it loads wherever better-payment.js does), added
23 * only while ProCompatibility::lite_copy_applies() is true. The event fires after the
24 * plain total is written, so load order does not matter.
25 *
26 * The slug is a Payment Form one rather than a User Dashboard one: the field belongs
27 * to the Payment Form widget, and the script loads with the payment form, not with
28 * the dashboard.
29 *
30 * @since 2.4.0
31 */
32 final class ProPaymentFormScripts {
33
34 /**
35 * Feature slug Pro declares once it ships the script.
36 */
37 const FEATURE = 'payment_form_pro_scripts';
38
39 /**
40 * Lite's script handle (registered in Assets).
41 */
42 const HANDLE = 'better-payment-payment-form-pro-quantity';
43
44 /**
45 * Dependencies to add to `better-payment`.
46 *
47 * @return string[]
48 */
49 public static function script_depends(): array {
50 return ProCompatibility::lite_copy_applies( self::FEATURE ) ? array( self::HANDLE ) : array();
51 }
52 }
53