| Server IP : 91.240.85.141 / Your IP : 216.73.216.223 Web Server : nginx/1.28.0 System : Linux nuevo.ru 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : ( 1029) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/wpface_ru_usr/data/www/wpface.ru/wp-content/plugins/plh/inc/ |
Upload File : |
<?php
if (!defined('ABSPATH')) {
exit;
}
new ScotEnqueue();
class ScotEnqueue
{
public function __construct()
{
add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_ss']);
add_action('wp_enqueue_scripts', [$this, 'enqueue_ss']);
}
public function enqueue_ss(): void
{
wp_register_style('scot_chat', SCOT_URL . 'assets/css/chat.css', false, time());
wp_register_script('petite-vue', SCOT_URL . 'assets/vendors/petite-vue.js', [], SCOT_V, true);
wp_register_script('scot_chat', SCOT_URL . 'assets/js/chat.js', ['petite-vue'], SCOT_V, true);
$avatar = scot_get_option('support_manager_avatar', '');
$widget_icon = scot_get_option('widget_icon', '');
$widget_close_icon = scot_get_option('widget_close_icon', '');
if (!empty($avatar)) {
$avatar = wp_get_attachment_url($avatar);
}
if (!empty($widget_icon)) {
$widget_icon = wp_get_attachment_url($widget_icon);
}
else {
$widget_icon = SCOT_URL . '/images/chat-icon.svg';
}
if (!empty($widget_close_icon)) {
$widget_close_icon = wp_get_attachment_url($widget_close_icon);
}
else {
$widget_close_icon = SCOT_URL . '/images/chat-close.svg';
}
$chat_data = [
'ajax_url' => admin_url('admin-ajax.php'),
'get_chat_nonce' => wp_create_nonce('get_chat_nonce'),
'send_message_nonce' => wp_create_nonce('send_message_nonce'),
'support_manager_name' => scot_get_option('support_manager_name', ''),
'support_manager_avatar' => $avatar,
'chat_bg' => scot_get_option('chat_bg', ''),
'widget_width' => scot_get_option('widget_width', ''),
'chat_text_color' => scot_get_option('chat_text_color', ''),
'hello_message' => scot_get_option('hello_message', ''),
'widget_icon' => $widget_icon,
'widget_close_icon' => $widget_close_icon,
'plugin_url' => SCOT_URL,
'header_bg' => scot_get_option('header_bg', ''),
'header_color' => scot_get_option('header_color', ''),
'customer_message_bg' => scot_get_option('customer_message_bg', ''),
'support_message_bg' => scot_get_option('support_message_bg', ''),
'input_field_bg' => scot_get_option('input_field_bg', ''),
'input_field_color' => scot_get_option('input_field_color', ''),
'offHoursMessage' => scot_get_option('off_hours_message', ''),
'isWorkingTime' => ScotChat::isWorkingTime(),
];
wp_localize_script('scot_chat', 'scot_data', $chat_data);
}
function enqueue_admin_ss($hook)
{
wp_enqueue_style('scot_admin_style', SCOT_URL . 'assets/css/admin.css', false, '1.0.1');
wp_enqueue_script('scot_script', SCOT_URL . 'assets/js/admin.js', ['jquery'], SCOT_V, true);
$translation_array = [
'ajax_url' => admin_url('admin-ajax.php'),
'ajax_nonce' => wp_create_nonce('ajax_nonce'),
'register_webhook' => wp_create_nonce('register_webhook'),
'activate_link' => esc_html__('Webhook Activated', 'site-chat-on-telegram'),
'deactivate_link' => esc_html__('Webhook Deactivated', 'site-chat-on-telegram'),
];
wp_enqueue_script('scot_webhook_script', SCOT_URL . '/assets/js/webhook.js', ['vue.js'], SCOT_V, true);
wp_localize_script('scot_script', 'scot_data', $translation_array);
}
}