<?php declare(strict_types = 1); namespace MailPoet\WooCommerce; if (!defined('ABSPATH')) exit; use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; use MailPoet\Config\Menu; use MailPoet\DI\ContainerWrapper; use MailPoet\Settings\SettingsController; /** * MailPoet task that is added to the WooCommerce homepage. */ class MailPoetTask extends Task { public function get_id(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps return 'mailpoet_task'; } public function get_title(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps if ($this->is_complete()) { return esc_html__('MailPoet is ready to send marketing emails from your store', 'mailpoet'); } return esc_html__('Set up email marketing with MailPoet', 'mailpoet'); } public function get_content(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps return ''; } /** * String that is displayed below the title of the task indicating the estimated completion time. */ public function get_time(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps return ''; } /** * Link used when the user clicks on the title of the task. */ public function get_action_url(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps if ($this->is_complete()) { return admin_url('admin.php?page=' . Menu::MAIN_PAGE_SLUG); } return admin_url('admin.php?page=' . Menu::WELCOME_WIZARD_PAGE_SLUG . '&mailpoet_wizard_loaded_via_woocommerce'); } /** * Whether the task is completed. * If the setting 'version' is not null it means the welcome wizard * was already completed so we mark this task as completed as well. */ public function is_complete(): bool { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps $settings = ContainerWrapper::getInstance()->get(SettingsController::class); $version = $settings->get('version'); return $version !== null; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Integrations | Folder | 0755 |
|
|
MultichannelMarketing | Folder | 0755 |
|
|
TransactionalEmails | Folder | 0755 |
|
|
WooCommerceSubscriptions | Folder | 0755 |
|
|
CouponPreProcessor.php | File | 5.56 KB | 0644 |
|
Helper.php | File | 10.38 KB | 0644 |
|
MailPoetTask.php | File | 1.99 KB | 0644 |
|
Settings.php | File | 1.41 KB | 0644 |
|
SubscriberEngagement.php | File | 1.43 KB | 0644 |
|
Subscription.php | File | 8.23 KB | 0644 |
|
Tracker.php | File | 2.52 KB | 0644 |
|
TransactionalEmailHooks.php | File | 4.84 KB | 0644 |
|
TransactionalEmails.php | File | 5.22 KB | 0644 |
|
WooSystemInfo.php | File | 1.29 KB | 0644 |
|
WooSystemInfoController.php | File | 2.09 KB | 0644 |
|
index.php | File | 6 B | 0644 |
|