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 / ProUserDashboardAssets.php

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

78 lines 2.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 User Dashboard script and styles for the cards only Pro renders.
11 *
12 * Transitional copy for Better Payment Pro <= 1.4.3; delete when
13 * ProCompatibility::MIN_PRO_VERSION >= 1.4.4 (with src/js/user-dashboard-pro.js,
14 * src/css/user-dashboard-pro.scss and their Assets entries).
15 * Pro copy: better-payment-pro/src/js/user-dashboard.js (slug `user_dashboard_pro_scripts`)
16 * and better-payment-pro/src/css/user-dashboard.scss (slug `user_dashboard_pro_styles`).
17 *
18 * Pro's templates and block panels render the analytics report box with its custom
19 * date range modal and datepicker, and the recurring and split subscription cards
20 * with their "View All" button. Their handlers used to live in Lite's common.js and
21 * admin.js, their rules in common.scss and admin.scss, all of which load on free
22 * installs too. They are now separate handles, each attached as a registration-time
23 * dependency of the handle that carried the code before, and only while
24 * ProCompatibility::lite_copy_applies() is true:
25 *
26 * - the script on `better-payment-common-script`, so it loads wherever Lite's
27 * common.js does (the User Dashboard widget and block);
28 * - the stylesheet on `better-payment-admin-style`, and it depends on
29 * `better-payment-common-style` itself, so it prints between common.min.css and
30 * admin.min.css, where its rules used to be.
31 *
32 * The PHP gate is the only switch: a free install never loads either file, and a Pro
33 * that declares the slugs loads its own copies instead. Neither file checks anything
34 * at runtime.
35 *
36 * @since 2.4.0
37 */
38 final class ProUserDashboardAssets {
39
40 /**
41 * Feature slug Pro declares once it ships the script.
42 */
43 const SCRIPTS_FEATURE = 'user_dashboard_pro_scripts';
44
45 /**
46 * Feature slug Pro declares once it ships the styles.
47 */
48 const STYLES_FEATURE = 'user_dashboard_pro_styles';
49
50 /**
51 * Lite's script handle (registered in Assets).
52 */
53 const SCRIPT_HANDLE = 'better-payment-user-dashboard-pro-script';
54
55 /**
56 * Lite's style handle (registered in Assets).
57 */
58 const STYLE_HANDLE = 'better-payment-user-dashboard-pro-style';
59
60 /**
61 * Dependencies to add to `better-payment-common-script`.
62 *
63 * @return string[]
64 */
65 public static function script_depends(): array {
66 return ProCompatibility::lite_copy_applies( self::SCRIPTS_FEATURE ) ? array( self::SCRIPT_HANDLE ) : array();
67 }
68
69 /**
70 * Dependencies to add to `better-payment-admin-style`.
71 *
72 * @return string[]
73 */
74 public static function style_depends(): array {
75 return ProCompatibility::lite_copy_applies( self::STYLES_FEATURE ) ? array( self::STYLE_HANDLE ) : array();
76 }
77 }
78