Recommended
2 years ago
Support
2 years ago
Cross.php
2 years ago
Fallback.php
2 years ago
Fields.php
2 years ago
Helper.php
2 years ago
I18n.php
2 years ago
Plugin.php
2 years ago
Popup.php
2 years ago
PostType.php
2 years ago
Review.php
2 years ago
Settings.php
2 years ago
Shortcode.php
2 years ago
Upgrade.php
2 years ago
Plugin.php
46 lines
| 1 | <?php |
| 2 | namespace NTA_WhatsApp; |
| 3 | |
| 4 | use FileBirdCross; |
| 5 | |
| 6 | defined('ABSPATH') || exit; |
| 7 | class Plugin { |
| 8 | protected static $instance = null; |
| 9 | |
| 10 | public static function getInstance() { |
| 11 | if (null == self::$instance) { |
| 12 | self::$instance = new self; |
| 13 | } |
| 14 | |
| 15 | return self::$instance; |
| 16 | } |
| 17 | |
| 18 | private function __construct() { |
| 19 | } |
| 20 | |
| 21 | public static function activate() { |
| 22 | $firstTimeActive = get_option('njt_wa_first_time_active'); |
| 23 | if ( $firstTimeActive === false ) { |
| 24 | $waReview = \NJTWhatsAppReview::get_instance('njt_wa', 'WhatsApp Plugin', 'ninjateam-whatsapp'); |
| 25 | $waReview->need_update_option(1); // 1 day |
| 26 | update_option('njt_wa_first_time_active', 1); |
| 27 | } |
| 28 | |
| 29 | $currentVersion = get_option('njt_wa_version'); |
| 30 | if ( version_compare(NTA_WHATSAPP_VERSION, $currentVersion, '>' ) ) { |
| 31 | $filebirdCross = \FileBirdCross::get_instance('filebird', 'filebird+ninjateam', NTA_WHATSAPP_PLUGIN_URL, array('filebird/filebird.php', 'filebird-pro/filebird.php')); |
| 32 | $filebirdCross->need_update_option(); |
| 33 | |
| 34 | if ($firstTimeActive !== false) { |
| 35 | $waReview = \NJTWhatsAppReview::get_instance('njt_wa', 'WhatsApp Plugin', 'ninjateam-whatsapp'); |
| 36 | $waReview->need_update_option(7); // 1 day |
| 37 | } |
| 38 | |
| 39 | update_option('njt_wa_version', NTA_WHATSAPP_VERSION); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | public static function deactivate() { |
| 44 | } |
| 45 | } |
| 46 |