AddCampaignFormFromRequest.php
1 year ago
AddNewBadgeToAdminMenuItem.php
1 year ago
ArchiveCampaignFormsAsDraftStatus.php
1 year ago
ArchiveCampaignPagesAsDraftStatus.php
1 year ago
AssignDuplicatedFormToCampaign.php
1 year ago
AssociateCampaignPageWithCampaign.php
1 year ago
ConvertQueryDataToCampaign.php
1 year ago
CreateCampaignPage.php
1 year ago
CreateDefaultCampaignForm.php
1 year ago
CreateDefaultLayoutForCampaignPage.php
1 year ago
EnqueueCampaignPageEditorAssets.php
1 year ago
FormInheritsCampaignGoal.php
1 year ago
LoadCampaignDetailsAssets.php
1 year ago
LoadCampaignOptions.php
1 year ago
LoadCampaignsListTableAssets.php
1 year ago
RedirectLegacyCreateFormToCreateCampaign.php
1 year ago
RegisterCampaignBlocks.php
1 year ago
RegisterCampaignEntity.php
1 year ago
RegisterCampaignIdRestField.php
1 year ago
RenderDonateButton.php
1 year ago
ReplaceGiveFormsCptLabels.php
1 year ago
LoadCampaignOptions.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Campaigns\Actions; |
| 4 | |
| 5 | /** |
| 6 | * The purpose of this action is to have a centralized place for localizing options used on many different places |
| 7 | * by campaign scripts (list tables, blocks, etc.) |
| 8 | * |
| 9 | * @since 4.0.0 |
| 10 | */ |
| 11 | class LoadCampaignOptions |
| 12 | { |
| 13 | public function __invoke() |
| 14 | { |
| 15 | wp_register_script('give-campaign-options', false); |
| 16 | |
| 17 | wp_localize_script('give-campaign-options', 'GiveCampaignOptions', |
| 18 | [ |
| 19 | 'isAdmin' => is_admin(), |
| 20 | 'adminUrl' => admin_url(), |
| 21 | 'campaignsAdminUrl' => admin_url('edit.php?post_type=give_forms&page=give-campaigns'), |
| 22 | 'currency' => give_get_currency(), |
| 23 | 'currencySymbol' => give_currency_symbol(), |
| 24 | 'isRecurringEnabled' => defined('GIVE_RECURRING_VERSION') |
| 25 | ? GIVE_RECURRING_VERSION |
| 26 | : null, |
| 27 | 'admin' => is_admin() |
| 28 | ? [ |
| 29 | 'showCampaignInteractionNotice' => !get_user_meta(get_current_user_id(), 'givewp_show_campaign_interaction_notice', true), |
| 30 | 'showExistingUserIntroNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_existing_user_intro_notice', true) && |
| 31 | version_compare((string)get_option('give_version_upgraded_from', '4.0.0'), '4.0.0', '<'), |
| 32 | 'showCampaignListTableNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_listtable_notice', true), |
| 33 | 'showCampaignFormNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_form_notice', true), |
| 34 | 'showCampaignSettingsNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_settings_notice', true), |
| 35 | ] |
| 36 | : null, |
| 37 | ] |
| 38 | ); |
| 39 | |
| 40 | wp_enqueue_script('give-campaign-options'); |
| 41 | } |
| 42 | } |
| 43 |