socials = CHT_Social_Icons::get_instance()->get_icons_list(); $this->chatwayIcons = CHT_Social_Icons::get_instance()->get_chatway_icons(); if (wp_doing_ajax()) { add_action('wp_ajax_choose_social', [$this, 'choose_social_handler']); add_action('wp_ajax_get_chaty_settings', [$this, 'get_chaty_settings']); // Return setting for a social media in html. add_action('wp_ajax_chaty_front_form_save_data', [$this, 'chaty_front_form_save_data']); add_action('wp_ajax_nopriv_chaty_front_form_save_data', [$this, 'chaty_front_form_save_data']); add_action('wp_ajax_remove_chaty_widget', [$this, 'remove_chaty_widget']); add_action('wp_ajax_rename_chaty_widget', array($this, 'rename_chaty_widget')); // rename social media widget // Remove social media widget. add_action('wp_ajax_change_chaty_widget_status', [$this, 'change_chaty_widget_status']); add_action('wp_ajax_update_chaty_view', [$this, 'update_chaty_view']); add_action('wp_ajax_nopriv_update_chaty_view', [$this, 'update_chaty_view']); // Remove social media widget. } $inEditors = $this->check_for_editors(); if (!($inEditors)) { add_action('wp_enqueue_scripts', [$this, 'cht_front_end_css_and_js']); } }//end __construct() /** * Update chaty view function * * This function updates the chaty view count when triggered. * * @return void * @since 1.0.0 * @access public * */ public function update_chaty_view() { if(isset($_POST['token'])) { $token = sanitize_text_field($_POST['token']); if(wp_verify_nonce($token, "update_chaty_view")) { if(!get_option("chaty_views")) { add_option("chaty_views", 1); } } } } /** * To rename Chaty widget * * @return void * @since 1.0.0 * @access public */ public function rename_chaty_widget() { if (current_user_can('manage_options')) { $widget_index = sanitize_text_field($_POST['widget_index']); $widget_nonce = sanitize_text_field($_POST['widget_nonce']); $widget_title = sanitize_text_field($_POST['widget_title']); if (isset($widget_index) && !empty($widget_index) && !empty($widget_nonce) && wp_verify_nonce($widget_nonce, "chaty_remove_" . $widget_index)) { $index = $widget_index; $index = trim($index, "_"); if(empty($index)) { update_option("cht_widget_title", $widget_title); } else { update_option("cht_widget_title_" . $index, $widget_title); } echo esc_url(admin_url("admin.php?page=chaty-app")); exit; } } } /** * Checks if the current page is being edited in a page builder. * * @return int Returns 1 if the page is being edited in a page builder, 0 otherwise. * @since 1.0.0 * @access public * */ function check_for_editors() { $isElementor = isset($_GET['elementor-preview']) ? 1 : 0; $isCtBuilder = isset($_GET['ct_builder']) ? 1 : 0; $isDiviTheme = isset($_GET['et_fb']) ? 1 : 0; $isZionBuilder = isset($_GET['zionbuilder-preview']) ? 1 : 0; $isSiteOrigin = isset($_GET['siteorigin_panels_live_editor']) ? 1 : 0; $flBuilder = isset($_GET['fl_builder']) ? 1 : 0; return ($isCtBuilder || $isElementor || $isDiviTheme || $isZionBuilder || $isSiteOrigin || $flBuilder) ? 1 : 0; }//end check_for_editors() /** * To remove a chaty widget * * @return void * @since 1.0.0 * @access public */ public function remove_chaty_widget() { if (current_user_can('manage_options')) { $widgetIndex = filter_input(INPUT_POST, 'widget_index'); $widgetNonce = filter_input(INPUT_POST, 'widget_nonce'); if (isset($widgetIndex) && !empty($widgetIndex) && !empty($widgetNonce) && wp_verify_nonce($widgetNonce, "chaty_remove_".$widgetIndex)) { $options = [ 'mobile' => '1', 'desktop' => '1', ]; delete_option("cht_active"); delete_option("chaty_icons_view"); delete_option("chaty_icons_view"); delete_option("cht_cta_text_color"); delete_option("cht_cta_bg_color"); delete_option("cht_pending_messages"); delete_option("cht_number_of_messages"); delete_option("cht_number_color"); delete_option("cht_number_bg_color"); delete_option("cht_cta_switcher"); delete_option("chaty_attention_effect"); delete_option("chaty_default_state"); delete_option("chaty_trigger_on_time"); delete_option("chaty_trigger_time"); delete_option("chaty_trigger_on_exit"); delete_option("chaty_trigger_on_scroll"); delete_option("chaty_trigger_on_page_scroll"); delete_option("cht_close_button"); delete_option("cht_close_button_text"); delete_option("chaty_updated_on"); delete_option("cht_widget_title"); delete_option("cht_widget_font"); delete_option("cta_type"); delete_option("cta_heading_text"); delete_option("cta_body_text"); delete_option("cta_header_text_color"); delete_option("cta_header_bg_color"); foreach ($this->socials as $social) { delete_option('cht_social_'.$social['slug']); } update_option('cht_devices', $options); update_option('cht_position', 'right'); update_option('cht_cta', 'Contact us'); update_option('cht_numb_slug', ',Phone,Whatsapp'); update_option('cht_social_whatsapp', ''); update_option('cht_social_phone', ''); update_option('cht_widget_size', '54'); update_option('widget_icon', 'chat-base'); update_option('cht_widget_img', ''); update_option('cht_color', '#A886CD'); echo esc_url(admin_url("admin.php?page=chaty-app")); exit; }//end if }//end if }//end remove_chaty_widget() /** * Change the status of the Chaty widget * * @return void * @since 1.0.0 * @access public */ public function change_chaty_widget_status() { if (current_user_can('manage_options')) { $widgetIndex = filter_input(INPUT_POST, 'widget_index'); $widgetNonce = filter_input(INPUT_POST, 'widget_nonce'); if (isset($widgetIndex) && !empty($widgetIndex) && !empty($widgetNonce) && wp_verify_nonce($widgetNonce, "chaty_remove_".$widgetIndex)) { $widgetIndex = trim($widgetIndex, "_"); if (empty($widgetIndex) || $widgetIndex == 0) { $widgetIndex = ""; } else { $widgetIndex = "_".$widgetIndex; } $status = get_option("cht_active".$widgetIndex); if ($status) { update_option("cht_active".$widgetIndex, 0); } else { update_option("cht_active".$widgetIndex, 1); } } } echo "1"; exit; }//end change_chaty_widget_status() /** * Save contact form data * * @return void * @since 1.0.0 * @access public */ function chaty_front_form_save_data() { $response = [ 'status' => 0, 'error' => 0, 'errors' => [], 'message' => '', ]; $postData = filter_input_array(INPUT_POST); $widgetIndex = $postData['widget']; if(empty($widgetIndex)) { $widgetIndex = ""; } if (isset($postData['nonce']) && isset($postData['widget']) && wp_verify_nonce($postData['nonce'], "chaty_widget_nonce".$widgetIndex)) { $name = isset($postData['name']) ? $postData['name'] : ""; $phone = isset($postData['phone']) ? $postData['phone'] : ""; $email = isset($postData['email']) ? $postData['email'] : ""; $message = isset($postData['message']) ? $postData['message'] : ""; $refURL = isset($postData['ref_url']) ? $postData['ref_url'] : ""; $widget = $postData['widget']; $channel = $postData['channel']; $value = get_option('cht_social_'.$channel); // get saved settings for button $errors = []; if (!empty($value)) { $fieldSetting = isset($value['name']) ? $value['name'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes" && isset($fieldSetting['is_required']) && $fieldSetting['is_required'] == "yes" && empty($name)) { $error = [ 'field' => 'chaty-field-name', 'message' => esc_html__("this field is required", 'chaty'), ]; $errors[] = $error; } $fieldSetting = isset($value['phone']) ? $value['phone'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes" && isset($fieldSetting['is_required']) && $fieldSetting['is_required'] == "yes" && empty($phone)) { $error = [ 'field' => 'chaty-field-phone', 'message' => esc_html__("this field is required", 'chaty'), ]; $errors[] = $error; } $fieldSetting = isset($value['email']) ? $value['email'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes" && isset($fieldSetting['is_required']) && $fieldSetting['is_required'] == "yes") { if (empty($email)) { $error = [ 'field' => 'chaty-field-email', 'message' => esc_html__("this field is required", 'chaty'), ]; $errors[] = $error; } else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = [ 'field' => 'chaty-field-email', 'message' => esc_html__("email address is not valid", 'chaty'), ]; $errors[] = $error; } } $fieldSetting = isset($value['message']) ? $value['message'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes" && isset($fieldSetting['is_required']) && $fieldSetting['is_required'] == "yes" && empty($message)) { $error = [ 'field' => 'chaty-field-message', 'message' => esc_html__("this field is required", 'chaty'), ]; $errors[] = $error; } if (empty($errors)) { $widget = trim($widget, "_"); $response['message'] = esc_attr($value['thanks_message']); $response['redirect_action'] = esc_attr($value['redirect_action']); $response['redirect_link'] = esc_url($value['redirect_link']); $response['link_in_new_tab'] = esc_attr($value['link_in_new_tab']); $response['close_form_after'] = esc_attr($value['close_form_after']); $response['close_form_after_seconds'] = esc_attr($value['close_form_after_seconds']); wp_timezone_string(); $currentDate = gmdate("Y-m-d H:i:s"); global $wpdb; $chatyTable = $wpdb->prefix.'chaty_contact_form_leads'; $insert = []; $fieldSetting = isset($value['name']) ? $value['name'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes") { $insert['name'] = esc_sql(sanitize_text_field($name)); } $fieldSetting = isset($value['email']) ? $value['email'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes") { $insert['email'] = esc_sql(sanitize_text_field($email)); } $fieldSetting = isset($value['phone']) ? $value['phone'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes") { $insert['phone_number'] = esc_sql(sanitize_text_field($phone)); } $fieldSetting = isset($value['message']) ? $value['message'] : []; if (isset($fieldSetting['is_active']) && $fieldSetting['is_active'] == "yes") { $insert['message'] = esc_sql(sanitize_text_field($message)); } $insert['ref_page'] = esc_url(esc_sql(sanitize_text_field($refURL))); $insert['ip_address'] = ""; $insert['widget_id'] = esc_sql(sanitize_text_field($widget)); $insert['created_on'] = esc_sql($currentDate); $wpdb->insert($chatyTable, $insert); $showFirst = get_option("show_first_chaty_lead_box"); if ($showFirst === false) { add_option("show_first_chaty_lead_box", 1); } $response['status'] = 1; } else { $response['errors'] = $errors; $response['error'] = 1; }//end if } else { $response['message'] = "Invalid request, Please try again"; }//end if } else { $response['message'] = "Invalid request, Please try again"; }//end if echo wp_json_encode($response); exit; }//end chaty_front_form_save_data() /** * To add front-end CSS and JS for the chat widget. * * @since 1.0.0 * @access private */ function cht_front_end_css_and_js() { if ($this->canInsertWidget()) : // Initialize widget if widget is enable for current page $social = $this->get_social_icon_list(); // get active icon list $chtActive = get_option("cht_active"); // $bgColor = $this->get_current_color(); // get custom background color for widget $defColor = get_option('cht_color'); $customColor = get_option('cht_custom_color'); // checking for custom color if (!empty($customColor)) { delete_option("cht_custom_color"); update_option("cht_color", $defColor); $color = $customColor; } else { $color = $defColor; } $bgColor = strtoupper($color); $len = count($social); // get total active channels $cta = nl2br(get_option('cht_cta')); // $cta = str_replace(array("\r", "\n"), "", $cta); $cta = str_replace("&#39;", "'", $cta); $cta = str_replace("'", "'", $cta); $cta = esc_attr(wp_unslash($cta)); $cta = html_entity_decode($cta); $positionSide = get_option('positionSide'); // get widget position $chtBottomSpacing = get_option('cht_bottom_spacing'); // get widget position from bottom $chtSideSpacing = get_option('cht_side_spacing'); // get widget position from left/Right $chtWidgetSize = get_option('cht_widget_size'); // get widget size $positionSide = empty($positionSide) ? 'right' : $positionSide; // Initialize widget position if not exists $chtSideSpacing = ($chtSideSpacing) ? $chtSideSpacing : '25'; // Initialize widget from left/Right if not exists $chtWidgetSize = ($chtWidgetSize) ? $chtWidgetSize : '54'; // Initialize widget size if not exists $position = get_option('cht_position'); $position = ($position) ? $position : 'right'; // Initialize widget position if not exists $total = ($chtSideSpacing + $chtWidgetSize + $chtSideSpacing); $chtBottomSpacing = ($chtBottomSpacing) ? $chtBottomSpacing : '25'; // Initialize widget bottom position if not exists $chtSideSpacing = ($chtSideSpacing) ? $chtSideSpacing : '25'; // Initialize widget left/Right position if not exists $imageId = ""; $imageUrl = plugin_dir_url("")."chaty-pro/admin/assets/images/chaty-default.png"; // Initialize default image $analytics = get_option("cht_google_analytics"); // check for google analytics enable or not $analytics = empty($analytics) ? 0 : $analytics; // Initialize google analytics flag to 0 if not data not exists $text = get_option("cht_close_button_text"); // close button settings $close_text = ($text === false) ? "Hide" : $text; $imageUrl = ""; if ($imageId != "") { $imageData = wp_get_attachment_image_src($imageId, "full"); if (!empty($imageData) && is_array($imageData)) { $imageUrl = $imageData[0]; // change close button image if exists } } $fontFamily = get_option('cht_widget_font'); if ($fontFamily == "System Stack") { $fontFamily = "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"; } // add inline css for custom position $animationClass = get_option("chaty_attention_effect"); $animationClass = empty($animationClass) ? "" : $animationClass; $timeTrigger = get_option("chaty_trigger_on_time"); $timeTrigger = empty($timeTrigger) ? "no" : $timeTrigger; $triggerTime = get_option("chaty_trigger_time"); $triggerTime = (empty($triggerTime) || !is_numeric($triggerTime) || $triggerTime < 0) ? "0" : $triggerTime; $exitIntent = get_option("chaty_trigger_on_exit"); $exitIntent = empty($exitIntent) ? "no" : $exitIntent; $onPageScroll = get_option("chaty_trigger_on_scroll"); $onPageScroll = empty($onPageScroll) ? "no" : $onPageScroll; $pageScroll = get_option("chaty_trigger_on_page_scroll"); $pageScroll = (empty($pageScroll) || !is_numeric($pageScroll) || $pageScroll < 0) ? "0" : $pageScroll; $state = get_option("chaty_default_state"); $state = empty($state) ? "click" : $state; $hasCloseButton = get_option("cht_close_button"); $hasCloseButton = empty($hasCloseButton) ? "yes" : $hasCloseButton; $hasCloseButton = ($hasCloseButton == "yes")?1:0; $displayDays = get_option("cht_date_and_time_settings"); $displayRules = []; $gmt = ""; if (!empty($displayDays)) { $count = 0; foreach ($displayDays as $key => $value) { if ($count == 0) { $gmt = intval($value['gmt']); $count++; } $record = []; $record['days'] = ($value['days'] - 1); $record['start_time'] = $value['start_time']; $record['start_hours'] = intval(gmdate("G", strtotime(gmdate("Y-m-d ".$value['start_time'])))); $record['start_min'] = intval(gmdate("i", strtotime(gmdate("Y-m-d ".$value['start_time'])))); $record['end_time'] = $value['end_time']; $record['end_hours'] = intval(gmdate("G", strtotime(gmdate("Y-m-d ".$value['end_time'])))); $record['end_min'] = intval(gmdate("i", strtotime(gmdate("Y-m-d ".$value['end_time'])))); $displayRules[] = $record; } } $displayConditions = 0; if (!empty($displayRules)) { $displayConditions = 1; } $mode = get_option("chaty_icons_view"); $mode = empty($mode) ? "vertical" : $mode; $pendingMessages = get_option("cht_pending_messages"); $pendingMessages = ($pendingMessages === false) ? "off" : $pendingMessages; $clickSetting = get_option("cht_cta_action"); $clickSetting = ($clickSetting === false) ? "click" : $clickSetting; $chtNumberOfMessages = get_option("cht_number_of_messages"); $chtNumberOfMessages = ($chtNumberOfMessages === false) ? 0 : $chtNumberOfMessages; $numberColor = get_option("cht_number_color"); $numberColor = ($numberColor === false) ? "#ffffff" : $numberColor; $numberBgColor = get_option("cht_number_bg_color"); $numberBgColor = ($numberBgColor === false) ? "#dd0000" : $numberBgColor; $chtCtaTextColor = get_option("cht_cta_text_color"); $chtCtaTextColor = ($chtCtaTextColor === false) ? "#dd0000" : $chtCtaTextColor; $chtCtaBgColor = get_option("cht_cta_bg_color"); $chtCtaBgColor = ($chtCtaBgColor === false) ? "#ffffff" : $chtCtaBgColor; if (empty($chtNumberOfMessages)) { $pendingMessages = "off"; } $bgColor = ($bgColor) ? $bgColor : '#A886CD'; $hideWidget = "no"; $hideTime = 0; $data = []; $data['ajax_url'] = admin_url("admin-ajax.php"); $data['analytics'] = 0; $data['capture_analytics'] = get_option("chaty_views")?0:1; $data['token'] = wp_create_nonce("update_chaty_view"); $state = ($state == "open")?"open":$state; if($state == "open") { $pending_messages = 0; $animation_class = ""; } /* * Check for CTA settings * */ $cta_type = "simple-view"; $cta_head = ""; $cta_body = ""; $cta_head_bg_color = ""; $cta_header_text_color = ""; // Widget setting array. $setting = []; $setting['cta_type'] = $this->sanitize_xss($cta_type); $setting['cta_body'] = html_entity_decode($cta_body); $setting['cta_head'] = $cta_head; $setting['cta_head_bg_color'] = $this->sanitize_xss($cta_head_bg_color); $setting['cta_head_text_color'] = $this->sanitize_xss($cta_header_text_color); $setting['show_close_button'] = $hasCloseButton; $setting['position'] = $position; $setting['custom_position'] = 1; $setting['bottom_spacing'] = $chtBottomSpacing; $setting['side_spacing'] = $chtSideSpacing; $setting['icon_view'] = $mode; $setting['default_state'] = $state; $setting['cta_text'] = wp_kses_post($cta); $setting['cta_text_color'] = $chtCtaTextColor; $setting['cta_bg_color'] = $chtCtaBgColor; $setting['show_cta'] = ($clickSetting == "click") ? "first_click" : "all_time"; $setting['is_pending_mesg_enabled'] = $pendingMessages; $setting['pending_mesg_count'] = $chtNumberOfMessages; $setting['pending_mesg_count_color'] = $numberColor; $setting['pending_mesg_count_bgcolor'] = $numberBgColor; $setting['widget_icon'] = get_option('widget_icon'); $setting['widget_icon_url'] = ''; $setting['font_family'] = $fontFamily; $setting['widget_size'] = $chtWidgetSize; $setting['custom_widget_size'] = $chtWidgetSize; $setting['is_google_analytics_enabled'] = $analytics; $setting['close_text'] = wp_strip_all_tags($this->sanitize_xss($close_text)); $setting['widget_color'] = $bgColor; $setting['widget_icon_color'] = "#ffffff"; $setting['widget_rgb_color'] = $this->getRGBColor($bgColor); $setting['has_custom_css'] = empty($custom_css) ? 0 : 1; $setting['custom_css'] = ''; $setting['widget_token'] = wp_create_nonce("chaty_widget_nonce"); $setting['widget_index'] = ''; $setting['attention_effect'] = $animationClass; $widgetSetting = []; $widgetSetting['id'] = empty($index) ? 0 : $index; $widgetSetting['identifier'] = 0; $widgetSetting['settings'] = $setting; $trigger = []; $trigger['has_time_delay'] = ($timeTrigger == "yes") ? 1 : 0; $trigger['time_delay'] = $triggerTime; $trigger['exit_intent'] = ($exitIntent == "yes") ? 1 : 0; $trigger['has_display_after_page_scroll'] = ($onPageScroll == "yes") ? 1 : 0; $trigger['display_after_page_scroll'] = $pageScroll; $trigger['auto_hide_widget'] = ($hideWidget == "yes") ? 1 : 0; $trigger['hide_after'] = $hideTime; $trigger['show_on_pages_rules'] = []; $trigger['time_diff'] = 0; $trigger['has_date_scheduling_rules'] = 0; $trigger['date_scheduling_rules'] = [ 'start_date_time' => '', 'end_date_time' => '', ]; $trigger['date_scheduling_rules_timezone'] = 0; $trigger['day_hours_scheduling_rules_timezone'] = 0; $trigger['has_day_hours_scheduling_rules'] = []; $trigger['day_hours_scheduling_rules'] = []; $trigger['day_time_diff'] = 0; $trigger['show_on_direct_visit'] = 0; $trigger['show_on_referrer_social_network'] = 0; $trigger['show_on_referrer_search_engines'] = 0; $trigger['show_on_referrer_google_ads'] = 0; $trigger['show_on_referrer_urls'] = []; $trigger['has_show_on_specific_referrer_urls'] = 0; $trigger['has_traffic_source'] = 0; $trigger['has_countries'] = 0; $trigger['countries'] = []; $trigger['has_target_rules'] = 0; $widgetSetting['triggers'] = $trigger; $widgetSetting['channels'] = $social; $data['chaty_widgets'] = []; $data['chaty_widgets'][] = $widgetSetting; $data['data_analytics_settings'] = "off"; $data['lang'] = $this->get_language_strings(); if ($len >= 1 && !empty($data['chaty_widgets'])) { $chaty_updated_on = get_option("chaty_updated_on"); if (empty($chaty_updated_on)) { $chaty_updated_on = time(); } $minified = CHT_DEV_MODE ? '' : '.min'; // add js for front end widget if (!empty($fontFamily)) { if (!in_array($fontFamily, ["Arial", "Tahoma", "Verdana", "Helvetica", "Times New Roman", "Trebuchet MS", "Georgia", "System Stack", "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"])) { wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family='.urlencode($fontFamily), false, CHT_VERSION); } } $in_footer = apply_filters('show_chaty_script_in_footer', true); // WP change this wp_enqueue_style('chaty-front-css', CHT_PLUGIN_URL."css/chaty-front".esc_attr($minified).".css", [], CHT_VERSION.$chaty_updated_on); wp_enqueue_script("chaty-front-end", CHT_PLUGIN_URL."js/cht-front-script".esc_attr($minified).".js", [ 'jquery' ], CHT_VERSION.$chaty_updated_on, $in_footer); if($this->hasEmail) { wp_enqueue_script("chaty-mail-check", CHT_PLUGIN_URL . "admin/assets/js/mailcheck.js", ['jquery'], CHT_VERSION, $in_footer); } if($this->hasEmoji) { wp_enqueue_script('chaty-picmo-js', CHT_PLUGIN_URL . 'admin/assets/js/picmo-umd.min.js', ['jquery'], CHT_VERSION, $in_footer); wp_enqueue_script('chaty-picmo-latest-js', CHT_PLUGIN_URL . 'admin/assets/js/picmo-latest-umd.min.js', ['jquery'], CHT_VERSION, $in_footer); } $data['has_chatway'] = $this->hasChatway; // Checked if the Cookie plugin is active or not. if (!function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } wp_localize_script('chaty-front-end', 'chaty_settings', $data); $add_defer = apply_filters('add_defer_to_chaty', true); if ($add_defer && (!is_plugin_active( 'litespeed-cache/litespeed-cache.php' ) || !get_option( 'litespeed.conf.optm-js_defer', false ))) { // Check if LSCache is active and defer is enabled // Only run this if WP version >= 6.3 if ( version_compare( get_bloginfo( 'version' ), '6.3', '>=' ) ) { add_filter( 'script_loader_tag', function ( $tag, $handle ) { if ( in_array( $handle, [ 'chaty-front-end', 'chaty-mail-check' ] ) ) { return str_replace( '