PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 3.2.1
Wp Social Login and Register Social Counter v3.2.1
3.2.1 trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / helper / helper.php
wp-social / helper Last commit date
helper.php 1 week ago share-style-settings.php 3 years ago social-share-style.php 1 week ago user-helper.php 3 years ago view-helper.php 1 week ago
helper.php
469 lines
1 <?php
2
3 namespace WP_Social\Helper;
4
5 defined('ABSPATH') || exit;
6
7 class Helper {
8
9 public static function is_true($val1, $val2, $print) {
10 return esc_attr($val1 === $val2 ? $print : '');
11 }
12
13 public static function sanitize_white_list($val, $def, $white_list) {
14
15 if(in_array($val, $white_list)) {
16
17 return $val;
18 }
19
20 return $def;
21 }
22
23 public static function get_kses_array(){
24 return array(
25 'a' => array(
26 'class' => array(),
27 'href' => array(),
28 'rel' => array(),
29 'title' => array(),
30 'target' => array(),
31 'style' => array(),
32 'id' => array(),
33 'onclick' => array(),
34 'data-pid' => array(),
35 'data-uri_hash' => array(),
36 'data-key' => array(),
37 'data-xs-href' => array(),
38 ),
39 'abbr' => array(
40 'title' => array(),
41 ),
42 'b' => array(
43 'class' => array(),
44 ),
45 'blockquote' => array(
46 'cite' => array(),
47 ),
48 'cite' => array(
49 'title' => array(),
50 ),
51 'button' => array(
52 'data-type' => array(),
53 'data-target' => array(),
54 'class' => array(),
55 ),
56 'code' => array(),
57 'pre' => array(),
58 'del' => array(
59 'datetime' => array(),
60 'title' => array(),
61 ),
62 'dd' => array(),
63 'div' => array(
64 'class' => array(),
65 'title' => array(),
66 'style' => array(),
67 ),
68 'dl' => array(),
69 'dt' => array(),
70 'em' => array(),
71 'strong' => array(),
72 'h1' => array(
73 'class' => array(),
74 ),
75 'h2' => array(
76 'class' => array(),
77 ),
78 'h3' => array(
79 'class' => array(),
80 ),
81 'h4' => array(
82 'class' => array(),
83 ),
84 'h5' => array(
85 'class' => array(),
86 ),
87 'h6' => array(
88 'class' => array(),
89 ),
90 'i' => array(
91 'class' => array(),
92 ),
93 'img' => array(
94 'alt' => array(),
95 'class' => array(),
96 'height' => array(),
97 'src' => array(),
98 'width' => array(),
99 'style' => array(),
100 'title' => array(),
101 'srcset' => array(),
102 'loading' => array(),
103 'sizes' => array(),
104 ),
105 'figure' => array(
106 'class' => array(),
107 ),
108 'li' => array(
109 'class' => array(),
110 ),
111 'ol' => array(
112 'class' => array(),
113 ),
114 'p' => array(
115 'class' => array(),
116 ),
117 'q' => array(
118 'cite' => array(),
119 'title' => array(),
120 ),
121 'span' => array(
122 'class' => array(),
123 'title' => array(),
124 'style' => array(),
125 ),
126 'iframe' => array(
127 'width' => array(),
128 'height' => array(),
129 'scrolling' => array(),
130 'frameborder' => array(),
131 'allow' => array(),
132 'src' => array(),
133 ),
134 'strike' => array(),
135 'br' => array(),
136 'table' => array(),
137 'thead' => array(),
138 'tbody' => array(),
139 'tfoot' => array(),
140 'tr' => array(),
141 'th' => array(),
142 'td' => array(),
143 'colgroup' => array(),
144 'col' => array(),
145 'strong' => array(),
146 'data-wow-duration' => array(),
147 'data-wow-delay' => array(),
148 'data-wallpaper-options' => array(),
149 'data-stellar-background-ratio' => array(),
150 'ul' => array(
151 'class' => array(),
152 ),
153 'svg' => array(
154 'class' => true,
155 'aria-hidden' => true,
156 'aria-labelledby' => true,
157 'role' => true,
158 'xmlns' => true,
159 'width' => true,
160 'height' => true,
161 'viewbox' => true, // <= Must be lower case!
162 'preserveaspectratio' => true,
163 ),
164 'g' => array( 'fill' => true ),
165 'title' => array( 'title' => true ),
166 'path' => array(
167 'd' => true,
168 'fill' => true,
169 ),
170 'input' => array(
171 'class' => array(),
172 'type' => array(),
173 'value' => array()
174 )
175 );
176 }
177
178 /**
179 * Display simple success page for TikTok callback
180 */
181 public static function tiktok_access_token_display_page_success_message( $access_token ) {
182 $counter_settings_url = admin_url('admin.php?page=wslu_counter_setting&tab=wslu_providers');
183 ?>
184 <!DOCTYPE html>
185 <html lang="en">
186 <head>
187 <meta charset="UTF-8">
188 <meta name="viewport" content="width=device-width, initial-scale=1.0">
189 <title>TikTok Connected Successfully</title>
190 <style>
191 body {
192 font-family: Arial, sans-serif;
193 background: #f0f0f1;
194 margin: 0;
195 padding: 40px 20px;
196 display: flex;
197 justify-content: center;
198 align-items: center;
199 min-height: 100vh;
200 }
201
202 .container {
203 background: white;
204 padding: 40px;
205 border-radius: 8px;
206 box-shadow: 0 2px 10px rgba(0,0,0,0.1);
207 max-width: 600px;
208 width: 100%;
209 text-align: center;
210 }
211
212 h1 {
213 color: #2c3e50;
214 margin-bottom: 10px;
215 font-size: 24px;
216 }
217
218 .subtitle {
219 color: #666;
220 margin-bottom: 30px;
221 font-size: 16px;
222 }
223
224 .token-box {
225 background: #f8f9fa;
226 border: 1px solid #dee2e6;
227 border-radius: 6px;
228 padding: 20px;
229 margin: 20px 0;
230 text-align: left;
231 }
232
233 .token-label {
234 font-weight: bold;
235 color: #333;
236 margin-bottom: 10px;
237 font-size: 14px;
238 }
239
240 .token-value {
241 background: white;
242 border: 1px solid #ccc;
243 padding: 12px;
244 border-radius: 4px;
245 font-family: monospace;
246 font-size: 13px;
247 word-break: break-all;
248 color: #427EEF;
249 position: relative;
250 }
251
252 .copy-btn {
253 position: absolute;
254 top: 8px;
255 right: 8px;
256 background: #427EEF;
257 color: white;
258 border: none;
259 padding: 5px 10px;
260 border-radius: 3px;
261 font-size: 11px;
262 cursor: pointer;
263 }
264
265 .copy-btn:hover {
266 background: #2c5aa0;
267 }
268
269 .actions {
270 margin-top: 30px;
271 }
272
273 .btn {
274 display: inline-block;
275 padding: 12px 24px;
276 border-radius: 5px;
277 text-decoration: none;
278 font-weight: 500;
279 font-size: 14px;
280 border: none;
281 cursor: pointer;
282 }
283
284 .btn-primary {
285 background: #427EEF;
286 color: white;
287 }
288
289 .btn-primary:hover {
290 background: #2c5aa0;
291 }
292
293 @media (max-width: 768px) {
294 .container {
295 padding: 30px 20px;
296 }
297 }
298 </style>
299 </head>
300 <body>
301 <div class="container">
302 <h1>TikTok Connected Successfully!</h1>
303 <p class="subtitle">Your TikTok account has been connected. Here's your access token:</p>
304
305 <div class="token-box">
306 <div class="token-label">Access Token:</div>
307 <div class="token-value" id="accessToken">
308 <?php echo esc_html( $access_token ); ?>
309 <button class="copy-btn" onclick="copyToken()">Copy</button>
310 </div>
311 </div>
312
313 <div class="actions">
314 <a href="<?php echo esc_url( $counter_settings_url ); ?>" class="btn btn-primary">Go Back to Settings</a>
315 </div>
316 </div>
317
318 <script>
319 function copyToken() {
320 const tokenElement = document.getElementById('accessToken');
321 const tokenText = tokenElement.textContent.replace('Copy', '').trim();
322 const copyBtn = document.querySelector('.copy-btn');
323
324 // Try modern clipboard API first
325 if (navigator.clipboard) {
326 navigator.clipboard.writeText(tokenText).then(function() {
327 copyBtn.textContent = 'Copied!';
328 setTimeout(() => { copyBtn.textContent = 'Copy'; }, 2000);
329 });
330 } else {
331 // Fallback for older browsers
332 const textArea = document.createElement('textarea');
333 textArea.value = tokenText;
334 document.body.appendChild(textArea);
335 textArea.select();
336 document.execCommand('copy');
337 document.body.removeChild(textArea);
338
339 copyBtn.textContent = 'Copied!';
340 setTimeout(() => { copyBtn.textContent = 'Copy'; }, 2000);
341 }
342 }
343 </script>
344 </body>
345 </html>
346 <?php
347 }
348
349 /**
350 * Display simple error page for TikTok callback
351 */
352 public static function tiktok_access_token_display_page_error_message() {
353 $counter_settings_url = admin_url('admin.php?page=wslu_counter_setting&tab=wslu_providers');
354 ?>
355 <!DOCTYPE html>
356 <html lang="en">
357 <head>
358 <meta charset="UTF-8">
359 <meta name="viewport" content="width=device-width, initial-scale=1.0">
360 <title>TikTok Connection Failed</title>
361 <style>
362 body {
363 font-family: Arial, sans-serif;
364 background: #f0f0f1;
365 margin: 0;
366 padding: 40px 20px;
367 display: flex;
368 justify-content: center;
369 align-items: center;
370 min-height: 100vh;
371 }
372
373 .container {
374 background: white;
375 padding: 40px;
376 border-radius: 8px;
377 box-shadow: 0 2px 10px rgba(0,0,0,0.1);
378 max-width: 500px;
379 width: 100%;
380 text-align: center;
381 }
382
383 h1 {
384 color: #d63638;
385 margin-bottom: 10px;
386 font-size: 24px;
387 }
388
389 .subtitle {
390 color: #666;
391 margin-bottom: 20px;
392 font-size: 16px;
393 }
394
395 .error-box {
396 background: #fef7f7;
397 border: 1px solid #f1a7a7;
398 border-radius: 6px;
399 padding: 20px;
400 margin: 20px 0;
401 text-align: left;
402 }
403
404 .error-title {
405 font-weight: bold;
406 color: #d63638;
407 margin-bottom: 10px;
408 }
409
410 .error-message {
411 color: #666;
412 font-size: 14px;
413 line-height: 1.5;
414 }
415
416 .actions {
417 margin-top: 30px;
418 }
419
420 .btn {
421 display: inline-block;
422 padding: 12px 24px;
423 border-radius: 5px;
424 text-decoration: none;
425 font-weight: 500;
426 font-size: 14px;
427 border: none;
428 cursor: pointer;
429 }
430
431 .btn-primary {
432 background: #427EEF;
433 color: white;
434 }
435
436 .btn-primary:hover {
437 background: #2c5aa0;
438 }
439
440 @media (max-width: 768px) {
441 .container {
442 padding: 30px 20px;
443 }
444 }
445 </style>
446 </head>
447 <body>
448 <div class="container">
449 <h1>Connection Failed</h1>
450 <p class="subtitle">Something went wrong while connecting to TikTok.</p>
451
452 <div class="error-box">
453 <div class="error-title">Error Details:</div>
454 <div class="error-message">
455 Unable to retrieve access token from TikTok. Please check your app credentials and try again.
456 </div>
457 </div>
458
459 <div class="actions">
460 <a href="<?php echo esc_url( $counter_settings_url ); ?>" class="btn btn-primary">Back to Settings</a>
461 </div>
462 </div>
463 </body>
464 </html>
465 <?php
466 }
467
468 }
469