| 1 |
<?php |
| 2 |
/** |
| 3 |
* Chat Settings |
| 4 |
* |
| 5 |
* CSF settings section for the chat feature. |
| 6 |
* |
| 7 |
* @package Forumax |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
CSF::createSection( |
| 15 |
$prefix, |
| 16 |
array( |
| 17 |
'id' => 'chat_opt', |
| 18 |
'title' => __( 'Chat', 'forumax' ), |
| 19 |
'icon' => 'dashicons dashicons-format-chat', |
| 20 |
'fields' => array( |
| 21 |
// Main Toggle. |
| 22 |
array( |
| 23 |
'type' => 'subheading', |
| 24 |
'content' => __( 'Chat System', 'forumax' ), |
| 25 |
), |
| 26 |
|
| 27 |
array( |
| 28 |
'id' => 'forumax_chat_enabled', |
| 29 |
'type' => 'switcher', |
| 30 |
'title' => __( 'Enable Chat', 'forumax' ), |
| 31 |
'subtitle' => __( 'Enable the private messaging chat system for forum users.', 'forumax' ), |
| 32 |
'default' => false, |
| 33 |
'class' => 'st-promax-notice', |
| 34 |
), |
| 35 |
|
| 36 |
// File Upload Settings. |
| 37 |
array( |
| 38 |
'type' => 'subheading', |
| 39 |
'content' => __( 'File Attachments', 'forumax' ), |
| 40 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 41 |
), |
| 42 |
|
| 43 |
array( |
| 44 |
'id' => 'forumax_chat_file_upload', |
| 45 |
'type' => 'switcher', |
| 46 |
'title' => __( 'Enable File Uploads', 'forumax' ), |
| 47 |
'subtitle' => __( 'Allow users to send file attachments in chat.', 'forumax' ), |
| 48 |
'default' => true, |
| 49 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 50 |
'class' => 'st-promax-notice', |
| 51 |
), |
| 52 |
|
| 53 |
array( |
| 54 |
'id' => 'forumax_chat_max_file_size', |
| 55 |
'type' => 'slider', |
| 56 |
'title' => __( 'Max File Size', 'forumax' ), |
| 57 |
'subtitle' => __( 'Define the maximum allowed file size (in Megabytes) for each individual uploaded chat attachment.', 'forumax' ), |
| 58 |
'unit' => 'MB', |
| 59 |
'min' => 1, |
| 60 |
'max' => 20, |
| 61 |
'step' => 1, |
| 62 |
'default' => 5, |
| 63 |
'dependency' => array( |
| 64 |
array( 'forumax_chat_enabled', '==', true ), |
| 65 |
array( 'forumax_chat_file_upload', '==', true ), |
| 66 |
), |
| 67 |
'class' => 'st-promax-notice', |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'forumax_chat_allowed_file_types', |
| 72 |
'type' => 'checkbox', |
| 73 |
'title' => __( 'Allowed File Types', 'forumax' ), |
| 74 |
'subtitle' => __( 'Specify which file formats users are permitted to upload and share within the chat interface.', 'forumax' ), |
| 75 |
'inline' => true, |
| 76 |
'options' => array( |
| 77 |
'jpg' => __( 'JPG', 'forumax' ), |
| 78 |
'jpeg' => __( 'JPEG', 'forumax' ), |
| 79 |
'png' => __( 'PNG', 'forumax' ), |
| 80 |
'gif' => __( 'GIF', 'forumax' ), |
| 81 |
'webp' => __( 'WebP', 'forumax' ), |
| 82 |
'pdf' => __( 'PDF', 'forumax' ), |
| 83 |
'doc' => __( 'DOC', 'forumax' ), |
| 84 |
'docx' => __( 'DOCX', 'forumax' ), |
| 85 |
'zip' => __( 'ZIP', 'forumax' ), |
| 86 |
'mp4' => __( 'MP4', 'forumax' ), |
| 87 |
'webm' => __( 'WebM', 'forumax' ), |
| 88 |
), |
| 89 |
'default' => array( 'jpg', 'jpeg', 'png', 'gif', 'webp', 'pdf', 'doc', 'docx', 'zip', 'mp4', 'webm' ), |
| 90 |
'dependency' => array( |
| 91 |
array( 'forumax_chat_enabled', '==', true ), |
| 92 |
array( 'forumax_chat_file_upload', '==', true ), |
| 93 |
), |
| 94 |
'class' => 'st-promax-notice', |
| 95 |
), |
| 96 |
|
| 97 |
// Emoji Settings. |
| 98 |
array( |
| 99 |
'type' => 'subheading', |
| 100 |
'content' => __( 'Emoji', 'forumax' ), |
| 101 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 102 |
), |
| 103 |
|
| 104 |
array( |
| 105 |
'id' => 'forumax_chat_emoji', |
| 106 |
'type' => 'switcher', |
| 107 |
'title' => __( 'Enable Emoji Picker', 'forumax' ), |
| 108 |
'subtitle' => __( 'Enable the emoji picker icon in the chat input area, allowing users to search and seamlessly insert emojis.', 'forumax' ), |
| 109 |
'default' => true, |
| 110 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 111 |
'class' => 'st-promax-notice', |
| 112 |
), |
| 113 |
|
| 114 |
// Notification Settings. |
| 115 |
array( |
| 116 |
'type' => 'subheading', |
| 117 |
'content' => __( 'Notifications', 'forumax' ), |
| 118 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 119 |
), |
| 120 |
|
| 121 |
array( |
| 122 |
'id' => 'forumax_chat_sound_enabled', |
| 123 |
'type' => 'switcher', |
| 124 |
'title' => __( 'Enable Notification Sound', 'forumax' ), |
| 125 |
'subtitle' => __( 'When enabled, plays a ring notification sound alert whenever a new real-time message is received in an active conversation.', 'forumax' ), |
| 126 |
'desc' => __( 'When enabled, plays a ring notification sound alert whenever a new real-time message is received in an active conversation.', 'forumax' ), |
| 127 |
'default' => true, |
| 128 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 129 |
'class' => 'st-promax-notice', |
| 130 |
), |
| 131 |
|
| 132 |
// UI Settings. |
| 133 |
array( |
| 134 |
'type' => 'subheading', |
| 135 |
'content' => __( 'Appearance', 'forumax' ), |
| 136 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 137 |
), |
| 138 |
|
| 139 |
array( |
| 140 |
'id' => 'forumax_chat_user_bubble_color', |
| 141 |
'type' => 'color', |
| 142 |
'title' => __( 'User Message Bubble Background', 'forumax' ), |
| 143 |
'subtitle' => __( 'Choose the background color for messages sent by the currently logged-in user (these appear on the right side of the chat interface).', 'forumax' ), |
| 144 |
'default' => '#4c4cf1', |
| 145 |
'output' => ':root', |
| 146 |
'output_mode' => '--forumax-chat-bubble-user', |
| 147 |
'output_important' => true, |
| 148 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 149 |
'class' => 'st-promax-notice', |
| 150 |
), |
| 151 |
|
| 152 |
array( |
| 153 |
'id' => 'forumax_chat_other_bubble_color', |
| 154 |
'type' => 'color', |
| 155 |
'title' => __( 'Other User Message Bubble Background', 'forumax' ), |
| 156 |
'subtitle' => __( 'Choose the background color for incoming messages received from the person you are chatting with (these appear on the left side of the chat interface).', 'forumax' ), |
| 157 |
'default' => '#eeeeee', |
| 158 |
'output' => ':root', |
| 159 |
'output_mode' => '--forumax-chat-bubble-other', |
| 160 |
'output_important' => true, |
| 161 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 162 |
'class' => 'st-promax-notice', |
| 163 |
), |
| 164 |
|
| 165 |
// Chat Assistants Settings. |
| 166 |
array( |
| 167 |
'type' => 'subheading', |
| 168 |
'content' => __( 'Chat Assistants', 'forumax' ), |
| 169 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 170 |
), |
| 171 |
|
| 172 |
array( |
| 173 |
'id' => 'forumax_chat_assistants_enabled', |
| 174 |
'type' => 'switcher', |
| 175 |
'title' => __( 'Enable Chat Assistants', 'forumax' ), |
| 176 |
'subtitle' => __( 'Allow designated moderators/keymasters to reply to any user in chat. These users will appear in the conversations list for everyone.', 'forumax' ), |
| 177 |
'default' => false, |
| 178 |
'dependency' => array( 'forumax_chat_enabled', '==', true ), |
| 179 |
'class' => 'st-promax-notice', |
| 180 |
), |
| 181 |
|
| 182 |
array( |
| 183 |
'id' => 'forumax_chat_assistants', |
| 184 |
'type' => 'select', |
| 185 |
'title' => __( 'Select Assistants', 'forumax' ), |
| 186 |
'subtitle' => __( 'Select users who can assist anyone in chat. Only moderators and keymasters are shown.', 'forumax' ), |
| 187 |
'placeholder' => __( 'Select assistants...', 'forumax' ), |
| 188 |
'options' => 'frmx_get_moderator_users', |
| 189 |
'multiple' => true, |
| 190 |
'chosen' => true, |
| 191 |
'dependency' => array( |
| 192 |
array( 'forumax_chat_enabled', '==', true ), |
| 193 |
array( 'forumax_chat_assistants_enabled', '==', true ), |
| 194 |
), |
| 195 |
'class' => 'st-promax-notice', |
| 196 |
), |
| 197 |
|
| 198 |
array( |
| 199 |
'id' => 'forumax_chat_assistants_label', |
| 200 |
'type' => 'text', |
| 201 |
'title' => __( 'Assistants Section Label', 'forumax' ), |
| 202 |
'subtitle' => __( 'Customize the header text displayed above the dedicated list of active chat assistants (e.g., "Support Team").', 'forumax' ), |
| 203 |
'default' => __( 'Support Team', 'forumax' ), |
| 204 |
'dependency' => array( |
| 205 |
array( 'forumax_chat_enabled', '==', true ), |
| 206 |
array( 'forumax_chat_assistants_enabled', '==', true ), |
| 207 |
), |
| 208 |
'class' => 'st-promax-notice', |
| 209 |
), |
| 210 |
), |
| 211 |
) |
| 212 |
); |
| 213 |
|