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

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

67 lines 2.0 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 React admin styles for the screens only Pro renders.
11 *
12 * The transaction receipt modal, the dashboard Analytics card, the Analytics page
13 * content, the refund card and the licence page are Pro components, but their rules
14 * used to be compiled into Lite's admin stylesheet. They now live in
15 * `src/admin/styles/pro/_pro-features.scss`, built as
16 * `assets/admin/pro-features.min.css`. Pro compiles a byte-identical copy into its
17 * own admin bundle and declares `react_admin_pro_styles`; this loads Lite's copy only
18 * for an active Pro that does not. A free install renders none of those screens.
19 * A later Lite release deletes the class and the stylesheet.
20 *
21 * @since 2.4.0
22 */
23 class ProAdminStyles {
24
25 /**
26 * Feature slug Pro declares once it ships these styles itself.
27 */
28 const FEATURE = 'react_admin_pro_styles';
29
30 /**
31 * Style handle.
32 */
33 const HANDLE = 'better-payment-react-admin-pro-features';
34
35 /**
36 * Whether Lite's copy should load.
37 *
38 * @return bool
39 */
40 public static function lite_copy_applies(): bool {
41 if ( ProCompatibility::provides( self::FEATURE ) ) {
42 return false;
43 }
44
45 return (bool) apply_filters( 'better_payment/pro_enabled', false );
46 }
47
48 /**
49 * Enqueue Lite's copy after the React admin stylesheet, when it applies.
50 *
51 * @param string|int|false $version Asset version.
52 * @return void
53 */
54 public static function enqueue( $version ) {
55 if ( ! self::lite_copy_applies() ) {
56 return;
57 }
58
59 $file = file_exists( BETTER_PAYMENT_PATH . '/assets/admin/pro-features.min.css' ) ? 'pro-features.min.css' : 'pro-features.css';
60 if ( ! file_exists( BETTER_PAYMENT_PATH . '/assets/admin/' . $file ) ) {
61 return;
62 }
63
64 wp_enqueue_style( self::HANDLE, BETTER_PAYMENT_ASSETS . '/admin/' . $file, [ 'better-payment-react-admin' ], $version );
65 }
66 }
67