api-routes.php
5 years ago
avatar.php
4 years ago
counter-settings.php
5 years ago
legacy.php
5 years ago
login-settings.php
3 years ago
providers.php
3 years ago
route.php
4 years ago
settings.php
5 years ago
share-settings.php
4 years ago
share.php
3 years ago
route.php
45 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 | $data = $this->request->get_params(); |
| 19 | |
| 20 | if(!empty($data['provider'])) { |
| 21 | |
| 22 | $provider = sanitize_key($data['provider']); |
| 23 | $username = isset($data['username']) ? sanitize_key($data['username']) : ''; |
| 24 | |
| 25 | if(delete_transient('_xs_social_' . $provider . '_count_' . $username)) { |
| 26 | |
| 27 | return [ |
| 28 | 'success' => true, |
| 29 | 'msg' => esc_html__('Cache cleared successfully!', 'wp-social') |
| 30 | ]; |
| 31 | } |
| 32 | |
| 33 | return [ |
| 34 | 'success' => true, |
| 35 | 'msg' => esc_html__('No cache found.', 'wp-social') |
| 36 | ]; |
| 37 | } |
| 38 | |
| 39 | return [ |
| 40 | 'success' => true, |
| 41 | 'msg' => esc_html__('Invalid data.', 'wp-social') |
| 42 | ]; |
| 43 | } |
| 44 | } |
| 45 |