PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.4.1
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.4.1
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
← All changes | includes/Campaign/CampaignStyles.php +4 -80 2.4.0 → 2.4.1 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 3 namespace Better_Payment\Lite\Campaign;
4 4
5 -use Better_Payment\Lite\Classes\ProCompatibility;
6 -
7 5 if ( ! defined( 'ABSPATH' ) ) {
8 6 exit;
9 7 }
10 8
@@ -21,14 +19,12 @@
21 19 * Without Pro, no surface loads any Pro design — not a live page, not the
22 20 * Campaign Builder, not a preview document. A campaign built from a Pro template
23 21 * keeps its theme class, and the zero-specificity `:where()` fallback tokens in
24 22 * the campaign-display stylesheet render it as a plain v2 page. A free install's
25 - * locked Pro template cards preview as their screenshot only.
23 + * locked Pro template cards preview as their screenshot only. Lite's transitional
24 + * copy of the Pro themes was deleted when ProCompatibility::MIN_PRO_VERSION
25 + * reached 1.4.4.
26 26 *
27 - * The one thing left here that is Pro's is Lite's transitional copy of the Pro
28 - * themes, loaded only for an active Pro that does not ship its own (see
29 - * {@see self::lite_copy_applies()}).
30 - *
31 27 * @since 2.4.0
32 28 */
33 29 final class CampaignStyles {
34 30
@@ -36,35 +32,9 @@
36 32 * The campaign-display stylesheet every theme builds on.
37 33 */
38 34 const DISPLAY_HANDLE = 'better-payment-campaign-display-style';
39 35
40 - // ── Transitional copy of the Pro themes ─────────────────────────────────────
41 - // Transitional copy for Better Payment Pro <= 1.4.3; delete when
42 - // ProCompatibility::MIN_PRO_VERSION >= 1.4.4. Pro copy:
43 - // better-payment-pro/src/css/campaign-themes.scss (loaded by
44 - // better-payment-pro/includes/Campaign/CampaignStyles.php). Slug:
45 - // campaign_theme_styles.
46 - // Deleting it means: FEATURE, LITE_COPY_HANDLE, LITE_COPY_PATH,
47 - // lite_copy_applies(), lite_copy_file(), the two blocks marked "Transitional
48 - // copy" below, and src/css/campaign-pro-themes.scss with its built
49 - // assets/css/campaign-pro-themes.min.css.
50 -
51 36 /**
52 - * Feature slug Pro declares on `better_payment/pro_provides`.
53 - */
54 - const FEATURE = 'campaign_theme_styles';
55 -
56 - /**
57 - * Handle of Lite's transitional copy.
58 - */
59 - const LITE_COPY_HANDLE = 'better-payment-campaign-pro-themes';
60 -
61 - /**
62 - * Lite's transitional copy, relative to the plugin directory.
63 - */
64 - const LITE_COPY_PATH = '/assets/css/campaign-pro-themes.min.css';
65 -
66 - /**
67 37 * Enqueue the theme stylesheets for one campaign surface.
68 38 *
69 39 * Call it right after the campaign-display stylesheet is enqueued or registered.
70 40 *
@@ -72,18 +42,8 @@
72 42 * Campaign Builder admin page.
73 43 * @return void
74 44 */
75 45 public static function enqueue_theme_styles( string $context = 'frontend' ): void {
76 - // Transitional copy — see lite_copy_applies().
77 - if ( self::lite_copy_applies() && file_exists( self::lite_copy_file() ) ) {
78 - wp_enqueue_style(
79 - self::LITE_COPY_HANDLE,
80 - BETTER_PAYMENT_ASSETS . self::LITE_COPY_PATH,
81 - array( self::DISPLAY_HANDLE ),
82 - (string) filemtime( self::lite_copy_file() )
83 - );
84 - }
85 -
86 46 /**
87 47 * Fires wherever a campaign's stylesheets are enqueued, so an add-on can load
88 48 * its own theme CSS after Lite's campaign-display stylesheet.
89 49 *
@@ -92,37 +52,8 @@
92 52 do_action( 'better_payment/campaign/enqueue_styles', $context );
93 53 }
94 54
95 55 /**
96 - * Whether Lite's transitional copy of the Pro themes should load.
97 - *
98 - * Transitional copy for Better Payment Pro <= 1.4.3; delete when
99 - * ProCompatibility::MIN_PRO_VERSION >= 1.4.4. Pro copy:
100 - * better-payment-pro/src/css/campaign-themes.scss. Slug: campaign_theme_styles.
101 - *
102 - * True only for an active Pro that does not declare the slug, on every
103 - * surface alike. A free install never loads it: the design is Pro's product.
104 - * Entitlement and the Pro declaration are read live on every call.
105 - *
106 - * @return bool
107 - */
108 - public static function lite_copy_applies(): bool {
109 - return ProCompatibility::lite_copy_applies( self::FEATURE );
110 - }
111 -
112 - /**
113 - * Absolute path of Lite's transitional copy.
114 - *
115 - * Transitional copy for Better Payment Pro <= 1.4.3; delete when
116 - * ProCompatibility::MIN_PRO_VERSION >= 1.4.4. Slug: campaign_theme_styles.
117 - *
118 - * @return string
119 - */
120 - private static function lite_copy_file(): string {
121 - return BETTER_PAYMENT_PATH . self::LITE_COPY_PATH;
122 - }
123 -
124 - /**
125 56 * Stylesheet URLs a standalone preview document links after campaign-display.
126 57 *
127 58 * Preview documents (the builder canvas, the template picker's lightbox) are
128 59 * built as HTML strings and never run wp_head, so they cannot use enqueues.
@@ -129,21 +60,14 @@
129 60 *
130 61 * @return string[]
131 62 */
132 63 public static function preview_stylesheets(): array {
133 - $urls = array();
134 -
135 - // Transitional copy — see lite_copy_applies().
136 - if ( self::lite_copy_applies() && file_exists( self::lite_copy_file() ) ) {
137 - $urls[] = add_query_arg( 'ver', (string) filemtime( self::lite_copy_file() ), BETTER_PAYMENT_ASSETS . self::LITE_COPY_PATH );
138 - }
139 -
140 64 /**
141 65 * Filter the extra stylesheets linked into a campaign preview document.
142 66 *
143 67 * @param string[] $urls Absolute stylesheet URLs.
144 68 */
145 - $urls = apply_filters( 'better_payment/campaign/preview_stylesheets', $urls );
69 + $urls = apply_filters( 'better_payment/campaign/preview_stylesheets', array() );
146 70
147 71 // A misbehaving callback can return anything; keep only strings.
148 72 return array_values( array_filter( (array) $urls, 'is_string' ) );
149 73 }