PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.2
GiveWP – Donation Plugin and Fundraising Platform v4.15.2
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Campaigns / Actions / LoadCampaignAdminOptions.php
LoadCampaignAdminOptions.php
49 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Campaigns\Actions;
4
5 use Give\API\REST\V3\Routes\Campaigns\ValueObjects\CampaignRoute;
6
7 /**
8 * The purpose of this action is to have a centralized place for localizing options used on many different places
9 * by campaign scripts (list tables, blocks, etc.)
10 *
11 * @since 4.6.1 Rename to LoadCampaignAdminOptions
12 * @since 4.0.0
13 */
14 class LoadCampaignAdminOptions
15 {
16 public function __invoke()
17 {
18 wp_register_script('give-campaign-options', false);
19
20 wp_localize_script('give-campaign-options', 'GiveCampaignOptions',
21 [
22 'isAdmin' => is_admin(),
23 'adminUrl' => admin_url(),
24 'apiRoot' => rest_url(CampaignRoute::NAMESPACE . '/' . CampaignRoute::CAMPAIGNS),
25 'apiNonce' => wp_create_nonce('wp_rest'),
26 'campaignsAdminUrl' => admin_url('edit.php?post_type=give_forms&page=give-campaigns'),
27 'currency' => give_get_currency(),
28 'currencySymbol' => give_currency_symbol(),
29 'isRecurringEnabled' => defined('GIVE_RECURRING_VERSION')
30 ? GIVE_RECURRING_VERSION
31 : null,
32 'admin' => is_admin()
33 ? [
34 'showCampaignInteractionNotice' => !get_user_meta(get_current_user_id(), 'givewp_show_campaign_interaction_notice', true),
35 'showFormGoalNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_form_goal_notice', true),
36 'showExistingUserIntroNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_existing_user_intro_notice', true) &&
37 version_compare((string)get_option('give_version_upgraded_from', '4.0.0'), '4.0.0', '<'),
38 'showCampaignListTableNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_listtable_notice', true),
39 'showCampaignFormNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_form_notice', true),
40 'showCampaignSettingsNotice' => !get_user_meta(get_current_user_id(), 'givewp_campaign_settings_notice', true)
41 ]
42 : null,
43 ]
44 );
45
46 wp_enqueue_script('give-campaign-options');
47 }
48 }
49