| 1 |
<?php |
| 2 |
|
| 3 |
namespace Better_Payment\Lite\Campaign\Elements; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* Lock stubs for the three Pro-only campaign elements — Donors Wall, FAQ and |
| 11 |
* Video. |
| 12 |
* |
| 13 |
* This is all Lite registers for them. Better Payment Pro owns their control |
| 14 |
* schemas and default settings (`better-payment-pro/includes/Campaign/ProElementSchemas.php`) |
| 15 |
* and replaces these entries on `better_payment/campaign_elements`. |
| 16 |
* |
| 17 |
* A stub carries only what a free install needs to show the element as a locked |
| 18 |
* Pro widget: a label and icon for the palette card, the `pro` flag every lock |
| 19 |
* affordance keys on, and a short feature list for the Customize panel's upgrade |
| 20 |
* banner. `settingsSchema` and `defaultSettings` are empty on purpose: |
| 21 |
* |
| 22 |
* - a free user can still drop, select, move and delete the element, and the |
| 23 |
* canvas shows {@see ProElementPreview}'s mock; |
| 24 |
* - a newly added element saves with no settings |
| 25 |
* ({@see \Better_Payment\Lite\Campaign\MetaBox::enforce_pro_entitlement()}), |
| 26 |
* and an existing one keeps its stored settings verbatim, so reactivating Pro |
| 27 |
* restores a lapsed subscriber's configuration exactly. |
| 28 |
* |
| 29 |
* The `pro` flag is a description of the element, never an entitlement. Locking |
| 30 |
* is decided everywhere by the live `better_payment/pro_enabled` filter. |
| 31 |
* |
| 32 |
* @since 2.4.0 |
| 33 |
*/ |
| 34 |
class ProElementStubs { |
| 35 |
|
| 36 |
/** |
| 37 |
* The three stubs, keyed by element type. |
| 38 |
* |
| 39 |
* @return array<string, array> |
| 40 |
*/ |
| 41 |
public static function get_all(): array { |
| 42 |
return [ |
| 43 |
'donors_wall' => self::stub( |
| 44 |
__( 'Donors Wall', 'better-payment' ), |
| 45 |
'groups', |
| 46 |
[ |
| 47 |
__( 'Shows real donors from your campaign payments', 'better-payment' ), |
| 48 |
__( 'List, grid or auto-scrolling ticker layouts', 'better-payment' ), |
| 49 |
__( 'Choose which donor details and totals to show', 'better-payment' ), |
| 50 |
] |
| 51 |
), |
| 52 |
'faq' => self::stub( |
| 53 |
__( 'FAQ', 'better-payment' ), |
| 54 |
'editor-help', |
| 55 |
[ |
| 56 |
__( 'Answer the questions donors ask before giving', 'better-payment' ), |
| 57 |
__( 'Collapsible accordion or open-list styles', 'better-payment' ), |
| 58 |
__( 'Add, reorder and pre-open as many questions as you need', 'better-payment' ), |
| 59 |
] |
| 60 |
), |
| 61 |
'video' => self::stub( |
| 62 |
__( 'Video', 'better-payment' ), |
| 63 |
'format-video', |
| 64 |
[ |
| 65 |
__( 'Embed YouTube, Vimeo or a video from your Media Library', 'better-payment' ), |
| 66 |
__( 'Responsive 16:9, 4:3, 1:1 and 21:9 players', 'better-payment' ), |
| 67 |
__( 'Autoplay, loop, mute and start-time controls', 'better-payment' ), |
| 68 |
] |
| 69 |
), |
| 70 |
]; |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* One stub definition. |
| 75 |
* |
| 76 |
* @param string $label Palette and settings-panel label. |
| 77 |
* @param string $icon Dashicons suffix. |
| 78 |
* @param string[] $features Upgrade-banner feature list. |
| 79 |
* @return array |
| 80 |
*/ |
| 81 |
private static function stub( string $label, string $icon, array $features ): array { |
| 82 |
return [ |
| 83 |
'label' => $label, |
| 84 |
'icon' => $icon, |
| 85 |
'pro' => true, |
| 86 |
'proFeatures' => $features, |
| 87 |
'settingsSchema' => [], |
| 88 |
'defaultSettings' => [], |
| 89 |
]; |
| 90 |
} |
| 91 |
} |
| 92 |
|