| @@ -1,4 +1,9 @@ | ||
| 1 | +<?php | |
| 2 | +if (!defined('ABSPATH')) : | |
| 3 | + exit; | |
| 4 | +endif; | |
| 5 | +?> | |
| 1 | 6 | <!--Start-- Upgrade Plan Overlay And Message--> |
| 2 | 7 | <div id="__tagembed__upgrade_plan_overlay" style="position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.1);z-index:999;display:none;"></div> |
| 3 | 8 | <div id="__tagembed__plan_upgrade_message" class="__tagembed__plan_upgrade_message"></div> |
| 4 | 9 | <!--End-- Upgrade Plan Overlay And Message--> |
| @@ -10,9 +15,9 @@ | ||
| 10 | 15 | window.addEventListener ? window.addEventListener("load", __tagembed__getAndManageIntercomSetting, false) : window.attachEvent && window.attachEvent("onload", __tagembed__getAndManageIntercomSetting); |
| 11 | 16 | |
| 12 | 17 | function __tagembed__getAndManageIntercomSetting() { |
| 13 | 18 | let formData = new FormData(); |
| 14 | - formData.append('action', 'data'); | |
| 19 | + formData.append('action', 'tagembed_data'); | |
| 15 | 20 | formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 16 | 21 | formData.append('__tagembed__ajax_action', '__tagembed__get_and_manage_intercom_chat_setting'); |
| 17 | 22 | fetch(__tagembed__ajax_url, { |
| 18 | 23 | method: 'POST', |
| @@ -90,9 +95,9 @@ | ||
| 90 | 95 | |
| 91 | 96 | function __tagembed__plugin_version() { |
| 92 | 97 | let __tagembed__toast = new TagembedToast; |
| 93 | 98 | let formData = new FormData(); |
| 94 | - formData.append('action', 'data'); | |
| 99 | + formData.append('action', 'tagembed_data'); | |
| 95 | 100 | formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 96 | 101 | formData.append('__tagembed__ajax_action', '__tagembed__plugin_version'); |
| 97 | 102 | fetch(__tagembed__ajax_url, { |
| 98 | 103 | method: 'POST', |
| @@ -104,21 +109,55 @@ | ||
| 104 | 109 | return response.json() |
| 105 | 110 | }).then(response => { |
| 106 | 111 | if (response.status == true) { |
| 107 | 112 | if (response.data.installedPluginVersion != response.data.livePluginVersion) { |
| 108 | - let elemHTML = `<div class="__tagembed__popupwrap __tagembed__popup_md">`; | |
| 109 | - elemHTML = `${elemHTML}<button onclick="__tagembed__hide_plugin_upgrade_message();" type="button" class="__tagembed__closebtn"></button>`; | |
| 110 | - elemHTML = `${elemHTML}<div class="__tagembed__popupinn">`; | |
| 111 | - elemHTML = `${elemHTML}<div class="__tagembed__header"><h2>Update Plugin For Free</h2></div>`; | |
| 112 | - elemHTML = `${elemHTML}<hr class="__tagembed__horizontaborder">`; | |
| 113 | - elemHTML = `${elemHTML}<div class="__tagembed__formwbody">`; | |
| 114 | - elemHTML = `${elemHTML}<div class="__tagembed__formwrow">`; | |
| 115 | - elemHTML = `${elemHTML}<p><strong> Note : </strong> There is a new version of Tagembed Widget available. <strong> ${response.data.livePluginVersion} </strong> is a recommended Update For Performance Improvements. </p>`; | |
| 116 | - elemHTML = `${elemHTML}</div></div>`; | |
| 117 | - elemHTML = `${elemHTML}<div class = "__tagembed__btnwrap text-center">`; | |
| 118 | - elemHTML = `${elemHTML}<a style="background: #d63638;" href="${response.data.pluginUpgradeURL}" class="__tagembed__okaybtn">Update Plugin</a>`; | |
| 119 | - elemHTML = `${elemHTML}</div></div></div>`; | |
| 120 | - document.getElementById("__tagembed__plugin_upgrade_message").innerHTML = elemHTML; | |
| 113 | + /* Built with DOM methods : the version string and the upgrade URL are | |
| 114 | + assigned as a text node and an attribute, never as markup. */ | |
| 115 | + let popupWrap = document.createElement("div"); | |
| 116 | + popupWrap.className = "__tagembed__popupwrap __tagembed__popup_md"; | |
| 117 | + let closeBtn = document.createElement("button"); | |
| 118 | + closeBtn.setAttribute("type", "button"); | |
| 119 | + closeBtn.className = "__tagembed__closebtn"; | |
| 120 | + closeBtn.addEventListener("click", __tagembed__hide_plugin_upgrade_message); | |
| 121 | + let popupInn = document.createElement("div"); | |
| 122 | + popupInn.className = "__tagembed__popupinn"; | |
| 123 | + let header = document.createElement("div"); | |
| 124 | + header.className = "__tagembed__header"; | |
| 125 | + let heading = document.createElement("h2"); | |
| 126 | + heading.textContent = "Update Plugin For Free"; | |
| 127 | + header.appendChild(heading); | |
| 128 | + let horizontalBorder = document.createElement("hr"); | |
| 129 | + horizontalBorder.className = "__tagembed__horizontaborder"; | |
| 130 | + let formBody = document.createElement("div"); | |
| 131 | + formBody.className = "__tagembed__formwbody"; | |
| 132 | + let formRow = document.createElement("div"); | |
| 133 | + formRow.className = "__tagembed__formwrow"; | |
| 134 | + let note = document.createElement("p"); | |
| 135 | + let noteLabel = document.createElement("strong"); | |
| 136 | + noteLabel.textContent = " Note : "; | |
| 137 | + let versionLabel = document.createElement("strong"); | |
| 138 | + versionLabel.textContent = " " + response.data.livePluginVersion + " "; | |
| 139 | + note.appendChild(noteLabel); | |
| 140 | + note.appendChild(document.createTextNode(" There is a new version of Tagembed Widget available. ")); | |
| 141 | + note.appendChild(versionLabel); | |
| 142 | + note.appendChild(document.createTextNode(" is a recommended Update For Performance Improvements. ")); | |
| 143 | + formRow.appendChild(note); | |
| 144 | + formBody.appendChild(formRow); | |
| 145 | + let btnWrap = document.createElement("div"); | |
| 146 | + btnWrap.className = "__tagembed__btnwrap text-center"; | |
| 147 | + let updateLink = document.createElement("a"); | |
| 148 | + updateLink.setAttribute("style", "background: #d63638;"); | |
| 149 | + updateLink.setAttribute("href", response.data.pluginUpgradeURL); | |
| 150 | + updateLink.className = "__tagembed__okaybtn"; | |
| 151 | + updateLink.textContent = "Update Plugin"; | |
| 152 | + btnWrap.appendChild(updateLink); | |
| 153 | + popupInn.appendChild(header); | |
| 154 | + popupInn.appendChild(horizontalBorder); | |
| 155 | + popupInn.appendChild(formBody); | |
| 156 | + popupInn.appendChild(btnWrap); | |
| 157 | + popupWrap.appendChild(closeBtn); | |
| 158 | + popupWrap.appendChild(popupInn); | |
| 159 | + document.getElementById("__tagembed__plugin_upgrade_message").replaceChildren(popupWrap); | |
| 121 | 160 | } |
| 122 | 161 | } else { |
| 123 | 162 | __tagembed__toast.danger({ |
| 124 | 163 | message: "Something went wrong. Please try after sometime", |
| @@ -188,10 +227,10 @@ | ||
| 188 | 227 | let __tagembed__nextAndBackLinkHtml = ""; |
| 189 | 228 | let __tagembed__next_and_back_link_main_section = document.querySelector("#__tagembed__next_and_back_link_main_section"); |
| 190 | 229 | __tagembed__next_and_back_link_main_section.innerHTML = ""; |
| 191 | 230 | let __tagembed__nextAndBackLinkSectionStyle = "block"; |
| 192 | - let __tagembed__widgets_count = "<?php echo esc_html($__tagembed__widgets_count); ?>"; | |
| 193 | - let __tagembed__active_menue_id = "<?php echo esc_html($__tagembed__active_menue_id); ?>"; | |
| 231 | + let __tagembed__widgets_count = <?php echo wp_json_encode((string) $__tagembed__widgets_count); ?>; | |
| 232 | + let __tagembed__active_menue_id = <?php echo wp_json_encode((string) $__tagembed__active_menue_id); ?>; | |
| 194 | 233 | if (__tagembed__widgets_count == 0) { |
| 195 | 234 | __tagembed__nextAndBackLinkSectionStyle = "none"; |
| 196 | 235 | } |
| 197 | 236 | switch (__tagembed__active_menue_id) { |
| @@ -236,24 +275,5 @@ | ||
| 236 | 275 | } |
| 237 | 276 | } |
| 238 | 277 | window.onload = __tagembed__manageNextAndBackButon(); |
| 239 | 278 | /*--End-- Manage And Generate Next And Back Link In Footer*/ |
| 240 | -</script> | |
| 241 | -<!--Start--Clarity Tracking Code --> | |
| 242 | -<script type="text/javascript"> | |
| 243 | - document.addEventListener('DOMContentLoaded', function() { | |
| 244 | - (function(c, l, a, r, i, t, y) { | |
| 245 | - c[a] = c[a] || function() { | |
| 246 | - (c[a].q = c[a].q || []).push(arguments) | |
| 247 | - }; | |
| 248 | - t = l.createElement(r); | |
| 249 | - t.async = 1; | |
| 250 | - t.src = "https://www.clarity.ms/tag/" + i; | |
| 251 | - y = l.getElementsByTagName(r)[0]; | |
| 252 | - y.parentNode.insertBefore(t, y); | |
| 253 | - })(window, document, "clarity", "script", "jz1bviq7un"); | |
| 254 | - var __tagembed__userEmailIdForClarity = "<?php echo esc_html($__tagembed__active_widget_user_email_id); ?>"; | |
| 255 | - clarity("set", "userEmail", __tagembed__userEmailIdForClarity); | |
| 256 | - clarity("set", "type", "wordpress"); | |
| 257 | - }); | |
| 258 | -</script> | |
| 259 | -<!--End--Clarity Tracking Code --> | |
| 279 | +</script> | |