| 1 |
<?php |
| 2 |
|
| 3 |
namespace ShareMyPost; |
| 4 |
|
| 5 |
if(!defined('ABSPATH')){ |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
class Install{ |
| 10 |
|
| 11 |
static function activate(){ |
| 12 |
self::default_settings(); |
| 13 |
update_option('sharemypost_version', SHAREMYPOST_VERSION); |
| 14 |
} |
| 15 |
|
| 16 |
static function deactivate(){ |
| 17 |
|
| 18 |
} |
| 19 |
|
| 20 |
static function uninstall(){ |
| 21 |
delete_option('sharemypost_version'); |
| 22 |
delete_option('sharemypost_settings'); |
| 23 |
} |
| 24 |
|
| 25 |
static function default_settings(){ |
| 26 |
|
| 27 |
$current_version = get_option('sharemypost_version'); |
| 28 |
|
| 29 |
if(empty($current_version)){ |
| 30 |
$settings = get_option('sharemypost_settings', []); |
| 31 |
$settings = wp_parse_args($settings, \ShareMyPost\Util::get_default_settings()); |
| 32 |
update_option('sharemypost_settings', $settings); |
| 33 |
} |
| 34 |
} |
| 35 |
} |