PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 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 All 255 releases
give / src / Promotions / InPluginUpsells / LegacyFormEditor.php

LegacyFormEditor.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Promotions/InPluginUpsells/LegacyFormEditor.php

63 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Promotions\InPluginUpsells;
4
5 use Give\Helpers\EnqueueScript;
6 use Give\Helpers\Utils;
7
8 class LegacyFormEditor
9 {
10
11 /**
12 * Load scripts
13 *
14 * @since 2.27.1
15 */
16 public function loadScripts()
17 {
18 $data = [
19 'apiRoot' => esc_url_raw(rest_url('give-api/v2')),
20 'apiNonce' => wp_create_nonce('wp_rest'),
21 ];
22
23 EnqueueScript::make(
24 'give-in-plugin-upsells-legacy-form-editor',
25 'build/assets/dist/js/donation-options.js'
26 )
27 ->loadInFooter()
28 ->registerTranslations()
29 ->registerLocalizeData('GiveLegacyFormEditor', $data)
30 ->enqueue();
31 }
32
33 /**
34 *
35 * @since 2.27.1
36 *
37 */
38 public function renderDonationOptionsRecurringRecommendation()
39 {
40 $isDismissed = get_option('givewp_form_editor_donation_options_recurring_recommendation', false);
41 $recurringAddonIsActive = Utils::isPluginActive('give-recurring/give-recurring.php');
42
43 if ($recurringAddonIsActive | $isDismissed) {
44 return;
45 }
46
47 require_once GIVE_PLUGIN_DIR . 'src/Promotions/InPluginUpsells/resources/views/donation-options-form-editor.php';
48 }
49
50 /**
51 * @since 3.2.1 replaced logic to be give_forms post_type specific
52 * @since 2.27.1
53 */
54 public static function isShowing(): bool
55 {
56 global $post, $pagenow;
57
58 return $post &&
59 in_array($pagenow, ['post-new.php', 'post.php'], true) &&
60 'give_forms' === get_post_type($post);
61 }
62 }
63