PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 1.5.2
Fluent Support – Helpdesk & Customer Support Ticket System v1.5.2
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Hooks / actions.php

actions.php in Fluent Support – Helpdesk & Customer Support Ticket System 1.5.2, at app/Hooks/actions.php

106 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * All registered action's handlers should be in app\Hooks\Handlers,
5 * addAction is similar to add_action and addCustomAction is just a
6 * wrapper over add_action which will add a prefix to the hook name
7 * using the plugin slug to make it unique in all wordpress plugins,
8 * ex: $app->addCustomAction('foo', ['FooHandler', 'handleFoo']) is
9 * equivalent to add_action('slug-foo', ['FooHandler', 'handleFoo']).
10 */
11
12 /**
13 * @var $app FluentSupport\Framework\Foundation\Application
14 */
15
16 use FluentSupport\App\App;
17
18 require_once 'Handlers/AuthHandler.php';
19
20 (new \FluentSupport\App\Hooks\Handlers\AuthHandler)->init();
21
22 $app->addCustomAction('handle_exception', 'ExceptionHandler@handle');
23
24 $app->addAction('admin_menu', 'Menu@add');
25 $app->addAction('admin_enqueue_scripts', 'Menu@maybeEnqueueAssets');
26
27 add_shortcode('fluent_support_portal', function () {
28 return (new \FluentSupport\App\Hooks\Handlers\CustomerPortalHandler())->renderPortal();
29 });
30
31 add_shortcode('fluent_support_admin_portal', function () {
32 $app = App::getInstance();
33 $assets = $app['url.assets'];
34 wp_enqueue_style('fluent_support_login_style', $assets.'admin/css/all_public.css');
35 if (!get_current_user_id()) {
36 $return = '<div class="fst_login"><h3>'.__('Please Login', 'fluent-support').'</h3>';
37 $return .= do_shortcode('[fluent_support_login]');
38 $return .= '</div>';
39 return $return;
40 }
41
42 $currentUserPermissions = \FluentSupport\App\Modules\PermissionManager::currentUserPermissions();
43 if (!$currentUserPermissions) {
44 return __('Sorry, You do not have permission to this page', 'fluent-support');
45 }
46
47 add_filter('fluent_support/base_url', function ($url) {
48 global $wp;
49 return home_url(add_query_arg(array(), $wp->request)) . '/#/';
50 });
51
52 add_filter('fluent_support/secondary_menu_items', function ($items) {
53 global $wp;
54 $items[] = [
55 'key' => 'logout',
56 'label' => __('Logout', 'fluent-support'),
57 'permalink' => wp_logout_url(home_url(add_query_arg(array(), $wp->request)))
58 ];
59 return $items;
60 });
61
62 ob_start();
63 echo '<div class="fst_front">';
64 (new \FluentSupport\App\Hooks\Handlers\Menu())->renderApp();
65 echo '</div>';
66 return ob_get_clean();
67 });
68
69 // init integrations
70 (new \FluentSupport\App\Services\Integrations\IntegrationInit())->init();
71
72 // Activities
73 (new \FluentSupport\App\Hooks\Handlers\ActivityLogger())->init();
74
75 /*
76 * Email Notification Hooks
77 */
78
79 $app->addAction('fluent_support/ticket_created', 'EmailNotificationHandler@ticketCreated', 10, 2);
80 $app->addAction('fluent_support/response_added_by_agent', 'EmailNotificationHandler@agentReplied', 10, 3);
81 $app->addAction('fluent_support/response_added_by_customer', 'EmailNotificationHandler@customerReplied', 10, 3);
82 $app->addAction('fluent_support/ticket_closed_by_agent', 'EmailNotificationHandler@closedByAgent', 10, 2);
83
84 // Cleanup
85 $app->addAction('fluent_support_hourly_tasks', 'CleanupHandler@initHourlyTasks');
86 $app->addAction('fluent_support_daily_tasks', 'CleanupHandler@initDailyTasks');
87
88 if(isset($_GET['fs_view'])) {
89 $app->addAction('init', 'ExternalPages@route');
90 }
91
92 if (isset($_GET['fst_file'])) {
93 add_action('init', function () {
94 (new \FluentSupport\App\Hooks\Handlers\ExternalPages())->view_attachment();
95 });
96 }
97
98 // require the CLI
99 if ( defined( 'WP_CLI' ) && WP_CLI ) {
100 \WP_CLI::add_command( 'fluent_support', '\FluentSupport\App\Hooks\CLI\FluentCli' );
101 }
102
103
104 (new \FluentSupport\App\Hooks\Handlers\PermissionFilterManager)->init();
105
106