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
counter.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social\Lib\Provider\Counter; |
| 4 | |
| 5 | |
| 6 | abstract class Counter implements Counter_Interface { |
| 7 | |
| 8 | protected $cache_time; |
| 9 | |
| 10 | |
| 11 | public static function get_last_cache_time() { |
| 12 | |
| 13 | return get_option(static::get_last_cache_key(), -1); |
| 14 | } |
| 15 | |
| 16 | |
| 17 | public static function get_cache_time_verbose() { |
| 18 | |
| 19 | $time = self::get_last_cache_time(); |
| 20 | |
| 21 | if($time < 0) { |
| 22 | |
| 23 | return __('No cache found', 'wp-social'); |
| 24 | } |
| 25 | |
| 26 | return human_time_diff($time, time()). ' ago'; |
| 27 | } |
| 28 | |
| 29 | public function get_cached_count() { |
| 30 | |
| 31 | return $this->get_count($this->cache_time); |
| 32 | } |
| 33 | |
| 34 | public function set_cache_time($time) { |
| 35 | |
| 36 | $this->cache_time = $time; |
| 37 | } |
| 38 | } |
| 39 |