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
Settings.php
51 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\WooCommerce; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Config\Renderer; |
| 9 | use MailPoet\Settings\SettingsController; |
| 10 | |
| 11 | class Settings { |
| 12 | |
| 13 | /** @var Renderer */ |
| 14 | private $renderer; |
| 15 | |
| 16 | /** @var SettingsController */ |
| 17 | private $settings; |
| 18 | |
| 19 | public function __construct( |
| 20 | Renderer $renderer, |
| 21 | SettingsController $settings |
| 22 | ) { |
| 23 | $this->renderer = $renderer; |
| 24 | $this->settings = $settings; |
| 25 | } |
| 26 | |
| 27 | public function disableWooCommerceSettings() { |
| 28 | if ( |
| 29 | !isset($_GET['tab']) |
| 30 | || $_GET['tab'] !== 'email' |
| 31 | || isset($_GET['section']) |
| 32 | ) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | //The templates are in our control and the inputs are sanitized. |
| 37 | //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 38 | echo $this->renderer->render('woocommerce/settings_button.html', [ |
| 39 | 'woocommerce_template_id' => (int)$this->settings->get(TransactionalEmails::SETTING_EMAIL_ID), |
| 40 | ]); |
| 41 | if (!(bool)$this->settings->get('woocommerce.use_mailpoet_editor')) { |
| 42 | return; |
| 43 | } |
| 44 | // The templates are in our control and the inputs are sanitized. |
| 45 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 46 | echo $this->renderer->render('woocommerce/settings_overlay.html', [ |
| 47 | 'woocommerce_template_id' => (int)$this->settings->get(TransactionalEmails::SETTING_EMAIL_ID), |
| 48 | ]); |
| 49 | } |
| 50 | } |
| 51 |