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/AI/Schema/CampaignSchema.php +18 -9 2.3.3 → 2.4.1 View file →
@@ -32,8 +32,18 @@
32 32 */
33 33 class CampaignSchema {
34 34
35 35 /**
36 + * Feature slug Pro declares on `better_payment/pro_provides` for the Pro-widget
37 + * guidance it ships: the generation instruction, the "Pro widgets" prompt section
38 + * on a Pro install, the three widgets' content guides, the setting-key aliases
39 + * and the video URL guard. Lite's copy was deleted when
40 + * ProCompatibility::MIN_PRO_VERSION reached 1.4.4; the slug stays as the
41 + * documented name of the hand-off.
42 + */
43 + const PRO_GUIDANCE_FEATURE = 'ai_pro_widget_guidance';
44 +
45 + /**
36 46 * Layout presets the builder understands.
37 47 *
38 48 * @return array<int, string>
39 49 */
@@ -80,10 +90,11 @@
80 90
81 91 /**
82 92 * Whether an element type is flagged Pro in the registry.
83 93 *
84 - * The `pro` flag is present whether or not Pro is installed — Lite owns all
85 - * three schemas — so this asks "is this a Pro widget", not "is it locked".
94 + * The `pro` flag is present whether or not Pro is installed — on Lite's lock
95 + * stubs and on Pro's full definitions alike — so this asks "is this a Pro
96 + * widget", not "is it locked".
86 97 */
87 98 public static function is_pro_element_type( string $type ): bool {
88 99 $schema = ElementRegistry::get( $type );
89 100
@@ -287,9 +298,9 @@
287 298 *
288 299 * @return array<string, array<string, string>>
289 300 */
290 301 private static function setting_key_aliases(): array {
291 - return apply_filters( 'better_payment/ai/setting_key_aliases', [
302 + $aliases = [
292 303 'campaign_title' => [ 'text' => 'title', 'heading' => 'title', 'label' => 'title', 'headline' => 'title', 'name' => 'title' ],
293 304 'campaign_description' => [ 'text' => 'content', 'body' => 'content', 'paragraph' => 'content', 'description' => 'content', 'story' => 'content', 'heading' => 'headline', 'title' => 'headline' ],
294 305 'donation_form' => [ 'text' => 'button_label', 'label' => 'button_label', 'cta' => 'button_label', 'button_text' => 'button_label', 'title' => 'button_label' ],
295 306 'photo' => [ 'url' => 'src', 'image' => 'src', 'source' => 'src', 'href' => 'src' ],
@@ -298,14 +309,12 @@
298 309 'donate_amount' => [ 'title' => 'headline', 'text' => 'headline' ],
299 310 'organizer' => [ 'text' => 'description', 'bio' => 'description', 'name' => 'role_title', 'title' => 'role_title' ],
300 311 'social_sharing' => [ 'title' => 'headline', 'text' => 'headline' ],
301 312 'social_links' => [ 'title' => 'headline', 'text' => 'headline' ],
302 - 'donors_wall' => [ 'title' => 'headline', 'text' => 'headline', 'heading' => 'headline', 'limit' => 'number_to_show', 'count' => 'number_to_show' ],
303 - // `faq` names its heading `heading`, not `headline` — the one element
304 - // that breaks the pattern, so the reverse alias matters here.
305 - 'faq' => [ 'title' => 'heading', 'text' => 'heading', 'headline' => 'heading', 'questions' => 'items', 'faqs' => 'items', 'list' => 'items' ],
306 - 'video' => [ 'src' => 'url', 'link' => 'url', 'video_url' => 'url', 'embed_url' => 'url' ],
307 - ] );
313 + ];
314 +
315 + // Pro supplies its widgets' aliases through the filter below.
316 + return apply_filters( 'better_payment/ai/setting_key_aliases', $aliases );
308 317 }
309 318
310 319 /**
311 320 * Resolve a possibly-aliased setting key for a type. Returns the canonical key