| 1 |
<?php |
| 2 |
|
| 3 |
namespace WP_Social\App; |
| 4 |
|
| 5 |
|
| 6 |
class Settings { |
| 7 |
|
| 8 |
public static $ok_global_counter_setting = 'xs_counter_global_setting_data'; |
| 9 |
public static $ok_counter_provider_setting = 'xs_counter_providers_data'; |
| 10 |
public static $ok_counter_cached_data = 'xs_counter_options'; |
| 11 |
|
| 12 |
|
| 13 |
/** |
| 14 |
* todo - we will finish it later |
| 15 |
* |
| 16 |
*/ |
| 17 |
public function load() { |
| 18 |
|
| 19 |
$global = get_option(self::$ok_global_counter_setting, []); |
| 20 |
$provider = get_option(self::$ok_counter_provider_setting, []); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* Return caching time in seconds |
| 26 |
* |
| 27 |
* @return int |
| 28 |
*/ |
| 29 |
public static function get_counter_cache_time() { |
| 30 |
|
| 31 |
$opt = get_option(self::$ok_global_counter_setting, []); |
| 32 |
|
| 33 |
return empty($opt['global']['cache']) ? 12 * 3600 : intval($opt['global']['cache']) * 3600; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
public static function get_counter_provider_settings() { |
| 38 |
|
| 39 |
$opt = get_option(self::$ok_counter_provider_setting, []); |
| 40 |
|
| 41 |
return empty($opt['social']) ? [] : $opt['social']; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
public static function get_counter_cached_data() { |
| 46 |
|
| 47 |
$opt = get_option(self::$ok_counter_cached_data, []); |
| 48 |
|
| 49 |
return empty($opt['data']) ? [] : $opt['data']; |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
} |