| @@ -65,8 +65,24 @@ | ||
| 65 | 65 | public function showFluentAddOns() |
| 66 | 66 | { |
| 67 | 67 | wp_enqueue_script('fluentform-modules'); |
| 68 | 68 | |
| 69 | + $addOns = $this->getRegisteredAddOns(); | |
| 70 | + | |
| 71 | + wp_localize_script('fluentform-modules', 'fluent_addon_modules', [ | |
| 72 | + 'addons' => $addOns, | |
| 73 | + 'has_pro' => defined('FLUENTFORMPRO'), | |
| 74 | + 'addOnModule_str' => TranslationString::getAddOnModuleI18n(), | |
| 75 | + ]); | |
| 76 | + | |
| 77 | + wpFluentForm('view')->render('admin.addons.list', []); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * The registry the Add-on Modules screen renders from, so the status writer can validate against the same source. | |
| 82 | + */ | |
| 83 | + public function getRegisteredAddOns() | |
| 84 | + { | |
| 69 | 85 | $addOns = apply_filters_deprecated( |
| 70 | 86 | 'fluentform_global_addons', |
| 71 | 87 | [ |
| 72 | 88 | [], |
| @@ -89,21 +105,15 @@ | ||
| 89 | 105 | if (!defined('FLUENTFORMPRO')) { |
| 90 | 106 | $addOns = array_merge($addOns, $this->getPremiumAddOns()); |
| 91 | 107 | } |
| 92 | 108 | |
| 93 | - wp_localize_script('fluentform-modules', 'fluent_addon_modules', [ | |
| 94 | - 'addons' => $addOns, | |
| 95 | - 'has_pro' => defined('FLUENTFORMPRO'), | |
| 96 | - 'addOnModule_str' => TranslationString::getAddOnModuleI18n(), | |
| 97 | - ]); | |
| 98 | - | |
| 99 | - wpFluentForm('view')->render('admin.addons.list', []); | |
| 109 | + return $addOns; | |
| 100 | 110 | } |
| 101 | 111 | |
| 102 | 112 | public function getPremiumAddOns() |
| 103 | 113 | { |
| 104 | 114 | $purchaseUrl = fluentform_upgrade_url(); |
| 105 | - return [ | |
| 115 | + $addOns = [ | |
| 106 | 116 | 'paypal' => [ |
| 107 | 117 | 'title' => __('PayPal', 'fluentform'), |
| 108 | 118 | 'description' => __('Accept Payments via paypal as a part of your form submission', 'fluentform'), |
| 109 | 119 | 'logo' => fluentFormMix('img/integrations/paypal.png'), |
| @@ -439,8 +449,15 @@ | ||
| 439 | 449 | 'purchase_url' => $purchaseUrl, |
| 440 | 450 | 'category' => 'crm', |
| 441 | 451 | ], |
| 442 | 452 | ]; |
| 453 | + | |
| 454 | + foreach ($addOns as $key => &$addOn) { | |
| 455 | + $feature = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $key)); | |
| 456 | + $addOn['purchase_url'] = fluentform_upgrade_url('feature_lock_' . $feature); | |
| 457 | + } | |
| 458 | + | |
| 459 | + return $addOns; | |
| 443 | 460 | } |
| 444 | 461 | |
| 445 | 462 | /** |
| 446 | 463 | * Show the suggested plugins list. |