| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) exit; |
| 4 |
if (!class_exists('WPRWPSettings')) : |
| 5 |
class WPRWPSettings { |
| 6 |
public function getOption($key) { |
| 7 |
$res = false; |
| 8 |
if (function_exists('get_site_option')) { |
| 9 |
$res = get_site_option($key, false); |
| 10 |
} |
| 11 |
if ($res === false) { |
| 12 |
$res = get_option($key, false); |
| 13 |
} |
| 14 |
return $res; |
| 15 |
} |
| 16 |
|
| 17 |
public function deleteOption($key) { |
| 18 |
if (function_exists('delete_site_option')) { |
| 19 |
return delete_site_option($key); |
| 20 |
} else { |
| 21 |
return delete_option($key); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
public function updateOption($key, $value) { |
| 26 |
if (function_exists('update_site_option')) { |
| 27 |
return update_site_option($key, $value); |
| 28 |
} else { |
| 29 |
return update_option($key, $value); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
public function setTransient($name, $value, $time) { |
| 34 |
if (function_exists('set_site_transient')) { |
| 35 |
return set_site_transient($name, $value, $time); |
| 36 |
} |
| 37 |
return false; |
| 38 |
} |
| 39 |
|
| 40 |
public function deleteTransient($name) { |
| 41 |
if (function_exists('delete_site_transient')) { |
| 42 |
return delete_site_transient($name); |
| 43 |
} |
| 44 |
return false; |
| 45 |
} |
| 46 |
|
| 47 |
public function getTransient($name) { |
| 48 |
if (function_exists('get_site_transient')) { |
| 49 |
return get_site_transient($name); |
| 50 |
} |
| 51 |
return false; |
| 52 |
} |
| 53 |
} |
| 54 |
endif; |