File_manager
2 years ago
Recommended
2 years ago
I18n.php
2 years ago
Plugin.php
2 years ago
cross.php
2 years ago
index.php
2 years ago
Plugin.php
47 lines
| 1 | <?php |
| 2 | namespace NinjaFileManager; |
| 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_fs_first_time_active'); |
| 25 | $njt_fs_review = get_option('njt_fs_review'); |
| 26 | |
| 27 | if ($first_time_active === false) { |
| 28 | update_option('njt_fs_first_time_active', 1); |
| 29 | if ($njt_fs_review !== false) return; |
| 30 | update_option('njt_fs_review', time() + 3*60*60*24); //After 3 days show |
| 31 | } |
| 32 | |
| 33 | $current_version = get_option('njt_fs_version'); |
| 34 | if ( version_compare(NJT_FS_BN_VERSION, $current_version, '>') ) { |
| 35 | $filebirdCross = \FileBirdCross::get_instance('filebird', 'filebird+ninjateam', NJT_FS_BN_PLUGIN_URL, array('filebird/filebird.php', 'filebird-pro/filebird.php')); |
| 36 | $filebirdCross->need_update_option(); |
| 37 | update_option('njt_fs_version', NJT_FS_BN_VERSION); |
| 38 | if ($njt_fs_review !== false) return; |
| 39 | update_option('njt_fs_review', time() + 3*60*60*24); //After 3 days show |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** Plugin deactivate hook */ |
| 44 | public static function deactivate() { |
| 45 | } |
| 46 | } |
| 47 |