views/includes
footerView.php
11.6 KB
4 days ago
headView.php
8.8 KB
4 days ago
headerView.php
3.5 KB
4 days ago
headView.php in Tagembed: Social Media Feeds and Customer Reviews Widget 7.9, at views/includes/headView.php
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) : |
| 3 | exit; |
| 4 | endif; |
| 5 | wp_enqueue_script('jquery'); |
| 6 | /* --Start-- DOMPurify : Third Party HTML Sanitizer. Loaded only on this plugin's own screen. */ |
| 7 | wp_enqueue_script('__tagembed__domPurifyJs', TAGEMBED_PLUGIN_URL . '/assets/js/vendor/purify.js', [], '3.4.13', true); |
| 8 | /* DOMPurify 3.4.13. Official release, used unmodified and byte for byte |
| 9 | identical to https://github.com/cure53/DOMPurify/blob/3.4.13/dist/purify.js |
| 10 | The sanitizer is a UMD bundle. If another plugin has left an AMD or CommonJS loader on |
| 11 | the page, the bundle would register there instead of on window, so those globals are |
| 12 | hidden for the moment it runs and restored immediately afterwards. */ |
| 13 | wp_add_inline_script('__tagembed__domPurifyJs', '(function(w){w.__tagembed__umd={d:w.define,m:w.module,e:w.exports};try{delete w.define;delete w.module;delete w.exports;}catch(e){w.define=undefined;w.module=undefined;w.exports=undefined;}})(window);', 'before'); |
| 14 | wp_add_inline_script('__tagembed__domPurifyJs', '(function(w){w.__tagembed__DOMPurify=w.DOMPurify;var s=w.__tagembed__umd;if(s){if(s.d!==undefined){w.define=s.d;}if(s.m!==undefined){w.module=s.m;}if(s.e!==undefined){w.exports=s.e;}delete w.__tagembed__umd;}})(window);', 'after'); |
| 15 | /* --End-- DOMPurify */ |
| 16 | wp_enqueue_script('__tagembed__custom-js', TAGEMBED_PLUGIN_URL . '/assets/js/tagembed.common.js', ['jquery', 'wp-escape-html', '__tagembed__domPurifyJs'], TAGEMBED_PLUGIN_VERSION, true); |
| 17 | wp_enqueue_script('__tagembed__script-widget-js', TAGEMBED_PLUGIN_URL . '/assets/js/widget/tagembed.widget.script.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true); |
| 18 | $__tagembed__account_page = true; /* Use : Check User Token Valid Or Not */ |
| 19 | $__tagembed__user_details = ___tagembed__user(); |
| 20 | $__tagembed__active_widget_user_id = ___tagembed__activeWidgetUser(); |
| 21 | $__tagembed__active_widget_user_name = !empty($__tagembed__user_details->name) ? $__tagembed__user_details->name : ''; |
| 22 | $__tagembed__active_widget_user_email_id = !empty($__tagembed__user_details->email) ? $__tagembed__user_details->email : ''; |
| 23 | $__tagembed__menus = ___tagembed__menus(); |
| 24 | $__tagembed__active_menue_id = null; |
| 25 | $__tagembed__active_widget_id = ___tagembed__activeWidget(); |
| 26 | $__tagembed__active_widget_id = !empty($__tagembed__active_widget_id) ? $__tagembed__active_widget_id : 0; |
| 27 | $__tagembed__widgets = ___tagembed__widgets(); |
| 28 | $__tagembed__widgets_count = count($__tagembed__widgets); /* Use In Next And Back Button */ |
| 29 | /* $__tagembed__collaborators = __tagembed__collaborator($__tagembed__user_details->userId); */ |
| 30 | ?> |
| 31 | <script type="text/javascript"> |
| 32 | var __tagembed__ajax_call_nones = <?php echo wp_json_encode((string) wp_create_nonce('__tagembed__ajax_call_security_nones')); ?>; |
| 33 | var __tagembed__ajax_url = <?php echo wp_json_encode((string) admin_url('admin-ajax.php')); ?>; |
| 34 | var __tagembed__plugin_server_url = <?php echo wp_json_encode((string) TAGEMBED_PLUGIN_SERVER_URL); ?>; |
| 35 | var __tagembed__network_already_exist_auth = []; |
| 36 | var __tagembed__plugin_url_for_js = <?php echo wp_json_encode((string) TAGEMBED_PLUGIN_URL); ?>; |
| 37 | var __tagembed__plugin_react_url = <?php echo wp_json_encode((string) TAGEMBED_PLUGIN_REACT_URL); ?>; |
| 38 | var __tagembed__user_id = <?php echo wp_json_encode(!empty($__tagembed__user_details->userId) ? (string) $__tagembed__user_details->userId : ''); ?>; |
| 39 | </script> |
| 40 | <!--Start--Check User Access Token--> |
| 41 | <?php if (!empty($__tagembed__user_details)) : ?> |
| 42 | <script> |
| 43 | window.addEventListener ? window.addEventListener("load", __tagembed__check_user_token, false) : window.attachEvent && window.attachEvent("onload", __tagembed__check_user_token); |
| 44 | |
| 45 | function __tagembed__check_user_token() { |
| 46 | let __tagembed__toast = new TagembedToast; |
| 47 | __tagembed__open_loader(); |
| 48 | let formData = new FormData(); |
| 49 | formData.append('action', 'tagembed_data'); |
| 50 | formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 51 | formData.append('__tagembed__ajax_action', '__tagembed__check_user_token'); |
| 52 | fetch(__tagembed__ajax_url, { |
| 53 | method: 'POST', |
| 54 | headers: { |
| 55 | 'x-requested-with': 'XMLHttpRequest', |
| 56 | }, |
| 57 | body: formData, |
| 58 | }).then(response => { |
| 59 | return response.json() |
| 60 | }).then(response => { |
| 61 | __tagembed__close_loader(); |
| 62 | if (response.status === true) { |
| 63 | if (!response.data.head.status && response.data.head.code == 401) |
| 64 | location.reload(); |
| 65 | } else { |
| 66 | if (response.hasOwnProperty("message")) { |
| 67 | __tagembed__toast.danger({ |
| 68 | message: response.message, |
| 69 | position: '__tagembed__is-top-right' |
| 70 | }); |
| 71 | } else { |
| 72 | __tagembed__toast.danger({ |
| 73 | message: "Something went wrong. Please try after sometime", |
| 74 | position: '__tagembed__is-top-right' |
| 75 | }); |
| 76 | } |
| 77 | } |
| 78 | }).catch((error) => { |
| 79 | console.log(error); |
| 80 | __tagembed__close_loader(); |
| 81 | __tagembed__toast.danger({ |
| 82 | message: "Something went wrong. Please try after sometime", |
| 83 | position: '__tagembed__is-top-right' |
| 84 | }); |
| 85 | }); |
| 86 | } |
| 87 | /*--End-- Check User Token*/ |
| 88 | </script> |
| 89 | <?php endif; ?> |
| 90 | <!--End--Check User Access Token--> |
| 91 | |
| 92 | <!--Start-- Manage Upgrade Plan Popup --> |
| 93 | <script> |
| 94 | async function __tagembed__upgradePlan() { |
| 95 | let overlay = document.querySelector("#__tagembed__upgrade_plan_overlay"); |
| 96 | if (overlay) overlay.style.display = 'block'; |
| 97 | let formData = new FormData(); |
| 98 | formData.append('action', 'tagembed_data'); |
| 99 | formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones); |
| 100 | formData.append('__tagembed__ajax_action', '__tagembed__check_plan_premium_feature'); |
| 101 | __tagembed__open_loader(); |
| 102 | let toast = new TagembedToast(); |
| 103 | try { |
| 104 | let response = await fetch(__tagembed__ajax_url, { |
| 105 | method: 'POST', |
| 106 | headers: { |
| 107 | 'x-requested-with': 'XMLHttpRequest' |
| 108 | }, |
| 109 | body: formData, |
| 110 | }); |
| 111 | |
| 112 | let data = await response.json(); |
| 113 | __tagembed__close_loader(); |
| 114 | if (data.status === true) { |
| 115 | if (data.data.premiumFeatureStatus === false) { |
| 116 | if (overlay) overlay.style.display = 'none'; |
| 117 | return false; |
| 118 | } |
| 119 | let elemHTML = ` |
| 120 | <div id="__tagembed__upgrade_plan_popup" class="__tagembed__popupwrap __tagembed__popup_xl"> |
| 121 | <button onclick="__tagembed__hide_upgrade_plan_close();" type="button" class="__tagembed__closebtn"></button> |
| 122 | <div class="__tagembed__popupinn"> |
| 123 | <div class="__tagembed__header"> |
| 124 | <h2>You've Discovered a Premium Feature!</h2> |
| 125 | </div> |
| 126 | <hr class="__tagembed__horizontaborder"> |
| 127 | <div class="__tagembed__formwbody"> |
| 128 | <div class="__tagembed__formwrow"> |
| 129 | <p> |
| 130 | You've created a <strong>premium feed</strong>, which is not available in your free plan. |
| 131 | To continue displaying content from this network, please upgrade your plan. |
| 132 | </p> |
| 133 | </div> |
| 134 | </div> |
| 135 | <div class="__tagembed__btnwrap text-center"> |
| 136 | <a style="background:#3b6de5;" onclick="__tagembed__menus('9')" class="__tagembed__okaybtn"> |
| 137 | Upgrade Plan |
| 138 | </a> |
| 139 | </div> |
| 140 | <div style="background:#fdecee; border-top:1px solid #c3c4c7; padding:14px 18px; display:flex; justify-content:space-between; align-items:center;"> |
| 141 | <div style="display:flex; flex-direction:column;"> |
| 142 | <span style="font-size:16px; font-weight:700;">Prefer Not to Upgrade?</span> |
| 143 | <span style="font-size:14px;"> |
| 144 | You can delete the (<span style="color:#6f42c1;"> Premium Network </span>) feed and choose a network included in the free plan. |
| 145 | </span> |
| 146 | </div> |
| 147 | <button onclick="__tagembed__menus('2')" |
| 148 | style="background:#ffffff; border:1px solid #dcdcdc; padding:8px 16px; cursor:pointer;"> |
| 149 | Delete Feed |
| 150 | </button> |
| 151 | </div> |
| 152 | </div> |
| 153 | </div> |
| 154 | `; |
| 155 | document.getElementById("__tagembed__plan_upgrade_message").innerHTML = elemHTML; |
| 156 | return true; |
| 157 | } else { |
| 158 | toast.danger({ |
| 159 | message: data.message || "Something went wrong. Please try after sometime", |
| 160 | position: '__tagembed__is-top-right' |
| 161 | }); |
| 162 | return false; |
| 163 | } |
| 164 | } catch (error) { |
| 165 | console.error(error); |
| 166 | __tagembed__close_loader(); |
| 167 | toast.danger({ |
| 168 | message: "Something went wrong. Please try after sometime", |
| 169 | position: '__tagembed__is-top-right' |
| 170 | }); |
| 171 | return false; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | function __tagembed__hide_upgrade_plan_close() { |
| 176 | let __tagembed__upgrade_plan_popup = document.querySelector("#__tagembed__upgrade_plan_popup"); |
| 177 | if (__tagembed__upgrade_plan_popup) __tagembed__upgrade_plan_popup.style.display = 'none'; |
| 178 | let __tagembed__upgrade_plan_overlay = document.querySelector("#__tagembed__upgrade_plan_overlay"); |
| 179 | if (__tagembed__upgrade_plan_overlay) __tagembed__upgrade_plan_overlay.style.display = 'none'; |
| 180 | } |
| 181 | </script> |
| 182 | <!--End-- Manage Upgrade Plan Popup --> |
| 183 | |
| 184 | <div id="__tagembed__plugin_upgrade_message"></div> |
| 185 | <div class="__tagembed__container"> |
| 186 | <div class="__tagembed__row"> |
| 187 | <div class="__tagembed__col __tagembed__col_12 __tagembed__widget"> |
| 188 | <div class="__tagembed__widget_inn"> |