| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\ThirdPartySupport\Elementor\Actions; |
| 4 |
|
| 5 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\DonationHistoryWidget; |
| 6 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\DonationReceiptWidget; |
| 7 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveDonorWallWidget; |
| 8 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveFormGridWidget; |
| 9 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveFormWidget; |
| 10 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveGoalWidget; |
| 11 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveLoginWidget; |
| 12 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveMultiFormGoalWidget; |
| 13 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveProfileEditorWidget; |
| 14 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveRegisterWidget; |
| 15 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveSubscriptionsWidget; |
| 16 |
use Give\ThirdPartySupport\Elementor\Widgets\V1\GiveTotalsWidget; |
| 17 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignDonationsWidget\ElementorCampaignDonationsWidget; |
| 18 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignDonorsWidget\ElementorCampaignDonorsWidget; |
| 19 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignGoalWidget\ElementorCampaignGoalWidget; |
| 20 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignStatsWidget\ElementorCampaignStatsWidget; |
| 21 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorDonationFormWidget\ElementorDonationFormWidget; |
| 22 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorDonorWallWidget\ElementorDonorWallWidget; |
| 23 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorDonationFormGridWidget\ElementorDonationFormGridWidget; |
| 24 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignGridWidget\ElementorCampaignGridWidget; |
| 25 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignWidget\ElementorCampaignWidget; |
| 26 |
use Give\ThirdPartySupport\Elementor\Widgets\V2\ElementorCampaignCommentsWidget\ElementorCampaignCommentsWidget; |
| 27 |
|
| 28 |
/** |
| 29 |
* @since 4.7.0 |
| 30 |
*/ |
| 31 |
class RegisterWidgets |
| 32 |
{ |
| 33 |
/** |
| 34 |
* @since 4.7.0 |
| 35 |
*/ |
| 36 |
public function __invoke($widgets_manager) |
| 37 |
{ |
| 38 |
$this->registerV1Widgets($widgets_manager); |
| 39 |
$this->registerV2Widgets($widgets_manager); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Register the v1 widgets that were previously available in the GiveWP Elementor Widgets plugin. |
| 44 |
* |
| 45 |
* @param \Elementor\Widgets_Manager $widgets_manager |
| 46 |
* @since 4.7.0 |
| 47 |
*/ |
| 48 |
private function registerV1Widgets($widgets_manager) |
| 49 |
{ |
| 50 |
if (apply_filters('givewp_elementor_legacy_widgets_enabled', give_is_setting_enabled(give_get_option('givewp_elementor_legacy_widgets_enabled', 'disabled')))) { |
| 51 |
/** @var \Elementor\Widgets_Manager $widgets_manager */ |
| 52 |
$widgets_manager->register(new DonationHistoryWidget()); |
| 53 |
$widgets_manager->register(new DonationReceiptWidget()); |
| 54 |
$widgets_manager->register(new GiveDonorWallWidget()); |
| 55 |
$widgets_manager->register(new GiveFormGridWidget()); |
| 56 |
$widgets_manager->register(new GiveFormWidget()); |
| 57 |
$widgets_manager->register(new GiveGoalWidget()); |
| 58 |
$widgets_manager->register(new GiveLoginWidget()); |
| 59 |
$widgets_manager->register(new GiveMultiFormGoalWidget()); |
| 60 |
$widgets_manager->register(new GiveProfileEditorWidget()); |
| 61 |
$widgets_manager->register(new GiveRegisterWidget()); |
| 62 |
$widgets_manager->register(new GiveTotalsWidget()); |
| 63 |
|
| 64 |
if (defined('GIVE_RECURRING_VERSION')) { |
| 65 |
$widgets_manager->register(new GiveSubscriptionsWidget()); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Register the v2 widgets that are available in GiveWP. |
| 72 |
* |
| 73 |
* @param \Elementor\Widgets_Manager $widgets_manager |
| 74 |
* @since 4.7.0 |
| 75 |
*/ |
| 76 |
private function registerV2Widgets($widgets_manager) |
| 77 |
{ |
| 78 |
$widgets_manager->register(new ElementorCampaignDonationsWidget()); |
| 79 |
$widgets_manager->register(new ElementorCampaignDonorsWidget()); |
| 80 |
$widgets_manager->register(new ElementorCampaignGoalWidget()); |
| 81 |
$widgets_manager->register(new ElementorCampaignStatsWidget()); |
| 82 |
$widgets_manager->register(new ElementorDonationFormWidget()); |
| 83 |
$widgets_manager->register(new ElementorDonorWallWidget()); |
| 84 |
$widgets_manager->register(new ElementorDonationFormGridWidget()); |
| 85 |
$widgets_manager->register(new ElementorCampaignGridWidget()); |
| 86 |
$widgets_manager->register(new ElementorCampaignWidget()); |
| 87 |
$widgets_manager->register(new ElementorCampaignCommentsWidget()); |
| 88 |
} |
| 89 |
} |
| 90 |
|