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

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

64 lines 1.7 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 * Styles for the Fundraising Campaign widget's Pro "Updates" tab.
11 *
12 * Only Pro renders that tab, so the rules live in their own stylesheet
13 * (`src/css/fundraising-campaign-updates.scss`) instead of
14 * `fundraising-campaign.scss`. Lite adds its copy to the widget's style depends
15 * while Pro is active but does not declare `fundraising_campaign_update_styles`;
16 * a Pro that declares it adds its own byte-identical copy through
17 * `better_payment/elementor/editor/get_style_depends`. A later Lite release
18 * deletes this class and the stylesheet.
19 *
20 * @since 2.4.0
21 */
22 class ProFundraisingUpdateStyles {
23
24 /**
25 * Feature slug Pro declares once it loads the styles itself.
26 */
27 const FEATURE = 'fundraising_campaign_update_styles';
28
29 /**
30 * Lite's style handle (registered in Assets).
31 */
32 const HANDLE = 'fundraising-campaign-updates-style';
33
34 /**
35 * Whether Lite's copy of the styles should load.
36 *
37 * A free install renders only the upgrade banner in that tab, so nothing needs
38 * the styles there.
39 *
40 * @return bool
41 */
42 public static function lite_copy_applies(): bool {
43 if ( ProCompatibility::provides( self::FEATURE ) ) {
44 return false;
45 }
46
47 return (bool) apply_filters( 'better_payment/pro_enabled', false );
48 }
49
50 /**
51 * The widget's style depends, with Lite's copy appended when it applies.
52 *
53 * @param array $depends Style handles.
54 * @return array
55 */
56 public static function style_depends( array $depends ): array {
57 if ( self::lite_copy_applies() ) {
58 $depends[] = self::HANDLE;
59 }
60
61 return $depends;
62 }
63 }
64