Automattic\WooCommerce\Admin
Events{} WC 1.0
Events Class.
Хуков нет.
Возвращает
null
. Null. Ничего.
Использование
$Events = new Events(); // use class methods
Методы
- __construct()
- do_wc_admin_daily()
- init()
- instance()
- is_merchant_email_notifications_enabled()
- is_remote_inbox_notifications_enabled()
- possibly_add_notes()
Код Events{} Events{} WC 5.2.0
<?php
class Events {
/**
* 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() {
add_action( 'wc_admin_daily', array( $this, 'do_wc_admin_daily' ) );
}
/**
* Daily events to run.
*
* Note: Order_Milestones::other_milestones is hooked to this as well.
*/
public function do_wc_admin_daily() {
$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() {
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();
Marketing::possibly_add_note();
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();
NavigationFeedback::possibly_add_note();
NavigationFeedbackFollowUp::possibly_add_note();
FilterByProductVariationsInReports::possibly_add_note();
DrawAttention::possibly_add_note();
ChoosingTheme::possibly_add_note();
InsightFirstProductAndPayment::possibly_add_note();
AddFirstProduct::possibly_add_note();
AddingAndManangingProducts::possibly_add_note();
CustomizingProductCatalog::possibly_add_note();
GettingStartedInEcommerceWebinar::possibly_add_note();
FirstDownlaodableProduct::possibly_add_note();
}
/**
* 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;
}
/**
* 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', 'no' ) ) {
return false;
}
// All checks have passed.
return true;
}
}