PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 1.8.2
Wp Social Login and Register Social Counter v1.8.2
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 4 years ago admin-create-shortcode.php 7 years ago admin-create-user.php 4 years ago admin-custom-function.php 4 years ago admin-rest-api.php 4 years ago admin-settings.php 4 years ago admin-social-button.php 4 years ago admin-social-enque-script.php 5 years ago counter-widget.php 4 years ago counter.php 4 years ago custom-function.php 4 years ago login-widget.php 4 years ago login.php 5 years ago share-widget.php 4 years ago share.php 4 years ago
admin-settings.php
885 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']) && $_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 $option_value_global = isset($_POST['xs_global']) ? Self::sanitize($_POST['xs_global']) : [];
362
363 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
364 $message_global = 'show';
365 }
366 }
367
368 // get returned global setting data from db
369 $return_data = get_option($global_optionKey);
370
371 $membership = get_option('users_can_register', 0);
372 $wpUserRole = get_option('default_role', 'subscriber');
373
374
375 // wordpress role options
376 $active_tab = isset($_GET["tab"]) ? $_GET["tab"] : 'wslu_global_setting';
377
378 if($active_tab == 'wslu_providers') {
379
380 $this->content_xs_providers();
381
382 } elseif($active_tab == 'wslu_style_setting') {
383
384 $this->content_xs_style_setting();
385
386 } else {
387
388 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/global-setting.php');
389 }
390 }
391 }
392
393
394 /**
395 * Method Name : content_xs_providers
396 * Method Details : content for social provider page
397 *
398 *
399 * @params : void
400 * @return : void
401 *
402 * @since : 1.0
403 */
404 public function content_xs_providers() {
405 $option_key = 'xs_provider_data';
406 $message_provider = 'hide';
407
408 $enabled_providers = \WP_Social\App\Settings::get_enabled_provider_conf_login();
409
410 /**
411 * Legacy version support
412 * After 3/4 version we can hopefully delete the below if block
413 */
414 if(empty($enabled_providers)) {
415
416 $old_settings = \WP_Social\App\Settings::get_login_settings_data();
417
418 if(!empty($old_settings)) {
419
420 $tmp = [];
421
422 foreach($old_settings as $key => $info) {
423
424 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
425 }
426
427 \WP_Social\App\Settings::update_enabled_provider_conf_login($tmp);
428
429 $enabled_providers = $tmp;
430 }
431 }
432
433
434 // save prodivers data in db
435 if(isset($_POST['xs_provider_submit_form'])) {
436
437 $option_value = isset($_POST['xs_social']) ? self::sanitize($_POST['xs_social']) : [];
438
439 if(update_option($option_key, $option_value, 'Yes')) {
440 $message_provider = 'show';
441 }
442 }
443
444 $saved_settings = \WP_Social\App\Settings::get_login_settings_data();
445 $core_provider = \WP_Social\App\Providers::get_core_providers_login();
446
447 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/providers-setting.php');
448 }
449
450
451 /**
452 * Method Name : content_xs_style_setting
453 * Method Details : content for social provider style settings
454 *
455 */
456 public function content_xs_style_setting() {
457
458 $message_provider = 'hide';
459
460 if(isset($_POST['style_setting_submit_form'])) {
461
462 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
463
464 if(update_option(Login_Settings::OK_STYLES, $option_value, 'yes')) {
465 $message_provider = 'show';
466 }
467 }
468
469 $saved_style = Login_Settings::instance()->get_style_settings();
470
471
472 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/style-setting.php');
473 }
474
475
476 /**
477 * Method Name : content_xs_counter_setting
478 * Method Details : content for social provider style settings
479 *
480 *
481 */
482 public function content_xs_counter_setting() {
483 $global_optionKey = 'xs_counter_global_setting_data';
484 $message_global = 'hide';
485
486 if(isset($_POST['counter_settings_submit_form_global'])) {
487 $option_value_global = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : [];
488 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
489 $message_global = 'show';
490 }
491 }
492
493 // get returned global setting data from db
494 $return_data = get_option($global_optionKey);
495
496 // wordpress role options
497 $active_tab = isset($_GET["tab"]) ? $_GET["tab"] : 'wslu_global_setting';
498
499 if($active_tab == 'wslu_providers') {
500 $this->content_xs_providers_counter();
501 } else {
502 if($active_tab == 'wslu_style_setting') {
503 $this->content_xs_style_setting_counter();
504 } else {
505 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/counter-setting.php');
506 }
507 }
508 }
509
510
511 public function export_users_content_csv() {
512 if(isset($_POST['provider'])) {
513 User_Helper::export_users_content_csv(sanitize_key($_POST['provider']));
514 }
515 }
516
517 /**
518 * Method Name : content_xs_settings
519 * Method Details :
520 *
521 *
522 * @params : void
523 * @return : void
524 *
525 * @since : 1.0
526 */
527 public function content_xs_settings() {
528
529 $message_global = '';
530
531 if(!empty($_POST['sycn_setting'])) {
532 if(isset($_POST['sync'])) {
533 update_option('wp_social_login_sync', sanitize_key($_POST['sync']));
534 } else {
535 update_option('wp_social_login_sync', 'no');
536 }
537
538 if(isset($_POST['sync_image'])) {
539 update_option('wp_social_login_sync_image_too', sanitize_key($_POST['sync_image']));
540 } else {
541 update_option('wp_social_login_sync_image_too', 'no');
542 }
543 $message_global = 'show';
544 }
545 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/settings.php');
546 }
547
548 /**
549 * Method Name : content_xs_providers_counter
550 * Method Details : content for social provider counter settings
551 *
552 *
553 * @params : void
554 * @return : void
555 *
556 * @since : 1.0
557 */
558 public function content_xs_providers_counter() {
559
560 $counter = new Counter(false);
561 $counter_social_items = $counter->xs_counter_providers();
562 $counter_provider = \WP_Social\App\Settings::get_counter_provider_settings();
563
564 $option_key = 'xs_counter_providers_data';
565 $message_provider = 'hide';
566
567 $enabled_providers = get_option(Settings::$ok_enabled_providers_counter, []);
568
569 /**
570 * Legacy version support
571 * After 3/4 version we can hopefully delete the below if block
572 */
573 if(empty($enabled_providers)) {
574
575 $old_settings = get_option($option_key, []);
576
577 if(!empty($old_settings['social'])) {
578
579 $tmp = [];
580
581 foreach($old_settings['social'] as $key => $info) {
582
583 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
584 }
585
586 update_option(Settings::$ok_enabled_providers_counter, $tmp);
587
588 $enabled_providers = $tmp;
589 }
590 }
591
592
593 /**
594 * Here saves all the counter providers updated settings
595 *
596 */
597 if(isset($_POST['counter_settings_submit_form'])) {
598
599 $option_value = isset($_POST['xs_counter']) ? self::sanitize($_POST['xs_counter']) : [];
600
601 if(update_option($option_key, $option_value, 'yes')) {
602
603 $message_provider = 'show';
604 }
605 }
606
607
608 $xsc_options = get_option($option_key, []);
609
610 $counter_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items;
611
612 $saved_settings = get_option($option_key, []);
613
614 $core_provider = \WP_Social\App\Providers::get_core_providers_count();
615
616 $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : '';
617
618 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/providers-counter.php');
619 }
620
621
622 /**
623 * Method Name : content_xs_style_setting
624 * Method Details : content for social provider style settings
625 *
626 * @params : void
627 * @return : void
628 *
629 * @since : 1.0
630 */
631 public function content_xs_style_setting_counter() {
632
633 $option_key = 'xs_style_setting_data_counter';
634 $message_provider = 'hide';
635
636 //save providers data in db
637 if(isset($_POST['style_setting_submit_form'])) {
638
639 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
640 if(update_option($option_key, $option_value, 'Yes')) {
641 $message_provider = 'show';
642 }
643 }
644
645
646 $return_data = Counter_Settings::instance()->get_style_settings();
647
648 // style type settings
649 $styleArr = self::counter_styles();
650
651 // prodiver settings data
652 $return_data_prodivers = Settings::get_login_settings_data();
653
654 if(empty($return_data['login_button_style']['style'])) {
655 $return_data = [];
656 $return_data['login_button_style']['style'] = 'style-1:top-tooltip';
657 }
658
659 $styleAndEffect = explode(':', $return_data['login_button_style']['style']);
660 $selectedStyle = $styleAndEffect[0];
661 $selectedEffect = empty($styleAndEffect[1]) ? 'top-tooltip' : $styleAndEffect[1];
662
663
664 if(did_action('wslu_social_pro/plugin_loaded')) {
665 // Counter Hover effect list
666 $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$counter_hover_effects;
667 }
668
669 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/counter/style-setting.php');
670 }
671
672
673 /**
674 * Method Name : content_xs_share_setting
675 * Method Details : content for social provider style settings for share
676 *
677 * @params : void
678 * @return : void
679 *
680 * @since : 1.0
681 */
682 public function content_xs_share_setting() {
683
684 $global_optionKey = 'xs_share_global_setting_data';
685 $message_global = 'hide';
686
687 if(isset($_POST['share_global_setting_submit_form'])) {
688 $option_value_global = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : [];
689 if(update_option($global_optionKey, $option_value_global, 'Yes')) {
690 $message_global = 'show';
691 }
692 }
693
694 // get returned global setting data from db
695 $return_data = get_option($global_optionKey);
696
697 // wordpress role options
698 $active_tab = isset($_GET["tab"]) ? $_GET["tab"] : 'wslu_global_setting';
699
700 if($active_tab == 'wslu_providers') {
701 $this->content_xs_share_provider();
702
703 } elseif($active_tab == 'wslu_style_setting') {
704 $this->content_xs_style_setting_share();
705
706 } else {
707 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-setting.php');
708 }
709 }
710
711
712 /**
713 * Social share providers
714 *
715 *
716 */
717 public function content_xs_share_provider() {
718 $share = new Share(false);
719 $counter_social_items = $share->social_share_link();
720
721 $option_key = 'xs_share_providers_data';
722 $message_provider = 'hide';
723 $saved_settings = get_option($option_key, []);
724 $enabled_providers = get_option(Settings::$ok_enabled_providers_share, []);
725
726 /**
727 * Legacy version support
728 * After 3/4 version we can hopefully delete the below if block
729 */
730 if(empty($enabled_providers)) {
731
732 $old_settings = get_option($option_key, []);
733
734 if(!empty($old_settings['social'])) {
735
736 $tmp = [];
737
738 foreach($old_settings['social'] as $key => $info) {
739
740 $tmp[$key]['enable'] = empty($info['enable']) ? '' : 1;
741 }
742
743 update_option(Settings::$ok_enabled_providers_share, $tmp);
744
745 $enabled_providers = $tmp;
746 }
747 }
748
749 if(isset($_POST['share_settings_submit_form'])) {
750
751 $option_value = isset($_POST['xs_share']) ? self::sanitize($_POST['xs_share']) : [];
752
753 if(update_option($option_key, $option_value, true)) {
754 $message_provider = 'show';
755 $saved_settings = $option_value;
756 }
757 }
758
759 // get returned data from db
760 $xsc_options = get_option($option_key) ? get_option($option_key) : [];
761 $share_provider = isset($xsc_options['social']) ? $xsc_options['social'] : $counter_social_items;
762 $core_provider = \WP_Social\App\Providers::get_core_providers_share();
763
764 $getType = isset($_GET['xs_access']) ? self::sanitize($_GET['xs_access']) : '';
765
766 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/share-providers.php');
767 }
768
769 /**
770 * Method Name : content_xs_style_setting
771 * Method Details : content for social provider style settings
772 *
773 * @params : void
774 * @return : void
775 *
776 * @since : 1.0
777 */
778 public function content_xs_style_setting_share() {
779
780 $option_key = 'xs_style_setting_data_share';
781 $message_provider = 'hide';
782
783 // save providers data in db
784 if(isset($_POST['style_setting_submit_form'])) {
785 $option_value = isset($_POST['xs_style']) ? self::sanitize($_POST['xs_style']) : [];
786 if(update_option($option_key, $option_value, 'Yes')) {
787 $message_provider = 'show';
788 }
789 }
790
791 // get returned data from db
792 $return_data = get_option($option_key);
793
794 // style type settings
795 $styleArr = self::share_styles();
796
797 // prodiver settings data
798 $return_data_prodivers = Settings::get_login_settings_data();
799
800 if(did_action('wslu_social_pro/plugin_loaded')) {
801 // share Hover effect list
802 $share_hover_effects = \WP_Social_Pro\Inc\Admin_Settings::$share_hover_effects;
803 }
804
805 if(empty($return_data['main_content']['style'])) {
806 $return_data['main_content']['style'] = 'style-1:none-none:horizontal';
807 }
808 if(empty($return_data['fixed_display']['style'])) {
809 $return_data['fixed_display']['style'] = 'style-1:none-none:vertical';
810 }
811
812
813 $styleAndEffect = explode(':', $return_data['main_content']['style']);
814 $mainEffect = empty($styleAndEffect[1]) ? 'none-none' : $styleAndEffect[1];
815
816 require_once(WSLU_LOGIN_PLUGIN . '/template/admin/share/style-setting.php');
817 }
818
819
820 public static function sanitize($value, $senitize_func = 'sanitize_text_field') {
821 $senitize_func = (in_array($senitize_func, [
822 'sanitize_email',
823 'sanitize_file_name',
824 'sanitize_hex_color',
825 'sanitize_hex_color_no_hash',
826 'sanitize_html_class',
827 'sanitize_key',
828 'sanitize_meta',
829 'sanitize_mime_type',
830 'sanitize_sql_orderby',
831 'sanitize_option',
832 'sanitize_text_field',
833 'sanitize_title',
834 'sanitize_title_for_query',
835 'sanitize_title_with_dashes',
836 'sanitize_user',
837 'esc_url_raw',
838 'wp_filter_nohtml_kses',
839 ])) ? $senitize_func : 'sanitize_text_field';
840
841 if(!is_array($value)) {
842 return $senitize_func($value);
843 } else {
844 return array_map(function ($inner_value) use ($senitize_func) {
845 return self::sanitize($inner_value, $senitize_func);
846 }, $value);
847 }
848 }
849
850
851 public function content_xs_data_migration() {
852
853 $migration = new Migration();
854
855 $ret = $migration->input('wp-social', '1.3.3', '1.3.5');
856
857 require_once(WSLU_LOGIN_PLUGIN . '/xs_migration/markup/data-conversion.php');
858
859 }
860
861 public function sort_providers_login() {
862
863 $providers = array_map('sanitize_key', $_POST['providers']);
864
865 return update_option(Providers::ORDER_LIST_PROVIDER_LOGIN, $providers);
866 }
867
868 public function sort_providers_share() {
869
870 $providers = array_map('sanitize_key', $_POST['providers']);
871
872 return update_option(Providers::ORDER_LIST_PROVIDER_SHARE, $providers);
873 }
874
875 public function sort_providers_counter() {
876 $providers = array_map('sanitize_key', $_POST['providers']);
877
878 update_option(Counter::ORDER_LIST_PROVIDER_COUNTER, $providers); // frontend sort
879
880 return update_option(Providers::ORDER_LIST_PROVIDER_COUNTER, $providers); // backend sort
881 }
882
883 }
884
885