flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-octolize-docs-chat
/
src
/
Chat
/
ChatContainer.php
flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-octolize-docs-chat
/
src
/
Chat
Last commit date
views
2 weeks ago
AjaxChatSettings.php
2 weeks ago
Assets.php
2 weeks ago
ChatContainer.php
2 weeks ago
ChatSettings.php
2 weeks ago
ChatSettingsProvider.php
2 weeks ago
ConsentSettings.php
2 weeks ago
DocsChat.php
2 weeks ago
HookableChatObjects.php
2 weeks ago
ChatContainer.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor\Octolize\Docs\Chat; |
| 4 | |
| 5 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 6 | use FSVendor\WPDesk\ShowDecision\ShouldShowStrategy; |
| 7 | class ChatContainer implements Hookable |
| 8 | { |
| 9 | private ShouldShowStrategy $show_strategy; |
| 10 | private string $plugin_slug; |
| 11 | public function __construct(ShouldShowStrategy $show_strategy, string $plugin_slug) |
| 12 | { |
| 13 | $this->show_strategy = $show_strategy; |
| 14 | $this->plugin_slug = $plugin_slug; |
| 15 | } |
| 16 | public function hooks(): void |
| 17 | { |
| 18 | add_action('admin_footer', [$this, 'render_chat']); |
| 19 | } |
| 20 | public function render_chat() |
| 21 | { |
| 22 | if ($this->show_strategy->shouldDisplay()) { |
| 23 | $ajax_url = admin_url('admin-ajax.php'); |
| 24 | $nonce = wp_create_nonce(AjaxChatSettings::AJAX_ACTION); |
| 25 | $ajax_action = AjaxChatSettings::AJAX_ACTION . '_' . $this->plugin_slug; |
| 26 | $instance_id = sanitize_key($_GET['instance_id'] ?? ''); |
| 27 | $plugin_slug = $this->plugin_slug; |
| 28 | include __DIR__ . '/views/html-chat-container.php'; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 |