Helpers
1 year ago
Integrations
3 weeks ago
RestApi
1 week ago
abilities
3 weeks ago
abstracts
1 week ago
admin
1 week ago
blocks
1 year ago
elementor
2 years ago
export
2 months ago
fields
3 weeks ago
interfaces
8 years ago
libraries
2 years ago
log-handlers
1 year ago
shortcodes
3 weeks ago
stats
5 months ago
templates
3 months ago
traits
3 weeks ago
class-everest-forms.php
1 week ago
class-evf-addon-upsell.php
3 weeks ago
class-evf-ajax.php
3 weeks ago
class-evf-autoloader.php
8 years ago
class-evf-background-process-import-entries.php
2 years ago
class-evf-background-updater.php
8 years ago
class-evf-cache-helper.php
2 months ago
class-evf-cron.php
2 years ago
class-evf-deprecated-action-hooks.php
6 years ago
class-evf-deprecated-filter-hooks.php
5 years ago
class-evf-email-entries-report.php
3 months ago
class-evf-emails.php
3 weeks ago
class-evf-fields.php
3 weeks ago
class-evf-form-handler.php
3 weeks ago
class-evf-form-task.php
3 weeks ago
class-evf-forms-features.php
3 weeks ago
class-evf-frontend-scripts.php
3 weeks ago
class-evf-install.php
2 months ago
class-evf-integrations.php
3 months ago
class-evf-log-levels.php
8 years ago
class-evf-logger.php
5 years ago
class-evf-post-types.php
1 year ago
class-evf-privacy.php
6 years ago
class-evf-report-cron.php
2 months ago
class-evf-reporting.php
2 months ago
class-evf-session-handler.php
7 years ago
class-evf-shortcodes.php
1 year ago
class-evf-smart-tags.php
9 months ago
class-evf-template-loader.php
1 year ago
class-evf-validation.php
6 years ago
evf-conditional-functions.php
6 years ago
evf-core-functions.php
3 weeks ago
evf-deprecated-functions.php
6 years ago
evf-entry-functions.php
4 months ago
evf-formatting-functions.php
4 years ago
evf-notice-functions.php
4 years ago
evf-template-functions.php
4 years ago
evf-template-hooks.php
8 years ago
evf-update-functions.php
5 years ago
class-evf-addon-upsell.php
247 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EverestForms Addon Upsell |
| 4 | * |
| 5 | * @package EverestForms\Admin |
| 6 | * @version 1.0.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | /** |
| 12 | * EVF_Addon_Upsell. |
| 13 | */ |
| 14 | class EVF_Addon_Upsell { |
| 15 | |
| 16 | /** |
| 17 | * Get addon registry. |
| 18 | * |
| 19 | * @return array |
| 20 | */ |
| 21 | private static function get_registry() { |
| 22 | |
| 23 | if ( defined( 'EFP_PLUGIN_FILE' ) ) { |
| 24 | return array(); |
| 25 | } |
| 26 | |
| 27 | return apply_filters( |
| 28 | 'everest_forms_addon_upsell_registry', |
| 29 | array( |
| 30 | 'pdf_submission' => array( |
| 31 | 'category' => 'utilities', |
| 32 | 'label' => esc_html__( 'PDF Submission', 'everest-forms' ), |
| 33 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/pdf-submission.png', EVF_PLUGIN_FILE ), |
| 34 | 'description' => esc_html__( 'Generate beautiful PDFs from form submissions and send them via email.', 'everest-forms' ), |
| 35 | 'active_check' => 'EVF_PDF_SUBMISSION_VERSION', |
| 36 | 'vedio_id' => '37CtaxJzYis', |
| 37 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 38 | 'docs_url' => 'https://docs.everestforms.net/docs/pdf-form-submission/', |
| 39 | 'features' => array( |
| 40 | esc_html__( 'Send submitted form data as a PDF attachment', 'everest-forms' ), |
| 41 | esc_html__( 'Print or share submission details more easily', 'everest-forms' ), |
| 42 | esc_html__( 'Store important form data in a professional format ', 'everest-forms' ), |
| 43 | esc_html__( 'Make record-keeping much simpler', 'everest-forms' ), |
| 44 | ), |
| 45 | ), |
| 46 | |
| 47 | 'user_registration' => array( |
| 48 | 'category' => 'utilities', |
| 49 | 'label' => esc_html__( 'User Registration', 'everest-forms' ), |
| 50 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/user-registration.png', EVF_PLUGIN_FILE ), |
| 51 | 'description' => esc_html__( 'Register WordPress users and enable social login directly from your forms.', 'everest-forms' ), |
| 52 | 'vedio_id' => 'MEyuznG2Tok', |
| 53 | 'active_check' => 'EverestForms\\Pro\\Addons\\UserRegistration\\UserRegistration', |
| 54 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 55 | 'docs_url' => 'https://docs.everestforms.net/docs/user-registration/', |
| 56 | 'features' => array( |
| 57 | esc_html__( 'Let people register from the front end of your site ', 'everest-forms' ), |
| 58 | esc_html__( 'Create WordPress user accounts from form submissions', 'everest-forms' ), |
| 59 | esc_html__( 'Map form fields to user account details', 'everest-forms' ), |
| 60 | esc_html__( 'Use one form for both data collection and signup', 'everest-forms' ), |
| 61 | ), |
| 62 | ), |
| 63 | |
| 64 | 'paypal_standard' => array( |
| 65 | 'category' => 'payments', |
| 66 | 'label' => esc_html__( 'PayPal Standard', 'everest-forms' ), |
| 67 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/payment-paypal.png', EVF_PLUGIN_FILE ), |
| 68 | 'description' => esc_html__( 'Accept one-time and recurring payments via PayPal.', 'everest-forms' ), |
| 69 | 'active_check' => 'EVF_PAYPAL_STANDARD_VERSION', |
| 70 | 'vedio_id' => 'pcwPjCt7N2I', |
| 71 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 72 | 'docs_url' => 'https://docs.everestforms.net/docs/paypal-standard/', |
| 73 | 'features' => array( |
| 74 | esc_html__( 'One-time payments and recurring subscriptions', 'everest-forms' ), |
| 75 | esc_html__( 'Trusted buyer protection and established security', 'everest-forms' ), |
| 76 | esc_html__( 'Multiple subscription plans with trial periods', 'everest-forms' ), |
| 77 | ), |
| 78 | ), |
| 79 | |
| 80 | 'stripe' => array( |
| 81 | 'category' => 'payments', |
| 82 | 'label' => esc_html__( 'Stripe', 'everest-forms' ), |
| 83 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/payment-stripe.png', EVF_PLUGIN_FILE ), |
| 84 | 'description' => esc_html__( 'Process one-time and recurring charges securely via Stripe.', 'everest-forms' ), |
| 85 | 'active_check' => 'EVF_STRIPE_VERSION', |
| 86 | 'vedio_id' => 'wZXnaxLxdz4', |
| 87 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 88 | 'docs_url' => 'https://docs.everestforms.net/docs/stripe/', |
| 89 | 'features' => array( |
| 90 | esc_html__( 'One-time charges and recurring subscriptions with trials', 'everest-forms' ), |
| 91 | esc_html__( 'SCA compliant for EU payment regulation', 'everest-forms' ), |
| 92 | esc_html__( 'Accepts credit cards and iDEAL payments', 'everest-forms' ), |
| 93 | esc_html__( 'Map form fields to Stripe customer profile', 'everest-forms' ), |
| 94 | ), |
| 95 | ), |
| 96 | |
| 97 | 'square' => array( |
| 98 | 'category' => 'payments', |
| 99 | 'label' => esc_html__( 'Square', 'everest-forms' ), |
| 100 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/square-payment.png', EVF_PLUGIN_FILE ), |
| 101 | 'description' => esc_html__( 'Accept Square payments directly inside your WordPress forms.', 'everest-forms' ), |
| 102 | 'active_check' => 'EVF_SQUARE_VERSION', |
| 103 | 'vedio_id' => '5ymZV-S0mMs', |
| 104 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 105 | 'docs_url' => 'https://docs.everestforms.net/docs/square/', |
| 106 | 'features' => array( |
| 107 | esc_html__( 'On-site payments — no off-site redirect', 'everest-forms' ), |
| 108 | esc_html__( 'Sandbox and production credentials supported', 'everest-forms' ), |
| 109 | esc_html__( 'Test Mode toggle for safe pre-launch testing', 'everest-forms' ), |
| 110 | esc_html__( 'Map form fields to Square customer details', 'everest-forms' ), |
| 111 | ), |
| 112 | ), |
| 113 | |
| 114 | 'authorize_net' => array( |
| 115 | 'category' => 'payments', |
| 116 | 'label' => esc_html__( 'Authorize.Net', 'everest-forms' ), |
| 117 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/authorize-net.png', EVF_PLUGIN_FILE ), |
| 118 | 'description' => esc_html__( 'Accept credit cards and recurring subscriptions via Authorize.Net.', 'everest-forms' ), |
| 119 | 'active_check' => 'EVF_AUTHORIZE_NET_VERSION', |
| 120 | 'vedio_id' => 'a5EcKjwWD1A', |
| 121 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 122 | 'docs_url' => 'https://docs.everestforms.net/docs/authorize-net/', |
| 123 | 'features' => array( |
| 124 | esc_html__( 'On-site card processing — users never leave your site', 'everest-forms' ), |
| 125 | esc_html__( 'Recurring billing with customizable plans and schedules', 'everest-forms' ), |
| 126 | esc_html__( 'Live and sandbox modes for safe testing', 'everest-forms' ), |
| 127 | esc_html__( 'Map form fields to customer billing details', 'everest-forms' ), |
| 128 | ), |
| 129 | ), |
| 130 | |
| 131 | 'razorpay' => array( |
| 132 | 'category' => 'payments', |
| 133 | 'label' => esc_html__( 'Razorpay', 'everest-forms' ), |
| 134 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/Razorpay.png', EVF_PLUGIN_FILE ), |
| 135 | 'description' => esc_html__( 'Accept cards, net banking, and mobile wallets — ideal for India.', 'everest-forms' ), |
| 136 | 'active_check' => 'EVF_RAZORPAY_VERSION', |
| 137 | 'vedio_id' => '2Og6b1JXDWs', |
| 138 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 139 | 'docs_url' => 'https://docs.everestforms.net/docs/razorpay/', |
| 140 | 'features' => array( |
| 141 | esc_html__( 'Cards, net banking, and Indian mobile wallets', 'everest-forms' ), |
| 142 | esc_html__( 'Coupon code support for payment discounts', 'everest-forms' ), |
| 143 | esc_html__( 'Separate test and live API credentials', 'everest-forms' ), |
| 144 | esc_html__( 'Industry-standard encryption for secure processing', 'everest-forms' ), |
| 145 | ), |
| 146 | ), |
| 147 | |
| 148 | 'mollie' => array( |
| 149 | 'category' => 'payments', |
| 150 | 'label' => esc_html__( 'Mollie', 'everest-forms' ), |
| 151 | 'icon' => plugins_url( 'assets/extensions-json/sections/images/Mollie.png', EVF_PLUGIN_FILE ), |
| 152 | 'description' => esc_html__( 'Accept payments and recurring subscriptions via Mollie.', 'everest-forms' ), |
| 153 | 'active_check' => 'EVF_MOLLIE_VERSION', |
| 154 | 'vedio_id' => 'r263krbqzfo', |
| 155 | 'upgrade_url' => 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 156 | 'docs_url' => 'https://docs.everestforms.net/docs/mollie/', |
| 157 | 'features' => array( |
| 158 | esc_html__( 'Recurring billing for memberships and services', 'everest-forms' ), |
| 159 | esc_html__( 'Map form fields to subscription customer details', 'everest-forms' ), |
| 160 | esc_html__( 'Custom confirmation page after payment', 'everest-forms' ), |
| 161 | esc_html__( 'Test and live modes for development and production', 'everest-forms' ), |
| 162 | ), |
| 163 | ), |
| 164 | ) |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Check whether an addon is currently active. |
| 170 | * |
| 171 | * @param string $active_check Constant name or fully-qualified class name. |
| 172 | * @return bool |
| 173 | */ |
| 174 | private static function is_active( $active_check ) { |
| 175 | if ( empty( $active_check ) ) { |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | return defined( $active_check ) || class_exists( $active_check ); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Build a upsell entry from a registry config. |
| 184 | * |
| 185 | * @param array $config Registry config. |
| 186 | * @return array |
| 187 | */ |
| 188 | private static function build_upsell( array $config ) { |
| 189 | return array( |
| 190 | 'label' => $config['label'], |
| 191 | 'upsell' => true, |
| 192 | 'icon' => $config['icon'] ?? '', |
| 193 | 'description' => $config['description'] ?? '', |
| 194 | 'vedio_id' => $config['vedio_id'] ?? '', |
| 195 | 'upgrade_url' => $config['upgrade_url'] ?? 'https://wpeverest.com/wordpress-plugins/everest-forms/pricing/', |
| 196 | 'docs_url' => $config['docs_url'] ?? 'https://docs.everestforms.net/docs/', |
| 197 | 'features' => $config['features'] ?? array(), |
| 198 | ); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Get upsell entries for addons in a given category. |
| 203 | * |
| 204 | * @param string $category Category key e.g. 'utilities', 'payments'. |
| 205 | * @param bool $check_active Skip entries whose addon is already active when true. |
| 206 | * @return array |
| 207 | */ |
| 208 | public static function get_upsells_for_category( $category, $check_active = true ) { |
| 209 | $upsells = array(); |
| 210 | |
| 211 | foreach ( self::get_registry() as $id => $config ) { |
| 212 | if ( $config['category'] !== $category ) { |
| 213 | continue; |
| 214 | } |
| 215 | |
| 216 | if ( $check_active && self::is_active( $config['active_check'] ) ) { |
| 217 | continue; |
| 218 | } |
| 219 | |
| 220 | $upsells[ $id ] = self::build_upsell( $config ); |
| 221 | } |
| 222 | |
| 223 | return $upsells; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Get upsell entries for all inactive addons across every category. |
| 228 | * |
| 229 | * @return array |
| 230 | */ |
| 231 | public static function get_all_upsells() { |
| 232 | $upsells = array(); |
| 233 | |
| 234 | foreach ( self::get_registry() as $id => $config ) { |
| 235 | if ( self::is_active( $config['active_check'] ) ) { |
| 236 | continue; |
| 237 | } |
| 238 | |
| 239 | $upsell = self::build_upsell( $config ); |
| 240 | $upsell['category'] = $config['category']; |
| 241 | $upsells[ $id ] = $upsell; |
| 242 | } |
| 243 | |
| 244 | return $upsells; |
| 245 | } |
| 246 | } |
| 247 |