comments-counter.php
5 years ago
counter-interface.php
5 years ago
counter.php
5 years ago
dribbble-counter.php
5 years ago
facebook-counter.php
3 years ago
instagram-counter.php
4 years ago
no-provider-counter.php
5 years ago
pinterest-counter.php
5 years ago
posts-counter.php
5 years ago
twitter-counter.php
5 years ago
youtube-counter.php
5 years ago
posts-counter.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social\Lib\Provider\Counter; |
| 4 | |
| 5 | |
| 6 | class Posts_Counter extends Counter { |
| 7 | |
| 8 | private $global_options; |
| 9 | |
| 10 | public static function get_transient_key() { |
| 11 | |
| 12 | return ''; |
| 13 | } |
| 14 | |
| 15 | public static function get_transient_timeout_key() { |
| 16 | |
| 17 | return ''; |
| 18 | } |
| 19 | |
| 20 | public static function get_last_cache_key() { |
| 21 | return ''; |
| 22 | } |
| 23 | |
| 24 | public function need_to_call_legacy_function() { |
| 25 | |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | |
| 30 | public function set_config_data($conf_array) { |
| 31 | |
| 32 | $this->global_options = $conf_array; |
| 33 | |
| 34 | return $this; |
| 35 | } |
| 36 | |
| 37 | |
| 38 | public function get_count($global_cache_time = 43200) { |
| 39 | |
| 40 | /** |
| 41 | * Here if there is no default value then show actual value! |
| 42 | */ |
| 43 | $count_posts = wp_count_posts(); |
| 44 | |
| 45 | return empty($this->global_options['data']['value']) ? $count_posts->publish : $this->global_options['data']['value']; |
| 46 | } |
| 47 | } |