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