PluginProbe
Tagembed: Social Media Feeds and Customer Reviews Widget / 7.4
Tagembed: Social Media Feeds and Customer Reviews Widget v7.4
7.8 7.5 7.6 7.7 7.4 trunk 3.10 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 All 43 releases
tagembed-widget / views / includes / headView.php

headView.php in Tagembed: Social Media Feeds and Customer Reviews Widget 7.4, at views/includes/headView.php

175 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 wp_enqueue_script('__jquery');
3 wp_enqueue_script('__tagembed__custom-js', TAGEMBED_PLUGIN_URL . '/assets/js/tagembed.common.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
4 wp_enqueue_script('__script-widget-js', TAGEMBED_PLUGIN_URL . '/assets/js/widget/tagembed.widget.script.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
5 $__tagembed__account_page = true; /* Use : Check User Token Valid Or Not */
6 $__tagembed__user_details = ___tagembed__user();
7 $__tagembed__active_widget_user_id = ___tagembed__activeWidgetUser();
8 $__tagembed__active_widget_user_name = !empty($__tagembed__user_details->name) ? $__tagembed__user_details->name : '';
9 $__tagembed__active_widget_user_email_id = !empty($__tagembed__user_details->email) ? $__tagembed__user_details->email : '';
10 $__tagembed__menus = ___tagembed__menus();
11 $__tagembed__active_menue_id = null;
12 $__tagembed__active_widget_id = ___tagembed__activeWidget();
13 $__tagembed__active_widget_id = !empty($__tagembed__active_widget_id) ? $__tagembed__active_widget_id : 0;
14 $__tagembed__widgets = ___tagembed__widgets();
15 $__tagembed__widgets_count = count($__tagembed__widgets); /* Use In Next And Back Button */
16 /* $__tagembed__collaborators = __tagembed__collaborator($__tagembed__user_details->userId); */
17 ?>
18 <script type="text/javascript">
19 var __tagembed__ajax_call_nones = "<?php echo esc_html(wp_create_nonce('__tagembed__ajax_call_security_nones')); ?>";
20 var __tagembed__ajax_url = "<?php echo esc_html(admin_url('admin-ajax.php')); ?>";
21 var __tagembed__plugin_server_url = "<?php echo esc_html(TAGEMBED_PLUGIN_SERVER_URL); ?>";
22 var __tagembed__network_already_exist_auth = [];
23 var __tagembed__plugin_url_for_js = "<?php echo esc_html(TAGEMBED_PLUGIN_URL); ?>";
24 var __tagembed__plugin_react_url = "<?php echo esc_html(TAGEMBED_PLUGIN_REACT_URL); ?>";
25 var __tagembed__user_id = "<?php echo esc_html(!empty($__tagembed__user_details->userId) ? $__tagembed__user_details->userId : ''); ?>";
26 </script>
27 <!--Start--Check User Access Token-->
28 <?php if (!empty($__tagembed__user_details)) : ?>
29 <script>
30 window.addEventListener ? window.addEventListener("load", __tagembed__check_user_token, false) : window.attachEvent && window.attachEvent("onload", __tagembed__check_user_token);
31
32 function __tagembed__check_user_token() {
33 let __tagembed__toast = new TagembedToast;
34 __tagembed__open_loader();
35 let formData = new FormData();
36 formData.append('action', 'data');
37 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
38 formData.append('__tagembed__ajax_action', '__tagembed__check_user_token');
39 fetch(__tagembed__ajax_url, {
40 method: 'POST',
41 headers: {
42 'x-requested-with': 'XMLHttpRequest',
43 },
44 body: formData,
45 }).then(response => {
46 return response.json()
47 }).then(response => {
48 __tagembed__close_loader();
49 if (response.status === true) {
50 if (!response.data.head.status && response.data.head.code == 401)
51 location.reload();
52 } else {
53 if (response.hasOwnProperty("message")) {
54 __tagembed__toast.danger({
55 message: response.message,
56 position: '__tagembed__is-top-right'
57 });
58 } else {
59 __tagembed__toast.danger({
60 message: "Something went wrong. Please try after sometime",
61 position: '__tagembed__is-top-right'
62 });
63 }
64 }
65 }).catch((error) => {
66 console.log(error);
67 __tagembed__close_loader();
68 __tagembed__toast.danger({
69 message: "Something went wrong. Please try after sometime",
70 position: '__tagembed__is-top-right'
71 });
72 });
73 }
74 /*--End-- Check User Token*/
75 </script>
76 <?php endif; ?>
77 <!--End--Check User Access Token-->
78
79 <!--Start-- Manage Upgrade Plan Popup -->
80 <script>
81 async function __tagembed__upgradePlan() {
82 let overlay = document.querySelector("#__tagembed__upgrade_plan_overlay");
83 if (overlay) overlay.style.display = 'block';
84 let formData = new FormData();
85 formData.append('action', 'data');
86 formData.append('__tagembed__ajax_call_nones', __tagembed__ajax_call_nones);
87 formData.append('__tagembed__ajax_action', '__tagembed__check_plan_premium_feature');
88 __tagembed__open_loader();
89 let toast = new TagembedToast();
90 try {
91 let response = await fetch(__tagembed__ajax_url, {
92 method: 'POST',
93 headers: {
94 'x-requested-with': 'XMLHttpRequest'
95 },
96 body: formData,
97 });
98
99 let data = await response.json();
100 __tagembed__close_loader();
101 if (data.status === true) {
102 if (data.data.premiumFeatureStatus === false) {
103 if (overlay) overlay.style.display = 'none';
104 return false;
105 }
106 let elemHTML = `
107 <div id="__tagembed__upgrade_plan_popup" class="__tagembed__popupwrap __tagembed__popup_xl">
108 <button onclick="__tagembed__hide_upgrade_plan_close();" type="button" class="__tagembed__closebtn"></button>
109 <div class="__tagembed__popupinn">
110 <div class="__tagembed__header">
111 <h2>You've Discovered a Premium Feature!</h2>
112 </div>
113 <hr class="__tagembed__horizontaborder">
114 <div class="__tagembed__formwbody">
115 <div class="__tagembed__formwrow">
116 <p>
117 You've created a <strong>LinkedIn feed</strong>, which is not available in your free plan.
118 To continue displaying content from this network, please upgrade your plan.
119 </p>
120 </div>
121 </div>
122 <div class="__tagembed__btnwrap text-center">
123 <a style="background:#3b6de5;" onclick="__tagembed__menus('9')" class="__tagembed__okaybtn">
124 Upgrade Plan
125 </a>
126 </div>
127 <div style="background:#fdecee; border-top:1px solid #c3c4c7; padding:14px 18px; display:flex; justify-content:space-between; align-items:center;">
128 <div style="display:flex; flex-direction:column;">
129 <span style="font-size:16px; font-weight:700;">Prefer Not to Upgrade?</span>
130 <span style="font-size:14px;">
131 You can delete the (<span style="color:#6f42c1;">LinkedIn</span>) feed and choose a network included in the free plan.
132 </span>
133 </div>
134 <button onclick="__tagembed__menus('2')"
135 style="background:#ffffff; border:1px solid #dcdcdc; padding:8px 16px; cursor:pointer;">
136 Delete Feed
137 </button>
138 </div>
139 </div>
140 </div>
141 `;
142 document.getElementById("__tagembed__plan_upgrade_message").innerHTML = elemHTML;
143 return true;
144 } else {
145 toast.danger({
146 message: data.message || "Something went wrong. Please try after sometime",
147 position: '__tagembed__is-top-right'
148 });
149 return false;
150 }
151 } catch (error) {
152 console.error(error);
153 __tagembed__close_loader();
154 toast.danger({
155 message: "Something went wrong. Please try after sometime",
156 position: '__tagembed__is-top-right'
157 });
158 return false;
159 }
160 }
161
162 function __tagembed__hide_upgrade_plan_close() {
163 let __tagembed__upgrade_plan_popup = document.querySelector("#__tagembed__upgrade_plan_popup");
164 if (__tagembed__upgrade_plan_popup) __tagembed__upgrade_plan_popup.style.display = 'none';
165 let __tagembed__upgrade_plan_overlay = document.querySelector("#__tagembed__upgrade_plan_overlay");
166 if (__tagembed__upgrade_plan_overlay) __tagembed__upgrade_plan_overlay.style.display = 'none';
167 }
168 </script>
169 <!--End-- Manage Upgrade Plan Popup -->
170
171 <div id="__tagembed__plugin_upgrade_message"></div>
172 <div class="__tagembed__container">
173 <div class="__tagembed__row">
174 <div class="__tagembed__col __tagembed__col_12 __tagembed__widget">
175 <div class="__tagembed__widget_inn">