Emails
2 months ago
Integrations
2 months ago
MultichannelMarketing
2 years ago
TransactionalEmails
10 months ago
WooCommerceBookings
1 month ago
WooCommerceSubscriptions
2 months ago
CouponPreProcessor.php
2 months ago
Emails.php
8 months ago
Helper.php
1 month ago
MailPoetTask.php
2 years ago
NonPersistablePreviewData.php
1 month ago
OrderAttributionFields.php
1 month ago
OrderAttributionRevenueReader.php
2 weeks ago
OrderAttributionWriter.php
1 month ago
RandomCouponCodeGenerator.php
2 months ago
Settings.php
1 year ago
SubscriberEngagement.php
3 years ago
Subscription.php
2 months ago
Tracker.php
2 years ago
TransactionalEmailHooks.php
1 year ago
TransactionalEmails.php
1 year ago
WooSystemInfo.php
1 month ago
WooSystemInfoController.php
1 year ago
index.php
3 years ago
WooSystemInfo.php
60 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\WooCommerce; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Cron\CronHelper; |
| 9 | use MailPoet\Router\Endpoints\CronDaemon; |
| 10 | use MailPoet\Settings\SettingsController; |
| 11 | |
| 12 | class WooSystemInfo { |
| 13 | |
| 14 | |
| 15 | private $cronHelper; |
| 16 | |
| 17 | /** @var SettingsController */ |
| 18 | private $settings; |
| 19 | |
| 20 | public function __construct( |
| 21 | CronHelper $cronHelper, |
| 22 | SettingsController $settings |
| 23 | ) { |
| 24 | $this->cronHelper = $cronHelper; |
| 25 | $this->settings = $settings; |
| 26 | } |
| 27 | |
| 28 | public function sendingMethod(): string { |
| 29 | return $this->settings->get('mta.method'); |
| 30 | } |
| 31 | |
| 32 | public function transactionalEmails(): string { |
| 33 | return $this->settings->get('send_transactional_emails') ? |
| 34 | __('Current sending method', 'mailpoet') : |
| 35 | __('Default WordPress sending method', 'mailpoet'); |
| 36 | |
| 37 | } |
| 38 | |
| 39 | public function taskSchedulerMethod(): string { |
| 40 | return $this->settings->get('cron_trigger.method'); |
| 41 | } |
| 42 | |
| 43 | public function cronPingUrl(): string { |
| 44 | try { |
| 45 | return $this->cronHelper->getCronUrl(CronDaemon::ACTION_PING); |
| 46 | } catch (\Throwable $e) { |
| 47 | return __('Can‘t generate cron URL.', 'mailpoet') . ' (' . $e->getMessage() . ')'; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | public function toArray(): array { |
| 52 | return [ |
| 53 | 'sending_method' => $this->sendingMethod(), |
| 54 | 'transactional_emails' => $this->transactionalEmails(), |
| 55 | 'task_scheduler_method' => $this->taskSchedulerMethod(), |
| 56 | 'cron_ping_url' => $this->cronPingUrl(), |
| 57 | ]; |
| 58 | } |
| 59 | } |
| 60 |