| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('UD_CENTRAL_DIR')) die('No direct access allowed'); |
| 4 |
|
| 5 |
// Options handling |
| 6 |
if (!defined('ABSPATH')) die('No direct access allowed'); |
| 7 |
|
| 8 |
if (class_exists('UpdraftCentral_Options')) return; |
| 9 |
|
| 10 |
class UpdraftCentral_Options { |
| 11 |
|
| 12 |
public static function get_option($option, $default = false) { |
| 13 |
$tmp = get_site_option('updraftcentral_options'); |
| 14 |
if (isset($tmp[$option])) { |
| 15 |
return $tmp[$option]; |
| 16 |
} else { |
| 17 |
return $default; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
public static function update_option($option, $value, $use_cache = true) { |
| 22 |
$tmp = get_site_option('updraftcentral_options', array(), $use_cache); |
| 23 |
if (!is_array($tmp)) $tmp = array(); |
| 24 |
$tmp[$option] = $value; |
| 25 |
return update_site_option('updraftcentral_options', $tmp); |
| 26 |
} |
| 27 |
|
| 28 |
public static function delete_option($option) { |
| 29 |
$tmp = get_site_option('updraftcentral_options'); |
| 30 |
if (is_array($tmp)) { |
| 31 |
if (isset($tmp[$option])) unset($tmp[$option]); |
| 32 |
} else { |
| 33 |
$tmp = array(); |
| 34 |
} |
| 35 |
update_site_option('updraftcentral_options', $tmp); |
| 36 |
} |
| 37 |
} |
| 38 |
|