PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.5
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.5
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
charitable / includes / admin / notifications / class-charitable-eventdriven.php

class-charitable-eventdriven.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.5, at includes/admin/notifications/class-charitable-eventdriven.php

768 lines 22.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin form model class.
4 *
5 * @package Charitable/Classes/Charitable_Admin_Form
6 * @author David Bisset
7 * @copyright Copyright (c) 2022, WP Charitable LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.5.0
10 * @version 1.5.0
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Class EventDriven.
20 *
21 * @since 1.7.5
22 */
23 class Charitable_EventDriven {
24
25 /**
26 * WPForms version when the Event Driven feature has been introduced.
27 *
28 * @since 1.7.5
29 *
30 * @var string
31 */
32 const FEATURE_INTRODUCED = '1.7.5';
33
34 /**
35 * Expected date format for notifications.
36 *
37 * @since 1.7.5
38 *
39 * @var string
40 */
41 const DATE_FORMAT = 'Y-m-d H:i:s';
42
43 /**
44 * Common UTM parameters.
45 *
46 * @since 1.7.5
47 *
48 * @var array
49 */
50 const UTM_PARAMS = [
51 'utm_source' => 'WordPress',
52 'utm_medium' => 'Event Notification',
53 ];
54
55 /**
56 * Common targets for date logic.
57 *
58 * Available items:
59 * - upgraded (upgraded to a latest version)
60 * - activated
61 * - forms_first_created
62 * - X.X.X.X (upgraded to a specific version)
63 * - pro (activated/installed)
64 * - lite (activated/installed)
65 *
66 * @since 1.7.5
67 *
68 * @var array
69 */
70 const DATE_LOGIC = [ 'upgraded', 'activated', 'forms_first_created' ];
71
72 /**
73 * Timestamps.
74 *
75 * @since 1.7.5
76 *
77 * @var array
78 */
79 private $timestamps = [];
80
81 /**
82 * Initialize class.
83 *
84 * @since 1.7.5
85 */
86 public function init() {
87
88 if ( ! $this->allow_load() ) {
89 return;
90 }
91
92 $this->hooks();
93 }
94
95 /**
96 * Indicate if this is allowed to load.
97 *
98 * @since 1.7.5
99 *
100 * @return bool
101 */
102 private function allow_load() {
103
104 return charitable()->get( 'notifications' )->has_access() || wp_doing_cron();
105 }
106
107 /**
108 * Hooks.
109 *
110 * @since 1.7.5
111 */
112 private function hooks() {
113
114 add_filter( 'charitable_admin_notifications_update_data', [ $this, 'update_events' ] );
115 }
116
117 /**
118 * Add Event Driven notifications before saving them in database.
119 *
120 * @since 1.7.5
121 *
122 * @param array $data Notification data.
123 *
124 * @return array
125 */
126 public function update_events( $data ) {
127
128 $updated = [];
129
130 /**
131 * Allow developers to turn on debug mode: store all notifications and then show all of them.
132 *
133 * @since 1.7.5
134 *
135 * @param bool $is_debug True if it's a debug mode. Default: false.
136 */
137 $is_debug = (bool) apply_filters( 'charitable_admin_notifications_event_driven_update_events_debug', false );
138
139 $charitable_notifications = charitable()->get( 'notifications' );
140
141 foreach ( $this->get_notifications() as $slug => $notification ) {
142
143 $is_processed = ! empty( $data['events'][ $slug ]['start'] );
144 $is_conditional_ok = ! ( isset( $notification['condition'] ) && $notification['condition'] === false );
145
146 // If it's a debug mode OR valid notification has been already processed - skip running logic checks and save it.
147 if (
148 $is_debug ||
149 ( $is_processed && $is_conditional_ok && $charitable_notifications->is_valid( $data['events'][ $slug ] ) )
150 ) {
151 unset( $notification['date_logic'], $notification['offset'], $notification['condition'] );
152
153 // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
154 $notification['start'] = $is_debug ? date( self::DATE_FORMAT ) : $data['events'][ $slug ]['start'];
155 $updated[ $slug ] = $notification;
156
157 continue;
158 }
159
160 // Ignore if a condition is not passed conditional checks.
161 if ( ! $is_conditional_ok ) {
162 continue;
163 }
164
165 $timestamp = $this->get_timestamp_by_date_logic(
166 $this->prepare_date_logic( $notification )
167 );
168
169 if ( empty( $timestamp ) ) {
170 continue;
171 }
172
173 // Probably, notification should be visible after some time.
174 $offset = empty( $notification['offset'] ) ? 0 : absint( $notification['offset'] );
175
176 // Set a start date when notification will be shown.
177 // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
178 $notification['start'] = date( self::DATE_FORMAT, $timestamp + $offset );
179
180 // Ignore if notification data is not valid.
181 if ( ! $charitable_notifications->is_valid( $notification ) ) {
182 continue;
183 }
184
185 // Remove unnecessary values, mark notification as active, and save it.
186 unset( $notification['date_logic'], $notification['offset'], $notification['condition'] );
187 $updated[ $slug ] = $notification;
188 }
189
190 $data['events'] = $updated;
191
192 return $data;
193 }
194
195 /**
196 * Prepare and retrieve date logic.
197 *
198 * @since 1.7.5
199 *
200 * @param array $notification Notification data.
201 *
202 * @return array
203 */
204 private function prepare_date_logic( $notification ) {
205
206 $date_logic = empty( $notification['date_logic'] ) || ! is_array( $notification['date_logic'] ) ? self::DATE_LOGIC : $notification['date_logic'];
207
208 return array_filter( array_filter( $date_logic, 'is_string' ) );
209 }
210
211 /**
212 * Retrieve a notification timestamp based on date logic.
213 *
214 * @since 1.7.5
215 *
216 * @param array $args Date logic.
217 *
218 * @return int
219 */
220 private function get_timestamp_by_date_logic( $args ) {
221
222 foreach ( $args as $target ) {
223
224 if ( ! empty( $this->timestamps[ $target ] ) ) {
225 return $this->timestamps[ $target ];
226 }
227
228 $timestamp = call_user_func(
229 $this->get_timestamp_callback( $target ),
230 $target
231 );
232
233 if ( ! empty( $timestamp ) ) {
234 $this->timestamps[ $target ] = $timestamp;
235
236 return $timestamp;
237 }
238 }
239
240 return 0;
241 }
242
243 /**
244 * Retrieve a callback that determines needed timestamp.
245 *
246 * @since 1.7.5
247 *
248 * @param string $target Date logic target.
249 *
250 * @return callable
251 */
252 private function get_timestamp_callback( $target ) {
253
254 $raw_target = $target;
255
256 // As $target should be a part of name for callback method,
257 // this regular expression allow lowercase characters, numbers, and underscore.
258 $target = strtolower( preg_replace( '/[^a-z0-9_]/', '', $target ) );
259
260 // Basic callback.
261 $callback = [ $this, 'get_timestamp_' . $target ];
262
263 // Determine if a special version number is passed.
264 // Uses the regular expression to check a SemVer string.
265 // @link https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string.
266 if ( preg_match( '/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.([1-9\d*]))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/', $raw_target ) ) {
267 $callback = [ $this, 'get_timestamp_upgraded' ];
268 }
269
270 // If callback is callable, return it. Otherwise, return fallback.
271 return is_callable( $callback ) ? $callback : '__return_zero';
272 }
273
274 /**
275 * Retrieve a timestamp when WPForms was upgraded.
276 *
277 * @since 1.7.5
278 *
279 * @param string $version WPForms version.
280 *
281 * @return int|false Unix timestamp. False on failure.
282 */
283 private function get_timestamp_upgraded( $version ) {
284
285 if ( $version === 'upgraded' ) {
286 $version = WPFORMS_VERSION;
287 }
288
289 $timestamp = charitable_get_upgraded_timestamp( $version );
290
291 if ( $timestamp === false ) {
292 return false;
293 }
294
295 // Return a current timestamp if no luck to return a migration's timestamp.
296 return $timestamp <= 0 ? time() : $timestamp;
297 }
298
299 /**
300 * Retrieve a timestamp when WPForms was first installed/activated.
301 *
302 * @since 1.7.5
303 *
304 * @return int|false Unix timestamp. False on failure.
305 */
306 private function get_timestamp_activated() {
307
308 return charitable_get_activated_timestamp();
309 }
310
311 /**
312 * Retrieve a timestamp when Lite was first installed.
313 *
314 * @since 1.7.5
315 *
316 * @return int|false Unix timestamp. False on failure.
317 */
318 private function get_timestamp_lite() {
319
320 $activated = (array) get_option( 'charitable_activated', [] );
321
322 return ! empty( $activated['lite'] ) ? absint( $activated['lite'] ) : false;
323 }
324
325 /**
326 * Retrieve a timestamp when Pro was first installed.
327 *
328 * @since 1.7.5
329 *
330 * @return int|false Unix timestamp. False on failure.
331 */
332 private function get_timestamp_pro() {
333
334 $activated = (array) get_option( 'charitable_activated', [] );
335
336 return ! empty( $activated['pro'] ) ? absint( $activated['pro'] ) : false;
337 }
338
339 /**
340 * Retrieve a timestamp when a first form was created.
341 *
342 * @since 1.7.5
343 *
344 * @return int|false Unix timestamp. False on failure.
345 */
346 private function get_timestamp_forms_first_created() {
347
348 $timestamp = get_option( 'charitable_forms_first_created' );
349
350 return ! empty( $timestamp ) ? absint( $timestamp ) : false;
351 }
352
353 /**
354 * Retrieve a number of entries.
355 *
356 * @since 1.7.5
357 *
358 * @return int
359 */
360 private function get_entry_count() {
361
362 static $count;
363
364 if ( is_int( $count ) ) {
365 return $count;
366 }
367
368 global $wpdb;
369
370 $count = 0;
371 $entry_handler = charitable()->get( 'entry' );
372 $entry_meta_handler = charitable()->get( 'entry_meta' );
373
374 if ( ! $entry_handler || ! $entry_meta_handler ) {
375 return $count;
376 }
377
378 $query = "SELECT COUNT({$entry_handler->primary_key})
379 FROM {$entry_handler->table_name}
380 WHERE {$entry_handler->primary_key}
381 NOT IN (
382 SELECT entry_id
383 FROM {$entry_meta_handler->table_name}
384 WHERE type = 'backup_id'
385 );";
386
387 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
388 $count = (int) $wpdb->get_var( $query );
389
390 return $count;
391 }
392
393 /**
394 * Retrieve forms.
395 *
396 * @since 1.7.5
397 *
398 * @param int $posts_per_page Number of form to return.
399 *
400 * @return array
401 */
402 private function get_forms( $posts_per_page ) {
403
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 : [];
416 }
417
418 /**
419 * Determine if the user has at least 1 form.
420 *
421 * @since 1.7.5
422 *
423 * @return bool
424 */
425 private function has_form() {
426
427 return ! empty( $this->get_forms( 1 ) );
428 }
429
430 /**
431 * Determine if it is a new user.
432 *
433 * @since 1.7.5
434 *
435 * @return bool
436 */
437 private function is_new_user() {
438
439 // Check if this is an update or first install.
440 return ! get_option( 'charitable_version_upgraded_from' );
441 }
442
443 /**
444 * Determine if it's an English site.
445 *
446 * @since 1.7.5
447 *
448 * @return bool
449 */
450 private function is_english_site() {
451
452 static $result;
453
454 if ( is_bool( $result ) ) {
455 return $result;
456 }
457
458 $locales = array_unique(
459 array_map(
460 [ $this, 'language_to_iso' ],
461 [ get_locale(), get_user_locale() ]
462 )
463 );
464 $result = count( $locales ) === 1 && $locales[0] === 'en';
465
466 return $result;
467 }
468
469 /**
470 * Convert language to ISO.
471 *
472 * @since 1.7.5
473 *
474 * @param string $lang Language value.
475 *
476 * @return string
477 */
478 private function language_to_iso( $lang ) {
479
480 return $lang === '' ? $lang : explode( '_', $lang )[0];
481 }
482
483 /**
484 * Retrieve a modified URL query string.
485 *
486 * @since 1.7.5
487 *
488 * @param array $args An associative array of query variables.
489 * @param string $url A URL to act upon.
490 *
491 * @return string
492 */
493 private function add_query_arg( $args, $url ) {
494
495 return add_query_arg(
496 array_merge( $this->get_utm_params(), array_map( 'rawurlencode', $args ) ),
497 $url
498 );
499 }
500
501 /**
502 * Retrieve UTM parameters for Event Driven notifications links.
503 *
504 * @since 1.7.5
505 *
506 * @return array
507 */
508 private function get_utm_params() {
509
510 static $utm_params;
511
512 if ( ! $utm_params ) {
513 $utm_params = [
514 'utm_source' => self::UTM_PARAMS['utm_source'],
515 'utm_medium' => rawurlencode( self::UTM_PARAMS['utm_medium'] ),
516 'utm_campaign' => charitable()->is_pro() ? 'plugin' : 'liteplugin',
517 ];
518 }
519
520 return $utm_params;
521 }
522
523 /**
524 * Retrieve Event Driven notifications.
525 *
526 * @since 1.7.5
527 *
528 * @return array
529 */
530 private function get_notifications() {
531
532 return [
533 'welcome-message' => [
534 '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' ),
537 'btns' => [
538 'main' => [
539 'url' => admin_url( 'admin.php?page=charitable-builder' ),
540 'text' => esc_html__( 'Start Building', 'charitable-lite' ),
541 ],
542 'alt' => [
543 'url' => $this->add_query_arg(
544 [ 'utm_content' => 'Welcome Read the Guide' ],
545 'https://wpcharitable.com/docs/creating-first-form/'
546 ),
547 'text' => esc_html__( 'Read the Guide', 'charitable-lite' ),
548 ],
549 ],
550 'type' => [
551 'lite',
552 'basic',
553 'plus',
554 'pro',
555 'agency',
556 'elite',
557 'ultimate',
558 ],
559 // Immediately after activation (new users only, not upgrades).
560 'condition' => $this->is_new_user(),
561 ],
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 ];
766 }
767 }
768