digg-sharer.php
5 years ago
email-sharer.php
5 years ago
facebook-messenger-sharer.php
5 years ago
facebook-sharer.php
5 years ago
kik-sharer.php
5 years ago
lineapp-sharer.php
1 week ago
linkedin-sharer.php
5 years ago
no-provider-share.php
5 years ago
pinterest-sharer.php
5 years ago
reddit-sharer.php
5 years ago
share-interface.php
5 years ago
sharer.php
5 years ago
skype-sharer.php
5 years ago
stumbleupon-sharer.php
5 years ago
telegram-sharer.php
5 years ago
trello-sharer.php
5 years ago
twitter-sharer.php
5 years ago
viber-sharer.php
5 years ago
whatsapp-sharer.php
5 years ago
facebook-sharer.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social\Lib\Provider\Share; |
| 4 | |
| 5 | use WP_Social\App\Settings; |
| 6 | |
| 7 | defined('ABSPATH') || exit; |
| 8 | |
| 9 | class Facebook_Sharer extends Sharer { |
| 10 | |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * @param int $global_cache_time |
| 15 | * @return int |
| 16 | */ |
| 17 | public function get_count($global_cache_time = 43200) { |
| 18 | |
| 19 | /** |
| 20 | * For now we are returning the default set value |
| 21 | * todo - give check for required info for calling api, if not found then return the default value |
| 22 | */ |
| 23 | |
| 24 | |
| 25 | if(!empty($this->global_options['enable'])) { |
| 26 | |
| 27 | $tran_key = $this->get_transient_key(); |
| 28 | $trans_value = get_transient($tran_key); |
| 29 | |
| 30 | if(true || false === $trans_value) { |
| 31 | |
| 32 | $set = Settings::instance()->get_providers_settings_share(); |
| 33 | |
| 34 | $result = empty($set['social'][$this->key]['data']['value']) ? 0 : intval($set['social'][$this->key]['data']['value']); |
| 35 | |
| 36 | $expiration_time = empty($global_cache_time) ? 43200 : intval($global_cache_time); |
| 37 | |
| 38 | set_transient($tran_key, $result, $expiration_time); |
| 39 | |
| 40 | return $result; |
| 41 | } |
| 42 | |
| 43 | return $trans_value; |
| 44 | } |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | } |