| @@ -7,9 +7,10 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace Give\Onboarding\Setup; |
| 10 | 10 | |
| 11 | -use Give\DonationForms\V2\DonationFormsAdminPage; | |
| 11 | +use Give\Campaigns\CampaignsAdminPage; | |
| 12 | +use Give\Framework\Permissions\Facades\UserPermissions; | |
| 12 | 13 | |
| 13 | 14 | defined('ABSPATH') || exit; |
| 14 | 15 | |
| 15 | 16 | /** |
| @@ -25,8 +26,9 @@ | ||
| 25 | 26 | |
| 26 | 27 | /** |
| 27 | 28 | * Dismiss the Setup Page. |
| 28 | 29 | * |
| 30 | + * @since 4.10.0 redirect to campaigns page | |
| 29 | 31 | * @since 2.8.0 |
| 30 | 32 | */ |
| 31 | 33 | public function dismissSetupPage() |
| 32 | 34 | { |
| @@ -32,9 +34,9 @@ | ||
| 32 | 34 | { |
| 33 | 35 | if (wp_verify_nonce($_GET['_wpnonce'], 'dismiss_setup_page')) { |
| 34 | 36 | give_update_option('setup_page_enabled', self::DISABLED); |
| 35 | 37 | |
| 36 | - wp_redirect(DonationFormsAdminPage::getUrl()); | |
| 38 | + wp_redirect(CampaignsAdminPage::getUrl()); | |
| 37 | 39 | exit; |
| 38 | 40 | } |
| 39 | 41 | } |
| 40 | 42 | |
| @@ -52,8 +54,9 @@ | ||
| 52 | 54 | |
| 53 | 55 | /** |
| 54 | 56 | * Add Setup submenu page to admin menu |
| 55 | 57 | * |
| 58 | + * @since 4.14.0 update permission capability to use facade | |
| 56 | 59 | * @since 2.8.0 |
| 57 | 60 | */ |
| 58 | 61 | public function add_page() |
| 59 | 62 | { |
| @@ -60,9 +63,9 @@ | ||
| 60 | 63 | add_submenu_page( |
| 61 | 64 | 'edit.php?post_type=give_forms', |
| 62 | 65 | esc_html__('Set up GiveWP', 'give'), |
| 63 | 66 | esc_html__('Setup', 'give'), |
| 64 | - 'manage_give_settings', | |
| 67 | + UserPermissions::settings()->manageCap(), | |
| 65 | 68 | 'give-setup', |
| 66 | 69 | [$this, 'render_page'] |
| 67 | 70 | ); |
| 68 | 71 | } |
| @@ -79,9 +82,9 @@ | ||
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | wp_enqueue_style( |
| 82 | 85 | 'give-admin-setup-style', |
| 83 | - GIVE_PLUGIN_URL . 'assets/dist/css/admin-setup.css', | |
| 86 | + GIVE_PLUGIN_URL . 'build/assets/dist/css/admin-setup.css', | |
| 84 | 87 | [], |
| 85 | 88 | GIVE_VERSION |
| 86 | 89 | ); |
| 87 | 90 | wp_enqueue_style('givewp-admin-fonts'); |
| @@ -86,13 +89,32 @@ | ||
| 86 | 89 | ); |
| 87 | 90 | wp_enqueue_style('givewp-admin-fonts'); |
| 88 | 91 | wp_enqueue_script( |
| 89 | 92 | 'give-admin-setup-script', |
| 90 | - GIVE_PLUGIN_URL . 'assets/dist/js/admin-setup.js', | |
| 93 | + GIVE_PLUGIN_URL . 'build/assets/dist/js/admin-setup.js', | |
| 91 | 94 | ['jquery'], |
| 92 | 95 | GIVE_VERSION, |
| 93 | 96 | $in_footer = true |
| 94 | 97 | ); |
| 98 | + | |
| 99 | + wp_enqueue_script( | |
| 100 | + 'give-admin-add-ons-script', | |
| 101 | + GIVE_PLUGIN_URL . 'build/assets/dist/js/admin-add-ons.js', | |
| 102 | + ['jquery'], | |
| 103 | + GIVE_VERSION, | |
| 104 | + $in_footer = true | |
| 105 | + ); | |
| 106 | + | |
| 107 | + $localized_data = [ | |
| 108 | + 'notices' => [ | |
| 109 | + 'invalid_license' => __( 'Sorry, you entered an invalid key.', 'give' ), | |
| 110 | + 'download_file' => __( 'Success! You have activated your license key and are receiving updates and priority support. <a href="{link}">Click here</a> to download your add-on.', 'give' ), | |
| 111 | + 'addon_activated' => __( '{pluginName} add-on activated successfully.', 'give' ), | |
| 112 | + 'addon_activation_error' => __( 'The add-on did not activate successfully.', 'give' ), | |
| 113 | + ], | |
| 114 | + ]; | |
| 115 | + | |
| 116 | + wp_localize_script( 'give-admin-add-ons-script', 'give_addon_var', $localized_data ); | |
| 95 | 117 | } |
| 96 | 118 | |
| 97 | 119 | /** |
| 98 | 120 | * Render the submenu page |