PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 2.0.4
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v2.0.4
2.1.0 2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 All 42 releases
fluent-boards / app / Services / Intergrations / FluentCRM / Init.php

Init.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration 2.0.4, at app/Services/Intergrations/FluentCRM/Init.php

107 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\App\Services\Intergrations\FluentCRM;
4
5 use FluentBoards\App\App;
6 use FluentBoards\App\Vite;
7 use FluentBoards\App\Services\Intergrations\FluentCRM\Automations\ContactAddedBoardTrigger;
8 use FluentBoards\App\Services\Intergrations\FluentCRM\Automations\ContactAddedTaskTrigger;
9 use FluentBoards\App\Services\Intergrations\FluentCRM\Automations\StageChangedTrigger;
10 use FluentBoards\App\Services\Intergrations\FluentCRM\Automations\TaskCreateAction;
11 use FluentBoards\App\Services\TransStrings;
12
13 class Init
14 {
15 public function __construct()
16 {
17 $this->registerToContactSection();
18
19 (new DeepIntegration())->init();
20 $this->registerAutomationFunnels();
21
22
23 add_filter('fluent_crm_asset_listed_slugs', function ($lists) {
24 $lists[] = 'fluent-boards';
25 return $lists;
26 });
27
28 }
29
30 public function registerToContactSection()
31 {
32 add_action('fluent_crm/global_app_boot_loaded', function () {
33 $this->enqueueCrmContactApp3();
34 });
35 }
36
37 /**
38 * Enqueue the FluentCRM contact app bundle.
39 *
40 * @return void
41 */
42 protected function enqueueCrmContactApp3()
43 {
44 $app = App::getInstance();
45 $assets = $app['url.assets'];
46 $slug = $app->config->get('app.slug');
47 $handle = $slug . '_in_crm_contact_app3';
48 $dependencies = wp_script_is('fluentcrm_admin_app_boot', 'registered') || wp_script_is('fluentcrm_admin_app_boot', 'enqueued')
49 ? ['fluentcrm_admin_app_boot']
50 : [];
51
52 Vite::injectViteClient();
53
54 Vite::enqueueScript(
55 $handle,
56 'admin/crm-contact-app3/app.js',
57 $dependencies,
58 FLUENT_BOARDS_PLUGIN_VERSION,
59 true
60 );
61
62 wp_localize_script(
63 $handle,
64 'fluentBoardsCrmContactApp',
65 [
66 'slug' => $slug,
67 'nonce' => wp_create_nonce($slug),
68 'rest' => $this->getRestInfo($app),
69 'ajaxurl' => admin_url('admin-ajax.php'),
70 'asset_url' => $assets,
71 'trans' => TransStrings::getStrings(),
72 'base_url' => fluent_boards_page_url(),
73 'admin_app_url' => admin_url('admin.php?page=fluent-boards#/'),
74 'admin_url' => admin_url('admin.php'),
75 'render_in' => is_admin() ? 'admin' : 'front',
76 'has_pro' => defined('FLUENT_BOARDS_PRO_VERSION'),
77 'advanced_modules' => fluent_boards_get_pref_settings(),
78 'features' => fluent_boards_get_features_config(),
79 ]
80 );
81 }
82
83 public function registerAutomationFunnels()
84 {
85 // new ContactAddedBoardTrigger();
86 new ContactAddedTaskTrigger();
87 new StageChangedTrigger();
88
89 new TaskCreateAction();
90 }
91
92
93 protected function getRestInfo($app)
94 {
95 $ns = $app->config->get('app.rest_namespace');
96 $ver = $app->config->get('app.rest_version');
97
98 return [
99 'base_url' => esc_url_raw(rest_url()),
100 'url' => rest_url($ns . '/' . $ver),
101 'nonce' => wp_create_nonce('wp_rest'),
102 'namespace' => $ns,
103 'version' => $ver,
104 ];
105 }
106 }
107