| 1 |
<?php |
| 2 |
namespace NjtNotificationBar; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit; |
| 5 |
/** |
| 6 |
* Plugin activate/deactivate logic |
| 7 |
*/ |
| 8 |
class Plugin { |
| 9 |
protected static $instance = null; |
| 10 |
|
| 11 |
public static function getInstance() { |
| 12 |
if (null == self::$instance) { |
| 13 |
self::$instance = new self; |
| 14 |
} |
| 15 |
|
| 16 |
return self::$instance; |
| 17 |
} |
| 18 |
|
| 19 |
private function __construct() { |
| 20 |
} |
| 21 |
|
| 22 |
/** Plugin activated hook */ |
| 23 |
public static function activate() { |
| 24 |
$first_time_active = get_option('njt_nofi_first_time_active'); |
| 25 |
$njt_nofi_review = get_option('njt_nofi_review'); |
| 26 |
|
| 27 |
if ($first_time_active === false) { |
| 28 |
update_option('njt_nofi_first_time_active', 1); |
| 29 |
if ($njt_nofi_review !== false) return; |
| 30 |
update_option('njt_nofi_review', time() + 3*60*60*24); //After 3 days show |
| 31 |
} |
| 32 |
|
| 33 |
$current_version = get_option('njt_nofi_version'); |
| 34 |
if ( version_compare(NJT_NOFI_VERSION, $current_version, '>') ) { |
| 35 |
$filebirdCross = \FileBirdCross::get_instance('filebird', 'filebird+ninjateam', NJT_NOFI_PLUGIN_URL, array('filebird/filebird.php', 'filebird-pro/filebird.php')); |
| 36 |
$filebirdCross->need_update_option(); |
| 37 |
update_option('njt_nofi_version', NJT_NOFI_VERSION); |
| 38 |
if ($njt_nofi_review !== false) return; |
| 39 |
update_option('njt_nofi_review', time() + 3*60*60*24); //After 3 days show |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
/** Plugin deactivate hook */ |
| 44 |
public static function deactivate() { |
| 45 |
} |
| 46 |
} |