PluginProbe
Eventin – Event Calendar, Tickets, Registration, Booking & WooCommerce / trunk
Eventin – Event Calendar, Tickets, Registration, Booking & WooCommerce vtrunk
4.1.23 4.1.22 4.1.21 4.1.20 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 209 releases
wp-event-solution / eventin.php

eventin.php in Eventin – Event Calendar, Tickets, Registration, Booking & WooCommerce trunk, at eventin.php

786 lines 26.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Eventin\Eventin;
4 use Eventin\Upgrade\Upgrade;
5 use Eventin\Upgrade\Upgraders\V_3_3_57;
6
7 defined('ABSPATH') || exit;
8
9 /**
10 * Plugin Name: Eventin
11 * Plugin URI: https://themewinter.com/eventin/
12 * Description: Simple and Easy to use Event Management Solution
13 * Version: 4.1.23
14 * Author: Themewinter
15 * Author URI: https://themewinter.com/
16 * License: GPL-2.0+
17 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
18 * Text Domain: eventin
19 * Domain Path: /languages
20 * Requires at least: 6.2
21 * Requires PHP: 7.4
22 */
23
24 require_once __DIR__ . '/vendor/autoload.php';
25 require_once plugin_dir_path(__FILE__) . '/utils/functions.php';
26
27 class Wpeventin
28 {
29
30 /**
31 * Instance of self
32 *
33 * @since 2.4.3
34 *
35 * @var Wpeventin
36 */
37 public static $instance = null;
38
39 /**
40 * Plugin Version
41 *
42 * @since 2.4.3
43 *
44 * @var string The plugin version.
45 */
46 public static function version() {
47 return "4.1.23";
48 }
49 /**
50 * Initializes the Wpeventin() class
51 *
52 * Checks for an existing Wpeventin() instance
53 * and if it doesn't find one, creates it.
54 */
55 public static function init()
56 {
57 if (null === self::$instance) {
58 self::$instance = new self();
59 }
60
61 return self::$instance;
62 }
63
64 /**
65 * Instance of Wpeventin
66 */
67 private function __construct()
68 {
69
70 $this->define_constants();
71
72 $this->activate();
73 $this->deactivate();
74
75 add_action('plugins_loaded', [$this, 'initialize_modules'], 999);
76 }
77
78 /**
79 * Define Plugin Constants
80 *
81 * @return void
82 */
83 public function define_constants()
84 {
85 // handle demo site features.
86 define('ETN_ASSETS', self::assets_dir());
87 define('ETN_PLUGIN_TEMPLATE_DIR', self::templates_dir());
88 define('ETN_THEME_TEMPLATE_DIR', self::theme_templates_dir());
89 define('ETN_DEMO_SITE', false);
90 if (ETN_DEMO_SITE === true) {
91 define('ETN_EVENT_TEMPLATE_ONE_ID', '41');
92 define('ETN_EVENT_TEMPLATE_TWO_ID', '13');
93 define('ETN_EVENT_TEMPLATE_THREE_ID', '39');
94
95 define('ETN_SPEAKER_TEMPLATE_ONE_ID', '19');
96 define('ETN_SPEAKER_TEMPLATE_TWO_LITE_ID', '20');
97 define('ETN_SPEAKER_TEMPLATE_TWO_ID', '17');
98 define('ETN_SPEAKER_TEMPLATE_THREE_ID', '21');
99 }
100
101 define('ETN_DEFAULT_TICKET_NAME', 'DEFAULT');
102
103 global $wpdb;
104 define('ETN_EVENT_PURCHASE_HISTORY_TABLE', $wpdb->prefix . 'etn_events');
105 define('ETN_EVENT_PURCHASE_HISTORY_META_TABLE', $wpdb->prefix . 'etn_trans_meta');
106 }
107
108 /**
109 * Initialize Modules
110 *
111 * @since 2.4.3
112 */
113 public function initialize_modules()
114 {
115 do_action('eventin/before_load');
116
117 Eventin::instance();
118
119 if (class_exists('Wpeventin_Pro') && version_compare(Wpeventin_Pro::version(), '4.0.16', '>')) {
120 do_action('eventin/after_load');
121 }
122
123 $this->load_composer_packages();
124 }
125
126 /**
127 * Theme's Templates Folder Directory Path
128 *
129 * @since 2.4.3
130 *
131 * @return string
132 */
133 public static function theme_templates_dir()
134 {
135 return trailingslashit('/eventin/templates');
136 }
137
138 /**
139 * Templates Folder Directory Path
140 *
141 * @since 2.4.3
142 *
143 * @return string
144 */
145 public static function templates_dir()
146 {
147 return trailingslashit(self::plugin_dir() . 'templates');
148 }
149
150 /**
151 * Utils Folder Directory Path
152 *
153 * @since 2.4.3
154 *
155 * @return string
156 */
157 public static function utils_dir()
158 {
159 return trailingslashit(self::plugin_dir() . 'utils');
160 }
161
162 /**
163 * Widgets Directory Url
164 *
165 * @return string
166 */
167 public static function widgets_url()
168 {
169 return trailingslashit(self::plugin_url() . 'widgets');
170 }
171
172 /**
173 * Widgets Folder Directory Path
174 *
175 * @since 2.4.3
176 *
177 * @return string
178 */
179 public static function widgets_dir()
180 {
181 return trailingslashit(self::plugin_dir() . 'widgets');
182 }
183
184 /**
185 * Assets Directory Url
186 *
187 * @return string
188 */
189 public static function assets_url()
190 {
191 return trailingslashit(self::plugin_url() . 'assets');
192 }
193
194 /**
195 * Assets Folder Directory Path
196 *
197 * @since 2.4.3
198 *
199 * @return string
200 */
201 public static function assets_dir()
202 {
203 return trailingslashit(self::plugin_dir() . 'assets');
204 }
205
206 /**
207 * Plugin Core File Directory Url
208 *
209 * @since 2.4.3
210 *
211 * @return string
212 */
213 public static function core_url()
214 {
215 return trailingslashit(self::plugin_url() . 'core');
216 }
217
218 /**
219 * Plugin Core File Directory Path
220 *
221 * @since 2.4.3
222 *
223 * @return string
224 */
225 public static function core_dir()
226 {
227 return trailingslashit(self::plugin_dir() . 'core');
228 }
229
230 /**
231 * Plugin Url
232 *
233 * @since 2.4.3
234 *
235 * @return string
236 */
237 public static function plugin_url($path = '')
238 {
239 return trailingslashit(plugin_dir_url(self::plugin_file())) . $path;
240 }
241
242 /**
243 * Plugin Directory Path
244 *
245 * @since 2.4.3
246 *
247 * @return string
248 */
249 public static function plugin_dir()
250 {
251 return trailingslashit(plugin_dir_path(self::plugin_file()));
252 }
253
254 /**
255 * Plugins Basename
256 *
257 * @since 2.4.3
258 *
259 * @return string
260 */
261 public static function plugins_basename()
262 {
263 return plugin_basename(self::plugin_file());
264 }
265
266 /**
267 * Plugin File
268 *
269 * @since 2.4.3
270 *
271 * @return string
272 */
273 public static function plugin_file()
274 {
275 return __FILE__;
276 }
277
278 /**
279 * Initialize on plugin activation
280 *
281 * @return void
282 */
283 public function activate()
284 {
285 register_activation_hook($this->plugin_file(), [$this, 'activate_actions']);
286 }
287
288 /**
289 * Run on deactivation hook
290 *
291 * @return void
292 */
293 public function deactivate()
294 {
295 register_deactivation_hook($this->plugin_file(), [$this, 'deactivate_actions']);
296 }
297
298 /**
299 * Run on deactivation hooks
300 *
301 * @return void
302 */
303 public function deactivate_actions()
304 {
305 $current_version = self::version();
306
307 if ('4.0.0' == $current_version) {
308 $v3_3_57 = new V_3_3_57();
309
310 $v3_3_57->run();
311 }
312 }
313
314 /**
315 * Fire on activation hook
316 *
317 * @return void
318 */
319 public function activate_actions()
320 {
321 Upgrade::register();
322
323 // Update plugin version and existing user roles.
324 $version = get_option('etn_version', true);
325 $current_version = self::version();
326
327 delete_transient('etn_event_list');
328
329 flush_rewrite_rules();
330 }
331
332 /**
333 * @return void
334 */
335 public function load_composer_packages()
336 {
337 if (file_exists(plugin_dir_path(__FILE__) . '/vendor/autoload.php')) {
338 require_once plugin_dir_path(__FILE__) . '/vendor/autoload.php';
339 }
340
341 // load UninstallerForm plugin
342 $this->load_uninstallerform_package();
343
344 $etn_addons_options = get_option('etn_addons_options') ?? [];
345 $is_automation_module_on = "off";
346 if (is_array($etn_addons_options)) {
347 $is_automation_module_on = $etn_addons_options["automation"] ?? "off";
348 }
349
350 // check if automation module is on
351 if ('on' === $is_automation_module_on) {
352 $this->load_automation_package();
353 }
354 }
355
356 private function load_uninstallerform_package()
357 {
358 if (class_exists('UninstallerForm\UninstallerForm') && is_callable(['\UninstallerForm\UninstallerForm', 'init'])) {
359
360 $reflection = new ReflectionMethod('\UninstallerForm\UninstallerForm', 'init');
361
362 // Maximum number of parameters allowed
363 $totalParams = $reflection->getNumberOfParameters();
364
365 if ($totalParams === 6) {
366 add_filter('rest_request_before_callbacks', function ($response, $handler, $request) {
367 if ($request->get_route() === '/eventin/v1/feedback') {
368 $params = $request->get_json_params();
369
370 if (empty($params['email'])) {
371 $params['email'] = get_option('admin_email');
372 $request->set_body(wp_json_encode($params));
373 }
374 }
375 return $response;
376 }, 10, 3);
377
378 \UninstallerForm\UninstallerForm::init(
379 'Eventin', // Plugin name
380 'eventin', // Plugin Slug
381 __FILE__,
382 'eventin', // Text Domain Name
383 'etn-dashboard', // plugins-admin-script-handler
384 'https://themewinter.com/?fluentcrm=1&route=contact&hash=50d358fa-e039-4459-a3d0-ef73b3c7d451'
385 );
386 } else {
387 add_filter('rest_request_before_callbacks', function ($response, $handler, $request) {
388 if ($request->get_route() === '/eventin/v1/feedback') {
389 $params = $request->get_json_params();
390
391 if (empty($params['email'])) {
392 $params['email'] = get_option('admin_email');
393 $request->set_body(wp_json_encode($params));
394 }
395 }
396 return $response;
397 }, 10, 3);
398
399 \UninstallerForm\UninstallerForm::init(
400 'Eventin', // Plugin name
401 'eventin', // Plugin Slug
402 __FILE__,
403 'eventin', // Text Domain Name
404 'etn-dashboard'
405 );
406 }
407 }
408 }
409
410 private function load_automation_package()
411 {
412 if (class_exists(\Eventin\Vendor\Ens\Core\SDK::class)) {
413 \Eventin\Vendor\Ens\Core\SDK::get_instance()->setup([
414 'plugin_name' => 'Eventin',
415 'plugin_slug' => 'eventin',
416 'general_prefix' => 'eve',
417 'text_domain' => 'eventin',
418 'admin_script_handler' => 'etn-dashboard',
419 'sub_menu_filter_hook' => 'eventin_menu',
420 'sub_menu_details' => [
421 'title' => 'Email Automation',
422 'capability' => 'manage_options',
423 'url' => 'admin.php?page=' . 'eventin' . '#/automation',
424 'position' => 8,
425 ],
426 ])
427 ->init();
428
429 add_filter('ens_eve_available_actions', function ($actions) {
430 $actions = [ // Array of all actions, on which you want to send email
431 [
432 "trigger_label" => "Event Ticket Purchase", // Name of the event
433 "trigger_value" => "event_ticket_purchase", // Event slug
434 "trigger_data" => [ // Data you have after the event happened
435 [
436 "label" => "Site Name",
437 "value" => "site_name",
438 "type" => "string",
439 ],
440 [
441 "label" => "Site Link",
442 "value" => "site_link",
443 "type" => "string",
444 ],
445 [
446 "label" => "Site Logo",
447 "value" => "site_logo",
448 "type" => "string",
449 ],
450 [
451 "label" => "Event Title",
452 "value" => "event_title",
453 "type" => "string",
454 ],
455 [
456 "label" => "Event Date",
457 "value" => "event_date",
458 "type" => "date",
459 ],
460 [
461 "label" => "Event Time",
462 "value" => "event_time",
463 "type" => "string",
464 ],
465 [
466 "label" => "Event Location",
467 "value" => "event_location",
468 "type" => "string",
469 ],
470 ],
471 "conditional_dependencies" => [ // Data you have after the event happened
472 [
473 "label" => "Event Title",
474 "value" => "event_title",
475 "type" => "string",
476 ],
477 ],
478 "delay_dependencies" => [
479 [
480 "label" => "After Booking Time",
481 "value" => "after_booking_time",
482 ],
483 ],
484 "email_receivers" => [
485 [
486 "label" => "Attendee",
487 "value" => "attendee_email",
488 ],
489 [
490 "label" => "Customer",
491 "value" => "customer_email",
492 ],
493 [
494 "label" => "Admin",
495 "value" => "admin_email",
496 ],
497 ],
498 ],
499 [
500 "trigger_label" => "RSVP Email", // Name of the event
501 "trigger_value" => "event_rsvp_email", // Event slug
502 "trigger_data" => [ // Data you have after the event happened
503 [
504 "label" => "Site Name",
505 "value" => "site_name",
506 "type" => "string",
507 ],
508 [
509 "label" => "Site Link",
510 "value" => "site_link",
511 "type" => "string",
512 ],
513 [
514 "label" => "Event Title",
515 "value" => "event_title",
516 "type" => "string",
517 ],
518 [
519 "label" => "Event Date",
520 "value" => "event_date",
521 "type" => "date",
522 ],
523 [
524 "label" => "Event Time",
525 "value" => "event_time",
526 "type" => "string",
527 ],
528 [
529 "label" => "Event Location",
530 "value" => "event_location",
531 "type" => "string",
532 ],
533
534 ],
535 "conditional_dependencies" => [ // Data you have after the event happened
536 [
537 "label" => "Event Title",
538 "value" => "event_title",
539 "type" => "string",
540 ],
541 ],
542 "delay_dependencies" => [
543 [
544 "label" => "After Registration Time",
545 "value" => "after_registration_time",
546 ],
547 ],
548 "email_receivers" => [
549 [
550 "label" => "Attendee",
551 "value" => "attendee_email",
552 ],
553 ],
554 ],
555 [
556 "trigger_label" => "Event Reminder Email", // Name of the event
557 "trigger_value" => "event_reminder_email", // Event slug
558 "trigger_data" => [ // Data you have after the event happened
559 [
560 "label" => "Site Name",
561 "value" => "site_name",
562 "type" => "string",
563 ],
564 [
565 "label" => "Site Link",
566 "value" => "site_link",
567 "type" => "string",
568 ],
569 [
570 "label" => "Event Title",
571 "value" => "event_title",
572 "type" => "string",
573 ],
574 [
575 "label" => "Event Date",
576 "value" => "event_date",
577 "type" => "date",
578 ],
579 [
580 "label" => "Event Time",
581 "value" => "event_time",
582 "type" => "string",
583 ],
584 [
585 "label" => "Event Location",
586 "value" => "event_location",
587 "type" => "string",
588 ],
589 ],
590 "conditional_dependencies" => [ // Data you have after the event happened
591 [
592 "label" => "Event Title",
593 "value" => "event_title",
594 "type" => "string",
595 ],
596 ],
597 "delay_dependencies" => [
598 [
599 "label" => "Before Event Start",
600 "value" => "before_event_start_date",
601 ],
602 [
603 "label" => "Before Event End",
604 "value" => "before_event_end_date",
605 ],
606 [
607 "label" => "After Event Start",
608 "value" => "after_event_start_date",
609 ],
610 [
611 "label" => "After Event End",
612 "value" => "after_event_end_date",
613 ],
614 ],
615 "email_receivers" => [
616 [
617 "label" => "Attendee",
618 "value" => "attendee_email",
619 ],
620 ],
621 ],
622 [
623 "trigger_label" => "Send Email To All Attendees", // Name of the event
624 "trigger_value" => "send_email_to_all_attendees", // Event slug
625 "trigger_data" => [ // Data you have after the event happened
626 [
627 "label" => "Site Name",
628 "value" => "site_name",
629 "type" => "string",
630 ],
631 [
632 "label" => "Site Link",
633 "value" => "site_link",
634 "type" => "string",
635 ],
636 [
637 "label" => "Event Title",
638 "value" => "event_title",
639 "type" => "string",
640 ],
641 [
642 "label" => "Event Date",
643 "value" => "event_date",
644 "type" => "date",
645 ],
646 [
647 "label" => "Event Time",
648 "value" => "event_time",
649 "type" => "string",
650 ],
651 [
652 "label" => "Event Location",
653 "value" => "event_location",
654 "type" => "string",
655 ],
656 ],
657 "conditional_dependencies" => [ // Data you have after the event happened
658 [
659 "label" => "Event Title",
660 "value" => "event_title",
661 "type" => "string",
662 ],
663 ],
664 "delay_dependencies" => [
665 [
666 "label" => "Before Event Start",
667 "value" => "before_event_start_date",
668 ],
669 [
670 "label" => "Before Event End",
671 "value" => "before_event_end_date",
672 ],
673 [
674 "label" => "After Event Start",
675 "value" => "after_event_start_date",
676 ],
677 [
678 "label" => "After Event End",
679 "value" => "after_event_end_date",
680 ],
681 ],
682 "email_receivers" => [
683 [
684 "label" => "Attendee",
685 "value" => "attendee_email",
686 ],
687 ],
688 ],
689 [
690 "trigger_label" => "Send Certificate", // Name of the event
691 "trigger_value" => "send_certificate", // Event slug
692 "trigger_data" => [ // Data you have after the event happened
693 [
694 "label" => "Site Name",
695 "value" => "site_name",
696 "type" => "string",
697 ],
698 [
699 "label" => "Site Link",
700 "value" => "site_link",
701 "type" => "string",
702 ],
703 [
704 "label" => "Event Title",
705 "value" => "event_title",
706 "type" => "string",
707 ],
708 [
709 "label" => "Event Date",
710 "value" => "event_date",
711 "type" => "date",
712 ],
713 [
714 "label" => "Event Time",
715 "value" => "event_time",
716 "type" => "string",
717 ],
718 [
719 "label" => "Event Location",
720 "value" => "event_location",
721 "type" => "string",
722 ],
723 [
724 "label" => "Certificate Link",
725 "value" => "certificate_link",
726 "type" => "string",
727 ],
728 [
729 "label" => "Ticket Link",
730 "value" => "ticket_link",
731 "type" => "string",
732 ],
733 ],
734 "conditional_dependencies" => [ // Data you have after the event happened
735 [
736 "label" => "Event Title",
737 "value" => "event_title",
738 "type" => "string",
739 ],
740 ],
741 "delay_dependencies" => [
742 [
743 "label" => "Before Event Start",
744 "value" => "before_event_start_date",
745 ],
746 [
747 "label" => "Before Event End",
748 "value" => "before_event_end_date",
749 ],
750 [
751 "label" => "After Event Start",
752 "value" => "after_event_start_date",
753 ],
754 [
755 "label" => "After Event End",
756 "value" => "after_event_end_date",
757 ],
758 ],
759 "email_receivers" => [
760 [
761 "label" => "Attendee",
762 "value" => "attendee_email",
763 ],
764 ],
765 ],
766 ];
767
768 return $actions;
769 });
770 }
771 }
772 }
773
774 /**
775 * Load Wpeventin plugin when all plugins are loaded
776 *
777 * @return Wpeventin
778 */
779 function wpeventin()
780 {
781 return Wpeventin::init();
782 }
783
784 // Let's Go...
785 wpeventin();
786