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;
|
|
|
|
|
2020-09-28 04:35:10 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Choose_Niche;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Giving_Feedback_Notes;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Mobile_App;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\New_Sales_Record;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Tracking_Opt_In;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Onboarding_Email_Marketing;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Onboarding_Payments;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Personalize_Store;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\EU_VAT_Number;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Payments;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Marketing;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Start_Dropshipping_Business;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Subscriptions;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Migrate_From_Shopify;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Launch_Checklist;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Real_Time_Order_Alerts;
|
2020-06-05 01:51:25 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller;
|
|
|
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
|
|
|
|
use \Automattic\WooCommerce\Admin\Loader;
|
2020-09-28 04:35:10 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Insight_First_Sale;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Home_Screen_Feedback;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Need_Some_Inspiration;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Online_Clothing_Store;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\First_Product;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Customize_Store_With_Blocks;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Google_Ads_And_Marketing;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Test_Checkout;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Edit_Products_On_The_Move;
|
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Performance_On_Mobile;
|
2020-10-13 04:35:53 +00:00
|
|
|
use \Automattic\WooCommerce\Admin\Notes\Manage_Orders_On_The_Go;
|
2019-08-06 19:36:15 +00:00
|
|
|
|
2019-05-14 14:33:45 +00:00
|
|
|
/**
|
|
|
|
* WC_Admin_Events Class.
|
|
|
|
*/
|
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() {
|
2020-09-28 04:35:10 +00:00
|
|
|
New_Sales_Record::possibly_add_note();
|
|
|
|
Mobile_App::possibly_add_note();
|
|
|
|
Tracking_Opt_In::possibly_add_note();
|
|
|
|
Onboarding_Email_Marketing::possibly_add_note();
|
|
|
|
Onboarding_Payments::possibly_add_note();
|
|
|
|
Personalize_Store::possibly_add_note();
|
|
|
|
WooCommerce_Payments::possibly_add_note();
|
|
|
|
EU_VAT_Number::possibly_add_note();
|
|
|
|
Marketing::possibly_add_note();
|
|
|
|
Giving_Feedback_Notes::possibly_add_note();
|
|
|
|
Start_Dropshipping_Business::possibly_add_note();
|
|
|
|
WooCommerce_Subscriptions::possibly_add_note();
|
|
|
|
Migrate_From_Shopify::possibly_add_note();
|
|
|
|
Insight_First_Sale::possibly_add_note();
|
|
|
|
Launch_Checklist::possibly_add_note();
|
|
|
|
Home_Screen_Feedback::possibly_add_note();
|
|
|
|
Need_Some_Inspiration::possibly_add_note();
|
|
|
|
Online_Clothing_Store::possibly_add_note();
|
|
|
|
First_Product::possibly_add_note();
|
|
|
|
Choose_Niche::possibly_add_note();
|
|
|
|
Real_Time_Order_Alerts::possibly_add_note();
|
|
|
|
Customize_Store_With_Blocks::possibly_add_note();
|
|
|
|
Google_Ads_And_Marketing::possibly_add_note();
|
|
|
|
Test_Checkout::possibly_add_note();
|
|
|
|
Edit_Products_On_The_Move::possibly_add_note();
|
|
|
|
Performance_On_Mobile::possibly_add_note();
|
2020-10-13 04:35:53 +00:00
|
|
|
Manage_Orders_On_The_Go::possibly_add_note();
|
2020-06-05 01:51:25 +00:00
|
|
|
|
2020-09-18 05:53:49 +00:00
|
|
|
if ( $this->is_remote_inbox_notifications_enabled() ) {
|
2020-06-05 01:51:25 +00:00
|
|
|
DataSourcePoller::read_specs_from_data_sources();
|
|
|
|
RemoteInboxNotificationsEngine::run();
|
|
|
|
}
|
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;
|
|
|
|
}
|
2019-05-14 14:33:45 +00:00
|
|
|
}
|