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