PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.0
Wp Social Login and Register Social Counter v2.2.0
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 / inc / admin-settings.php
wp-social / inc Last commit date
elementor 3 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 3 years ago admin-custom-function.php 3 years ago admin-rest-api.php 5 years ago admin-settings.php 3 years ago admin-social-button.php 3 years ago admin-social-enque-script.php 5 years ago counter-widget.php 3 years ago counter.php 3 years ago custom-function.php 5 years ago login-widget.php 3 years ago login.php 5 years ago share-widget.php 3 years ago share.php 3 years ago
admin-settings.php
931 lines
1 <?php
2
3 namespace WP_Social\Inc;
4
5 defined('ABSPATH') || exit;
6
7 use WP_Social\App\Counter_Settings;
8 use WP_Social\App\Login_Settings;
9 use WP_Social\App\Providers;
10 use WP_Social\App\Settings;
11 use WP_Social\Helper\User_Helper;
12 use WP_Social\Lib\Onboard\Onboard;
13 use WP_Social\Xs_Migration\Migration;
14 use WP_User_Query;
15
16 /**
17 * Class Name : XS_Social_Login_Settings;
18 * Class Details : Added menu and sub menu in wordpress main admin menu
19 *
20 * @params : void
21 * @return : added new page link
22 *
23 * @since : 1.0
24 */
25 class Admin_Settings {
26
27 public static $counter_style = ['wslu-counter-box-shaped wslu-counter-fill-colored' => 'Block', 'wslu-counter-line-shaped wslu-counter-fill-colored' => 'Line', 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-rounded' => 'Line with Round'];
28
29 /**
30 * @var array
31 */
32 public static $horizontal_style = [
33
34 'horizontal' => [
35 'class' => 'wslu-share-horizontal',
36 'name' => 'Horizontal',
37 ],
38
39 'vertical' => [
40 'class' => 'wslu-share-vertical',
41 'name' => 'Vertical',
42 ],
43 ];
44
45
46 public function __construct($load = true) {
47
48 add_action('wp_ajax_export_users_content_csv', [$this, 'export_users_content_csv']);
49
50 add_action('wp_ajax_sort_providers_login', [$this, 'sort_providers_login']);
51
52 add_action('wp_ajax_sort_providers_share', [$this, 'sort_providers_share']);
53
54 add_action('wp_ajax_sort_providers_counter', [$this, 'sort_providers_counter']);
55
56 if($load) {
57 // added admin menu
58 add_action('admin_menu', [$this, 'wp_social_admin_menu']);
59 }
60
61 if(!did_action('wslu_social_pro/plugin_loaded')) {
62 add_filter('wslu/share/style_settins', [$this, 'share_style_settings']);
63 add_filter('wslu/counter/style_settings', [$this, 'counter_style_settings']);
64 }
65 }
66
67
68 public static function share_styles() {
69
70 $share_style = [
71 'style-1' => [
72 'name' => 'Icon with fill color',
73 'class' => 'wslu-share-box-shaped wslu-fill-colored',
74 'design' => 'img-1',
75 'package' => 'free',
76 ],
77 'style-2' => [
78 'name' => 'Icon with fill color and space',
79 'class' => 'wslu-share-box-shaped wslu-fill-colored wslu-share-m-5',
80 'design' => 'img-2',
81 'package' => 'free',
82 ],
83 'style-3' => [
84 'name' => 'Icon with hover fill color and space',
85 'class' => 'wslu-share-box-shaped wslu-fill-brand-hover-colored wslu-share-m-5',
86 'design' => 'img-3',
87 'package' => 'free',
88 ],
89 ];
90
91 return apply_filters('wslu/share/style_settins', $share_style);
92 }
93
94 public function share_style_settings($share) {
95
96 $array = [
97 'style-4' => [
98 'name' => 'Icon with text',
99 'class' => 'wslu-go-pro',
100 'design' => 'img-4',
101 'package' => 'pro',
102 ],
103 'style-5' => [
104 'name' => 'Icon with text & slightly rounded',
105 'class' => 'wslu-go-pro',
106 'design' => 'img-5',
107 'package' => 'pro',
108 ],
109 'style-6' => [
110 'name' => 'Circled Icon with fill color',
111 'class' => 'wslu-go-pro',
112 'design' => 'img-6',
113 'package' => 'pro',
114 ],
115 'style-7' => [
116 'name' => 'Circled Icon with hover fill color',
117 'class' => 'wslu-go-pro',
118 'design' => 'img-7',
119 'package' => 'pro',
120 ],
121 'style-8' => [
122 'name' => 'Icon with colored border',
123 'class' => 'wslu-go-pro',
124 'design' => 'img-8',
125 'package' => 'pro',
126 ],
127 'style-9' => [
128 'name' => 'Icon with hover colored border',
129 'class' => 'wslu-go-pro',
130 'design' => 'img-9',
131 'package' => 'pro',
132 ],
133 'style-10' => [
134 'name' => 'Icon with colored rounded border',
135 'class' => 'wslu-go-pro',
136 'design' => 'img-10',
137 'package' => 'pro',
138 ],
139 'style-11' => [
140 'name' => 'Icon with hover colored rounded border',
141 'class' => 'wslu-go-pro',
142 'design' => 'img-11',
143 'package' => 'pro',
144 ],
145 'style-12' => [
146 'name' => 'Icon with hover fill color border',
147 'class' => 'wslu-go-pro',
148 'design' => 'img-12',
149 'package' => 'pro',
150 ],
151 'style-13' => [
152 'name' => 'Slightly rounded icon with fill color',
153 'class' => 'wslu-go-pro',
154 'design' => 'img-13',
155 'package' => 'pro',
156 ],
157 'style-14' => [
158 'name' => 'Icon with follower count',
159 'class' => 'wslu-go-pro',
160 'design' => 'img-14',
161 'package' => 'pro',
162 ],
163 'style-15' => [
164 'name' => 'Rounded filled icon with text',
165 'class' => 'wslu-go-pro',
166 'design' => 'img-15',
167 'package' => 'pro',
168 ],
169 'style-16' => [
170 'name' => 'Semi-rounded icon with fill color',
171 'class' => 'wslu-go-pro',
172 'design' => 'img-16',
173 'package' => 'pro',
174 ],
175 'style-17' => [
176 'name' => 'Semi-rounded icon and border color',
177 'class' => 'wslu-go-pro',
178 'design' => 'img-17',
179 'package' => 'pro',
180 ],
181 'style-18' => [
182 'name' => 'Icon with text and follower count',
183 'class' => 'wslu-go-pro',
184 'design' => 'img-18',
185 'package' => 'pro',
186 ],
187 ];
188
189 return array_merge($share, $array);
190 }
191
192
193 /**
194 *
195 * @return mixed
196 */
197 public static function counter_styles() {
198
199 $counterStyles = [
200
201 'style-1' => [
202 'name' => 'Flat style with fill color',
203 'class' => 'wslu-counter-box-shaped wslu-counter-fill-colored wslu-counter-space',
204 'design' => 'img-1',
205 'package' => 'free',
206 ],
207
208 'style-2' => [
209 'name' => 'Line style with fill color',
210 'class' => 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-space',
211 'design' => 'img-2',
212 'package' => 'free',
213 ],
214
215 'style-3' => [
216 'name' => 'Line slightly rounded style with fill color',
217 'class' => 'wslu-counter-line-shaped wslu-counter-fill-colored wslu-counter-rounded wslu-counter-space',
218 'design' => 'img-3',
219 'package' => 'free',
220 ],
221 ];
222
223
224 return apply_filters('wslu/counter/style_settings', $counterStyles);
225 }
226
227 public function counter_style_settings($counter) {
228 $array = [
229 'style-4' => [
230 'name' => 'Flat style with hover fill color',
231 'class' => 'wslu-counter-go-pro',
232 'design' => 'img-4',
233 'package' => 'pro',
234 ],
235 'style-5' => [
236 'name' => 'Metro style with fill color',
237 'class' => 'wslu-counter-go-pro',
238 'design' => 'img-5',
239 'package' => 'pro',
240 ],
241 'style-6' => [
242 'name' => 'Flat style with hover icon color',
243 'class' => 'wslu-counter-go-pro',
244 'design' => 'img-6',
245 'package' => 'pro',
246 ],
247 'style-7' => [
248 'name' => 'Flat style with icon color',
249 'class' => 'wslu-counter-go-pro',
250 'design' => 'img-7',
251 'package' => 'pro',
252 ],
253 'style-8' => [
254 'name' => ' Flat style with icon fill color ',
255 'class' => 'wslu-counter-go-pro',
256 'design' => 'img-8',
257 'package' => 'pro',
258 ],
259 'style-9' => [
260 'name' => 'Flat style with fill color & rounded icon',
261 'class' => 'wslu-counter-go-pro',
262 'design' => 'img-9',
263 'package' => 'pro',
264 ],
265 'style-10' => [
266 'name' => 'Vertical line style with icon color',
267 'class' => 'wslu-counter-go-pro',
268 'design' => 'img-10',
269 'package' => 'pro',
270 ],
271 'style-11' => [
272 'name' => 'Vertical line style with icon fill color',
273 'class' => 'wslu-counter-go-pro',
274 'design' => 'img-11',
275 'package' => 'pro',
276 ],
277 'style-12' => [
278 'name' => 'Vertical line style with fill color & rounded icon',
279 'class' => 'wslu-counter-go-pro',
280 'design' => 'img-12',
281 'package' => 'pro',
282 ],
283 'style-13' => [
284 'name' => 'Rounded icon style with fill color',
285 'class' => 'wslu-counter-go-pro',
286 'design' => 'img-13',
287 'package' => 'pro',
288 ],
289 'style-14' => [
290 'name' => 'Rounded icon style with hover fill color',
291 'class' => 'wslu-counter-go-pro',
292 'design' => 'img-14',
293 'package' => 'pro',
294 ],
295 'style-15' => [
296 'name' => 'Slightly Rounded icon style with fill color',
297 'class' => 'wslu-counter-go-pro',
298 'design' => 'img-15',
299 'package' => 'pro',
300 ],
301 'style-16' => [
302 'name' => 'Slightly Rounded icon style with hover fill color',
303 'class' => 'wslu-counter-go-pro',
304 'design' => 'img-16',
305 'package' => 'pro',
306 ],
307 'style-17' => [
308 'name' => 'Metro style with hover fill color',
309 'class' => 'wslu-counter-go-pro',
310 'design' => 'img-17',
311 'package' => 'pro',
312 ],
313 'style-18' => [
314 'name' => 'Line style with hover fill color',
315 'class' => 'wslu-counter-go-pro',
316 'design' => 'img-18',
317 'package' => 'pro',
318 ],
319 ];
320
321 return array_merge($counter, $array);
322 }
323
324
325 /**
326 * Method Name : wp_social_admin_menu
327 * Method Details : add menu for social login plugin
328 *
329 * @params : void
330 * @return : void
331 *
332 * @since : 1.0
333 */
334 public function wp_social_admin_menu() {
335 add_menu_page('WP Social Login Ultimate', 'WP Social', 'manage_options', 'wslu_global_setting', [$this, 'content_xs_global_setting'], WSLU_LOGIN_PLUGIN_URL . 'assets/images/icon-menu.png');
336 add_submenu_page('wslu_global_setting', 'Social Login', 'Social Login', 'manage_options', 'wslu_global_setting', [$this, 'content_xs_global_setting']);
337 add_submenu_page('wslu_global_setting', 'Social Share', 'Social Share', 'manage_options', 'wslu_share_setting', [$this, 'content_xs_share_setting']);
338 add_submenu_page('wslu_global_setting', 'Social Counter', 'Social Counter', 'manage_options', 'wslu_counter_setting', [$this, 'content_xs_counter_setting']);
339 add_submenu_page('wslu_global_setting', 'Settings', 'Settings', 'manage_options', 'wslu_settings', [$this, 'content_xs_settings']);
340 //add_submenu_page('wslu_global_setting', 'Test123', 'Data conversion', 'manage_options', 'wslu_data_migration', [$this, 'content_xs_data_migration']);
341 }
342
343 /**
344 * Method Name : content_xs_global_setting
345 * Method Details : content for global setting page
346 *
347 * @params : void
348 * @return : void
349 *
350 * @since : 1.0
351 */
352 public function content_xs_global_setting() {
353
354 if(isset($_GET['wp-social-met-onboard-steps']) && sanitize_text_field($_GET['wp-social-met-onboard-steps']) == 'loaded') {
355 Onboard::instance()->views();
356 } else {
357 $global_optionKey = 'xs_global_setting_data';
358 $message_global = 'hide';
359
360 if(isset($_POST['global_setting_submit_form'])) {
361
362 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'global_setting_submit_form_nonce' ) ) {
363 return;
364 }
365
366 $option_value_global = isset($_POST['xs_global']) ? Self::sanitize($_POST['xs_global']) : [];
367
368 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
369 $message_global = 'show';
370 }
371 }
372
373 // get returned global setting data from db
374 $return_data = get_option($global_optionKey);
375
376 $membership = get_option('users_can_register', 0);
377 $wpUserRole = get_option('default_role', 'subscriber');
378
379
380 // wordpress role options
381 $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting';
382
383 if($active_tab == 'wslu_providers') {
384
385 $this->content_xs_providers();
386
387 } elseif($active_tab == 'wslu_style_setting') {
388
389 $this->content_xs_style_setting();
390
391 } else {
392
393 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/global-setting.php');
394 }
395 }
396 }
397
398
399 /**
400 * Method Name : content_xs_providers
401 * Method Details : content for social provider page
402 *
403 *
404 * @params : void
405 * @return : void
406 *
407 * @since : 1.0
408 */
409 public function content_xs_providers() {
410 $option_key = 'xs_provider_data';
411 $message_provider = 'hide';
412
413 $enabled_providers = \WP_Social\App\Settings::get_enabled_provider_conf_login();
414
415 /**
416 * Legacy version support
417 * After 3/4 version we can hopefully delete the below if block
418 */
419 if(empty($enabled_providers)) {
420
421 $old_settings = \WP_Social\App\Settings::get_login_settings_data();
422
423 if(!empty($old_settings)) {
424
425 $tmp = [];
426
427 foreach($old_settings as $key => $info) {
428
429 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
430 }
431
432 \WP_Social\App\Settings::update_enabled_provider_conf_login($tmp);
433
434 $enabled_providers = $tmp;
435 }
436 }
437
438
439 // save prodivers data in db
440 if(isset($_POST['xs_provider_submit_form'])) {
441
442 $option_value = isset($_POST['xs_social']) ? self::sanitize($_POST['xs_social']) : [];
443
444 if(update_option($option_key, $option_value, 'Yes')) {
445 $message_provider = 'show';
446 }
447 }
448
449 $saved_settings = \WP_Social\App\Settings::get_login_settings_data();
450 $core_provider = \WP_Social\App\Providers::get_core_providers_login();
451
452 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/providers-setting.php');
453 }
454
455
456 /**
457 * Method Name : content_xs_style_setting
458 * Method Details : content for social provider style settings
459 *
460 */
461 public function content_xs_style_setting() {
462
463 $message_provider = 'hide';
464
465 if(isset($_POST['style_setting_submit_form'])) {
466
467 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_nonce' ) ) {
468 return;
469 }
470
471 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
472
473 if(update_option(Login_Settings::OK_STYLES, $option_value, 'yes')) {
474 $message_provider = 'show';
475 }
476 }
477
478 $saved_style = Login_Settings::instance()->get_style_settings();
479
480
481 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/style-setting.php');
482 }
483
484
485 /**
486 * Method Name : content_xs_counter_setting
487 * Method Details : content for social provider style settings
488 *
489 *
490 */
491 public function content_xs_counter_setting() {
492 $global_optionKey = 'xs_counter_global_setting_data';
493 $message_global = 'hide';
494
495 if(isset($_POST['counter_settings_submit_form_global'])) {
496
497 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'counter_settings_submit_form_global_nonce' ) ) {
498 return;
499 }
500
501 $option_value_global = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : [];
502 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
503 $message_global = 'show';
504 }
505 }
506
507 // get returned global setting data from db
508 $return_data = get_option($global_optionKey);
509
510 // wordpress role options
511 $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting';
512
513 if($active_tab == 'wslu_providers') {
514 $this->content_xs_providers_counter();
515 } else {
516 if($active_tab == 'wslu_style_setting') {
517 $this->content_xs_style_setting_counter();
518 } else {
519 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/counter-setting.php');
520 }
521 }
522 }
523
524
525 public function export_users_content_csv() {
526 if(current_user_can('manage_options') && isset($_POST['wslu_export_users_list_nonce']) && wp_verify_nonce($_POST['wslu_export_users_list_nonce'],'wslu_export_users_list_nonce') && isset($_POST['provider'])) {
527 User_Helper::export_users_content_csv(sanitize_text_field($_POST['provider']));
528 }
529 }
530
531 /**
532 * Method Name : content_xs_settings
533 * Method Details :
534 *
535 *
536 * @params : void
537 * @return : void
538 *
539 * @since : 1.0
540 */
541 public function content_xs_settings() {
542
543 $message_global = '';
544
545 if(!empty($_POST['sycn_setting'])) {
546
547 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'sycn_setting_nonce' ) ) {
548 return;
549 }
550
551 if(isset($_POST['sync'])) {
552 update_option('wp_social_login_sync', sanitize_key($_POST['sync']));
553 } else {
554 update_option('wp_social_login_sync', 'no');
555 }
556
557 if(isset($_POST['sync_image'])) {
558 update_option('wp_social_login_sync_image_too', sanitize_key($_POST['sync_image']));
559 } else {
560 update_option('wp_social_login_sync_image_too', 'no');
561 }
562 $message_global = 'show';
563 }
564 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/settings.php');
565 }
566
567 /**
568 * Method Name : content_xs_providers_counter
569 * Method Details : content for social provider counter settings
570 *
571 *
572 * @params : void
573 * @return : void
574 *
575 * @since : 1.0
576 */
577 public function content_xs_providers_counter() {
578
579 $counter = new Counter(false);
580 $counter_social_items = $counter->xs_counter_providers();
581 $counter_provider = \WP_Social\App\Settings::get_counter_provider_settings();
582
583 $option_key = 'xs_counter_providers_data';
584 $message_provider = 'hide';
585
586 $enabled_providers = get_option(Settings::$ok_enabled_providers_counter, []);
587
588 /**
589 * Legacy version support
590 * After 3/4 version we can hopefully delete the below if block
591 */
592 if(empty($enabled_providers)) {
593
594 $old_settings = get_option($option_key, []);
595
596 if(!empty($old_settings['social'])) {
597
598 $tmp = [];
599
600 foreach($old_settings['social'] as $key => $info) {
601
602 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
603 }
604
605 update_option(Settings::$ok_enabled_providers_counter, $tmp);
606
607 $enabled_providers = $tmp;
608 }
609 }
610
611
612 /**
613 * Here saves all the counter providers updated settings
614 *
615 */
616 if(isset($_POST['counter_settings_submit_form'])) {
617
618 $option_value = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : [];
619
620 if(update_option($option_key, $option_value, 'yes')) {
621
622 $message_provider = 'show';
623 }
624 }
625
626
627 $xsc_options = get_option($option_key, []);
628
629 $counter_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items;
630
631 $saved_settings = get_option($option_key, []);
632
633 $core_provider = \WP_Social\App\Providers::get_core_providers_count();
634
635 $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : '';
636
637 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/providers-counter.php');
638 }
639
640
641 /**
642 * Method Name : content_xs_style_setting
643 * Method Details : content for social provider style settings
644 *
645 * @params : void
646 * @return : void
647 *
648 * @since : 1.0
649 */
650 public function content_xs_style_setting_counter() {
651
652 $option_key = 'xs_style_setting_data_counter';
653 $message_provider = 'hide';
654
655 //save providers data in db
656 if(isset($_POST['style_setting_submit_form'])) {
657
658 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_counter_nonce' ) ) {
659 return;
660 }
661
662 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
663 if(update_option($option_key, $option_value, 'Yes')) {
664 $message_provider = 'show';
665 }
666 }
667
668
669 $return_data = Counter_Settings::instance()->get_style_settings();
670
671 // style type settings
672 $styleArr = self::counter_styles();
673
674 // prodiver settings data
675 $return_data_prodivers = Settings::get_login_settings_data();
676
677 if(empty($return_data['login_button_style']['style'])) {
678 $return_data = [];
679 $return_data['login_button_style']['style'] = 'style-1:top-tooltip';
680 }
681
682 $styleAndEffect = explode(':', $return_data['login_button_style']['style']);
683 $selectedStyle = $styleAndEffect[0];
684 $selectedEffect = empty($styleAndEffect[1]) ? 'top-tooltip' : $styleAndEffect[1];
685
686
687 if(did_action('wslu_social_pro/plugin_loaded')) {
688 // Counter Hover effect list
689 $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$counter_hover_effects;
690 }
691
692 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/style-setting.php');
693 }
694
695
696 /**
697 * Method Name : content_xs_share_setting
698 * Method Details : content for social provider style settings for share
699 *
700 * @params : void
701 * @return : void
702 *
703 * @since : 1.0
704 */
705 public function content_xs_share_setting() {
706
707 $global_optionKey = 'xs_share_global_setting_data';
708 $message_global = 'hide';
709
710 if(isset($_POST['share_global_setting_submit_form'])) {
711
712 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'share_global_setting_submit_form_nonce' ) ) {
713 return;
714 }
715
716 $option_value_global = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : [];
717 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
718 $message_global = 'show';
719 }
720 }
721
722 // get returned global setting data from db
723 $return_data = get_option($global_optionKey);
724
725 // wordpress role options
726 $active_tab = isset($_GET["tab"]) ? sanitize_text_field($_GET["tab"]) : 'wslu_global_setting';
727
728 if($active_tab == 'wslu_providers') {
729 $this->content_xs_share_provider();
730
731 } elseif($active_tab == 'wslu_style_setting') {
732 $this->content_xs_style_setting_share();
733
734 } else {
735 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-setting.php');
736 }
737 }
738
739
740 /**
741 * Social share providers
742 *
743 *
744 */
745 public function content_xs_share_provider() {
746 $share = new Share(false);
747 $counter_social_items = $share->social_share_link();
748
749 $option_key = 'xs_share_providers_data';
750 $message_provider = 'hide';
751 $saved_settings = get_option($option_key, []);
752 $enabled_providers = get_option(Settings::$ok_enabled_providers_share, []);
753
754 /**
755 * Legacy version support
756 * After 3/4 version we can hopefully delete the below if block
757 */
758 if(empty($enabled_providers)) {
759
760 $old_settings = get_option($option_key, []);
761
762 if(!empty($old_settings['social'])) {
763
764 $tmp = [];
765
766 foreach($old_settings['social'] as $key => $info) {
767
768 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
769 }
770
771 update_option(Settings::$ok_enabled_providers_share, $tmp);
772
773 $enabled_providers = $tmp;
774 }
775 }
776
777 if(isset($_POST['share_settings_submit_form'])) {
778
779 $option_value = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : [];
780
781 if(update_option($option_key, $option_value, true)) {
782 $message_provider = 'show';
783 $saved_settings = $option_value;
784 }
785 }
786
787 // get returned data from db
788 $xsc_options = get_option($option_key) ? get_option($option_key) : [];
789 $share_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items;
790 $core_provider = \WP_Social\App\Providers::get_core_providers_share();
791
792 $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : '';
793
794 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-providers.php');
795 }
796
797 /**
798 * Method Name : content_xs_style_setting
799 * Method Details : content for social provider style settings
800 *
801 * @params : void
802 * @return : void
803 *
804 * @since : 1.0
805 */
806 public function content_xs_style_setting_share() {
807
808 $option_key = 'xs_style_setting_data_share';
809 $message_provider = 'hide';
810
811 // save providers data in db
812 if(isset($_POST['style_setting_submit_form'])) {
813
814 if( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'style_setting_submit_form_share_nonce' ) ) {
815 return;
816 }
817
818 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
819 if(update_option($option_key, $option_value, 'Yes')) {
820 $message_provider = 'show';
821 }
822 }
823
824 // get returned data from db
825 $return_data = get_option($option_key);
826
827 // style type settings
828 $styleArr = self::share_styles();
829
830 // prodiver settings data
831 $return_data_prodivers = Settings::get_login_settings_data();
832
833 if(did_action('wslu_social_pro/plugin_loaded')) {
834 // share Hover effect list
835 $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects;
836 }
837
838 if(empty($return_data['main_content']['style'])) {
839 $return_data['main_content']['style'] = 'style-1:none-none:horizontal';
840 }
841 if(empty($return_data['fixed_display']['style'])) {
842 $return_data['fixed_display']['style'] = 'style-1:none-none:vertical';
843 }
844
845
846 $styleAndEffect = explode(':', $return_data['main_content']['style']);
847 $mainEffect = empty($styleAndEffect[1]) ? 'none-none' : $styleAndEffect[1];
848
849 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/style-setting.php');
850 }
851
852
853 public static function sanitize($value, $senitize_func = 'sanitize_text_field') {
854 $senitize_func = (in_array($senitize_func, [
855 'sanitize_email',
856 'sanitize_file_name',
857 'sanitize_hex_color',
858 'sanitize_hex_color_no_hash',
859 'sanitize_html_class',
860 'sanitize_key',
861 'sanitize_meta',
862 'sanitize_mime_type',
863 'sanitize_sql_orderby',
864 'sanitize_option',
865 'sanitize_text_field',
866 'sanitize_title',
867 'sanitize_title_for_query',
868 'sanitize_title_with_dashes',
869 'sanitize_user',
870 'esc_url_raw',
871 'wp_filter_nohtml_kses',
872 ])) ? $senitize_func : 'sanitize_text_field';
873
874 if(!is_array($value)) {
875 return $senitize_func($value);
876 } else {
877 return array_map(function ($inner_value) use ($senitize_func) {
878 return self::sanitize($inner_value, $senitize_func);
879 }, $value);
880 }
881 }
882
883
884 public function content_xs_data_migration() {
885
886 $migration = new Migration();
887
888 $ret = $migration->input('wp-social', '1.3.3', '1.3.5');
889
890 require_once(WSLU_LOGIN_PLUGIN . '/xs_migration/markup/data-conversion.php');
891
892 }
893
894 public function sort_providers_login() {
895
896 if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' ) ) {
897 return;
898 }
899
900 $providers = array_map('sanitize_key', $_POST['providers']);
901
902 return update_option(Providers::ORDER_LIST_PROVIDER_LOGIN, $providers);
903 }
904
905 public function sort_providers_share() {
906
907 if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' )) {
908 return;
909 }
910
911 $providers = array_map('sanitize_key', $_POST['providers']);
912
913 return update_option(Providers::ORDER_LIST_PROVIDER_SHARE, $providers);
914 }
915
916 public function sort_providers_counter() {
917
918 if ( ! isset($_POST['wslu_provider_nonce'] ) || ( isset($_POST['wslu_provider_nonce']) && ! wp_verify_nonce( $_POST['wslu_provider_nonce'], 'wp_rest' )) || ! current_user_can( 'manage_options' ) ) {
919 return;
920 }
921
922 $providers = array_map('sanitize_key', $_POST['providers']);
923
924 update_option(Counter::ORDER_LIST_PROVIDER_COUNTER, $providers); // frontend sort
925
926 return update_option(Providers::ORDER_LIST_PROVIDER_COUNTER, $providers); // backend sort
927 }
928
929 }
930
931