HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/intranet.kauko.lt/wp-content/plugins/wise-chat/src/setup/0-wise-chat-engine.php
<?php
/**
 * Plugin Name: {{PLUGIN_NAME}} Gold Engine
 * Plugin URI: https://kainex.pl
 * Description: This is automatically generated by the {{PLUGIN_NAME}} plugin to increase performance of the chat. Please do not delete it because it may seriously break the chat. It is automatically deleted after deleting {{PLUGIN_NAME}} plugin.
 * Author: Kainex
 * Author URI: https://kainex.pl
 * License: GPL2
 * Network: true
*/

if (!headers_sent()) {
	header('Content-Type: text/html');
	header('Cache-Control: no-cache');
	header('Pragma: no-cache');
}

if (!isset($_GET['wc-gold-engine'])) {
    return;
}

if (!defined('WP_PLUGIN_DIR')) {
    exit;
}

if (!defined('DOING_AJAX')) {
	define('DOING_AJAX', true);
}

if (!isset($_REQUEST['action'])) {
    http_response_code(400);
    die(json_encode(['error' => 'No action specified']));
}

require_once(ABSPATH.WPINC.'/default-constants.php');
wp_cookie_constants();
require_once(ABSPATH.WPINC.'/pluggable.php');

$GLOBALS['wp_rewrite'] = new WP_Rewrite();

require_once('{{PLUGIN_DIR}}src/WiseChatContainer.php');
WiseChatContainer::load('WiseChatInstaller');
WiseChatContainer::load('WiseChatOptions');

$action = $_REQUEST['action'];
if ($action === 'wise_chat_messages_endpoint') {
	/** @var WiseChatMessagesEndpoint $endpoint */
	$endpoint = WiseChatContainer::get('endpoints/WiseChatMessagesEndpoint');
	$endpoint->messagesEndpoint();
} else if ($action === 'wise_chat_prepare_image_endpoint') {
	/** @var WiseChatUserCommandEndpoint $endpoint */
	$endpoint = WiseChatContainer::get('endpoints/WiseChatUserCommandEndpoint');
	$endpoint->prepareImageEndpoint();
} else if ($action === 'check') {
	die('OK');
} else {
	http_response_code(400);
    die(json_encode(['error' => 'Invalid action']));
}