| @@ -89,10 +89,9 @@ | ||
| 89 | 89 | if ( ! $screen || false === strpos( $screen->id, 'wp-subscription-integrations' ) ) { |
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - wp_enqueue_script( 'subscrpt-integrations', SUBSCRPT_ASSETS . '/js/integration_settings.js', [ 'wp-i18n' ], SUBSCRPT_VERSION, true ); | |
| 94 | - wp_set_script_translations( 'subscrpt-integrations', 'subscription', SUBSCRPT_PATH . '/languages' ); | |
| 93 | + wp_enqueue_script( 'subscrpt-integrations', SUBSCRPT_ASSETS . '/js/integration_settings.js', [], SUBSCRPT_VERSION, true ); | |
| 95 | 94 | |
| 96 | 95 | wp_localize_script( |
| 97 | 96 | 'subscrpt-integrations', |
| 98 | 97 | 'subscrptIntegrations', |
| @@ -193,55 +192,8 @@ | ||
| 193 | 192 | return is_plugin_active( $plugin_file ); |
| 194 | 193 | } |
| 195 | 194 | |
| 196 | 195 | /** |
| 197 | - * Find the basename of an installed plugin from its wp.org slug. | |
| 198 | - * | |
| 199 | - * @param string $slug The wp.org plugin slug, which is also its directory. | |
| 200 | - * @return string The plugin basename, or an empty string when not installed. | |
| 201 | - */ | |
| 202 | - protected function find_plugin_file( $slug ) { | |
| 203 | - if ( ! function_exists( 'get_plugins' ) ) { | |
| 204 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 205 | - } | |
| 206 | - foreach ( array_keys( get_plugins() ) as $plugin_file ) { | |
| 207 | - if ( 0 === strpos( $plugin_file, $slug . '/' ) ) { | |
| 208 | - return $plugin_file; | |
| 209 | - } | |
| 210 | - } | |
| 211 | - return ''; | |
| 212 | - } | |
| 213 | - | |
| 214 | - /** | |
| 215 | - * Mark a gateway card installed when its plugin is on disk, and give it an | |
| 216 | - * Activate action for when that plugin is inactive. | |
| 217 | - * | |
| 218 | - * Gateway cards otherwise detect installation by a class the plugin declares, | |
| 219 | - * which only exists while it is active, so an installed-but-inactive gateway | |
| 220 | - * offered "Install Now" and the install failed on the existing folder. | |
| 221 | - * | |
| 222 | - * @param array $integration The integration card. | |
| 223 | - * @param string $slug The wp.org plugin slug. | |
| 224 | - * @return array | |
| 225 | - */ | |
| 226 | - protected function with_gateway_plugin_state( array $integration, $slug ) { | |
| 227 | - $plugin_file = $this->find_plugin_file( $slug ); | |
| 228 | - if ( '' === $plugin_file ) { | |
| 229 | - return $integration; | |
| 230 | - } | |
| 231 | - | |
| 232 | - $integration['is_installed'] = true; | |
| 233 | - $integration['plugin_file'] = $plugin_file; | |
| 234 | - $integration['actions'][] = [ | |
| 235 | - 'action' => 'activate', | |
| 236 | - 'label' => __( 'Activate', 'subscription' ), | |
| 237 | - 'type' => 'function', | |
| 238 | - 'function' => "subscrptActivatePlugin(this, '" . esc_js( $plugin_file ) . "')", | |
| 239 | - ]; | |
| 240 | - return $integration; | |
| 241 | - } | |
| 242 | - | |
| 243 | - /** | |
| 244 | 196 | * Check if a payment gateway is enabled. |
| 245 | 197 | * |
| 246 | 198 | * @param string $gateway_id Gateway ID. |
| 247 | 199 | */ |
| @@ -258,9 +210,9 @@ | ||
| 258 | 210 | protected function get_integrations(): array { |
| 259 | 211 | $integrations = [ |
| 260 | 212 | 'paypal' => [ |
| 261 | 213 | 'title' => 'PayPal', |
| 262 | - 'description' => __( 'Accept recurring subscription payments directly through PayPal.', 'subscription' ), | |
| 214 | + 'description' => 'Accept recurring subscription payments directly through PayPal.', | |
| 263 | 215 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/paypal.svg', |
| 264 | 216 | 'type' => 'payment_gateway', |
| 265 | 217 | 'is_installed' => 'on' === get_option( 'wp_subs_paypal_integration_enabled', 'off' ), |
| 266 | 218 | 'is_active' => self::is_gateway_enabled( 'wp_subscription_paypal' ), |
| @@ -273,9 +225,9 @@ | ||
| 273 | 225 | // 'function' => 'wpSubsInstallPaypalIntegration()', |
| 274 | 226 | // ], |
| 275 | 227 | [ |
| 276 | 228 | 'action' => 'settings', |
| 277 | - 'label' => __( 'Settings', 'subscription' ), | |
| 229 | + 'label' => 'Settings', | |
| 278 | 230 | 'type' => 'link', |
| 279 | 231 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=wp_subscription_paypal' ), |
| 280 | 232 | ], |
| 281 | 233 | // [ |
| @@ -288,9 +240,9 @@ | ||
| 288 | 240 | ], |
| 289 | 241 | ], |
| 290 | 242 | 'stripe' => [ |
| 291 | 243 | 'title' => 'Stripe', |
| 292 | - 'description' => __( 'Process subscription payments securely with Stripe.', 'subscription' ), | |
| 244 | + 'description' => 'Process subscription payments securely with Stripe.', | |
| 293 | 245 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/stripe.png', |
| 294 | 246 | 'type' => 'payment_gateway', |
| 295 | 247 | 'is_installed' => class_exists( 'WC_Stripe' ), |
| 296 | 248 | 'is_active' => self::is_gateway_enabled( 'stripe' ), |
| @@ -297,15 +249,15 @@ | ||
| 297 | 249 | 'supports_recurring' => true, |
| 298 | 250 | 'actions' => [ |
| 299 | 251 | [ |
| 300 | 252 | 'action' => 'install', |
| 301 | - 'label' => __( 'Install Now', 'subscription' ), | |
| 253 | + 'label' => 'Install Now', | |
| 302 | 254 | 'type' => 'function', |
| 303 | 255 | 'function' => "subscrptInstallPlugin(this, 'woocommerce-gateway-stripe')", |
| 304 | 256 | ], |
| 305 | 257 | [ |
| 306 | 258 | 'action' => 'settings', |
| 307 | - 'label' => __( 'Settings', 'subscription' ), | |
| 259 | + 'label' => 'Settings', | |
| 308 | 260 | 'type' => 'link', |
| 309 | 261 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=stripe&panel=settings' ), |
| 310 | 262 | ], |
| 311 | 263 | ], |
| @@ -311,9 +263,9 @@ | ||
| 311 | 263 | ], |
| 312 | 264 | ], |
| 313 | 265 | 'paddle' => [ |
| 314 | 266 | 'title' => 'Paddle', |
| 315 | - 'description' => __( 'Process subscription payments securely with Paddle.', 'subscription' ), | |
| 267 | + 'description' => 'Process subscription payments securely with Paddle.', | |
| 316 | 268 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/paddle.svg', |
| 317 | 269 | 'type' => 'payment_gateway', |
| 318 | 270 | 'is_installed' => class_exists( 'SmartPayWoo\Gateways\Paddle\SmartPay_Paddle' ), |
| 319 | 271 | 'is_active' => self::is_gateway_enabled( 'smartpay_paddle' ), |
| @@ -320,15 +272,15 @@ | ||
| 320 | 272 | 'supports_recurring' => true, |
| 321 | 273 | 'actions' => [ |
| 322 | 274 | [ |
| 323 | 275 | 'action' => 'install', |
| 324 | - 'label' => __( 'Get Paddle', 'subscription' ), | |
| 276 | + 'label' => 'Get Paddle', | |
| 325 | 277 | 'type' => 'external_link', |
| 326 | 278 | 'url' => 'https://wpsmartpay.com/paddle-for-woocommerce/', |
| 327 | 279 | ], |
| 328 | 280 | [ |
| 329 | 281 | 'action' => 'enable', |
| 330 | - 'label' => __( 'Enable Gateway', 'subscription' ), | |
| 282 | + 'label' => 'Enable Gateway', | |
| 331 | 283 | 'type' => 'toggle_option', |
| 332 | 284 | 'option_key' => 'woocommerce_enable_paddle_gateway', |
| 333 | 285 | 'value' => true, |
| 334 | 286 | ], |
| @@ -333,14 +285,14 @@ | ||
| 333 | 285 | 'value' => true, |
| 334 | 286 | ], |
| 335 | 287 | [ |
| 336 | 288 | 'action' => 'settings', |
| 337 | - 'label' => __( 'Settings', 'subscription' ), | |
| 289 | + 'label' => 'Settings', | |
| 338 | 290 | 'type' => 'link', |
| 339 | 291 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=smartpay_paddle&from=WCADMIN_PAYMENT_SETTINGS' ), |
| 340 | 292 | ], |
| 341 | 293 | [ |
| 342 | - 'label' => __( 'More Details', 'subscription' ), | |
| 294 | + 'label' => 'More Details', | |
| 343 | 295 | 'type' => 'external_link', |
| 344 | 296 | 'url' => 'https://wpsmartpay.com/paddle-for-woocommerce/', |
| 345 | 297 | ], |
| 346 | 298 | ], |
| @@ -346,9 +298,9 @@ | ||
| 346 | 298 | ], |
| 347 | 299 | ], |
| 348 | 300 | 'mollie' => [ |
| 349 | 301 | 'title' => 'Mollie', |
| 350 | - 'description' => __( 'Pay for subscriptions with Mollie Payments for WooCommerce.', 'subscription' ), | |
| 302 | + 'description' => 'Pay for subscriptions with Mollie Payments for WooCommerce.', | |
| 351 | 303 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/mollie.png', |
| 352 | 304 | 'type' => 'payment_gateway', |
| 353 | 305 | 'is_pro' => true, |
| 354 | 306 | 'is_installed' => class_exists( 'Mollie\WooCommerce\Activation\ActivationModule' ), |
| @@ -356,20 +308,20 @@ | ||
| 356 | 308 | 'supports_recurring' => true, |
| 357 | 309 | 'actions' => [ |
| 358 | 310 | [ |
| 359 | 311 | 'action' => 'install', |
| 360 | - 'label' => __( 'Install Now', 'subscription' ), | |
| 312 | + 'label' => 'Install Now', | |
| 361 | 313 | 'type' => 'function', |
| 362 | 314 | 'function' => "subscrptInstallPlugin(this, 'mollie-payments-for-woocommerce')", |
| 363 | 315 | ], |
| 364 | 316 | [ |
| 365 | 317 | 'action' => 'settings', |
| 366 | - 'label' => __( 'Settings', 'subscription' ), | |
| 318 | + 'label' => 'Settings', | |
| 367 | 319 | 'type' => 'link', |
| 368 | 320 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=mollie_settings' ), |
| 369 | 321 | ], |
| 370 | 322 | [ |
| 371 | - 'label' => __( 'More Details', 'subscription' ), | |
| 323 | + 'label' => 'More Details', | |
| 372 | 324 | 'type' => 'external_link', |
| 373 | 325 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-payment-with-mollie?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 374 | 326 | ], |
| 375 | 327 | ], |
| @@ -375,9 +327,9 @@ | ||
| 375 | 327 | ], |
| 376 | 328 | ], |
| 377 | 329 | 'razorpay' => [ |
| 378 | 330 | 'title' => 'Razorpay', |
| 379 | - 'description' => __( 'Pay for subscriptions securely with Razorpay for WooCommerce.', 'subscription' ), | |
| 331 | + 'description' => 'Pay for subscriptions securely with Razorpay for WooCommerce.', | |
| 380 | 332 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/razorpay.png', |
| 381 | 333 | 'type' => 'payment_gateway', |
| 382 | 334 | 'is_pro' => true, |
| 383 | 335 | 'is_beta' => true, |
| @@ -386,20 +338,20 @@ | ||
| 386 | 338 | 'supports_recurring' => true, |
| 387 | 339 | 'actions' => [ |
| 388 | 340 | [ |
| 389 | 341 | 'action' => 'install', |
| 390 | - 'label' => __( 'Install Now', 'subscription' ), | |
| 342 | + 'label' => 'Install Now', | |
| 391 | 343 | 'type' => 'function', |
| 392 | 344 | 'function' => "subscrptInstallPlugin(this, 'woo-razorpay')", |
| 393 | 345 | ], |
| 394 | 346 | [ |
| 395 | 347 | 'action' => 'settings', |
| 396 | - 'label' => __( 'Settings', 'subscription' ), | |
| 348 | + 'label' => 'Settings', | |
| 397 | 349 | 'type' => 'link', |
| 398 | 350 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=razorpay' ), |
| 399 | 351 | ], |
| 400 | 352 | [ |
| 401 | - 'label' => __( 'More Details', 'subscription' ), | |
| 353 | + 'label' => 'More Details', | |
| 402 | 354 | 'type' => 'external_link', |
| 403 | 355 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-payment-with-razorpay?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 404 | 356 | ], |
| 405 | 357 | ], |
| @@ -405,9 +357,9 @@ | ||
| 405 | 357 | ], |
| 406 | 358 | ], |
| 407 | 359 | 'xendit' => [ |
| 408 | 360 | 'title' => 'Xendit', |
| 409 | - 'description' => __( 'Pay for subscriptions securely with Xendit for WooCommerce.', 'subscription' ), | |
| 361 | + 'description' => 'Pay for subscriptions securely with Xendit for WooCommerce.', | |
| 410 | 362 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/xendit.png', |
| 411 | 363 | 'type' => 'payment_gateway', |
| 412 | 364 | 'is_pro' => true, |
| 413 | 365 | 'is_beta' => true, |
| @@ -416,20 +368,20 @@ | ||
| 416 | 368 | 'supports_recurring' => true, |
| 417 | 369 | 'actions' => [ |
| 418 | 370 | [ |
| 419 | 371 | 'action' => 'install', |
| 420 | - 'label' => __( 'Install Now', 'subscription' ), | |
| 372 | + 'label' => 'Install Now', | |
| 421 | 373 | 'type' => 'function', |
| 422 | 374 | 'function' => "subscrptInstallPlugin(this, 'woo-xendit-virtual-accounts')", |
| 423 | 375 | ], |
| 424 | 376 | [ |
| 425 | 377 | 'action' => 'settings', |
| 426 | - 'label' => __( 'Settings', 'subscription' ), | |
| 378 | + 'label' => 'Settings', | |
| 427 | 379 | 'type' => 'link', |
| 428 | 380 | 'url' => admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=xendit_gateway' ), |
| 429 | 381 | ], |
| 430 | 382 | [ |
| 431 | - 'label' => __( 'More Details', 'subscription' ), | |
| 383 | + 'label' => 'More Details', | |
| 432 | 384 | 'type' => 'external_link', |
| 433 | 385 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-payment-with-xendit?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 434 | 386 | ], |
| 435 | 387 | ], |
| @@ -435,24 +387,19 @@ | ||
| 435 | 387 | ], |
| 436 | 388 | ], |
| 437 | 389 | ]; |
| 438 | 390 | |
| 439 | - $integrations['stripe'] = $this->with_gateway_plugin_state( $integrations['stripe'], 'woocommerce-gateway-stripe' ); | |
| 440 | - $integrations['mollie'] = $this->with_gateway_plugin_state( $integrations['mollie'], 'mollie-payments-for-woocommerce' ); | |
| 441 | - $integrations['razorpay'] = $this->with_gateway_plugin_state( $integrations['razorpay'], 'woo-razorpay' ); | |
| 442 | - $integrations['xendit'] = $this->with_gateway_plugin_state( $integrations['xendit'], 'woo-xendit-virtual-accounts' ); | |
| 443 | - | |
| 444 | 391 | // Third-party integrations (requires Pro plugin to function). |
| 445 | 392 | $third_party = [ |
| 446 | 393 | // LMS. |
| 447 | 394 | 'tutor_lms' => [ |
| 448 | 395 | 'title' => 'Tutor LMS', |
| 449 | - 'description' => __( 'Restrict course access based on subscription status. Enroll and unenroll students automatically.', 'subscription' ), | |
| 396 | + 'description' => 'Restrict course access based on subscription status. Enroll and unenroll students automatically.', | |
| 450 | 397 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/tutor-lms.jpeg', |
| 451 | 398 | 'type' => 'third_party', |
| 452 | 399 | 'is_pro' => true, |
| 453 | 400 | 'category' => 'lms', |
| 454 | - 'is_installed' => $this->is_plugin_installed( 'tutor/tutor.php' ), | |
| 401 | + 'is_installed' => is_plugin_active( 'tutor/tutor.php' ) && class_exists( 'TUTOR\Tutor' ), | |
| 455 | 402 | 'is_active' => is_plugin_active( 'tutor/tutor.php' ) && class_exists( 'TUTOR\Tutor' ), |
| 456 | 403 | 'actions' => [ |
| 457 | 404 | [ |
| 458 | 405 | 'action' => 'install', |
| @@ -460,14 +407,8 @@ | ||
| 460 | 407 | 'type' => 'function', |
| 461 | 408 | 'function' => "subscrptInstallPlugin(this, 'tutor')", |
| 462 | 409 | ], |
| 463 | 410 | [ |
| 464 | - 'action' => 'activate', | |
| 465 | - 'label' => __( 'Activate', 'subscription' ), | |
| 466 | - 'type' => 'function', | |
| 467 | - 'function' => "subscrptActivatePlugin(this, 'tutor/tutor.php')", | |
| 468 | - ], | |
| 469 | - [ | |
| 470 | 411 | 'label' => __( 'Learn More', 'subscription' ), |
| 471 | 412 | 'type' => 'external_link', |
| 472 | 413 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-tutor-lms?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 473 | 414 | ], |
| @@ -474,14 +415,14 @@ | ||
| 474 | 415 | ], |
| 475 | 416 | ], |
| 476 | 417 | 'learnpress' => [ |
| 477 | 418 | 'title' => 'LearnPress', |
| 478 | - 'description' => __( 'Connect subscriptions with LearnPress courses. Enroll users automatically when subscriptions are active.', 'subscription' ), | |
| 419 | + 'description' => 'Connect subscriptions with LearnPress courses. Enroll users automatically when subscriptions are active.', | |
| 479 | 420 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/learnpress.png', |
| 480 | 421 | 'type' => 'third_party', |
| 481 | 422 | 'is_pro' => true, |
| 482 | 423 | 'category' => 'lms', |
| 483 | - 'is_installed' => $this->is_plugin_installed( 'learnpress/learnpress.php' ), | |
| 424 | + 'is_installed' => is_plugin_active( 'learnpress/learnpress.php' ) && class_exists( 'LearnPress' ), | |
| 484 | 425 | 'is_active' => is_plugin_active( 'learnpress/learnpress.php' ) && class_exists( 'LearnPress' ), |
| 485 | 426 | 'actions' => [ |
| 486 | 427 | [ |
| 487 | 428 | 'action' => 'install', |
| @@ -489,14 +430,8 @@ | ||
| 489 | 430 | 'type' => 'function', |
| 490 | 431 | 'function' => "subscrptInstallPlugin(this, 'learnpress')", |
| 491 | 432 | ], |
| 492 | 433 | [ |
| 493 | - 'action' => 'activate', | |
| 494 | - 'label' => __( 'Activate', 'subscription' ), | |
| 495 | - 'type' => 'function', | |
| 496 | - 'function' => "subscrptActivatePlugin(this, 'learnpress/learnpress.php')", | |
| 497 | - ], | |
| 498 | - [ | |
| 499 | 434 | 'label' => __( 'Learn More', 'subscription' ), |
| 500 | 435 | 'type' => 'external_link', |
| 501 | 436 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-learnpress-lms?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 502 | 437 | ], |
| @@ -503,14 +438,14 @@ | ||
| 503 | 438 | ], |
| 504 | 439 | ], |
| 505 | 440 | 'learndash' => [ |
| 506 | 441 | 'title' => 'LearnDash', |
| 507 | - 'description' => __( 'Sync subscription status with LearnDash group enrollment and course access.', 'subscription' ), | |
| 442 | + 'description' => 'Sync subscription status with LearnDash group enrollment and course access.', | |
| 508 | 443 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/learndash.jpeg', |
| 509 | 444 | 'type' => 'third_party', |
| 510 | 445 | 'is_pro' => true, |
| 511 | 446 | 'category' => 'lms', |
| 512 | - 'is_installed' => $this->is_plugin_installed( 'sfwd-lms/sfwd_lms.php' ), | |
| 447 | + 'is_installed' => is_plugin_active( 'sfwd-lms/sfwd_lms.php' ) && class_exists( 'LearnDash\Core\App' ), | |
| 513 | 448 | 'is_active' => is_plugin_active( 'sfwd-lms/sfwd_lms.php' ) && class_exists( 'LearnDash\Core\App' ), |
| 514 | 449 | 'actions' => [ |
| 515 | 450 | [ |
| 516 | 451 | 'action' => 'install', |
| @@ -518,14 +453,8 @@ | ||
| 518 | 453 | 'type' => 'external_link', |
| 519 | 454 | 'url' => 'https://www.learndash.com/', |
| 520 | 455 | ], |
| 521 | 456 | [ |
| 522 | - 'action' => 'activate', | |
| 523 | - 'label' => __( 'Activate', 'subscription' ), | |
| 524 | - 'type' => 'function', | |
| 525 | - 'function' => "subscrptActivatePlugin(this, 'sfwd-lms/sfwd_lms.php')", | |
| 526 | - ], | |
| 527 | - [ | |
| 528 | 457 | 'label' => __( 'Learn More', 'subscription' ), |
| 529 | 458 | 'type' => 'external_link', |
| 530 | 459 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-learndash-lms?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 531 | 460 | ], |
| @@ -533,14 +462,14 @@ | ||
| 533 | 462 | ], |
| 534 | 463 | // CRM. |
| 535 | 464 | 'fluentcrm' => [ |
| 536 | 465 | 'title' => 'FluentCRM', |
| 537 | - 'description' => __( 'Trigger email sequences and manage contacts based on subscription events and status changes.', 'subscription' ), | |
| 466 | + 'description' => 'Trigger email sequences and manage contacts based on subscription events and status changes.', | |
| 538 | 467 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/fluentcrm.png', |
| 539 | 468 | 'type' => 'third_party', |
| 540 | 469 | 'is_pro' => true, |
| 541 | 470 | 'category' => 'crm', |
| 542 | - 'is_installed' => $this->is_plugin_installed( 'fluent-crm/fluent-crm.php' ), | |
| 471 | + 'is_installed' => class_exists( 'FluentCrm\App\Services\Funnel\BaseTrigger' ), | |
| 543 | 472 | 'is_active' => class_exists( 'FluentCrm\App\Services\Funnel\BaseTrigger' ), |
| 544 | 473 | 'actions' => [ |
| 545 | 474 | [ |
| 546 | 475 | 'action' => 'install', |
| @@ -548,14 +477,8 @@ | ||
| 548 | 477 | 'type' => 'function', |
| 549 | 478 | 'function' => "subscrptInstallPlugin(this, 'fluent-crm')", |
| 550 | 479 | ], |
| 551 | 480 | [ |
| 552 | - 'action' => 'activate', | |
| 553 | - 'label' => __( 'Activate', 'subscription' ), | |
| 554 | - 'type' => 'function', | |
| 555 | - 'function' => "subscrptActivatePlugin(this, 'fluent-crm/fluent-crm.php')", | |
| 556 | - ], | |
| 557 | - [ | |
| 558 | 481 | 'label' => __( 'Learn More', 'subscription' ), |
| 559 | 482 | 'type' => 'external_link', |
| 560 | 483 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-fluent-crm?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 561 | 484 | ], |
| @@ -563,14 +486,14 @@ | ||
| 563 | 486 | ], |
| 564 | 487 | // Automation. |
| 565 | 488 | 'automatorwp' => [ |
| 566 | 489 | 'title' => 'AutomatorWP', |
| 567 | - 'description' => __( 'Build powerful automations triggered by subscription events without writing any code.', 'subscription' ), | |
| 490 | + 'description' => 'Build powerful automations triggered by subscription events without writing any code.', | |
| 568 | 491 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/automatorwp.png', |
| 569 | 492 | 'type' => 'third_party', |
| 570 | 493 | 'is_pro' => true, |
| 571 | 494 | 'category' => 'automation', |
| 572 | - 'is_installed' => $this->is_plugin_installed( 'automatorwp/automatorwp.php' ), | |
| 495 | + 'is_installed' => is_plugin_active( 'automatorwp/automatorwp.php' ) && class_exists( 'AutomatorWP' ), | |
| 573 | 496 | 'is_active' => is_plugin_active( 'automatorwp/automatorwp.php' ) && class_exists( 'AutomatorWP' ), |
| 574 | 497 | 'actions' => [ |
| 575 | 498 | [ |
| 576 | 499 | 'action' => 'install', |
| @@ -577,14 +500,8 @@ | ||
| 577 | 500 | 'label' => __( 'Install Now', 'subscription' ), |
| 578 | 501 | 'type' => 'function', |
| 579 | 502 | 'function' => "subscrptInstallPlugin(this, 'automatorwp')", |
| 580 | 503 | ], |
| 581 | - [ | |
| 582 | - 'action' => 'activate', | |
| 583 | - 'label' => __( 'Activate', 'subscription' ), | |
| 584 | - 'type' => 'function', | |
| 585 | - 'function' => "subscrptActivatePlugin(this, 'automatorwp/automatorwp.php')", | |
| 586 | - ], | |
| 587 | 504 | // [ |
| 588 | 505 | // 'label' => __( 'Learn More', 'subscription' ), |
| 589 | 506 | // 'type' => 'external_link', |
| 590 | 507 | // 'url' => 'https://docs.wpsubscription.co/en/', |
| @@ -592,14 +509,14 @@ | ||
| 592 | 509 | ], |
| 593 | 510 | ], |
| 594 | 511 | 'wpfusion' => [ |
| 595 | 512 | 'title' => 'WP Fusion', |
| 596 | - 'description' => __( 'Sync subscription data with your CRM and marketing platforms through WP Fusion.', 'subscription' ), | |
| 513 | + 'description' => 'Sync subscription data with your CRM and marketing platforms through WP Fusion.', | |
| 597 | 514 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/wp-fusion.png', |
| 598 | 515 | 'type' => 'third_party', |
| 599 | 516 | 'is_pro' => true, |
| 600 | 517 | 'category' => 'automation', |
| 601 | - 'is_installed' => $this->is_plugin_installed( 'wp-fusion/wp-fusion.php' ) || class_exists( 'WPF_Integrations_Base' ), | |
| 518 | + 'is_installed' => class_exists( 'WPF_Integrations_Base' ), | |
| 602 | 519 | 'is_active' => class_exists( 'WPF_Integrations_Base' ), |
| 603 | 520 | 'actions' => [ |
| 604 | 521 | [ |
| 605 | 522 | 'action' => 'install', |
| @@ -606,14 +523,8 @@ | ||
| 606 | 523 | 'label' => __( 'Get WP Fusion', 'subscription' ), |
| 607 | 524 | 'type' => 'external_link', |
| 608 | 525 | 'url' => 'https://wpfusion.com/', |
| 609 | 526 | ], |
| 610 | - [ | |
| 611 | - 'action' => 'activate', | |
| 612 | - 'label' => __( 'Activate', 'subscription' ), | |
| 613 | - 'type' => 'function', | |
| 614 | - 'function' => "subscrptActivatePlugin(this, 'wp-fusion/wp-fusion.php')", | |
| 615 | - ], | |
| 616 | 527 | // [ |
| 617 | 528 | // 'label' => __( 'Learn More', 'subscription' ), |
| 618 | 529 | // 'type' => 'external_link', |
| 619 | 530 | // 'url' => 'https://docs.wpsubscription.co/en/', |
| @@ -622,14 +533,14 @@ | ||
| 622 | 533 | ], |
| 623 | 534 | // Email Marketing. |
| 624 | 535 | 'mailpoet' => [ |
| 625 | 536 | 'title' => 'MailPoet', |
| 626 | - 'description' => __( 'Add subscribers to MailPoet lists and trigger email automations based on subscription lifecycle events.', 'subscription' ), | |
| 537 | + 'description' => 'Add subscribers to MailPoet lists and trigger email automations based on subscription lifecycle events.', | |
| 627 | 538 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/mailpoet.png', |
| 628 | 539 | 'type' => 'third_party', |
| 629 | 540 | 'is_pro' => true, |
| 630 | 541 | 'category' => 'email', |
| 631 | - 'is_installed' => $this->is_plugin_installed( 'mailpoet/mailpoet.php' ) || is_plugin_active( 'mailpoet-premium/mailpoet-premium.php' ), | |
| 542 | + 'is_installed' => is_plugin_active( 'mailpoet/mailpoet.php' ) || is_plugin_active( 'mailpoet-premium/mailpoet-premium.php' ), | |
| 632 | 543 | 'is_active' => is_plugin_active( 'mailpoet/mailpoet.php' ) || is_plugin_active( 'mailpoet-premium/mailpoet-premium.php' ), |
| 633 | 544 | 'actions' => [ |
| 634 | 545 | [ |
| 635 | 546 | 'action' => 'install', |
| @@ -637,14 +548,8 @@ | ||
| 637 | 548 | 'type' => 'function', |
| 638 | 549 | 'function' => "subscrptInstallPlugin(this, 'mailpoet')", |
| 639 | 550 | ], |
| 640 | 551 | [ |
| 641 | - 'action' => 'activate', | |
| 642 | - 'label' => __( 'Activate', 'subscription' ), | |
| 643 | - 'type' => 'function', | |
| 644 | - 'function' => "subscrptActivatePlugin(this, 'mailpoet/mailpoet.php')", | |
| 645 | - ], | |
| 646 | - [ | |
| 647 | 552 | 'label' => __( 'Learn More', 'subscription' ), |
| 648 | 553 | 'type' => 'external_link', |
| 649 | 554 | 'url' => 'https://docs.wpsubscription.co/en/wpsubscription-mailpoet?utm_source=plugin&utm_medium=admin&utm_campaign=docs', |
| 650 | 555 | ], |
| @@ -652,14 +557,14 @@ | ||
| 652 | 557 | ], |
| 653 | 558 | // License Management. |
| 654 | 559 | 'wp_soft_lic' => [ |
| 655 | 560 | 'title' => 'WP Software License', |
| 656 | - 'description' => __( 'Issue and validate software licenses for subscription-based digital products.', 'subscription' ), | |
| 561 | + 'description' => 'Issue and validate software licenses for subscription-based digital products.', | |
| 657 | 562 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/wp-software-license.png', |
| 658 | 563 | 'type' => 'third_party', |
| 659 | 564 | 'is_pro' => true, |
| 660 | 565 | 'category' => 'license', |
| 661 | - 'is_installed' => $this->is_plugin_installed( 'software-license/software-license.php' ), | |
| 566 | + 'is_installed' => is_plugin_active( 'software-license/software-license.php' ) && class_exists( 'WOO_SL' ), | |
| 662 | 567 | 'is_active' => is_plugin_active( 'software-license/software-license.php' ) && class_exists( 'WOO_SL' ), |
| 663 | 568 | 'actions' => [ |
| 664 | 569 | [ |
| 665 | 570 | 'action' => 'install', |
| @@ -666,14 +571,8 @@ | ||
| 666 | 571 | 'label' => __( 'Get Plugin', 'subscription' ), |
| 667 | 572 | 'type' => 'external_link', |
| 668 | 573 | 'url' => 'https://wpsoftwarelicense.com/', |
| 669 | 574 | ], |
| 670 | - [ | |
| 671 | - 'action' => 'activate', | |
| 672 | - 'label' => __( 'Activate', 'subscription' ), | |
| 673 | - 'type' => 'function', | |
| 674 | - 'function' => "subscrptActivatePlugin(this, 'software-license/software-license.php')", | |
| 675 | - ], | |
| 676 | 575 | // [ |
| 677 | 576 | // 'label' => __( 'Learn More', 'subscription' ), |
| 678 | 577 | // 'type' => 'external_link', |
| 679 | 578 | // 'url' => 'https://docs.wpsubscription.co/en/', |
| @@ -681,14 +580,14 @@ | ||
| 681 | 580 | ], |
| 682 | 581 | ], |
| 683 | 582 | 'license_mgr' => [ |
| 684 | 583 | 'title' => 'License Manager for WooCommerce', |
| 685 | - 'description' => __( 'Generate and manage software license keys that are automatically tied to active subscriptions.', 'subscription' ), | |
| 584 | + 'description' => 'Generate and manage software license keys that are automatically tied to active subscriptions.', | |
| 686 | 585 | 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/license-manager.png', |
| 687 | 586 | 'type' => 'third_party', |
| 688 | 587 | 'is_pro' => true, |
| 689 | 588 | 'category' => 'license', |
| 690 | - 'is_installed' => $this->is_plugin_installed( 'license-manager-for-woocommerce/license-manager-for-woocommerce.php' ), | |
| 589 | + 'is_installed' => is_plugin_active( 'license-manager-for-woocommerce/license-manager-for-woocommerce.php' ) && class_exists( 'LicenseManagerForWooCommerce\Models\Resources\License' ), | |
| 691 | 590 | 'is_active' => is_plugin_active( 'license-manager-for-woocommerce/license-manager-for-woocommerce.php' ) && class_exists( 'LicenseManagerForWooCommerce\Models\Resources\License' ), |
| 692 | 591 | 'actions' => [ |
| 693 | 592 | [ |
| 694 | 593 | 'action' => 'install', |
| @@ -695,14 +594,8 @@ | ||
| 695 | 594 | 'label' => __( 'Install Now', 'subscription' ), |
| 696 | 595 | 'type' => 'function', |
| 697 | 596 | 'function' => "subscrptInstallPlugin(this, 'license-manager-for-woocommerce')", |
| 698 | 597 | ], |
| 699 | - [ | |
| 700 | - 'action' => 'activate', | |
| 701 | - 'label' => __( 'Activate', 'subscription' ), | |
| 702 | - 'type' => 'function', | |
| 703 | - 'function' => "subscrptActivatePlugin(this, 'license-manager-for-woocommerce/license-manager-for-woocommerce.php')", | |
| 704 | - ], | |
| 705 | 598 | // [ |
| 706 | 599 | // 'label' => __( 'Learn More', 'subscription' ), |
| 707 | 600 | // 'type' => 'external_link', |
| 708 | 601 | // 'url' => 'https://docs.wpsubscription.co/en/', |
| @@ -729,13 +622,8 @@ | ||
| 729 | 622 | foreach ( $integrations as $integration ) { |
| 730 | 623 | $is_installed = $integration['is_installed'] ?? false; |
| 731 | 624 | $is_active = $integration['is_active'] ?? false; |
| 732 | 625 | |
| 733 | - // A gateway card is "active" when its gateway is enabled, which is not | |
| 734 | - // the same as its plugin being active; read the plugin itself. | |
| 735 | - $plugin_file = $integration['plugin_file'] ?? ''; | |
| 736 | - $plugin_active = '' !== $plugin_file ? is_plugin_active( $plugin_file ) : $is_active; | |
| 737 | - | |
| 738 | 626 | $cleaned_actions = []; |
| 739 | 627 | $shown_install_url = null; |
| 740 | 628 | |
| 741 | 629 | foreach ( $integration['actions'] as $integration_action ) { |
| @@ -753,14 +641,8 @@ | ||
| 753 | 641 | $cleaned_actions[] = $integration_action; |
| 754 | 642 | } |
| 755 | 643 | continue; |
| 756 | 644 | } |
| 757 | - if ( 'activate' === $action_tag ) { | |
| 758 | - if ( $is_installed && ! $plugin_active ) { | |
| 759 | - $cleaned_actions[] = $integration_action; | |
| 760 | - } | |
| 761 | - continue; | |
| 762 | - } | |
| 763 | 645 | if ( 'enable' === $action_tag ) { |
| 764 | 646 | if ( $is_installed && ! $is_active ) { |
| 765 | 647 | $cleaned_actions[] = $integration_action; |
| 766 | 648 | } |
| @@ -766,9 +648,9 @@ | ||
| 766 | 648 | } |
| 767 | 649 | continue; |
| 768 | 650 | } |
| 769 | 651 | if ( 'settings' === $action_tag ) { |
| 770 | - if ( $is_installed && ( '' === $plugin_file || $plugin_active ) ) { | |
| 652 | + if ( $is_installed ) { | |
| 771 | 653 | $cleaned_actions[] = $integration_action; |
| 772 | 654 | } |
| 773 | 655 | continue; |
| 774 | 656 | } |