芝麻web文件管理V1.00
编辑当前文件:/home/paymbalq/www/wp-content/plugins/woocommerce/src/Internal/Admin/Notes/TrackingOptIn.php
', '
', '
' ); $note = new Note(); $note->set_title( __( 'Help WooCommerce improve with usage tracking', 'woocommerce' ) ); $note->set_content( $note_content ); $note->set_content_data( (object) array() ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_name( self::NOTE_NAME ); $note->set_source( 'woocommerce-admin' ); $note->add_action( 'tracking-opt-in', __( 'Activate usage tracking', 'woocommerce' ), false, Note::E_WC_ADMIN_NOTE_ACTIONED, true, __( 'Usage tracking activated', 'woocommerce' ) ); return $note; } /** * Opt in to usage tracking when note is actioned. * * @param Note $note Note being acted upon. */ public function opt_in_to_tracking( $note ) { if ( self::NOTE_NAME === $note->get_name() ) { // Get the previous value of the tracking. $prev_value = get_option( 'woocommerce_allow_tracking', 'no' ); // Opt in to tracking and schedule the first data update. // Same mechanism as in WC_Admin_Setup_Wizard::wc_setup_store_setup_save(). update_option( 'woocommerce_allow_tracking', 'yes' ); // Track woocommerce_allow_tracking_toggled in case was set as 'no' before. if ( class_exists( 'WC_Tracks' ) && 'no' === $prev_value ) { WC_Tracks::track_woocommerce_allow_tracking_toggled( $prev_value, 'yes', 'usage_tracking_note' ); } wp_schedule_single_event( time() + 10, 'woocommerce_tracker_send_event', array( true ) ); } } }