PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
← All changes | includes/admin/notifications/class-charitable-eventdriven.php +125 -279 1.7.0.3 → 1.8.13 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2 /**
3 - * Admin form model class.
3 + * Events for notification class.
4 4 *
5 5 * @package Charitable/Classes/Charitable_Admin_Form
6 6 * @author David Bisset
7 - * @copyright Copyright (c) 2022, WP Charitable LLC
7 + * @copyright Copyright (c) 2023, WP Charitable LLC
8 8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 9 * @since 1.5.0
10 10 * @version 1.5.0
11 11 */
@@ -17,25 +17,32 @@
17 17
18 18 /**
19 19 * Class EventDriven.
20 20 *
21 - * @since 1.7.5
21 + * @since 1.8.3
22 22 */
23 23 class Charitable_EventDriven {
24 24
25 25 /**
26 - * WPForms version when the Event Driven feature has been introduced.
26 + * The single instance of this class.
27 27 *
28 - * @since 1.7.5
28 + * @var Charitable_Notifications|null
29 + */
30 + private static $instance = null;
31 +
32 + /**
33 + * Charitable version when the Event Driven feature has been introduced.
29 34 *
35 + * @since 1.8.3
36 + *
30 37 * @var string
31 38 */
32 - const FEATURE_INTRODUCED = '1.7.5';
39 + const FEATURE_INTRODUCED = '1.8.3';
33 40
34 41 /**
35 42 * Expected date format for notifications.
36 43 *
37 - * @since 1.7.5
44 + * @since 1.8.3
38 45 *
39 46 * @var string
40 47 */
41 48 const DATE_FORMAT = 'Y-m-d H:i:s';
@@ -42,9 +49,9 @@
42 49
43 50 /**
44 51 * Common UTM parameters.
45 52 *
46 - * @since 1.7.5
53 + * @since 1.8.3
47 54 *
48 55 * @var array
49 56 */
50 57 const UTM_PARAMS = [
@@ -57,23 +64,23 @@
57 64 *
58 65 * Available items:
59 66 * - upgraded (upgraded to a latest version)
60 67 * - activated
61 - * - forms_first_created
68 + * - campaigns_first_created
62 69 * - X.X.X.X (upgraded to a specific version)
63 70 * - pro (activated/installed)
64 71 * - lite (activated/installed)
65 72 *
66 - * @since 1.7.5
73 + * @since 1.8.3
67 74 *
68 75 * @var array
69 76 */
70 - const DATE_LOGIC = [ 'upgraded', 'activated', 'forms_first_created' ];
77 + const DATE_LOGIC = [ 'upgraded', 'activated', 'campaigns_first_created' ];
71 78
72 79 /**
73 80 * Timestamps.
74 81 *
75 - * @since 1.7.5
82 + * @since 1.8.3
76 83 *
77 84 * @var array
78 85 */
79 86 private $timestamps = [];
@@ -78,11 +85,19 @@
78 85 */
79 86 private $timestamps = [];
80 87
81 88 /**
89 + * Create object instance.
90 + *
91 + * @since 1.8.3
92 + */
93 + public function __construct() {
94 + }
95 +
96 + /**
82 97 * Initialize class.
83 98 *
84 - * @since 1.7.5
99 + * @since 1.8.3
85 100 */
86 101 public function init() {
87 102
88 103 if ( ! $this->allow_load() ) {
@@ -87,38 +102,34 @@
87 102
88 103 if ( ! $this->allow_load() ) {
89 104 return;
90 105 }
91 -
92 - $this->hooks();
93 106 }
94 107
95 108 /**
96 109 * Indicate if this is allowed to load.
97 110 *
98 - * @since 1.7.5
111 + * @since 1.8.3
99 112 *
100 113 * @return bool
101 114 */
102 115 private function allow_load() {
103 116
104 - return charitable()->get( 'notifications' )->has_access() || wp_doing_cron();
117 + return charitable()->registry()->get( 'notifications' )->has_access() || wp_doing_cron();
105 118 }
106 119
107 120 /**
108 121 * Hooks.
109 122 *
110 - * @since 1.7.5
123 + * @since 1.8.3
111 124 */
112 125 private function hooks() {
113 -
114 - add_filter( 'charitable_admin_notifications_update_data', [ $this, 'update_events' ] );
115 126 }
116 127
117 128 /**
118 129 * Add Event Driven notifications before saving them in database.
119 130 *
120 - * @since 1.7.5
131 + * @since 1.8.3
121 132 *
122 133 * @param array $data Notification data.
123 134 *
124 135 * @return array
@@ -129,15 +140,15 @@
129 140
130 141 /**
131 142 * Allow developers to turn on debug mode: store all notifications and then show all of them.
132 143 *
133 - * @since 1.7.5
144 + * @since 1.8.3
134 145 *
135 146 * @param bool $is_debug True if it's a debug mode. Default: false.
136 147 */
137 148 $is_debug = (bool) apply_filters( 'charitable_admin_notifications_event_driven_update_events_debug', false );
138 149
139 - $charitable_notifications = charitable()->get( 'notifications' );
150 + $charitable_notifications = charitable()->registry()->get( 'notifications' );
140 151
141 152 foreach ( $this->get_notifications() as $slug => $notification ) {
142 153
143 154 $is_processed = ! empty( $data['events'][ $slug ]['start'] );
@@ -194,9 +205,9 @@
194 205
195 206 /**
196 207 * Prepare and retrieve date logic.
197 208 *
198 - * @since 1.7.5
209 + * @since 1.8.3
199 210 *
200 211 * @param array $notification Notification data.
201 212 *
202 213 * @return array
@@ -210,9 +221,9 @@
210 221
211 222 /**
212 223 * Retrieve a notification timestamp based on date logic.
213 224 *
214 - * @since 1.7.5
225 + * @since 1.8.3
215 226 *
216 227 * @param array $args Date logic.
217 228 *
218 229 * @return int
@@ -242,9 +253,9 @@
242 253
243 254 /**
244 255 * Retrieve a callback that determines needed timestamp.
245 256 *
246 - * @since 1.7.5
257 + * @since 1.8.3
247 258 *
248 259 * @param string $target Date logic target.
249 260 *
250 261 * @return callable
@@ -271,23 +282,23 @@
271 282 return is_callable( $callback ) ? $callback : '__return_zero';
272 283 }
273 284
274 285 /**
275 - * Retrieve a timestamp when WPForms was upgraded.
286 + * Retrieve a timestamp when Charitable was upgraded.
276 287 *
277 - * @since 1.7.5
288 + * @since 1.8.3
278 289 *
279 - * @param string $version WPForms version.
290 + * @param string $version Charitable version.
280 291 *
281 292 * @return int|false Unix timestamp. False on failure.
282 293 */
283 - private function get_timestamp_upgraded( $version ) {
294 + private function get_timestamp_upgraded( $version = false ) {
284 295
285 - if ( $version === 'upgraded' ) {
286 - $version = WPFORMS_VERSION;
296 + if ( false === $version || $version === 'upgraded' ) {
297 + $version = charitable()->get_version();
287 298 }
288 299
289 - $timestamp = charitable_get_upgraded_timestamp( $version );
300 + $timestamp = charitable_get_updated_timestamp( $version );
290 301
291 302 if ( $timestamp === false ) {
292 303 return false;
293 304 }
@@ -296,11 +307,11 @@
296 307 return $timestamp <= 0 ? time() : $timestamp;
297 308 }
298 309
299 310 /**
300 - * Retrieve a timestamp when WPForms was first installed/activated.
311 + * Retrieve a timestamp when Charitable was first installed/activated.
301 312 *
302 - * @since 1.7.5
313 + * @since 1.8.3
303 314 *
304 315 * @return int|false Unix timestamp. False on failure.
305 316 */
306 317 private function get_timestamp_activated() {
@@ -310,9 +321,9 @@
310 321
311 322 /**
312 323 * Retrieve a timestamp when Lite was first installed.
313 324 *
314 - * @since 1.7.5
325 + * @since 1.8.3
315 326 *
316 327 * @return int|false Unix timestamp. False on failure.
317 328 */
318 329 private function get_timestamp_lite() {
@@ -324,9 +335,9 @@
324 335
325 336 /**
326 337 * Retrieve a timestamp when Pro was first installed.
327 338 *
328 - * @since 1.7.5
339 + * @since 1.8.3
329 340 *
330 341 * @return int|false Unix timestamp. False on failure.
331 342 */
332 343 private function get_timestamp_pro() {
@@ -338,15 +349,15 @@
338 349
339 350 /**
340 351 * Retrieve a timestamp when a first form was created.
341 352 *
342 - * @since 1.7.5
353 + * @since 1.8.3
343 354 *
344 355 * @return int|false Unix timestamp. False on failure.
345 356 */
346 - private function get_timestamp_forms_first_created() {
357 + private function get_timestamp_campaigns_first_created() {
347 358
348 - $timestamp = get_option( 'charitable_forms_first_created' );
359 + $timestamp = get_option( 'charitable_campaigns_first_created' );
349 360
350 361 return ! empty( $timestamp ) ? absint( $timestamp ) : false;
351 362 }
352 363
@@ -352,9 +363,9 @@
352 363
353 364 /**
354 365 * Retrieve a number of entries.
355 366 *
356 - * @since 1.7.5
367 + * @since 1.8.3
357 368 *
358 369 * @return int
359 370 */
360 371 private function get_entry_count() {
@@ -384,67 +395,89 @@
384 395 WHERE type = 'backup_id'
385 396 );";
386 397
387 398 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
388 - $count = (int) $wpdb->get_var( $query );
399 + $count = (int) $wpdb->get_var( $query ); // phpcs:ignore
389 400
390 401 return $count;
391 402 }
392 403
393 404 /**
394 - * Retrieve forms.
405 + * Retrieve campaigns.
395 406 *
396 - * @since 1.7.5
407 + * @since 1.8.3
397 408 *
398 409 * @param int $posts_per_page Number of form to return.
399 410 *
400 411 * @return array
401 412 */
402 - private function get_forms( $posts_per_page ) {
413 + private function get_campaigns( $posts_per_page ) { // phpcs:ignore
403 414
404 - $forms = charitable()->get( 'form' )->get(
405 - '',
406 - [
407 - 'posts_per_page' => (int) $posts_per_page,
408 - 'nopaging' => false,
409 - 'update_post_meta_cache' => false,
410 - 'update_post_term_cache' => false,
411 - 'cap' => false,
412 - ]
413 - );
414 -
415 - return ! empty( $forms ) ? (array) $forms : [];
415 + return ! empty( $campaigns ) ? (array) $campaigns : [];
416 416 }
417 417
418 418 /**
419 419 * Determine if the user has at least 1 form.
420 420 *
421 - * @since 1.7.5
421 + * @since 1.8.3
422 422 *
423 423 * @return bool
424 424 */
425 425 private function has_form() {
426 426
427 - return ! empty( $this->get_forms( 1 ) );
427 + return ! empty( $this->get_campaigns( 1 ) );
428 428 }
429 429
430 430 /**
431 - * Determine if it is a new user.
431 + * Determine if it is a new user, usually by checking if the plugin has been updated or first installed.
432 432 *
433 - * @since 1.7.5
433 + * @since 1.8.3
434 434 *
435 435 * @return bool
436 436 */
437 437 private function is_new_user() {
438 438
439 - // Check if this is an update or first install.
440 - return ! get_option( 'charitable_version_upgraded_from' );
439 + $activated = (array) get_option( 'charitable_activated', array() );
440 +
441 + if ( empty( $activated ) || ! is_array( $activated ) ) {
442 + delete_transient( 'charitable_autoshow_plugin_notifications' );
443 + return true;
444 + }
445 +
446 + // Find for the oldest unix timestamp in the values of $activated and assign it to a variable.
447 + $activated_time = max( $activated );
448 +
449 + // If the timestamp eariler than 30 days from current time, then the user is new.
450 + $is_new_user = ( time() - $activated_time ) < 30 * DAY_IN_SECONDS;
451 +
452 + if ( ! $is_new_user ) {
453 + return false;
454 + }
455 +
456 + $versions_upgraded_from = get_option( 'charitable_version_upgraded_from', [] );
457 +
458 + if ( empty( $versions_upgraded_from ) ) {
459 + return true;
460 + }
461 +
462 + // Get the first value in the $versions_upgraded_from array.
463 + $version = reset( $versions_upgraded_from );
464 +
465 + // If the version equals the current version, then it is a new user.
466 + $is_new_user = version_compare( $version, charitable()->get_version(), '=' );
467 +
468 + if ( $is_new_user ) {
469 + delete_transient( 'charitable_autoshow_plugin_notifications' );
470 + return true;
471 + }
472 +
473 + return false;
441 474 }
442 475
443 476 /**
444 477 * Determine if it's an English site.
445 478 *
446 - * @since 1.7.5
479 + * @since 1.8.3
447 480 *
448 481 * @return bool
449 482 */
450 483 private function is_english_site() {
@@ -468,9 +501,9 @@
468 501
469 502 /**
470 503 * Convert language to ISO.
471 504 *
472 - * @since 1.7.5
505 + * @since 1.8.3
473 506 *
474 507 * @param string $lang Language value.
475 508 *
476 509 * @return string
@@ -482,9 +515,9 @@
482 515
483 516 /**
484 517 * Retrieve a modified URL query string.
485 518 *
486 - * @since 1.7.5
519 + * @since 1.8.3
487 520 *
488 521 * @param array $args An associative array of query variables.
489 522 * @param string $url A URL to act upon.
490 523 *
@@ -500,9 +533,9 @@
500 533
501 534 /**
502 535 * Retrieve UTM parameters for Event Driven notifications links.
503 536 *
504 - * @since 1.7.5
537 + * @since 1.8.3
505 538 *
506 539 * @return array
507 540 */
508 541 private function get_utm_params() {
@@ -512,9 +545,9 @@
512 545 if ( ! $utm_params ) {
513 546 $utm_params = [
514 547 'utm_source' => self::UTM_PARAMS['utm_source'],
515 548 'utm_medium' => rawurlencode( self::UTM_PARAMS['utm_medium'] ),
516 - 'utm_campaign' => charitable()->is_pro() ? 'plugin' : 'liteplugin',
549 + 'utm_campaign' => charitable_is_pro() ? 'plugin' : 'liteplugin',
517 550 ];
518 551 }
519 552
520 553 return $utm_params;
@@ -522,9 +555,9 @@
522 555
523 556 /**
524 557 * Retrieve Event Driven notifications.
525 558 *
526 - * @since 1.7.5
559 + * @since 1.8.3
527 560 *
528 561 * @return array
529 562 */
530 563 private function get_notifications() {
@@ -529,23 +562,23 @@
529 562 */
530 563 private function get_notifications() {
531 564
532 565 return [
533 - 'welcome-message' => [
566 + 'welcome-message' => [
534 567 'id' => 'welcome-message',
535 - 'title' => esc_html__( 'Welcome to WPForms!', 'charitable-lite' ),
536 - 'content' => esc_html__( 'We’re grateful that you chose WPForms for your website! Now that you’ve installed the plugin, you’re less than 5 minutes away from publishing your first form. To make it easy, we’ve got 400+ form templates to get you started!', 'charitable-lite' ),
568 + 'title' => esc_html__( 'Welcome to Charitable!', 'charitable' ),
569 + 'content' => esc_html__( 'We’re grateful that you chose Charitable! Now that you’ve installed the plugin, you’re less than 5 minutes away from publishing your first campaign. To make it easy, we’ve got a checklist to get you started!', 'charitable' ),
537 570 'btns' => [
538 571 'main' => [
539 - 'url' => admin_url( 'admin.php?page=charitable-builder' ),
540 - 'text' => esc_html__( 'Start Building', 'charitable-lite' ),
572 + 'url' => admin_url( 'admin.php?page=charitable-setup-checklist' ),
573 + 'text' => esc_html__( 'Start Checklist', 'charitable' ),
541 574 ],
542 575 'alt' => [
543 576 'url' => $this->add_query_arg(
544 577 [ 'utm_content' => 'Welcome Read the Guide' ],
545 - 'https://wpcharitable.com/docs/creating-first-form/'
578 + 'https://wpcharitable.com/documentation/creating-your-first-campaign/'
546 579 ),
547 - 'text' => esc_html__( 'Read the Guide', 'charitable-lite' ),
580 + 'text' => esc_html__( 'Read the Guide', 'charitable' ),
548 581 ],
549 582 ],
550 583 'type' => [
551 584 'lite',
@@ -554,214 +587,27 @@
554 587 'pro',
555 588 'agency',
556 589 'elite',
557 590 'ultimate',
591 + 'lifetime',
558 592 ],
559 593 // Immediately after activation (new users only, not upgrades).
560 594 'condition' => $this->is_new_user(),
561 595 ],
562 - 'wp-mail-smtp-education' => [
563 - 'id' => 'wp-mail-smtp-education',
564 - 'title' => esc_html__( 'Don’t Miss Your Form Notification Emails!', 'charitable-lite' ),
565 - 'content' => esc_html__( 'Did you know that many WordPress sites are not properly configured to send emails? With the free WP Mail SMTP plugin, you can easily optimize your site to send emails, avoid the spam folder, and make sure your emails land in the recipient’s inbox every time.', 'charitable-lite' ),
566 - 'btns' => [
567 - 'main' => [
568 - 'url' => admin_url( 'admin.php?page=charitable-smtp' ),
569 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
570 - ],
571 - 'alt' => [
572 - 'url' => $this->add_query_arg(
573 - [ 'utm_content' => 'WP Mail SMTP Learn More' ],
574 - 'https://wpcharitable.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/'
575 - ),
576 - 'text' => esc_html__( 'Learn More', 'charitable-lite' ),
577 - ],
578 - ],
579 - // 3 days after activation/upgrade.
580 - 'offset' => 3 * DAY_IN_SECONDS,
581 - 'condition' => ! function_exists( 'wp_mail_smtp' ),
582 - ],
583 - 'join-vip-circle' => [
584 - 'id' => 'join-vip-circle',
585 - 'title' => esc_html__( 'Want to Be a VIP? Join Now!', 'charitable-lite' ),
586 - 'content' => esc_html__( 'Running a WordPress site can be challenging. But help is just around the corner! Our Facebook group contains tons of tips and help to get your business growing! When you join our VIP Circle, you’ll get instant access to tips, tricks, and answers from a community of loyal WPForms users. Best of all, membership is 100% free!', 'charitable-lite' ),
587 - 'btns' => [
588 - 'main' => [
589 - 'url' => 'https://www.facebook.com/groups/charitablevip/',
590 - 'text' => esc_html__( 'Join Now', 'charitable-lite' ),
591 - ],
592 - ],
593 - // 30 days after activation/upgrade.
594 - 'offset' => 30 * DAY_IN_SECONDS,
595 - ],
596 - 'survey-reports' => [
597 - 'id' => 'survey-reports',
598 - 'title' => esc_html__( 'Want to Know What Your Customers Really Think?', 'charitable-lite' ),
599 - 'content' => esc_html__( 'Nothing beats real feedback from your customers and visitors. That’s why many small businesses love our awesome Surveys and Polls addon. Instantly unlock full survey reporting right in your WordPress dashboard. And don’t forget: building a survey is easy with our pre-made templates, so you could get started within a few minutes!', 'charitable-lite' ),
600 - 'btns' => [
601 - 'main' => [
602 - 'license' => [
603 - 'lite' => [
604 - 'url' => $this->add_query_arg(
605 - [ 'utm_content' => 'Surveys and Polls Upgrade Lite' ],
606 - 'https://wpcharitable.com/lite-upgrade/'
607 - ),
608 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
609 - ],
610 - 'basic' => [
611 - 'url' => $this->add_query_arg(
612 - [ 'utm_content' => 'Surveys and Polls Upgrade Basic' ],
613 - 'https://wpcharitable.com/account/licenses/'
614 - ),
615 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
616 - ],
617 - 'plus' => [
618 - 'url' => $this->add_query_arg(
619 - [ 'utm_content' => 'Surveys and Polls Upgrade Basic' ],
620 - 'https://wpcharitable.com/account/licenses/'
621 - ),
622 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
623 - ],
624 - 'pro' => [
625 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
626 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
627 - ],
628 - 'elite' => [
629 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
630 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
631 - ],
632 - ],
633 - ],
634 - 'alt' => [
635 - 'url' => $this->add_query_arg(
636 - [ 'utm_content' => 'Surveys and Polls Learn More' ],
637 - 'https://wpcharitable.com/docs/how-to-install-and-use-the-surveys-and-polls-addon/'
638 - ),
639 - 'text' => esc_html__( 'Learn More', 'charitable-lite' ),
640 - ],
641 - ],
642 - // 45 days after activation/upgrade.
643 - 'offset' => 45 * DAY_IN_SECONDS,
644 - 'condition' => ! defined( 'WPFORMS_SURVEYS_POLLS_VERSION' ),
645 - ],
646 - 'form-abandonment' => [
647 - 'id' => 'form-abandonment',
648 - 'title' => esc_html__( 'Get More Leads From Your Forms!', 'charitable-lite' ),
649 - 'content' => esc_html__( 'Are your forms converting fewer visitors than you hoped? Often, visitors quit forms partway through. That can prevent you from getting all the leads you deserve to capture. With our Form Abandonment addon, you can capture partial entries even if your visitor didn’t hit Submit! From there, it’s easy to follow up with leads and turn them into loyal customers.', 'charitable-lite' ),
650 - 'btns' => [
651 - 'main' => [
652 - 'license' => [
653 - 'lite' => [
654 - 'url' => $this->add_query_arg(
655 - [ 'utm_content' => 'Form Abandonment Upgrade Lite' ],
656 - 'https://wpcharitable.com/lite-upgrade/'
657 - ),
658 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
659 - ],
660 - 'basic' => [
661 - 'url' => $this->add_query_arg(
662 - [ 'utm_content' => 'Form Abandonment Upgrade Basic' ],
663 - 'https://wpcharitable.com/account/licenses/'
664 - ),
665 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
666 - ],
667 - 'plus' => [
668 - 'url' => $this->add_query_arg(
669 - [ 'utm_content' => 'Form Abandonment Upgrade Basic' ],
670 - 'https://wpcharitable.com/account/licenses/'
671 - ),
672 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
673 - ],
674 - 'pro' => [
675 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
676 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
677 - ],
678 - 'elite' => [
679 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
680 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
681 - ],
682 - ],
683 - ],
684 - 'alt' => [
685 - 'url' => $this->add_query_arg(
686 - [ 'utm_content' => 'Form Abandonment Learn More' ],
687 - 'https://wpcharitable.com/docs/how-to-install-and-use-form-abandonment-with-charitable/'
688 - ),
689 - 'text' => esc_html__( 'Learn More', 'charitable-lite' ),
690 - ],
691 - ],
692 - // 60 days after activation/upgrade.
693 - 'offset' => 60 * DAY_IN_SECONDS,
694 - 'condition' => ! defined( 'WPFORMS_FORM_ABANDONMENT_VERSION' ),
695 - ],
696 - 'translation-community' => [
697 - 'id' => 'translation-community',
698 - 'title' => esc_html__( 'WPForms Needs Your Translation Skills!', 'charitable-lite' ),
699 - 'content' => esc_html__( 'Did you know that WPForms has its own Translation Community? We’re on the lookout for skilled translators to help make WPForms truly accessible to our millions of users around the world. You can earn WPForms swag and a free Pro license. Want to get involved?', 'charitable-lite' ),
700 - 'btns' => [
701 - 'main' => [
702 - 'url' => 'https://wpcharitable.com/translate/',
703 - 'text' => esc_html__( 'Join Now', 'charitable-lite' ),
704 - ],
705 - ],
706 - // 90 days after activation/upgrade.
707 - 'offset' => 90 * DAY_IN_SECONDS,
708 - 'condition' => $this->has_form() && ! $this->is_english_site(),
709 - ],
710 - 'ideas' => [
711 - 'id' => 'ideas',
712 - 'title' => esc_html__( 'What’s Your Dream WPForms Feature?', 'charitable-lite' ),
713 - 'content' => esc_html__( 'If you could add just one feature to WPForms, what would it be? We want to know! Our team is busy surveying valued customers like you as we plan the year ahead. We’d love to know which features would take your business to the next level! Do you have a second to share your idea with us?', 'charitable-lite' ),
714 - 'btns' => [
715 - 'main' => [
716 - 'url' => 'https://wpcharitable.com/share-your-idea/',
717 - 'text' => esc_html__( 'Share Your Idea', 'charitable-lite' ),
718 - ],
719 - ],
720 - // 120 days after activation/upgrade.
721 - 'offset' => 120 * DAY_IN_SECONDS,
722 - 'condition' => $this->has_form(),
723 - ],
724 - 'user-insights' => [
725 - 'id' => 'user-insights',
726 - 'title' => esc_html__( 'Congratulations! You Just Got Your 100th Form Entry!', 'charitable-lite' ),
727 - 'content' => esc_html__( 'You just hit 100 entries&hellip; and this is just the beginning! Now it’s time to dig into the data and figure out what makes your visitors tick. The User Journey addon shows you what your visitors looked at before submitting your form. Now you can easily find which areas of your site are triggering form conversions.', 'charitable-lite' ),
728 - 'btns' => [
729 - 'main' => [
730 - 'license' => [
731 - 'lite' => [
732 - 'url' => $this->add_query_arg(
733 - [ 'utm_content' => 'User Journey Upgrade Lite' ],
734 - 'https://wpcharitable.com/lite-upgrade/'
735 - ),
736 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
737 - ],
738 - 'basic' => [
739 - 'url' => $this->add_query_arg(
740 - [ 'utm_content' => 'User Journey Upgrade Basic' ],
741 - 'https://wpcharitable.com/account/licenses/'
742 - ),
743 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
744 - ],
745 - 'plus' => [
746 - 'url' => $this->add_query_arg(
747 - [ 'utm_content' => 'User Journey Upgrade Basic' ],
748 - 'https://wpcharitable.com/account/licenses/'
749 - ),
750 - 'text' => esc_html__( 'Upgrade Now', 'charitable-lite' ),
751 - ],
752 - 'pro' => [
753 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
754 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
755 - ],
756 - 'elite' => [
757 - 'url' => admin_url( 'admin.php?page=charitable-addons' ),
758 - 'text' => esc_html__( 'Install Now', 'charitable-lite' ),
759 - ],
760 - ],
761 - ],
762 - ],
763 - 'condition' => ! defined( 'WPFORMS_USER_JOURNEY_VERSION' ) && $this->get_entry_count() >= 100,
764 - ],
765 596 ];
597 + }
598 +
599 + /**
600 + * Returns and/or create the single instance of this class.
601 + *
602 + * @since 1.8.3
603 + *
604 + * @return Charitable_EventDriven
605 + */
606 + public static function get_instance() {
607 + if ( is_null( self::$instance ) ) {
608 + self::$instance = new self();
609 + }
610 +
611 + return self::$instance;
766 612 }
767 613 }