| @@ -7,8 +7,9 @@ | ||
| 7 | 7 | use SyncBasalam\Registrar\ListenerRegistrar; |
| 8 | 8 | use SyncBasalam\Registrar\OrderRegistrar; |
| 9 | 9 | use SyncBasalam\Registrar\ProductRegistrar; |
| 10 | 10 | use SyncBasalam\Registrar\QueueRegistrar; |
| 11 | +use SyncBasalam\Services\Api\CircuitBreaker; | |
| 11 | 12 | use SyncBasalam\Services\FetchVersionDetail; |
| 12 | 13 | |
| 13 | 14 | defined('ABSPATH') || exit; |
| 14 | 15 | |
| @@ -13,9 +14,9 @@ | ||
| 13 | 14 | defined('ABSPATH') || exit; |
| 14 | 15 | |
| 15 | 16 | class Plugin |
| 16 | 17 | { |
| 17 | - public const VERSION = '1.8.5'; | |
| 18 | + public const VERSION = '1.10.19'; | |
| 18 | 19 | |
| 19 | 20 | public function __construct() |
| 20 | 21 | { |
| 21 | 22 | $this->onboarding(); |
| @@ -28,9 +29,9 @@ | ||
| 28 | 29 | { |
| 29 | 30 | if (get_transient('sync_basalam_just_activated')) { |
| 30 | 31 | delete_transient('sync_basalam_just_activated'); |
| 31 | 32 | if (!syncBasalamSettings()->hasToken()) { |
| 32 | - wp_redirect(admin_url('admin.php?page=basalam-onboarding')); | |
| 33 | + wp_safe_redirect(admin_url('admin.php?page=basalam-onboarding')); | |
| 33 | 34 | exit(); |
| 34 | 35 | } |
| 35 | 36 | } |
| 36 | 37 | } |
| @@ -51,8 +52,10 @@ | ||
| 51 | 52 | private function notices() |
| 52 | 53 | { |
| 53 | 54 | if (!get_option('sync_basalam_review_never_remind')) { |
| 54 | 55 | add_action('admin_notices', function () { |
| 56 | + if (!AdminRegistrar::isWoosalamRelatedAdminScreen()) return; | |
| 57 | + | |
| 55 | 58 | $template = syncBasalamPlugin()->templatePath("notifications/LikeAlert.php"); |
| 56 | 59 | require_once $template; |
| 57 | 60 | }); |
| 58 | 61 | } |
| @@ -58,15 +61,29 @@ | ||
| 58 | 61 | } |
| 59 | 62 | |
| 60 | 63 | if (!syncBasalamSettings()->hasToken()) { |
| 61 | 64 | add_action('admin_notices', function () { |
| 65 | + if (!AdminRegistrar::isWoosalamRelatedAdminScreen()) return; | |
| 66 | + | |
| 62 | 67 | $template = syncBasalamPlugin()->templatePath("notifications/AccessAlert.php"); |
| 63 | 68 | require_once($template); |
| 64 | 69 | }); |
| 65 | 70 | } |
| 66 | 71 | add_action('admin_notices', function () { |
| 72 | + if (!AdminRegistrar::isWoosalamRelatedAdminScreen()) return; | |
| 73 | + | |
| 67 | 74 | $template = syncBasalamPlugin()->templatePath("notifications/HttpBlock.php"); |
| 68 | 75 | require_once($template); |
| 76 | + }); | |
| 77 | + add_action('admin_notices', function () { | |
| 78 | + if (!AdminRegistrar::isWoosalamRelatedAdminScreen()) return; | |
| 79 | + | |
| 80 | + $circuitBreaker = new CircuitBreaker(); | |
| 81 | + | |
| 82 | + if ($circuitBreaker->getState() === CircuitBreaker::STATE_CLOSED) return; | |
| 83 | + | |
| 84 | + $template = syncBasalamPlugin()->templatePath("notifications/CircuitBreakerAlert.php"); | |
| 85 | + require $template; | |
| 69 | 86 | }); |
| 70 | 87 | } |
| 71 | 88 | |
| 72 | 89 | private function registrars() |