File_manager
13 hours ago
Recommended
13 hours ago
I18n.php
13 hours ago
Plugin.php
13 hours ago
cross.php
13 hours ago
functions.php
13 hours ago
index.php
13 hours ago
Plugin.php
52 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 | add_action('plugins_loaded', array($this, 'loadPluginCross')); |
| 21 | } |
| 22 | |
| 23 | public function loadPluginCross() { |
| 24 | \FileBirdCross::get_instance('filebird', 'filebird+ninjateam', NJT_FS_BN_PLUGIN_URL, array('filebird/filebird.php', 'filebird-pro/filebird.php')); |
| 25 | } |
| 26 | |
| 27 | /** Plugin activated hook */ |
| 28 | public static function activate() { |
| 29 | $first_time_active = get_option('njt_fs_first_time_active'); |
| 30 | $njt_fs_review = get_option('njt_fs_review'); |
| 31 | |
| 32 | if ($first_time_active === false) { |
| 33 | update_option('njt_fs_first_time_active', 1); |
| 34 | if ($njt_fs_review !== false) return; |
| 35 | update_option('njt_fs_review', time() + 3*60*60*24); //After 3 days show |
| 36 | } |
| 37 | |
| 38 | $current_version = get_option('njt_fs_version'); |
| 39 | if ( version_compare(NJT_FS_BN_VERSION, $current_version, '>') ) { |
| 40 | $filebirdCross = \FileBirdCross::get_instance('filebird', 'filebird+ninjateam', NJT_FS_BN_PLUGIN_URL, array('filebird/filebird.php', 'filebird-pro/filebird.php')); |
| 41 | $filebirdCross->need_update_option(); |
| 42 | update_option('njt_fs_version', NJT_FS_BN_VERSION); |
| 43 | if ($njt_fs_review !== false) return; |
| 44 | update_option('njt_fs_review', time() + 3*60*60*24); //After 3 days show |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** Plugin deactivate hook */ |
| 49 | public static function deactivate() { |
| 50 | } |
| 51 | } |
| 52 |