JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr

" height="16" style="margin-bottom: -3px" />   ", "" ); ?>

user_email; $admin_name = wp_get_current_user()->display_name; $website_name = get_bloginfo("name"); $website_domain = get_site_url(); $website_domain = str_replace("http://", "", $website_domain); $website_domain = str_replace("https://", "", $website_domain); $website_domain = preg_replace("(:[0-9]{1,6})", "", $website_domain); $add_to_crisp_link = esc_url_raw("https://app.crisp.chat/initiate/plugin/aca0046c-356c-428f-8eeb-063014c6a278?payload=$http_callback&user_email=$admin_email&user_name=$admin_name&website_name=$website_name&website_domain=$website_domain"); if ($is_crisp_working) { include_once(plugin_dir_path( __FILE__ ) . "views/settings_installed.php"); } else { include_once(plugin_dir_path( __FILE__ ) . "views/settings_install.php"); } } function crisp_sync_wordpress_user() { $output = ""; if (is_user_logged_in()) { $current_user = wp_get_current_user(); } if (!isset($current_user)) { return ""; } $website_verify = get_option("website_verify"); $email = esc_js($current_user->user_email); $nickname = esc_js($current_user->display_name); if (!empty($email) && empty($website_verify)) { $output .= "\$crisp.push(['set', 'user:email', '" . $email . "']);"; } else if (!empty($email)) { $hmac = hash_hmac("sha256", $email, $website_verify); $output .= "\$crisp.push(['set', 'user:email', ['" . $email . "', '" . $hmac . "']]);"; } if (!empty($nickname)) { $output .= "\$crisp.push(['set', 'user:nickname', '" . $nickname . "']);"; } return $output; } function crisp_sync_woocommerce_customer() { $output = ""; if (!class_exists("WooCommerce") || is_admin()) { return $output; } if (WC()->session == NULL) { return $output; } $customer = WC()->session->get("customer"); if ($customer == NULL) { return $output; } if (isset($customer["phone"]) && !empty($customer["phone"])) { $output .= "\$crisp.push(['set', 'user:phone', '" . $customer["phone"] . "']);"; } $nickname = ""; if (isset($customer["first_name"]) && !empty($customer["first_name"])) { $nickname = esc_js($customer["first_name"]); } if (isset($customer["last_name"]) && !empty($customer["last_name"])) { $nickname .= " ".(esc_js($customer["last_name"])); } if (!empty($nickname)) { $output .= "\$crisp.push(['set', 'user:nickname', '" . $nickname . "']);"; } $data = array(); $data_keys = array( "company", "address", "address_1", "address_2", "postcode", "state", "country", "shipping_company", "shipping_address", "shipping_address_1", "shipping_address_2", "shipping_state", "shipping_country", ); foreach ($data_keys as $key) { if (isset($customer[$key]) && !empty($customer[$key])) { $data[] = "['". esc_js($key) . "', '" . esc_js($customer[$key]) . "']"; } } if (count($data) > 0) { $output .= "\$crisp.push(['set', 'session:data', [[" . implode(",", $data) . "]]]);"; } return $output; } function crisp_enqueue_script() { $website_id = get_option("website_id"); $locale = str_replace("_", "-", strtolower(get_locale())); $locale = preg_replace("/([a-z]{2}-[a-z]{2})(-.*)/", "$1", $locale); if (!isset($website_id) || empty($website_id)) { return; } $output=" window.\$crisp=[]; if (!window.CRISP_RUNTIME_CONFIG) { window.CRISP_RUNTIME_CONFIG = {} } if (!window.CRISP_RUNTIME_CONFIG.locale) { window.CRISP_RUNTIME_CONFIG.locale = '$locale' } CRISP_WEBSITE_ID = '$website_id';"; $output .= crisp_sync_wordpress_user(); $output .= crisp_sync_woocommerce_customer(); $cache_buster = date("Ymd"); wp_enqueue_script("crisp", "https://client.crisp.chat/l.js", array(), $cache_buster, true); wp_add_inline_script("crisp", $output, "before"); } function crisp_enqueue_async($tag, $handle) { if ("crisp" !== $handle ) { return $tag; } return str_replace("src", " async src", $tag ); }