PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.4
Wp Social Login and Register Social Counter v2.2.4
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-rest-api.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 4 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 4 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-rest-api.php
117 lines
1 <?php
2
3 defined('ABSPATH') || exit;
4
5 /**
6 * Function Name : xs_return_call_back_login_function();
7 * Function Details : WP Rest API.
8 *
9 * @params : void
10 *
11 * @return : array()
12 *
13 * @since : 1.0
14 */
15 if(!function_exists('xs_return_call_back_login_function')) {
16
17 function xs_return_call_back_login_function(WP_REST_Request $request) {
18
19 $param = $request['data'];
20 $code = $request['code'];
21 if(is_null($param)) {
22 $typeSocial = '';
23 }
24
25 $typeSocial = $param;
26 $socialType = '';
27 $callBackUrl = '';
28
29 require_once(WSLU_LOGIN_PLUGIN . '/inc/admin-create-user.php');
30 die();
31 }
32 }
33
34 /**
35 * wp rest api add action
36 */
37 add_action('rest_api_init', function() {
38
39 //https://dev.finesttheme.com/social/wp-json/wslu-social-login/type/google
40 register_rest_route('wslu-social-login', '/type/(?P<data>\w+)/',
41 array(
42 'methods' => 'GET',
43 'callback' => 'xs_return_call_back_login_function',
44 'permission_callback' => '__return_true',
45 )
46 );
47
48
49 register_rest_route('wslu/v1', '/check_cache/(?P<type>\w+)/',
50 array(
51 'methods' => 'POST',
52 'callback' => 'post_check_counter_cache',
53 'permission_callback' => '__return_true',
54 )
55 );
56
57 register_rest_route('wslu/v1', '/save_cache/(?P<type>\w+)/',
58 array(
59 'methods' => 'POST',
60 'callback' => 'post_save_instagram_counter_cache',
61 'permission_callback' => '__return_true',
62 )
63 );
64 });
65
66
67 function post_save_instagram_counter_cache(WP_REST_Request $request) {
68
69 $data = $request->get_params();
70
71 $ins = new \WP_Social\Lib\Counter\Instagram_Counter();
72
73 $ins->cache_instagram_return($data['content']['count'], \WP_Social\App\Settings::get_counter_cache_time());
74
75 return array(
76 'success' => true,
77 'msg' => 'successfully fetched and cached',
78 //'result' => $data,
79 );
80 }
81
82
83 function post_check_counter_cache(WP_REST_Request $request) {
84
85 $data = $request->get_params();
86
87 if($data['type'] == 'instagram') {
88
89 $ins = new \WP_Social\Lib\Counter\Instagram_Counter();
90
91 $ins->load();
92
93 if($ins->cache_expired) {
94
95 return array(
96 'msg' => 'Successfull',
97 'expired' => true,
98 'unm' => $ins->user_id,
99 'success' => true,
100 );
101 }
102
103
104 return array(
105 'msg' => 'Successfull',
106 'expired' => false,
107 'success' => true,
108 );
109 }
110
111 return array(
112 'msg' => 'error',
113 'success' => false,
114 );
115 }
116
117