flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-octolize-docs-chat
/
src
/
Chat
/
AjaxChatSettings.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
AjaxChatSettings.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor\Octolize\Docs\Chat; |
| 4 | |
| 5 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 6 | class AjaxChatSettings implements Hookable |
| 7 | { |
| 8 | const AJAX_ACTION = 'octolize_docs_chat_settings'; |
| 9 | private string $plugin_slug; |
| 10 | public function __construct(string $plugin_slug) |
| 11 | { |
| 12 | $this->plugin_slug = $plugin_slug; |
| 13 | } |
| 14 | function hooks() |
| 15 | { |
| 16 | add_action('wp_ajax_' . self::AJAX_ACTION . '_' . $this->plugin_slug, [$this, 'get_settings_ajax']); |
| 17 | } |
| 18 | public function get_settings_ajax(): void |
| 19 | { |
| 20 | check_ajax_referer(self::AJAX_ACTION, 'nonce'); |
| 21 | $data = []; |
| 22 | $data['instance_id'] = sanitize_key($_POST['instance_id'] ?? ''); |
| 23 | wp_send_json_success(['settings' => apply_filters('octolize_docs_chat_settings_' . $this->plugin_slug, [], $data)]); |
| 24 | } |
| 25 | } |
| 26 |