AdditionalPayments.php
1 year ago
Appearance.php
2 years ago
CustomizeStore.php
5 months ago
ExperimentalShippingRecommendation.php
5 months ago
ExtendStore.php
1 year ago
GetMobileApp.php
3 years ago
LaunchYourStore.php
2 years ago
Marketing.php
7 months ago
Payments.php
10 months ago
Products.php
1 month ago
ReviewShippingOptions.php
3 years ago
Shipping.php
3 months ago
StoreCreation.php
4 years ago
StoreDetails.php
3 years ago
Tax.php
1 year ago
TourInAppMarketplace.php
2 years ago
WooCommercePayments.php
5 months ago
Marketing.php
126 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks; |
| 4 | |
| 5 | use Automattic\WooCommerce\Admin\Features\Features; |
| 6 | use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; |
| 7 | |
| 8 | /** |
| 9 | * Marketing Task |
| 10 | */ |
| 11 | class Marketing extends Task { |
| 12 | /** |
| 13 | * Constructor |
| 14 | * |
| 15 | * @param TaskList $task_list Parent task list. |
| 16 | */ |
| 17 | public function __construct( $task_list ) { |
| 18 | parent::__construct( $task_list ); |
| 19 | |
| 20 | add_action( 'activated_plugin', array( $this, 'on_activated_plugin' ), 10, 1 ); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Mark the task as complete when related plugins are activated. |
| 25 | */ |
| 26 | public function on_activated_plugin( $plugin ) { |
| 27 | $plugin_basename = basename( plugin_basename( $plugin ), '.php' ); |
| 28 | |
| 29 | // Example: How to mark the marketing task as complete when a specific plugin is activated. |
| 30 | /** |
| 31 | * Example: |
| 32 | * if ( |
| 33 | * $plugin_basename === 'multichannel-by-cedcommerce' && |
| 34 | * $this->task_list->visible && |
| 35 | * ! $this->task_list->is_hidden() && |
| 36 | * ! $this->is_complete() |
| 37 | * ) { |
| 38 | * $this->mark_actioned(); |
| 39 | * } |
| 40 | */ |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Used to cache is_complete() method result. |
| 45 | * |
| 46 | * @var null |
| 47 | */ |
| 48 | private $is_complete_result = null; |
| 49 | |
| 50 | /** |
| 51 | * ID. |
| 52 | * |
| 53 | * @return string |
| 54 | */ |
| 55 | public function get_id() { |
| 56 | return 'marketing'; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Title. |
| 61 | * |
| 62 | * @return string |
| 63 | */ |
| 64 | public function get_title() { |
| 65 | return __( 'Grow your business', 'woocommerce' ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Content. |
| 70 | * |
| 71 | * @return string |
| 72 | */ |
| 73 | public function get_content() { |
| 74 | return __( |
| 75 | 'Add recommended marketing tools to reach new customers and grow your business', |
| 76 | 'woocommerce' |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Time. |
| 82 | * |
| 83 | * @return string |
| 84 | */ |
| 85 | public function get_time() { |
| 86 | return __( '2 minutes', 'woocommerce' ); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Task visibility. |
| 91 | * |
| 92 | * @return bool |
| 93 | */ |
| 94 | public function can_view() { |
| 95 | return Features::is_enabled( 'remote-free-extensions' ); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Get the marketing plugins. |
| 100 | * |
| 101 | * @deprecated 9.3.0 Removed to improve performance. |
| 102 | * @return array |
| 103 | */ |
| 104 | public static function get_plugins() { |
| 105 | wc_deprecated_function( |
| 106 | __METHOD__, |
| 107 | '9.3.0' |
| 108 | ); |
| 109 | return array(); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Check if the store has installed marketing extensions. |
| 114 | * |
| 115 | * @deprecated 9.3.0 Removed to improve performance. |
| 116 | * @return bool |
| 117 | */ |
| 118 | public static function has_installed_extensions() { |
| 119 | wc_deprecated_function( |
| 120 | __METHOD__, |
| 121 | '9.3.0' |
| 122 | ); |
| 123 | return false; |
| 124 | } |
| 125 | } |
| 126 |