* @license : GPL2 * */ if (defined('ABSPATH') === false) { exit; } $value = get_option('cht_social_'.$social['slug']); // get setting for media if already saved $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; if (empty($value)) { // Initialize default values if not found $value = [ 'value' => '', 'is_mobile' => 'checked', 'is_desktop' => 'checked', 'image_id' => '', 'title' => $social['title'], 'bg_color' => "", ]; } if (!isset($value['bg_color']) || empty($value['bg_color'])) { $value['bg_color'] = $social['color']; // Initialize background color value if not exists. 2.1.0 change } if (!isset($value['image_id'])) { $value['image_id'] = ''; // Initialize custom image id if not exists. 2.1.0 change } if (!isset($value['title'])) { $value['title'] = $social['title']; // Initialize title if not exists. 2.1.0 change } if (!isset($value['fa_icon'])) { $value['fa_icon'] = ""; // Initialize title if not exists. 2.1.0 change } if (!isset($value['value'])) { $value['value'] = ""; // Initialize title if not exists. 2.1.0 change } $imageId = $value['image_id']; $status = 0; if (!empty($imageId)) { $imageUrl = wp_get_attachment_image_src($imageId, "full")[0]; // get custom image URL if exists $status = 1; } if ($imageUrl == "") { $imageUrl = plugin_dir_url("")."chaty/admin/assets/images/chaty-default.png"; // Initialize with default image if custom image is not exists $status = 0; $imageId = ""; } $color = ""; if (!empty($value['bg_color'])) { $color = "background-color: ".$value['bg_color']; // set background color of icon it it is exists } if ($social['slug'] == "Whatsapp") { // $val = $value['value']; // $val = str_replace("+", "", $val); // $value['value'] = $val; } else if ($social['slug'] == "Facebook_Messenger") { $val = $value['value']; $val = str_replace("facebook.com", "m.me", $val); // Replace facebook.com with m.me version 2.0.1 change. $val = str_replace("www.", "", $val); // Replace www. with blank version 2.0.1 change. $value['value'] = $val; $val = trim($val, "/"); $valArray = explode("/", $val); $total = (count($valArray) - 1); $lastValue = $valArray[$total]; $lastValue = explode("-", $lastValue); $totalText = (count($lastValue) - 1); $totalText = $lastValue[$totalText]; if (is_numeric($totalText)) { $valArray[$total] = $totalText; $value['value'] = implode("/", $valArray); } }//end if $value['value'] = esc_attr(wp_unslash($value['value'])); $value['title'] = esc_attr(wp_unslash($value['title'])); $svgIcon = $social['svg']; $helpTitle = ""; $helpText = ""; $helpLink = ""; if ((isset($social['help']) && !empty($social['help'])) || isset($social['help_link'])) { $helpTitle = isset($social['help_title']) ? $social['help_title'] : "Doesn't work?"; $helpText = isset($social['help']) ? $social['help'] : ""; if (isset($social['help_link']) && !empty($social['help_link'])) { $helpLink = $social['help_link']; } } $channelType = ""; $placeholder = $social['example']; if ($social['slug'] == "Link" || $social['slug'] == "Custom_Link" || $social['slug'] == "Custom_Link_3" || $social['slug'] == "Custom_Link_4" || $social['slug'] == "Custom_Link_5") { if (isset($value['channel_type'])) { $channelType = esc_attr(wp_unslash($value['channel_type'])); } if (!empty($channelType)) { foreach ($this->socials as $icon) { if ($icon['slug'] == $channelType) { $svgIcon = $icon['svg']; $placeholder = $icon['example']; if ((isset($icon['help']) && !empty($icon['help'])) || isset($icon['help_link'])) { $helpTitle = isset($icon['help_title']) ? $icon['help_title'] : "Doesn't work?"; $helpText = isset($icon['help']) ? $icon['help'] : ""; if (isset($icon['help_link']) && !empty($icon['help_link'])) { $helpLink = $icon['help_link']; } } } } } }//end if if (empty($channelType)) { $channelType = $social['slug']; } if(!empty($value['value'])) { if($social['slug'] == "Whatsapp" || $social['slug'] == "SMS" || $social['slug'] == "Viber") { $val = $value['value']; $val = str_replace("+","",$val); $val = str_replace("-","",$val); $val = str_replace(" ","",$val); $value['value'] = "+" . $val; } if ($social['slug'] == "Telegram" || $social['slug'] == "Instagram" || $social['slug'] == "Snapchat" || $social['slug'] == "TikTok") { $value['value'] = trim($value['value'], "@"); $value['value'] = "@" . $value['value']; } } $isAgent = 0; ?>
  • " data-channel="" id="chaty-social-">
    free 1 available">
    ">
    custom-icon- default_image_">
    " name="cht_social_[value]" value="" data-gramm_editor="false" id="channel_input_" />
    [ 'href' => [], 'title' => [], 'target' => [] ], 'br' => [], 'em' => [], 'strong' => [], ]; ?>
    ">
    [ 'title' => "Name", 'placeholder' => "Enter your name", 'is_required' => 1, 'type' => 'input', 'is_enabled' => 1, ], 'email' => [ 'title' => "Email", 'placeholder' => "Enter your email address", 'is_required' => 1, 'type' => 'email', 'is_enabled' => 1, ], 'phone' => [ 'title' => "Phone", 'placeholder' => "Enter your phone number", 'is_required' => 1, 'type' => 'input', 'is_enabled' => 1, ], 'message' => [ 'title' => "Message", 'placeholder' => "Enter your message", 'is_required' => 1, 'type' => 'textarea', 'is_enabled' => 1, ], ]; echo '
    '; foreach ($fields as $label => $field) { $saved_value = isset($value[$label]) ? $value[$label] : []; $field_value = [ 'is_active' => (isset($saved_value['is_active'])) ? $saved_value['is_active'] : 'yes', 'is_required' => (isset($saved_value['is_required'])) ? $saved_value['is_required'] : 'yes', 'placeholder' => (isset($saved_value['placeholder'])) ? $saved_value['placeholder'] : $field['placeholder'], ]; ?>
    ">
    '; ?>
    del_space($social['slug'])); $slug = str_replace(' ', '_', $slug); $isDesktop = isset($value['is_desktop']) && $value['is_desktop'] == "checked" ? "checked" : ''; $isMobile = isset($value['is_mobile']) && $value['is_mobile'] == "checked" ? "checked" : ''; ?>
    " id="-close-btn" onclick="toggle_chaty_setting('')">
    "> socials; ?>
    Submit Button
    ">
    " type="text" name="cht_social_[redirect_link]" value="">
    ">
    {title} and {url} tags are supported