PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / trunk
Wp Social Login and Register Social Counter vtrunk
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 / app / route.php
wp-social / app Last commit date
api-routes.php 9 months ago avatar.php 5 years ago counter-settings.php 5 years ago legacy.php 5 years ago login-settings.php 4 months ago providers.php 2 weeks ago route.php 2 weeks ago settings.php 5 years ago share-settings.php 2 weeks ago share.php 3 years ago
route.php
51 lines
1 <?php
2
3 namespace WP_Social\App;
4
5 use WP_Social\Base\Api;
6
7 class Route extends Api {
8
9 public function config() {
10
11 $this->prefix = 'settings';
12 $this->param = "";
13 }
14
15
16 public function post_clear_counter_cache() {
17
18 // Verify nonce
19 if (!wp_verify_nonce($this->request->get_header('X-WP-Nonce'), 'wp_rest')
20 || !current_user_can('manage_options')) {
21 return new \WP_Error('rest_forbidden', esc_html__('Access Denied', 'wp-social'), array('status' => 403));
22 }
23
24 $data = $this->request->get_params();
25
26 if(!empty($data['provider'])) {
27
28 $provider = sanitize_key($data['provider']);
29 $username = isset($data['username']) ? sanitize_key($data['username']) : '';
30
31 if(delete_transient('_xs_social_' . $provider . '_count_' . $username)) {
32
33 return [
34 'success' => true,
35 'msg' => esc_html__('Cache cleared successfully!', 'wp-social')
36 ];
37 }
38
39 return [
40 'success' => true,
41 'msg' => esc_html__('No cache found.', 'wp-social')
42 ];
43 }
44
45 return [
46 'success' => true,
47 'msg' => esc_html__('Invalid data.', 'wp-social')
48 ];
49 }
50 }
51