Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/chaty/views/admin
File: channel.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Contact form leads
[2] Fix | Delete
*
[3] Fix | Delete
* @author : Premio <contact@premio.io>
[4] Fix | Delete
* @license : GPL2
[5] Fix | Delete
* */
[6] Fix | Delete
[7] Fix | Delete
if (defined('ABSPATH') === false) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
$value = get_option('cht_social_'.$social['slug']);
[12] Fix | Delete
// get setting for media if already saved
[13] Fix | Delete
$imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png";
[14] Fix | Delete
if (empty($value)) {
[15] Fix | Delete
// Initialize default values if not found
[16] Fix | Delete
$value = [
[17] Fix | Delete
'value' => '',
[18] Fix | Delete
'is_mobile' => 'checked',
[19] Fix | Delete
'is_desktop' => 'checked',
[20] Fix | Delete
'image_id' => '',
[21] Fix | Delete
'title' => $social['title'],
[22] Fix | Delete
'bg_color' => "",
[23] Fix | Delete
];
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
if (!isset($value['bg_color']) || empty($value['bg_color'])) {
[27] Fix | Delete
$value['bg_color'] = $social['color'];
[28] Fix | Delete
// Initialize background color value if not exists. 2.1.0 change
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
if (!isset($value['image_id'])) {
[32] Fix | Delete
$value['image_id'] = '';
[33] Fix | Delete
// Initialize custom image id if not exists. 2.1.0 change
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
if (!isset($value['title'])) {
[37] Fix | Delete
$value['title'] = $social['title'];
[38] Fix | Delete
// Initialize title if not exists. 2.1.0 change
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
if (!isset($value['fa_icon'])) {
[42] Fix | Delete
$value['fa_icon'] = "";
[43] Fix | Delete
// Initialize title if not exists. 2.1.0 change
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
if (!isset($value['value'])) {
[47] Fix | Delete
$value['value'] = "";
[48] Fix | Delete
// Initialize title if not exists. 2.1.0 change
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
$imageId = $value['image_id'];
[52] Fix | Delete
$status = 0;
[53] Fix | Delete
if (!empty($imageId)) {
[54] Fix | Delete
$imageUrl = wp_get_attachment_image_src($imageId, "full")[0];
[55] Fix | Delete
// get custom image URL if exists
[56] Fix | Delete
$status = 1;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
if ($imageUrl == "") {
[60] Fix | Delete
$imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png";
[61] Fix | Delete
// Initialize with default image if custom image is not exists
[62] Fix | Delete
$status = 0;
[63] Fix | Delete
$imageId = "";
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
if($social['slug'] == "Twitter" && ($value['bg_color'] == "#1ab2e8" || $value['bg_color'] == "rgb(26, 178, 232)") ) {
[67] Fix | Delete
$value['bg_color'] = "#000000";
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$color = "";
[71] Fix | Delete
if (!empty($value['bg_color'])) {
[72] Fix | Delete
$value['bg_color'] = $this->validate_color($value['bg_color'], $social['color']);
[73] Fix | Delete
$color = "background-color: ".esc_attr($value['bg_color']);
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
if ($social['slug'] == "Whatsapp") {
[77] Fix | Delete
// $val = $value['value'];
[78] Fix | Delete
// $val = str_replace("+", "", $val);
[79] Fix | Delete
// $value['value'] = $val;
[80] Fix | Delete
} else if ($social['slug'] == "Facebook_Messenger") {
[81] Fix | Delete
$val = $value['value'];
[82] Fix | Delete
$val = str_replace("facebook.com", "m.me", $val);
[83] Fix | Delete
// Replace facebook.com with m.me version 2.0.1 change.
[84] Fix | Delete
$val = str_replace("www.", "", $val);
[85] Fix | Delete
// Replace www. with blank version 2.0.1 change.
[86] Fix | Delete
$value['value'] = $val;
[87] Fix | Delete
[88] Fix | Delete
$val = trim($val, "/");
[89] Fix | Delete
$valArray = explode("/", $val);
[90] Fix | Delete
$total = (count($valArray) - 1);
[91] Fix | Delete
$lastValue = $valArray[$total];
[92] Fix | Delete
$lastValue = explode("-", $lastValue);
[93] Fix | Delete
$totalText = (count($lastValue) - 1);
[94] Fix | Delete
$totalText = $lastValue[$totalText];
[95] Fix | Delete
[96] Fix | Delete
if (is_numeric($totalText)) {
[97] Fix | Delete
$valArray[$total] = $totalText;
[98] Fix | Delete
$value['value'] = implode("/", $valArray);
[99] Fix | Delete
}
[100] Fix | Delete
}//end if
[101] Fix | Delete
[102] Fix | Delete
$value['value'] = esc_attr(wp_unslash($value['value']));
[103] Fix | Delete
$value['title'] = esc_attr(wp_unslash($value['title']));
[104] Fix | Delete
[105] Fix | Delete
$svgIcon = $social['svg'];
[106] Fix | Delete
[107] Fix | Delete
$helpTitle = "";
[108] Fix | Delete
$helpText = "";
[109] Fix | Delete
$helpLink = "";
[110] Fix | Delete
[111] Fix | Delete
if ((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) {
[112] Fix | Delete
$helpTitle = isset($social['help_title']) ? $social['help_title'] : "Doesn't work?";
[113] Fix | Delete
$helpText = isset($social['help']) ? $social['help'] : "";
[114] Fix | Delete
if (isset($social['help_link']) && !empty($social['help_link'])) {
[115] Fix | Delete
$helpLink = $social['help_link'];
[116] Fix | Delete
}
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
[120] Fix | Delete
[121] Fix | Delete
$channelType = "";
[122] Fix | Delete
$placeholder = $social['example'];
[123] Fix | Delete
if ($social['slug'] == "Link" || $social['slug'] == "Custom_Link" || $social['slug'] == "Custom_Link_3" || $social['slug'] == "Custom_Link_4" || $social['slug'] == "Custom_Link_5") {
[124] Fix | Delete
if (isset($value['channel_type'])) {
[125] Fix | Delete
$channelType = esc_attr(wp_unslash($value['channel_type']));
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
if (!empty($channelType)) {
[129] Fix | Delete
foreach ($this->socials as $icon) {
[130] Fix | Delete
if ($icon['slug'] == $channelType) {
[131] Fix | Delete
$svgIcon = $icon['svg'];
[132] Fix | Delete
[133] Fix | Delete
$placeholder = $icon['example'];
[134] Fix | Delete
[135] Fix | Delete
if ((isset($icon['help']) && !empty($icon['help'])) || isset($icon['help_link'])) {
[136] Fix | Delete
$helpTitle = isset($icon['help_title']) ? $icon['help_title'] : "Doesn't work?";
[137] Fix | Delete
$helpText = isset($icon['help']) ? $icon['help'] : "";
[138] Fix | Delete
if (isset($icon['help_link']) && !empty($icon['help_link'])) {
[139] Fix | Delete
$helpLink = $icon['help_link'];
[140] Fix | Delete
}
[141] Fix | Delete
}
[142] Fix | Delete
}
[143] Fix | Delete
}
[144] Fix | Delete
}
[145] Fix | Delete
}//end if
[146] Fix | Delete
[147] Fix | Delete
if (empty($channelType)) {
[148] Fix | Delete
$channelType = $social['slug'];
[149] Fix | Delete
}
[150] Fix | Delete
[151] Fix | Delete
// Check if the 'value' field is not empty
[152] Fix | Delete
if (!empty($value['value'])) {
[153] Fix | Delete
[154] Fix | Delete
// Extract the social slug for readability
[155] Fix | Delete
$socialSlug = $social['slug'];
[156] Fix | Delete
[157] Fix | Delete
// Check if the social slug is one of the specified values
[158] Fix | Delete
if ($socialSlug == "Whatsapp" || $socialSlug == "Phone" || $socialSlug == "SMS") {
[159] Fix | Delete
// Clean the 'value' field for numbers
[160] Fix | Delete
$value['value'] = $this->cleanStringForNumbers($value['value']);
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
// Check if the social slug is "Whatsapp"
[164] Fix | Delete
if ($socialSlug == "Whatsapp") {
[165] Fix | Delete
// Remove leading '+' and then prepend '+'
[166] Fix | Delete
$value['value'] = "+" . ltrim($value['value'], "+");
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
// Social slugs that require numeric formatting
[170] Fix | Delete
$numericSocials = ["Whatsapp", "Viber"];
[171] Fix | Delete
[172] Fix | Delete
// Social slugs that require username formatting
[173] Fix | Delete
$usernameSocials = ["Telegram", "Snapchat", "TikTok"];
[174] Fix | Delete
[175] Fix | Delete
// Check if the current social slug requires numeric formatting
[176] Fix | Delete
if (in_array($socialSlug, $numericSocials)) {
[177] Fix | Delete
// Remove unwanted characters and prepend '+'
[178] Fix | Delete
$val = str_replace(["+", "-", " "], "", $value['value']);
[179] Fix | Delete
[180] Fix | Delete
if(is_numeric($val)) {
[181] Fix | Delete
$value['value'] = "+" . $val;
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
// Check if the current social slug requires username formatting
[185] Fix | Delete
elseif (in_array($socialSlug, $usernameSocials)) {
[186] Fix | Delete
// Remove '@' if present and prepend '@'
[187] Fix | Delete
$value['value'] = "@" . trim($value['value'], "@");
[188] Fix | Delete
}
[189] Fix | Delete
// No special formatting required for other social slugs
[190] Fix | Delete
}
[191] Fix | Delete
$isAgent = 0;
[192] Fix | Delete
[193] Fix | Delete
[194] Fix | Delete
?>
[195] Fix | Delete
<!-- Social media setting box: start -->
[196] Fix | Delete
<li data-id="<?php echo esc_attr($social['slug']) ?>" class="chaty-channel <?php echo ($isAgent == 1) ? "has-agent-view" : "" ?>" data-type="<?php echo esc_attr($social['slug']) ?>" data-channel="<?php echo esc_attr($channelType) ?>" id="chaty-social-<?php echo esc_attr($social['slug']) ?>">
[197] Fix | Delete
<!-- channel default settings start -->
[198] Fix | Delete
<div class="channels-selected__item <?php echo esc_attr(($status) ? "img-active" : "") ?> free 1 available">
[199] Fix | Delete
<!-- icon and input field start -->
[200] Fix | Delete
<div class="chaty-default-settings space-x-3 flex items-center">
[201] Fix | Delete
<!-- drag icon and channel icon start -->
[202] Fix | Delete
<div class="flex space-x-2 items-center relative">
[203] Fix | Delete
<div class="move-icon opacity-0 transition duration-150 hover:opacity-100 cursor-grab">
[204] Fix | Delete
<img src="<?php echo esc_url(CHT_PLUGIN_URL."admin/assets/images/move-icon.png") ?>">
[205] Fix | Delete
</div>
[206] Fix | Delete
<div class="icon icon-md active" data-label="<?php echo esc_attr($social['title']); ?>" id="chaty_image_<?php echo esc_attr($social['slug']) ?>">
[207] Fix | Delete
<span style="" class="custom-chaty-image custom-image-<?php echo esc_attr($social['slug']) ?>" id="image_data_<?php echo esc_attr($social['slug']) ?>">
[208] Fix | Delete
<img src="<?php echo esc_url($imageUrl) ?>" />
[209] Fix | Delete
<span onclick="remove_chaty_image('<?php echo esc_attr($social['slug']) ?>')" class="remove-icon-img"></span>
[210] Fix | Delete
</span>
[211] Fix | Delete
<span class="default-chaty-icon <?php echo (isset($value['fa_icon'])&&!empty($value['fa_icon'])) ? "has-fa-icon" : "" ?> custom-icon-<?php echo esc_attr($social['slug']) ?> default_image_<?php echo esc_attr($social['slug']) ?>">
[212] Fix | Delete
<?php echo $svgIcon; ?>
[213] Fix | Delete
<span class="facustom-icon" style="background-color: <?php echo esc_attr($value['bg_color']) ?>"><i class="<?php echo esc_attr($value['fa_icon']) ?>"></i></span>
[214] Fix | Delete
</span>
[215] Fix | Delete
</div>
[216] Fix | Delete
<?php if(isset($social['header_help']) && !empty($social['header_help'])) { ?>
[217] Fix | Delete
<span class="header-tooltip header-icon-tooltip">
[218] Fix | Delete
<span class="header-tooltip-text text-center"><?php echo esc_attr($social['header_help']) ?></span>
[219] Fix | Delete
<span class="ml-1">
[220] Fix | Delete
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
[221] Fix | Delete
<path d="M8.00004 14.6654C11.6819 14.6654 14.6667 11.6806 14.6667 7.9987C14.6667 4.3168 11.6819 1.33203 8.00004 1.33203C4.31814 1.33203 1.33337 4.3168 1.33337 7.9987C1.33337 11.6806 4.31814 14.6654 8.00004 14.6654Z" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[222] Fix | Delete
<path d="M8 10.6667V8" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[223] Fix | Delete
<path d="M8 5.33203H8.00667" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[224] Fix | Delete
</svg>
[225] Fix | Delete
</span>
[226] Fix | Delete
</span>
[227] Fix | Delete
<?php } ?>
[228] Fix | Delete
</div>
[229] Fix | Delete
<!-- drag icon and channel icon end -->
[230] Fix | Delete
<!-- input field start-->
[231] Fix | Delete
<?php if ($social['slug'] != 'Contact_Us') { ?>
[232] Fix | Delete
<?php if (($social['slug'] == "Whatsapp" || $channelType == "Whatsapp") && !empty($value['value'])) {
[233] Fix | Delete
// $value['value'] = trim($value['value'], "+");
[234] Fix | Delete
// $value['value'] = "+".$value['value'];
[235] Fix | Delete
if($value['value'][1] == "0") {
[236] Fix | Delete
$value['value'][1] = " ";
[237] Fix | Delete
$value['value'] = str_replace(' ', '', $value['value']);
[238] Fix | Delete
}
[239] Fix | Delete
} ?>
[240] Fix | Delete
<div class="channels__input-box flex-auto">
[241] Fix | Delete
<div class="p-relative test-btn <?php echo esc_attr($social['slug']) ?>-input">
[242] Fix | Delete
<input data-label="<?php echo esc_attr($social['title']) ?>" placeholder="<?php echo esc_attr($placeholder); ?>" type="text" class="channels__input custom-channel-<?php echo esc_attr($channelType) ?> <?php echo isset($social['attr']) ? esc_attr($social['attr']) : "" ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[value]" value="<?php echo esc_attr(wp_unslash($value['value'])); ?>" data-gramm_editor="false" id="channel_input_<?php echo esc_attr($social['slug']); ?>" />
[243] Fix | Delete
[244] Fix | Delete
<?php if($social['slug'] == 'Whatsapp' || $social['slug'] == 'Facebook_Messenger') { ?>
[245] Fix | Delete
<button type="button" class="wf-test-button <?php echo !empty($value['value']) ? "active" : "" ?>" data-slug="<?php echo esc_attr($social['slug']) ?>"><?php esc_html_e('Test', 'chaty') ?></button>
[246] Fix | Delete
<?php } ?>
[247] Fix | Delete
</div>
[248] Fix | Delete
</div>
[249] Fix | Delete
<?php } ?>
[250] Fix | Delete
<!-- input field end -->
[251] Fix | Delete
</div>
[252] Fix | Delete
<!-- icon and input field end -->
[253] Fix | Delete
[254] Fix | Delete
<!-- example and help text start -->
[255] Fix | Delete
<div class="flex items-center flex-wrap gap-3 pl-20 ml-1">
[256] Fix | Delete
<?php if ($social['slug'] != 'Contact_Us') { ?>
[257] Fix | Delete
[258] Fix | Delete
[259] Fix | Delete
<!-- checking for extra help message for social media -->
[260] Fix | Delete
<div class="help-section inline-block relative">
[261] Fix | Delete
<?php if ((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) { ?>
[262] Fix | Delete
<div class="viber-help">
[263] Fix | Delete
<?php if (isset($helpLink) && !empty($helpLink)) { ?>
[264] Fix | Delete
<a class="help-link" href="<?php echo esc_url($helpLink) ?>" target="_blank"><?php echo esc_attr($helpTitle); ?></a>
[265] Fix | Delete
<?php } else if (isset($helpText) && !empty($helpText)) { ?>
[266] Fix | Delete
<?php
[267] Fix | Delete
$allowedHTML = [
[268] Fix | Delete
'a' => [
[269] Fix | Delete
'href' => [],
[270] Fix | Delete
'title' => [],
[271] Fix | Delete
'target' => []
[272] Fix | Delete
],
[273] Fix | Delete
'br' => [],
[274] Fix | Delete
'em' => [],
[275] Fix | Delete
'strong' => [],
[276] Fix | Delete
]; ?>
[277] Fix | Delete
<span class="help-text"><?php echo wp_kses($helpText, $allowedHTML); ?></span>
[278] Fix | Delete
<!-- $helpText contains HTML -->
[279] Fix | Delete
<span class="help-title"><?php echo esc_attr($helpTitle); ?></span>
[280] Fix | Delete
<?php } ?>
[281] Fix | Delete
</div>
[282] Fix | Delete
<?php } ?>
[283] Fix | Delete
</div>
[284] Fix | Delete
<?php }//end if
[285] Fix | Delete
?>
[286] Fix | Delete
</div>
[287] Fix | Delete
[288] Fix | Delete
<!-- example and help text end -->
[289] Fix | Delete
<!-- whatsapp settings start -->
[290] Fix | Delete
<?php if ($social['slug'] == "Whatsapp" || $social['slug'] == "Link" || $social['slug'] == "Custom_Link" || $social['slug'] == "Custom_Link_3" || $social['slug'] == "Custom_Link_4" || $social['slug'] == "Custom_Link_5") { ?>
[291] Fix | Delete
<div class="Whatsapp-settings sm:pl-20 ml-1 mt-2 font-primary text-cht-gray-150 advanced-settings extra-chaty-settings">
[292] Fix | Delete
<?php $embeddedWindow = isset($value['embedded_window']) ? $value['embedded_window'] : "no"; ?>
[293] Fix | Delete
<div class="chaty-setting-co">
[294] Fix | Delete
<input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[embedded_window]" value="no">
[295] Fix | Delete
<label class="flex mt-1 items-center chaty-switch full-width chaty-embedded-window" for="whatsapp_embedded_window_<?php echo esc_attr($social['slug']); ?>">
[296] Fix | Delete
<input type="checkbox" class="embedded_window-checkbox" name="cht_social_<?php echo esc_attr($social['slug']); ?>[embedded_window]" id="whatsapp_embedded_window_<?php echo esc_attr($social['slug']); ?>" value="yes" <?php checked($embeddedWindow, "yes") ?>>
[297] Fix | Delete
<div class="chaty-slider round"></div>
[298] Fix | Delete
<?php esc_html_e("Enable WhatsApp Chat Widget", "chaty") ?> &#128172;
[299] Fix | Delete
<div class="html-tooltip top">
[300] Fix | Delete
<span>
[301] Fix | Delete
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
[302] Fix | Delete
<path d="M8.00004 14.6654C11.6819 14.6654 14.6667 11.6806 14.6667 7.9987C14.6667 4.3168 11.6819 1.33203 8.00004 1.33203C4.31814 1.33203 1.33337 4.3168 1.33337 7.9987C1.33337 11.6806 4.31814 14.6654 8.00004 14.6654Z" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round">
[303] Fix | Delete
</path>
[304] Fix | Delete
<path d="M8 10.6667V8" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[305] Fix | Delete
<path d="M8 5.33203H8.00667" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[306] Fix | Delete
</svg>
[307] Fix | Delete
</span>
[308] Fix | Delete
<span class="tooltip-text top">
[309] Fix | Delete
<?php esc_html_e("Engage visitors with a WhatsApp-style chat window with a welcome message. Visitors can start conversations by typing messages and clicking on 'Send' will redirect them to WhatsApp.", "chaty") ?>
[310] Fix | Delete
<img src="<?php echo esc_url(CHT_PLUGIN_URL) ?>/admin/assets/images/chaty-wa-widget-ez.gif" loading="lazy"/>
[311] Fix | Delete
</span>
[312] Fix | Delete
</div>
[313] Fix | Delete
</label>
[314] Fix | Delete
</div>
[315] Fix | Delete
<!-- advance setting for Whatsapp -->
[316] Fix | Delete
<div class="whatsapp-welcome-message mt-4 <?php echo ($embeddedWindow == "yes") ? "active" : "" ?>">
[317] Fix | Delete
<div class="chaty-setting-col">
[318] Fix | Delete
<label style="display: block; width: 100%" for="cht_social_embedded_message_<?php echo esc_attr($social['slug']); ?>"><?php esc_html_e("Welcome message", "chaty") ?></label>
[319] Fix | Delete
<div class="full-width">
[320] Fix | Delete
<div class="full-width">
[321] Fix | Delete
<?php $unique_id = uniqid(); ?>
[322] Fix | Delete
<?php $embeddedMessage = isset($value['embedded_message']) ? $value['embedded_message'] : esc_html__("How can I help you? :)", "chaty"); ?>
[323] Fix | Delete
<textarea class="chaty-setting-textarea chaty-whatsapp-setting-textarea" data-id="<?php echo esc_attr($unique_id) ?>" id="cht_social_embedded_message_<?php echo esc_attr($unique_id) ?>" type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[embedded_message]"><?php echo esc_textarea($embeddedMessage) ?></textarea>
[324] Fix | Delete
</div>
[325] Fix | Delete
</div>
[326] Fix | Delete
</div>
[327] Fix | Delete
<div class="chaty-setting-col">
[328] Fix | Delete
<?php $isDefaultOpen = isset($value['is_default_open']) ? $value['is_default_open'] : "no"; ?>
[329] Fix | Delete
<input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_default_open]" value="no">
[330] Fix | Delete
<label class="chaty-switch" for="whatsapp_default_open_embedded_window_<?php echo esc_attr($social['slug']); ?>">
[331] Fix | Delete
<input type="checkbox" name="cht_social_<?php echo esc_attr($social['slug']); ?>[is_default_open]" id="whatsapp_default_open_embedded_window_<?php echo esc_attr($social['slug']); ?>" value="yes" <?php checked($isDefaultOpen, "yes") ?>>
[332] Fix | Delete
<div class="chaty-slider round"></div>
[333] Fix | Delete
<?php esc_html_e("Open the chat widget on page load", "chaty") ?>
[334] Fix | Delete
<span class="icon label-tooltip" data-label="<?php esc_html_e("Open the WhatsApp chat popup on page load, after the user sends a message or closes the window, the window will stay closed to avoid disruption", "chaty") ?>" >
[335] Fix | Delete
<span>
[336] Fix | Delete
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
[337] Fix | Delete
<path d="M8.00004 14.6654C11.6819 14.6654 14.6667 11.6806 14.6667 7.9987C14.6667 4.3168 11.6819 1.33203 8.00004 1.33203C4.31814 1.33203 1.33337 4.3168 1.33337 7.9987C1.33337 11.6806 4.31814 14.6654 8.00004 14.6654Z" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[338] Fix | Delete
<path d="M8 10.6667V8" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[339] Fix | Delete
<path d="M8 5.33203H8.00667" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"></path>
[340] Fix | Delete
</svg>
[341] Fix | Delete
</span>
[342] Fix | Delete
</span>
[343] Fix | Delete
</label>
[344] Fix | Delete
</div>
[345] Fix | Delete
<div class="sm:flex sm:items-center sm:space-x-3 mt-4">
[346] Fix | Delete
<?php $wp_popup_headline = isset($value['wp_popup_headline']) ? $value['wp_popup_headline'] : esc_html__("Let's chat on WhatsApp","chaty") ?>
[347] Fix | Delete
<div class="chaty-setting-col inline-options">
[348] Fix | Delete
<label class="font-primary text-base text-cht-gray-150 sm:w-44">
[349] Fix | Delete
<?php esc_html_e("Headline", "chaty") ?>
[350] Fix | Delete
</label>
[351] Fix | Delete
<div>
[352] Fix | Delete
<input type="text" id="wp_popup_headline" name="cht_social_<?php echo esc_attr($social['slug']); ?>[wp_popup_headline]" value="<?php echo esc_attr($wp_popup_headline) ?>">
[353] Fix | Delete
</div>
[354] Fix | Delete
</div>
[355] Fix | Delete
<div class="chaty-setting-col inline-options">
[356] Fix | Delete
<?php
[357] Fix | Delete
$wp_popup_head_bg_color = isset($value['wp_popup_head_bg_color']) ? $value['wp_popup_head_bg_color'] : "#4AA485";
[358] Fix | Delete
$wp_popup_head_bg_color = $this->validate_color($wp_popup_head_bg_color, "#4AA485");
[359] Fix | Delete
?>
[360] Fix | Delete
<label class="font-primary text-base text-cht-gray-150 sm:w-44">
[361] Fix | Delete
<?php esc_html_e("Header Background", "chaty") ?>
[362] Fix | Delete
</label>
[363] Fix | Delete
<div>
[364] Fix | Delete
<input type="text" name="cht_social_<?php echo esc_attr($social['slug']); ?>[wp_popup_head_bg_color]" class="chaty-color-field button-color" value="<?php echo esc_attr($wp_popup_head_bg_color) ?>" />
[365] Fix | Delete
</div>
[366] Fix | Delete
</div>
[367] Fix | Delete
</div>
[368] Fix | Delete
<div class="">
[369] Fix | Delete
<?php $wp_popup_nickname = isset($value['wp_popup_nickname']) ? $value['wp_popup_nickname'] : "" ?>
[370] Fix | Delete
<div class="sm:flex sm:items-center sm:space-x-3 mt-4">
[371] Fix | Delete
<div class="chaty-setting-col inline-options">
[372] Fix | Delete
<label class="font-primary text-base text-cht-gray-150 sm:w-44">
[373] Fix | Delete
<?php esc_html_e("Nickname", "chaty") ?>
[374] Fix | Delete
</label>
[375] Fix | Delete
<div>
[376] Fix | Delete
<input type="text" id="wp_popup_nickname" placeholder="Micheal" name="cht_social_<?php echo esc_attr($social['slug']); ?>[wp_popup_nickname]" value="<?php echo esc_attr($wp_popup_nickname) ?>">
[377] Fix | Delete
</div>
[378] Fix | Delete
</div>
[379] Fix | Delete
</div>
[380] Fix | Delete
<?php $wp_popup_profile = isset($value['wp_popup_profile']) ? $value['wp_popup_profile'] : "" ?>
[381] Fix | Delete
<div class="chaty-setting-col sm:flex sm:items-center sm:space-x-3 mt-4">
[382] Fix | Delete
<div class="chaty-setting-col">
[383] Fix | Delete
<label class="font-primary text-base text-cht-gray-150 sm:w-44">
[384] Fix | Delete
<?php esc_html_e("Add a profile image", "chaty") ?>
[385] Fix | Delete
</label>
[386] Fix | Delete
<div class="sm:flex sm:items-center custom-img-upload <?php echo esc_attr(!empty($wp_popup_profile)?"active":"") ?>" id="<?php echo esc_attr($social['slug']); ?>-custom-image-upload">
[387] Fix | Delete
<div class="image-info">
[388] Fix | Delete
<?php if(!empty($wp_popup_profile)) { ?>
[389] Fix | Delete
<img src="<?php echo esc_url($wp_popup_profile) ?>" alt="<?php esc_html_e("Profile image", "chaty"); ?>" />
[390] Fix | Delete
<?php } ?>
[391] Fix | Delete
</div>
[392] Fix | Delete
<a href="#" class="upload-chaty-icon flex items-center px-2 upload-wp-profile img-upload-btn" data-for="<?php echo esc_attr($social['slug']); ?>">
[393] Fix | Delete
<?php esc_html_e('Upload Image', 'chaty') ?>
[394] Fix | Delete
</a>
[395] Fix | Delete
<a href="#" class="remove-custom-img" data-for="<?php echo esc_attr($social['slug']); ?>">
[396] Fix | Delete
<?php esc_html_e('Remove', 'chaty') ?>
[397] Fix | Delete
</a>
[398] Fix | Delete
<input class="img-value" type="hidden" id="wp_popup_profile" name="cht_social_<?php echo esc_attr($social['slug']); ?>[wp_popup_profile]" value="<?php echo esc_attr($wp_popup_profile) ?>">
[399] Fix | Delete
</div>
[400] Fix | Delete
</div>
[401] Fix | Delete
</div>
[402] Fix | Delete
<?php $input_placeholder = isset($value['input_placeholder']) ? $value['input_placeholder'] : esc_html__("Write your message...","chaty") ?>
[403] Fix | Delete
<div class="sm:flex sm:items-center sm:space-x-3 mt-4">
[404] Fix | Delete
<div class="chaty-setting-col inline-options">
[405] Fix | Delete
<label class="font-primary text-base text-cht-gray-150 sm:w-44">
[406] Fix | Delete
<?php esc_html_e("Text input placeholder", "chaty") ?>
[407] Fix | Delete
</label>
[408] Fix | Delete
<div>
[409] Fix | Delete
<input type="text" class="whatsapp-placeholder" id="input_placeholder_<?php echo esc_attr($social['slug']); ?>" name="cht_social_<?php echo esc_attr($social['slug']); ?>[input_placeholder]" value="<?php echo esc_attr($input_placeholder) ?>">
[410] Fix | Delete
</div>
[411] Fix | Delete
</div>
[412] Fix | Delete
</div>
[413] Fix | Delete
<div class="chaty-setting-col mt-4">
[414] Fix | Delete
<?php $emoji_picker= isset($value['emoji_picker']) ? $value['emoji_picker'] : "yes"; ?>
[415] Fix | Delete
<input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[emoji_picker]" value="no" >
[416] Fix | Delete
<label class="chaty-switch text-base font-primary text-cht-gray-150" for="whatsapp_emoji_picker_<?php echo esc_attr($social['slug']); ?>">
[417] Fix | Delete
<input type="checkbox" class="whatsapp-emoji" name="cht_social_<?php echo esc_attr($social['slug']); ?>[emoji_picker]" id="whatsapp_emoji_picker_<?php echo esc_attr($social['slug']); ?>" value="yes" <?php checked($emoji_picker, "yes") ?> >
[418] Fix | Delete
<div class="chaty-slider round"></div>
[419] Fix | Delete
<span class="text-cht-gray-150">
[420] Fix | Delete
<?php esc_html_e("Enable emoji picker", "chaty") ?>
[421] Fix | Delete
</span>
[422] Fix | Delete
[423] Fix | Delete
<div class="html-tooltip top">
[424] Fix | Delete
<span>
[425] Fix | Delete
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
[426] Fix | Delete
<path d="M8.00004 14.6654C11.6819 14.6654 14.6667 11.6806 14.6667 7.9987C14.6667 4.3168 11.6819 1.33203 8.00004 1.33203C4.31814 1.33203 1.33337 4.3168 1.33337 7.9987C1.33337 11.6806 4.31814 14.6654 8.00004 14.6654Z" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
[427] Fix | Delete
<path d="M8 10.6667V8" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
[428] Fix | Delete
<path d="M8 5.33203H8.00667" stroke="#72777c" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>
[429] Fix | Delete
</svg>
[430] Fix | Delete
</span>
[431] Fix | Delete
<span class="tooltip-text top">
[432] Fix | Delete
<?php esc_html_e("Allow visitors to pick emoji from the emoji picker and enter them into the message input field", "chaty") ?>
[433] Fix | Delete
<img alt="chaty" src="<?php echo esc_url(CHT_PLUGIN_URL) ?>/admin/assets/images/chaty-emoji.png" loading="lazy"/>
[434] Fix | Delete
</span>
[435] Fix | Delete
</div>
[436] Fix | Delete
</label>
[437] Fix | Delete
</div>
[438] Fix | Delete
</div>
[439] Fix | Delete
</div>
[440] Fix | Delete
</div>
[441] Fix | Delete
<?php }//end if
[442] Fix | Delete
?>
[443] Fix | Delete
<!-- whatsapp settings end -->
[444] Fix | Delete
[445] Fix | Delete
<!-- device, agent and settings button start -->
[446] Fix | Delete
<div class="flex items-center sm:pl-20 ml-1 mt-2">
[447] Fix | Delete
<?php if ($social['slug'] == 'Contact_Us') { ?>
[448] Fix | Delete
<?php $fields = [
[449] Fix | Delete
'name' => [
[450] Fix | Delete
'title' => esc_html__("Name", "chaty"),
[451] Fix | Delete
'placeholder' => esc_html__("Enter your name", "chaty"),
[452] Fix | Delete
'is_required' => 1,
[453] Fix | Delete
'type' => 'input',
[454] Fix | Delete
'is_enabled' => 1,
[455] Fix | Delete
],
[456] Fix | Delete
'email' => [
[457] Fix | Delete
'title' => esc_html__("Email", "chaty"),
[458] Fix | Delete
'placeholder' => esc_html__("Enter your email address", "chaty"),
[459] Fix | Delete
'is_required' => 1,
[460] Fix | Delete
'type' => 'email',
[461] Fix | Delete
'is_enabled' => 1,
[462] Fix | Delete
],
[463] Fix | Delete
'phone' => [
[464] Fix | Delete
'title' => esc_html__("Phone", "chaty"),
[465] Fix | Delete
'placeholder' => esc_html__("Enter your phone number", "chaty"),
[466] Fix | Delete
'is_required' => 1,
[467] Fix | Delete
'type' => 'input',
[468] Fix | Delete
'is_enabled' => 1,
[469] Fix | Delete
],
[470] Fix | Delete
'message' => [
[471] Fix | Delete
'title' => esc_html__("Message", "chaty"),
[472] Fix | Delete
'placeholder' => esc_html__("Enter your message", "chaty"),
[473] Fix | Delete
'is_required' => 1,
[474] Fix | Delete
'type' => 'textarea',
[475] Fix | Delete
'is_enabled' => 1,
[476] Fix | Delete
],
[477] Fix | Delete
];
[478] Fix | Delete
echo '<div class="form-field-setting-col">';
[479] Fix | Delete
foreach ($fields as $label => $field) {
[480] Fix | Delete
$saved_value = isset($value[$label]) ? $value[$label] : [];
[481] Fix | Delete
$field_value = [
[482] Fix | Delete
'is_active' => (isset($saved_value['is_active'])) ? $saved_value['is_active'] : 'yes',
[483] Fix | Delete
'is_required' => (isset($saved_value['is_required'])) ? $saved_value['is_required'] : 'yes',
[484] Fix | Delete
'placeholder' => (isset($saved_value['placeholder'])) ? $saved_value['placeholder'] : $field['placeholder'],
[485] Fix | Delete
'field_label' => (isset($saved_value['field_label'])) ? $saved_value['field_label'] : $field['title'],
[486] Fix | Delete
];
[487] Fix | Delete
?>
[488] Fix | Delete
<div class="field-setting-col <?php echo ($field_value['is_active'] == "yes") ? "" : "hide-label-setting" ?> mb-2.5">
[489] Fix | Delete
<input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[<?php echo esc_attr($label) ?>][is_active]" value="no">
[490] Fix | Delete
<input type="hidden" name="cht_social_<?php echo esc_attr($social['slug']); ?>[<?php echo esc_attr($label) ?>][is_required]" value="no">
[491] Fix | Delete
[492] Fix | Delete
<div class="label-flex mb-4">
[493] Fix | Delete
<label class="chaty-switch chaty-switch-toggle text-cht-gray-150 text-base" for="field_for_<?php echo esc_attr($social['slug']); ?>_<?php echo esc_attr($label) ?>">
[494] Fix | Delete
<input type="checkbox" class="chaty-field-setting" name="cht_social_<?php echo esc_attr($social['slug']); ?>[<?php echo esc_attr($label) ?>][is_active]" id="field_for_<?php echo esc_attr($social['slug']); ?>_<?php echo esc_attr($label) ?>" value="yes" <?php checked($field_value['is_active'], "yes") ?>>
[495] Fix | Delete
<div class="chaty-slider round"></div>
[496] Fix | Delete
<span class="field-label"><?php echo esc_attr($field_value['field_label']) ?>
[497] Fix | Delete
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
[498] Fix | Delete
<g clip-path="url(#clip0_8719_30645)">
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function