2019-05-14 14:33:45 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2019-05-14 22:08:13 +00:00
|
|
|
* Handle cron events.
|
2019-05-14 14:33:45 +00:00
|
|
|
* NOTE: DO NOT edit this file in WooCommerce core, this is generated from woocommerce-admin.
|
|
|
|
*/
|
|
|
|
|
2019-08-06 19:36:15 +00:00
|
|
|
namespace Automattic\WooCommerce\Admin;
|
|
|
|
|
2019-05-14 14:33:45 +00:00
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
2021-01-08 01:10:07 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\AddingAndManangingProducts;
|
2020-10-28 17:12:14 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\ChooseNiche;
|
2021-01-07 06:49:29 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\ChoosingTheme;
|
2021-01-21 06:11:53 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\CustomizingProductCatalog;
|
2020-10-28 17:12:14 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\GivingFeedbackNotes;
|
2021-01-07 06:39:04 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\InsightFirstProductAndPayment;
|
2020-10-28 17:12:14 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\MobileApp;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\NewSalesRecord;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\TrackingOptIn;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\OnboardingEmailMarketing;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\OnboardingPayments;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\PersonalizeStore;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\EUVATNumber;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\WooCommercePayments;
|
2020-09-28 04:35:10 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Marketing;
|
2020-10-28 17:12:14 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\StartDropshippingBusiness;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\WooCommerceSubscriptions;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\MigrateFromShopify;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\LaunchChecklist;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\RealTimeOrderAlerts;
|
2020-06-05 01:51:25 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller;
|
|
|
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
|
2021-01-13 00:09:22 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\MerchantEmailNotifications\MerchantEmailNotifications;
|
2020-06-05 01:51:25 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Loader;
|
2020-10-28 17:12:14 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\InsightFirstSale;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\NeedSomeInspiration;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\OnlineClothingStore;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\FirstProduct;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\CustomizeStoreWithBlocks;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\GoogleAdsAndMarketing;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\TestCheckout;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\EditProductsOnTheMove;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\PerformanceOnMobile;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\ManageOrdersOnTheGo;
|
2020-10-29 20:30:04 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\NavigationFeedback;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\NavigationFeedbackFollowUp;
|
2020-12-08 03:50:27 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\FilterByProductVariationsInReports;
|
2021-01-13 00:09:22 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\AddFirstProduct;
|
2021-01-07 21:23:43 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\DrawAttention;
|
2021-01-21 03:13:23 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\GettingStartedInEcommerceWebinar;
|
2019-08-06 19:36:15 +00:00
|
|
|
|
2019-05-14 14:33:45 +00:00
|
|
|
/**
|
2020-10-28 17:12:14 +00:00
|
|
|
* Events Class.
|
2019-05-14 14:33:45 +00:00
|
|
|
*/
|
2019-08-12 21:52:09 +00:00
|
|
|
class Events {
|
2019-05-14 14:33:45 +00:00
|
|
|
/**
|
|
|
|
* The single instance of the class.
|
|
|
|
*
|
|
|
|
* @var object
|
|
|
|
*/
|
|
|
|
protected static $instance = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function __construct() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get class instance.
|
|
|
|
*
|
|
|
|
* @return object Instance.
|
|
|
|
*/
|
|
|
|
final public static function instance() {
|
|
|
|
if ( null === static::$instance ) {
|
|
|
|
static::$instance = new static();
|
|
|
|
}
|
|
|
|
return static::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cron event handlers.
|
|
|
|
*/
|
|
|
|
public function init() {
|
2019-05-14 22:09:02 +00:00
|
|
|
add_action( 'wc_admin_daily', array( $this, 'do_wc_admin_daily' ) );
|
2019-05-14 14:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Daily events to run.
|
|
|
|
*
|
2020-09-28 04:35:10 +00:00
|
|
|
* Note: Order_Milestones::other_milestones is hooked to this as well.
|
2019-05-14 14:33:45 +00:00
|
|
|
*/
|
2019-06-12 02:37:45 +00:00
|
|
|
public function do_wc_admin_daily() {
|
2021-01-13 00:09:22 +00:00
|
|
|
$this->possibly_add_notes();
|
|
|
|
|
|
|
|
if ( $this->is_remote_inbox_notifications_enabled() ) {
|
|
|
|
DataSourcePoller::read_specs_from_data_sources();
|
|
|
|
RemoteInboxNotificationsEngine::run();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $this->is_merchant_email_notifications_enabled() ) {
|
|
|
|
MerchantEmailNotifications::run();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds notes that should be added.
|
|
|
|
*/
|
|
|
|
protected function possibly_add_notes() {
|
2020-10-28 17:12:14 +00:00
|
|
|
NewSalesRecord::possibly_add_note();
|
|
|
|
MobileApp::possibly_add_note();
|
|
|
|
TrackingOptIn::possibly_add_note();
|
|
|
|
OnboardingEmailMarketing::possibly_add_note();
|
|
|
|
OnboardingPayments::possibly_add_note();
|
|
|
|
PersonalizeStore::possibly_add_note();
|
|
|
|
WooCommercePayments::possibly_add_note();
|
|
|
|
EUVATNumber::possibly_add_note();
|
2020-09-28 04:35:10 +00:00
|
|
|
Marketing::possibly_add_note();
|
2020-10-28 17:12:14 +00:00
|
|
|
GivingFeedbackNotes::possibly_add_note();
|
|
|
|
StartDropshippingBusiness::possibly_add_note();
|
|
|
|
WooCommerceSubscriptions::possibly_add_note();
|
|
|
|
MigrateFromShopify::possibly_add_note();
|
|
|
|
InsightFirstSale::possibly_add_note();
|
|
|
|
LaunchChecklist::possibly_add_note();
|
|
|
|
NeedSomeInspiration::possibly_add_note();
|
|
|
|
OnlineClothingStore::possibly_add_note();
|
|
|
|
FirstProduct::possibly_add_note();
|
|
|
|
ChooseNiche::possibly_add_note();
|
|
|
|
RealTimeOrderAlerts::possibly_add_note();
|
|
|
|
CustomizeStoreWithBlocks::possibly_add_note();
|
|
|
|
GoogleAdsAndMarketing::possibly_add_note();
|
|
|
|
TestCheckout::possibly_add_note();
|
|
|
|
EditProductsOnTheMove::possibly_add_note();
|
|
|
|
PerformanceOnMobile::possibly_add_note();
|
|
|
|
ManageOrdersOnTheGo::possibly_add_note();
|
2020-10-29 20:30:04 +00:00
|
|
|
NavigationFeedback::possibly_add_note();
|
|
|
|
NavigationFeedbackFollowUp::possibly_add_note();
|
2020-12-08 03:50:27 +00:00
|
|
|
FilterByProductVariationsInReports::possibly_add_note();
|
2021-01-07 21:23:43 +00:00
|
|
|
DrawAttention::possibly_add_note();
|
2021-01-07 06:49:29 +00:00
|
|
|
ChoosingTheme::possibly_add_note();
|
2021-01-07 06:39:04 +00:00
|
|
|
InsightFirstProductAndPayment::possibly_add_note();
|
2021-01-13 00:09:22 +00:00
|
|
|
AddFirstProduct::possibly_add_note();
|
2021-01-08 01:10:07 +00:00
|
|
|
AddingAndManangingProducts::possibly_add_note();
|
2021-01-21 06:11:53 +00:00
|
|
|
CustomizingProductCatalog::possibly_add_note();
|
2021-01-21 03:13:23 +00:00
|
|
|
GettingStartedInEcommerceWebinar::possibly_add_note();
|
2019-05-14 14:33:45 +00:00
|
|
|
}
|
2020-09-18 05:53:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if remote inbox notifications are enabled.
|
|
|
|
*
|
|
|
|
* @return bool Whether remote inbox notifications are enabled.
|
|
|
|
*/
|
|
|
|
protected function is_remote_inbox_notifications_enabled() {
|
|
|
|
// Check if the feature flag is disabled.
|
|
|
|
if ( ! Loader::is_feature_enabled( 'remote-inbox-notifications' ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the site has opted out of marketplace suggestions.
|
|
|
|
if ( 'yes' !== get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// All checks have passed.
|
|
|
|
return true;
|
|
|
|
}
|
2021-01-13 00:09:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if merchant email notifications are enabled.
|
|
|
|
*
|
|
|
|
* @return bool Whether merchant email notifications are enabled.
|
|
|
|
*/
|
|
|
|
protected function is_merchant_email_notifications_enabled() {
|
|
|
|
// Check if the feature flag is disabled.
|
|
|
|
if ( 'yes' !== get_option( 'woocommerce_merchant_email_notifications', 'yes' ) ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// All checks have passed.
|
|
|
|
return true;
|
|
|
|
}
|
2019-05-14 14:33:45 +00:00
|
|
|
}
|