| 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/nuxy_settings/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Initiating Stylemix NUXY settings framework
*/
new ScotNuxySettings();
class ScotNuxySettings {
/**
* @throws Exception
*/
public function __construct() {
add_filter( 'wpcfto_options_page_setup', [ $this, 'telegram_settings' ] );
add_filter( 'stm_wpcfto_autocomplete_visible_posts', function ( $array ) {
if ( ! is_array( $array ) ) {
return $array;
}
return array_map( function ( $item ) {
if ( isset( $item['excerpt'] ) ) {
$item['excerpt'] = '';
}
return $item;
}, $array );
} );
add_filter( 'wpcfto_field_scot_webhook_activation', function ( $path ) {
return SCOT_DIR . '/nuxy_settings/webhook.php';
} );
}
function timezones():array {
$result = [];
$timezones = timezone_identifiers_list();
foreach ( $timezones as $timezone ) {
$result[$timezone] = $timezone;
}
return $result;
}
function telegram_settings( $setups ) {
$setups[] = [
'option_name' => 'scot_settings',
'title' => esc_html__( 'Site Chat Settings', 'site-chat-on-telegram' ),
'sub_title' => esc_html__( 'by Guru Team', 'site-chat-on-telegram' ),
'logo' => SCOT_URL . '/assets/images/icon.png',
'page' => [
'page_title' => esc_html__( 'Site Chat Settings', 'site-chat-on-telegram' ),
'menu_title' => esc_html__( 'Site Chat', 'site-chat-on-telegram' ),
'menu_slug' => 'scot_settings',
'icon' => SCOT_URL . '/assets/images/icon.png',
'position' => 140,
],
'fields' => [
'bot_settings' => [
'name' => esc_html__( 'BOT Settings', 'site-chat-on-telegram' ),
'fields' => [
'bot_api_token' => [
'label' => esc_html__( 'Telegram Bot Token', 'site-chat-on-telegram' ),
'type' => 'text',
],
'bot_name' => [
'label' => esc_html__( 'Telegram Bot Username', 'site-chat-on-telegram' ),
'type' => 'text',
'description' => esc_html__( '(Without "@")', 'site-chat-on-telegram' ),
],
'webhook_activation' => [
'label' => esc_html__( 'Activate Webhook', 'site-chat-on-telegram' ),
'type' => 'scot_webhook_activation',
'description' => esc_html__( 'Save BOT Token first', 'site-chat-on-telegram' ),
],
'tg_group' => [
'label' => esc_html__( 'Telegram Supergroup', 'site-chat-on-telegram' ),
'type' => 'select',
'options' => $this->get_groups(),
'description' => esc_html__( 'Please activate the webhook first. After adding a bot to a group as an administrator, this group will appear in the list. If you added the bot to the group before activating the webhook, just write any message to the group and reload the page, it should appear here', 'site-chat-on-telegram' ),
],
'tread_name' => [
'type' => 'hint_textarea',
'label' => esc_html__( 'Thread name', 'site-chat-on-telegram' ),
'hints' => [
'user_id' => esc_html__( 'User ID', 'site-chat-on-telegram' ),
],
'value' => esc_html__( 'Thread for user {{user_id}}', 'site-chat-on-telegram' ),
],
],
],
'chat_widget' => [
'name' => esc_html__( 'Chat Widget', 'site-chat-on-telegram' ),
'fields' => [
'enable_widget' => [
'label' => esc_html__( 'Enable widget', 'site-chat-on-telegram' ),
'type' => 'checkbox',
],
'hello_message' => [
'label' => esc_html__( 'Hello Message', 'site-chat-on-telegram' ),
'type' => 'editor',
],
'off_hours_message' => [
'label' => esc_html__( 'Off-Hours Message', 'site-chat-on-telegram' ),
'type' => 'editor',
'value' => esc_html__("We're currently offline. Please leave your contact details, and we'll get back to you during working hours.", "site-chat-on-telegram")
],
'support_manager_name' => [
'label' => esc_html__( 'Support Manager Name', 'site-chat-on-telegram' ),
'type' => 'text',
],
'support_manager_avatar' => [
'label' => esc_html__( 'Support Manager Avatar', 'site-chat-on-telegram' ),
'type' => 'image',
],
'enable_auto_reply' => [
'label' => esc_html__( 'Enable automatic reply to the first message', 'site-chat-on-telegram' ),
'type' => 'checkbox',
],
'auto_reply_message' => [
'label' => esc_html__( "Automatic reply message", 'site-chat-on-telegram' ),
'type' => 'editor',
'value' => esc_html__( "Hi! It is an automated message. An available manager will get back to you shortly.", 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'enable_auto_reply',
'value' => 'not_empty',
],
],
],
],
'visibility' => tg_visibility_settings(),
'appearance' => [
'name' => esc_html__( 'Appearance', 'site-chat-on-telegram' ),
'fields' => [
'widget_icon' => [
'label' => esc_html__( 'Widget Icon', 'site-chat-on-telegram' ),
'type' => 'image',
],
'widget_close_icon' => [
'label' => esc_html__( 'Close Widget Icon', 'site-chat-on-telegram' ),
'type' => 'image',
],
'widget_position' => [
'label' => esc_html__( 'Widget Position', 'site-chat-on-telegram' ),
'type' => 'select',
'value' => 'right',
'options' => [
'left' => esc_html__( 'Left', 'site-chat-on-telegram' ),
'right' => esc_html__( 'Right', 'site-chat-on-telegram' ),
],
],
'widget_width' => [
'label' => esc_html__( 'Widget width (in px)', 'site-chat-on-telegram' ),
'type' => 'number',
'value' => 300,
],
'chat_bg' => [
'label' => esc_html__( 'Chat Background Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'chat_text_color' => [
'label' => esc_html__( 'Chat Text Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'header_bg' => [
'label' => esc_html__( 'Chat Header Background Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'header_color' => [
'label' => esc_html__( 'Chat Header Text Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'customer_message_bg' => [
'label' => esc_html__( 'Customer Message Background Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'support_message_bg' => [
'label' => esc_html__( 'Support Message Background Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'input_field_bg' => [
'label' => esc_html__( 'Input Field Background Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
'input_field_color' => [
'label' => esc_html__( 'Input Field Text Color', 'site-chat-on-telegram' ),
'type' => 'color',
],
],
],
'working_hours' => [
'name' => esc_html__( 'Working hours', 'site-chat-on-telegram' ),
'fields' => [
'always_enabled' => [
'label' => esc_html__( 'Opening hours: 24/7?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'value' => '1',
],
'monday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Monday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'monday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'monday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'monday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'monday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'tuesday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Tuesday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'tuesday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'tuesday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'tuesday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'tuesday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'wednesday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Wednesday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'wednesday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'wednesday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'wednesday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'wednesday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'thursday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Thursday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'thursday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'thursday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'thursday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'thursday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'friday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Friday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'friday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'friday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'friday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'friday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'saturday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Saturday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'saturday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'saturday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'saturday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'saturday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'sunday_day_off' => [
'label' => esc_html__( 'Day off?', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'group' => 'started',
'group_title' => esc_html__( 'Sunday', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'always_enabled',
'value' => 'empty',
],
],
'sunday_start' => [
'label' => esc_html__( 'Start', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'Start of working day', 'site-chat-on-telegram' ),
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'sunday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
'sunday_end' => [
'label' => esc_html__( 'End', 'site-chat-on-telegram' ),
'type' => 'time',
'description' => esc_html__( 'End of working day', 'site-chat-on-telegram' ),
'group' => 'ended',
'dependency' => [
[
'key' => 'always_enabled',
'value' => 'empty',
],
[
'key' => 'sunday_day_off',
'value' => 'empty',
]
],
'dependencies' => '&&'
],
],
],
'advanced' => [
'name' => esc_html__( 'Advanced', 'site-chat-on-telegram' ),
'fields' => [
'webhook_path' => [
'label' => esc_html__( 'Webhook Path', 'site-chat-on-telegram' ),
'type' => 'text',
'value' => 'scot',
'description' => esc_html__( 'Webhook URL will be', 'site-chat-on-telegram' ) . ' ' . get_site_url() . '/wp-json/{YOUR WEBHOOK PATH}/v1/main/',
],
'telegram_server_url' => [
'label' => esc_html__( 'Telegram Server URL', 'site-chat-on-telegram' ),
'type' => 'text',
'value' => 'https://api.telegram.org/bot',
'description' => esc_html__( 'Default https://api.telegram.org/bot', 'site-chat-on-telegram' ),
],
],
],
],
];
return $setups;
}
function get_site_domain() {
$home_url = get_home_url();
$parse = wp_parse_url( $home_url );
return $parse['host'];
}
function get_groups() {
return get_option( 'scot_all_groups', [] );
}
}
function scot_get_option( $option_name, $default = '' ) {
$options = get_option( 'scot_settings', [] );
if ( ! isset( $options[ $option_name ] ) ) {
return $default;
}
if ( false === $options[ $option_name ] ) {
return false;
}
// Return even an empty array
if ( is_array( $options[ $option_name ] ) ) {
return $options[ $option_name ];
}
return ! empty( $options[ $option_name ] ) ? $options[ $option_name ] : $default;
}
add_filter( 'stm_wpcfto_autocomplete_visible_taxonomy_category', 'scot_visible_taxonomies', 10, 2 );
add_filter( 'stm_wpcfto_autocomplete_hidden_taxonomy_category', 'scot_visible_taxonomies', 10, 2 );
function scot_visible_taxonomies( $r, $args ) {
$search = '';
$limit = 5;
if ( ! empty( $args['s'] ) ) {
$search = $args['s'];
}
$taxonomies = get_taxonomies( [ 'public' => true ], 'objects' );
$result = [];
foreach ( $taxonomies as $taxonomy ) {
if ( ! $limit ) {
break;
}
$terms = get_terms( [
'taxonomy' => $taxonomy->name,
'search' => $search,
'hide_empty' => false,
] );
foreach ( $terms as $term ) {
$result[] = [
'id' => $term->term_id,
'title' => $term->name,
'post_type' => $taxonomy->name,
];
$limit --;
}
}
return $result;
}
function tg_visibility_settings() {
$post_types = get_post_types( [ 'public' => true ], 'objects' );
$post_types_array = [];
$post_types_data = [];
foreach ( $post_types as $post_type ) {
$post_types_array[] = [
'value' => $post_type->name,
'label' => $post_type->labels->name,
];
$post_types_data[] = $post_type->name;
}
$taxonomies = get_taxonomies( [ 'public' => true ], 'objects' );
$taxonomies_array = [];
foreach ( $taxonomies as $taxonomy ) {
$taxonomies_array[] = [
'value' => $taxonomy->name,
'label' => $taxonomy->labels->name,
];
}
return [
'name' => esc_html__( 'Visibility', 'site-chat-on-telegram' ),
'fields' => [
'visible_entire_site' => [
'label' => esc_html__( 'Entire Site', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'value' => true,
'description' => esc_html__( 'You can add this shortcode anywhere: [scot_chat is_open="1" is_fixed="0"]. is_open - indicates whether the chat is open by default or not (value: 0 or 1). is_fixed - indicates whether the chat\'s position is fixed or not (value: 0 or 1).', 'site-chat-on-telegram' ),
],
'control_id' => [
'type' => 'group_title',
'label' => esc_html__( 'Include Rules', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'visible_front_page' => [
'label' => esc_html__( 'Show on front page', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'default' => true,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
// 'visible_blog_page' => [
// 'label' => esc_html__('Show on blog page', 'site-chat-on-telegram'),
// 'type' => 'checkbox',
// 'default' => true,
// 'dependency' => [
// 'key' => 'visible_entire_site',
// 'value' => 'empty',
// ],
// ],
'visible_post_type' => [
'label' => esc_html__( 'Include post types', 'site-chat-on-telegram' ),
'type' => 'multiselect',
'options' => $post_types_array,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'visible_posts' => [
'label' => esc_html__( 'Include specific posts', 'site-chat-on-telegram' ),
'type' => 'autocomplete',
'post_type' => $post_types_data,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'visible_taxonomy' => [
'label' => esc_html__( 'Include taxonomies', 'site-chat-on-telegram' ),
'type' => 'multiselect',
'options' => $taxonomies_array,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'visible_taxonomy_category' => [
'label' => esc_html__( 'Include specific categories', 'site-chat-on-telegram' ),
'type' => 'autocomplete',
'post_type' => [ 'tg' ],
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'control_id_exclude' => [
'type' => 'group_title',
'label' => esc_html__( 'Exclude Rules', 'site-chat-on-telegram' ),
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'hidden_front_page' => [
'label' => esc_html__( 'Hide on front page', 'site-chat-on-telegram' ),
'type' => 'checkbox',
'default' => true,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'exclude_post_type' => [
'label' => esc_html__( 'Exclude post types', 'site-chat-on-telegram' ),
'type' => 'multiselect',
'options' => $post_types_array,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'hidden_posts' => [
'label' => esc_html__( 'Exclude specific posts', 'site-chat-on-telegram' ),
'type' => 'autocomplete',
'post_type' => $post_types_data,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'hidden_taxonomy' => [
'label' => esc_html__( 'Hidden taxonomies', 'site-chat-on-telegram' ),
'type' => 'multiselect',
'options' => $taxonomies_array,
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
'hidden_taxonomy_category' => [
'label' => esc_html__( 'Hidden specific categories', 'site-chat-on-telegram' ),
'type' => 'autocomplete',
'post_type' => [ 'tg' ],
'dependency' => [
'key' => 'visible_entire_site',
'value' => 'empty',
],
],
],
];
}