PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.3.1
Fluent Support – Helpdesk & Customer Support Ticket System v2.3.1
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 / Services / Integrations / FluentCommunity / PortalRenderer.php

PortalRenderer.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.3.1, at app/Services/Integrations/FluentCommunity/PortalRenderer.php

95 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Services\Integrations\FluentCommunity;
4
5 use FluentCommunity\Modules\Theming\TemplateLoader;
6 use FluentSupport\App\Hooks\Handlers\CustomerPortalHandler;
7
8 /**
9 * PortalRenderer handles asset enqueuing and HTML output for the
10 * Fluent Support portal embedded inside FluentCommunity.
11 *
12 * - Enqueue FS portal assets — wp_head() is called by the frame template
13 * so standard WP enqueueing works automatically, no force-printing needed.
14 * - Replace the default theme_content with the FS portal mount point.
15 * - Load the FC frame template directly and exit.
16 */
17 class PortalRenderer
18 {
19 public function render()
20 {
21 (new CustomerPortalHandler())->enqueueScripts();
22
23 add_action('wp_head', [$this, 'printPortalStyles'], 999);
24 add_action('wp_footer', [$this, 'markSupportLinkActive']);
25
26 remove_all_actions('fluent_community/theme_content');
27 add_action('fluent_community/theme_content', [$this, 'renderContent']);
28
29 (new TemplateLoader())->loadScriptsAndStyles();
30
31 status_header(200);
32 require_once FLUENT_COMMUNITY_PLUGIN_DIR . 'Modules/Theming/templates/fluent-community-frame-full.php';
33 exit();
34 }
35
36 public function printPortalStyles()
37 {
38 ?>
39 <style>
40 #fluent_support_client_app {
41 background: var(--fs-bg-white, #ffffff);
42 min-height: calc(100dvh - var(--fcom-header-height, 55px) - 5px);
43 box-sizing: border-box;
44 width: calc(100% - 4rem);
45 max-width: 1080px;
46 border-radius: 14px;
47 margin: 2rem auto;
48 }
49 #fluent_support_client_app .fs_create_ticket_container,
50 #fluent_support_client_app .fs_ticket {
51 padding: 2rem;
52 }
53
54 @media (max-width: 768px) {
55 #fluent_support_client_app {
56 width: calc(100% - 2rem);
57 margin: 1rem auto;
58 }
59
60 #fluent_support_client_app .fs_create_ticket_container,
61 #fluent_support_client_app .fs_ticket {
62 padding: 1rem;
63 }
64 }
65 </style>
66 <?php
67 }
68
69 public function markSupportLinkActive()
70 {
71 $supportUrl = \FluentCommunity\App\Services\Helper::baseUrl('support/');
72 ?>
73 <script>
74 (function () {
75 var url = <?php echo wp_json_encode(esc_url($supportUrl)); ?>;
76 document.querySelectorAll('a[href="' + url + '"]').forEach(function (el) {
77 el.classList.add('router-link-active', 'router-link-exact-active');
78 });
79 })();
80 </script>
81 <?php
82 }
83
84 public function renderContent()
85 {
86 ?>
87 <div id="fluent_support_client_app">
88 <h3 class="fs_loading_text" style="padding:2rem;text-align:center;">
89 <?php esc_html_e('Loading Support Portal. Please wait...', 'fluent-support'); ?>
90 </h3>
91 </div>
92 <?php
93 }
94 }
95