Rename admin notes classes and file names to fit conventions (https://github.com/woocommerce/woocommerce-admin/pull/5142)

* Rename admin notes classes and file names to fit conventions

* Use a facade class that adds deprecation warnings to each function call

* Tidy up after rebase

Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
Bec Scott 2020-09-28 14:35:10 +10:00 committed by GitHub
parent df91b1f0a6
commit ad8f8c5b08
63 changed files with 1354 additions and 434 deletions

View File

@ -67,7 +67,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_One {
* Adds a note to the merchant' inbox. * Adds a note to the merchant' inbox.
*/ */
public static function add_activity_panel_inbox_welcome_note() { public static function add_activity_panel_inbox_welcome_note() {
if ( ! class_exists( 'WC_Admin_Notes' ) ) { if ( ! class_exists( 'Notes' ) ) {
return; return;
} }
@ -80,7 +80,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_One {
// First, see if we've already created this kind of note so we don't do it again. // First, see if we've already created this kind of note so we don't do it again.
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
foreach( (array) $note_ids as $note_id ) { foreach( (array) $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
$content_data = $note->get_content_data(); $content_data = $note->get_content_data();
if ( property_exists( $content_data, 'getting_started' ) ) { if ( property_exists( $content_data, 'getting_started' ) ) {
return; return;
@ -90,7 +90,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_One {
// Otherwise, add the note // Otherwise, add the note
$activated_time = current_time( 'timestamp', 0 ); $activated_time = current_time( 'timestamp', 0 );
$activated_time_formatted = date( 'F jS', $activated_time ); $activated_time_formatted = date( 'F jS', $activated_time );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Getting Started', 'wapi-example-plugin-one' ) ); $note->set_title( __( 'Getting Started', 'wapi-example-plugin-one' ) );
$note->set_content( $note->set_content(
sprintf( sprintf(
@ -104,7 +104,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_One {
'activated' => $activated_time, 'activated' => $activated_time,
'activated_formatted' => $activated_time_formatted, 'activated_formatted' => $activated_time_formatted,
) ); ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_layout('plain'); $note->set_layout('plain');
$note->set_image(''); $note->set_image('');
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
@ -129,11 +129,11 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_One {
* Removes any notes this plugin created. * Removes any notes this plugin created.
*/ */
public static function remove_activity_panel_inbox_notes() { public static function remove_activity_panel_inbox_notes() {
if ( ! class_exists( 'WC_Admin_Notes' ) ) { if ( ! class_exists( 'Notes' ) ) {
return; return;
} }
WC_Admin_Notes::delete_notes_with_name( self::NOTE_NAME ); Notes::delete_notes_with_name( self::NOTE_NAME );
} }
} }
@ -171,7 +171,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_Two {
* Adds a note to the merchant' inbox. * Adds a note to the merchant' inbox.
*/ */
public static function add_or_update_activity_panel_inbox_note() { public static function add_or_update_activity_panel_inbox_note() {
if ( ! class_exists( 'WC_Admin_Notes' ) ) { if ( ! class_exists( 'Notes' ) ) {
return; return;
} }
@ -184,10 +184,10 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_Two {
// First, see if we've already created our note so we don't do it again. // First, see if we've already created our note so we don't do it again.
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
if ( empty( $note_ids ) ) { if ( empty( $note_ids ) ) {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Domain Renewal Coming Up', 'wapi-example-plugin-two' ) ); $note->set_title( __( 'Domain Renewal Coming Up', 'wapi-example-plugin-two' ) );
} else { } else {
$note = WC_Admin_Notes::get_note( $note_ids[0] ); $note = Notes::get_note( $note_ids[0] );
} }
$expires_in_days = rand( 2, 365 ); $expires_in_days = rand( 2, 365 );
@ -202,7 +202,7 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_Two {
'expires_in_days' => $expires_in_days, 'expires_in_days' => $expires_in_days,
) ); ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_layout('plain'); $note->set_layout('plain');
$note->set_image(''); $note->set_image('');
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
@ -217,11 +217,11 @@ class WooCommerce_Activity_Panel_Inbox_Example_Plugin_Two {
* Removes any notes this plugin created. * Removes any notes this plugin created.
*/ */
public static function remove_activity_panel_inbox_notes() { public static function remove_activity_panel_inbox_notes() {
if ( ! class_exists( 'WC_Admin_Notes' ) ) { if ( ! class_exists( 'Notes' ) ) {
return; return;
} }
WC_Admin_Notes::delete_notes_with_name( self::NOTE_NAME ); Notes::delete_notes_with_name( self::NOTE_NAME );
} }
} }

View File

@ -8,8 +8,8 @@
*/ */
use \Automattic\WooCommerce\Admin\Install as Installer; use \Automattic\WooCommerce\Admin\Install as Installer;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Deactivate_Plugin; use \Automattic\WooCommerce\Admin\Notes\Deactivate_Plugin;
/** /**
* Update order stats `status` index length. * Update order stats `status` index length.
@ -68,8 +68,8 @@ function wc_admin_update_0230_db_version() {
* Remove the note unsnoozing scheduled action. * Remove the note unsnoozing scheduled action.
*/ */
function wc_admin_update_0251_remove_unsnooze_action() { function wc_admin_update_0251_remove_unsnooze_action() {
as_unschedule_action( WC_Admin_Notes::UNSNOOZE_HOOK, null, 'wc-admin-data' ); as_unschedule_action( Notes::UNSNOOZE_HOOK, null, 'wc-admin-data' );
as_unschedule_action( WC_Admin_Notes::UNSNOOZE_HOOK, null, 'wc-admin-notes' ); as_unschedule_action( Notes::UNSNOOZE_HOOK, null, 'wc-admin-notes' );
} }
/** /**
@ -83,7 +83,7 @@ function wc_admin_update_0251_db_version() {
* Remove Facebook Extension note. * Remove Facebook Extension note.
*/ */
function wc_admin_update_110_remove_facebook_note() { function wc_admin_update_110_remove_facebook_note() {
WC_Admin_Notes::delete_notes_with_name( 'wc-admin-facebook-extension' ); Notes::delete_notes_with_name( 'wc-admin-facebook-extension' );
} }
/** /**
@ -115,7 +115,7 @@ function wc_admin_update_130_db_version() {
function wc_admin_update_140_change_deactivate_plugin_note_type() { function wc_admin_update_140_change_deactivate_plugin_note_type() {
global $wpdb; global $wpdb;
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wc_admin_notes SET type = 'info' WHERE name = %s", WC_Admin_Notes_Deactivate_Plugin::NOTE_NAME ) ); $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wc_admin_notes SET type = 'info' WHERE name = %s", Deactivate_Plugin::NOTE_NAME ) );
} }
/** /**

View File

@ -9,8 +9,8 @@ namespace Automattic\WooCommerce\Admin\API;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use Automattic\WooCommerce\Admin\Notes\Note;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes as NotesFactory;
/** /**
* REST API Admin Note Action controller class. * REST API Admin Note Action controller class.
@ -55,7 +55,7 @@ class NoteActions extends Notes {
* @return WP_REST_Request|WP_Error * @return WP_REST_Request|WP_Error
*/ */
public function trigger_note_action( $request ) { public function trigger_note_action( $request ) {
$note = WC_Admin_Notes::get_note( $request->get_param( 'note_id' ) ); $note = NotesFactory::get_note( $request->get_param( 'note_id' ) );
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
@ -88,7 +88,7 @@ class NoteActions extends Notes {
* Fires when an admin note action is taken. * Fires when an admin note action is taken.
* *
* @param string $name The triggered action name. * @param string $name The triggered action name.
* @param WC_Admin_Note $note The corresponding Note. * @param Note $note The corresponding Note.
*/ */
do_action( 'woocommerce_note_action', $triggered_action->name, $note ); do_action( 'woocommerce_note_action', $triggered_action->name, $note );
@ -96,7 +96,7 @@ class NoteActions extends Notes {
* Fires when an admin note action is taken. * Fires when an admin note action is taken.
* For more specific targeting of note actions. * For more specific targeting of note actions.
* *
* @param WC_Admin_Note $note The corresponding Note. * @param Note $note The corresponding Note.
*/ */
do_action( 'woocommerce_note_action_' . $triggered_action->name, $note ); do_action( 'woocommerce_note_action_' . $triggered_action->name, $note );

View File

@ -9,8 +9,8 @@ namespace Automattic\WooCommerce\Admin\API;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use Automattic\WooCommerce\Admin\Notes\Note;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use Automattic\WooCommerce\Admin\Notes\Notes as NotesRepository;
/** /**
* REST API Admin Notes controller class. * REST API Admin Notes controller class.
@ -122,7 +122,7 @@ class Notes extends \WC_REST_CRUD_Controller {
* @return WP_REST_Response|WP_Error * @return WP_REST_Response|WP_Error
*/ */
public function get_item( $request ) { public function get_item( $request ) {
$note = WC_Admin_Notes::get_note( $request->get_param( 'id' ) ); $note = NotesRepository::get_note( $request->get_param( 'id' ) );
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
@ -150,7 +150,7 @@ class Notes extends \WC_REST_CRUD_Controller {
public function get_items( $request ) { public function get_items( $request ) {
$query_args = $this->prepare_objects_query( $request ); $query_args = $this->prepare_objects_query( $request );
$notes = WC_Admin_Notes::get_notes( 'edit', $query_args ); $notes = NotesRepository::get_notes( 'edit', $query_args );
$data = array(); $data = array();
foreach ( (array) $notes as $note_obj ) { foreach ( (array) $notes as $note_obj ) {
@ -160,7 +160,7 @@ class Notes extends \WC_REST_CRUD_Controller {
} }
$response = rest_ensure_response( $data ); $response = rest_ensure_response( $data );
$response->header( 'X-WP-Total', WC_Admin_Notes::get_notes_count( $query_args['type'], $query_args['status'] ) ); $response->header( 'X-WP-Total', NotesRepository::get_notes_count( $query_args['type'], $query_args['status'] ) );
return $response; return $response;
} }
@ -234,7 +234,7 @@ class Notes extends \WC_REST_CRUD_Controller {
* @return WP_REST_Request|WP_Error * @return WP_REST_Request|WP_Error
*/ */
public function update_item( $request ) { public function update_item( $request ) {
$note = WC_Admin_Notes::get_note( $request->get_param( 'id' ) ); $note = NotesRepository::get_note( $request->get_param( 'id' ) );
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
@ -244,7 +244,7 @@ class Notes extends \WC_REST_CRUD_Controller {
); );
} }
WC_Admin_Notes::update_note( $note, $this->get_requested_updates( $request ) ); NotesRepository::update_note( $note, $this->get_requested_updates( $request ) );
return $this->get_item( $request ); return $this->get_item( $request );
} }
@ -255,7 +255,7 @@ class Notes extends \WC_REST_CRUD_Controller {
* @return WP_REST_Request|WP_Error * @return WP_REST_Request|WP_Error
*/ */
public function delete_item( $request ) { public function delete_item( $request ) {
$note = WC_Admin_Notes::get_note( $request->get_param( 'id' ) ); $note = NotesRepository::get_note( $request->get_param( 'id' ) );
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
@ -265,7 +265,7 @@ class Notes extends \WC_REST_CRUD_Controller {
); );
} }
WC_Admin_Notes::delete_note( $note ); NotesRepository::delete_note( $note );
$data = $this->prepare_note_data_for_response( $note, $request ); $data = $this->prepare_note_data_for_response( $note, $request );
return rest_ensure_response( $data ); return rest_ensure_response( $data );
} }
@ -277,22 +277,23 @@ class Notes extends \WC_REST_CRUD_Controller {
* @return WP_REST_Request|WP_Error * @return WP_REST_Request|WP_Error
*/ */
public function delete_all_items( $request ) { public function delete_all_items( $request ) {
$notes = WC_Admin_Notes::delete_all_notes(); $notes = NotesRepository::delete_all_notes();
$data = array(); $data = array();
foreach ( (array) $notes as $note_obj ) { foreach ( (array) $notes as $note_obj ) {
$data[] = $this->prepare_note_data_for_response( $note_obj, $request ); $data[] = $this->prepare_note_data_for_response( $note_obj, $request );
} }
$response = rest_ensure_response( $data ); $response = rest_ensure_response( $data );
$response->header( 'X-WP-Total', WC_Admin_Notes::get_notes_count( array( 'info', 'warning' ), array() ) ); $response->header( 'X-WP-Total', NotesRepository::get_notes_count( array( 'info', 'warning' ), array() ) );
return $response; return $response;
} }
/** /**
* Prepare note data. * Prepare note data.
* *
* @param WC_Admin_Note $note Note data. * @param Note $note Note data.
* @param WP_REST_Request $request Request object. * @param WP_REST_Request $request Request object.
*
* @return WP_REST_Response $response Response data. * @return WP_REST_Response $response Response data.
*/ */
public function prepare_note_data_for_response( $note, $request ) { public function prepare_note_data_for_response( $note, $request ) {
@ -353,15 +354,15 @@ class Notes extends \WC_REST_CRUD_Controller {
} }
foreach ( (array) $note_ids as $note_id ) { foreach ( (array) $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( (int) $note_id ); $note = NotesRepository::get_note( (int) $note_id );
if ( $note ) { if ( $note ) {
WC_Admin_Notes::update_note( $note, $this->get_requested_updates( $request ) ); NotesRepository::update_note( $note, $this->get_requested_updates( $request ) );
$data[] = $this->prepare_note_data_for_response( $note, $request ); $data[] = $this->prepare_note_data_for_response( $note, $request );
} }
} }
$response = rest_ensure_response( $data ); $response = rest_ensure_response( $data );
$response->header( 'X-WP-Total', WC_Admin_Notes::get_notes_count( array( 'info', 'warning' ), array() ) ); $response->header( 'X-WP-Total', NotesRepository::get_notes_count( array( 'info', 'warning' ), array() ) );
return $response; return $response;
} }
@ -501,7 +502,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
'enum' => WC_Admin_Note::get_allowed_types(), 'enum' => Note::get_allowed_types(),
'type' => 'string', 'type' => 'string',
), ),
); );
@ -511,7 +512,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
'enum' => WC_Admin_Note::get_allowed_statuses(), 'enum' => Note::get_allowed_statuses(),
'type' => 'string', 'type' => 'string',
), ),
); );

View File

@ -9,7 +9,7 @@ namespace Automattic\WooCommerce\Admin\API;
use Automattic\WooCommerce\Admin\Features\Onboarding; use Automattic\WooCommerce\Admin\Features\Onboarding;
use Automattic\WooCommerce\Admin\PluginsHelper; use Automattic\WooCommerce\Admin\PluginsHelper;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Install_JP_And_WCS_Plugins; use \Automattic\WooCommerce\Admin\Notes\Install_JP_And_WCS_Plugins;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
@ -194,7 +194,7 @@ class Plugins extends \WC_REST_Data_Controller {
return; return;
} }
WC_Admin_Notes_Install_JP_And_WCS_Plugins::possibly_add_note(); Install_JP_And_WCS_Plugins::possibly_add_note();
} }
/** /**

View File

@ -0,0 +1,81 @@
<?php
/**
* A facade to allow deprecating an entire class. Calling instance or static
* functions on the facade triggers a deprecation notice before calling the
* underlying function.
*
* Use it by extending DeprecatedClassFacade in your facade class, setting the
* static $facade_over_classname string to the name of the class to build
* a facade over, and setting the static $deprecated_in_version to the version
* that the class was deprecated in. Eg.:
*
* class DeprecatedGoose extends DeprecatedClassFacade {
* static $facade_over_classname = 'Goose';
* static $deprecated_in_version = '1.6.0';
* }
*/
namespace Automattic\WooCommerce\Admin;
defined( 'ABSPATH' ) || exit;
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
/**
* A facade to allow deprecating an entire class.
*/
class DeprecatedClassFacade {
/**
* The instance that this facade covers over.
*
* @var object
*/
private $instance;
/**
* Constructor.
*/
public function __construct() {
$this->instance = new static::$facade_over_classname();
}
/**
* Executes when calling any function on an instance of this class.
*
* @param string $name The name of the function being called.
* @param array $arguments An array of the arguments to the function call.
*/
public function __call( $name, $arguments ) {
_deprecated_function(
static::$facade_over_classname . '::' . $name,
static::$deprecated_in_version
);
call_user_func_array(
array(
$this->instance,
$name,
),
$arguments
);
}
/**
* Executes when calling any static function on this class.
*
* @param string $name The name of the function being called.
* @param array $arguments An array of the arguments to the function call.
*/
public static function __callStatic( $name, $arguments ) {
_deprecated_function(
static::$facade_over_classname . '::' . $name,
static::$deprecated_in_version
);
call_user_func_array(
array(
static::$facade_over_classname,
$name,
),
$arguments
);
}
}

View File

@ -8,36 +8,36 @@ namespace Automattic\WooCommerce\Admin;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Choose_Niche; use \Automattic\WooCommerce\Admin\Notes\Choose_Niche;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Giving_Feedback_Notes; use \Automattic\WooCommerce\Admin\Notes\Giving_Feedback_Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Mobile_App; use \Automattic\WooCommerce\Admin\Notes\Mobile_App;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_New_Sales_Record; use \Automattic\WooCommerce\Admin\Notes\New_Sales_Record;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Tracking_Opt_In; use \Automattic\WooCommerce\Admin\Notes\Tracking_Opt_In;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Onboarding_Email_Marketing; use \Automattic\WooCommerce\Admin\Notes\Onboarding_Email_Marketing;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Onboarding_Payments; use \Automattic\WooCommerce\Admin\Notes\Onboarding_Payments;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Personalize_Store; use \Automattic\WooCommerce\Admin\Notes\Personalize_Store;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_EU_VAT_Number; use \Automattic\WooCommerce\Admin\Notes\EU_VAT_Number;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments; use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Payments;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Marketing; use \Automattic\WooCommerce\Admin\Notes\Marketing;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Start_Dropshipping_Business; use \Automattic\WooCommerce\Admin\Notes\Start_Dropshipping_Business;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Subscriptions; use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Subscriptions;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Migrate_From_Shopify; use \Automattic\WooCommerce\Admin\Notes\Migrate_From_Shopify;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Launch_Checklist; use \Automattic\WooCommerce\Admin\Notes\Launch_Checklist;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Real_Time_Order_Alerts; use \Automattic\WooCommerce\Admin\Notes\Real_Time_Order_Alerts;
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller;
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
use \Automattic\WooCommerce\Admin\Loader; use \Automattic\WooCommerce\Admin\Loader;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Insight_First_Sale; use \Automattic\WooCommerce\Admin\Notes\Insight_First_Sale;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Home_Screen_Feedback; use \Automattic\WooCommerce\Admin\Notes\Home_Screen_Feedback;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Need_Some_Inspiration; use \Automattic\WooCommerce\Admin\Notes\Need_Some_Inspiration;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Learn_More_About_Product_Settings; use \Automattic\WooCommerce\Admin\Notes\Learn_More_About_Product_Settings;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Online_Clothing_Store; use \Automattic\WooCommerce\Admin\Notes\Online_Clothing_Store;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_First_Product; use \Automattic\WooCommerce\Admin\Notes\First_Product;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Customize_Store_With_Blocks; use \Automattic\WooCommerce\Admin\Notes\Customize_Store_With_Blocks;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Google_Ads_And_Marketing; use \Automattic\WooCommerce\Admin\Notes\Google_Ads_And_Marketing;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Test_Checkout; use \Automattic\WooCommerce\Admin\Notes\Test_Checkout;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Edit_Products_On_The_Move; use \Automattic\WooCommerce\Admin\Notes\Edit_Products_On_The_Move;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Performance_On_Mobile; use \Automattic\WooCommerce\Admin\Notes\Performance_On_Mobile;
/** /**
* WC_Admin_Events Class. * WC_Admin_Events Class.
@ -79,36 +79,36 @@ class Events {
/** /**
* Daily events to run. * Daily events to run.
* *
* Note: WC_Admin_Notes_Order_Milestones::other_milestones is hooked to this as well. * Note: Order_Milestones::other_milestones is hooked to this as well.
*/ */
public function do_wc_admin_daily() { public function do_wc_admin_daily() {
WC_Admin_Notes_New_Sales_Record::possibly_add_note(); New_Sales_Record::possibly_add_note();
WC_Admin_Notes_Mobile_App::possibly_add_note(); Mobile_App::possibly_add_note();
WC_Admin_Notes_Tracking_Opt_In::possibly_add_note(); Tracking_Opt_In::possibly_add_note();
WC_Admin_Notes_Onboarding_Email_Marketing::possibly_add_note(); Onboarding_Email_Marketing::possibly_add_note();
WC_Admin_Notes_Onboarding_Payments::possibly_add_note(); Onboarding_Payments::possibly_add_note();
WC_Admin_Notes_Personalize_Store::possibly_add_note(); Personalize_Store::possibly_add_note();
WC_Admin_Notes_WooCommerce_Payments::possibly_add_note(); WooCommerce_Payments::possibly_add_note();
WC_Admin_Notes_EU_VAT_Number::possibly_add_note(); EU_VAT_Number::possibly_add_note();
WC_Admin_Notes_Marketing::possibly_add_note(); Marketing::possibly_add_note();
WC_Admin_Notes_Giving_Feedback_Notes::possibly_add_note(); Giving_Feedback_Notes::possibly_add_note();
WC_Admin_Notes_Start_Dropshipping_Business::possibly_add_note(); Start_Dropshipping_Business::possibly_add_note();
WC_Admin_Notes_WooCommerce_Subscriptions::possibly_add_note(); WooCommerce_Subscriptions::possibly_add_note();
WC_Admin_Notes_Migrate_From_Shopify::possibly_add_note(); Migrate_From_Shopify::possibly_add_note();
WC_Admin_Notes_Insight_First_Sale::possibly_add_note(); Insight_First_Sale::possibly_add_note();
WC_Admin_Notes_Launch_Checklist::possibly_add_note(); Launch_Checklist::possibly_add_note();
WC_Admin_Notes_Home_Screen_Feedback::possibly_add_note(); Home_Screen_Feedback::possibly_add_note();
WC_Admin_Notes_Need_Some_Inspiration::possibly_add_note(); Need_Some_Inspiration::possibly_add_note();
WC_Admin_Notes_Learn_More_About_Product_Settings::possibly_add_note(); Learn_More_About_Product_Settings::possibly_add_note();
WC_Admin_Notes_Online_Clothing_Store::possibly_add_note(); Online_Clothing_Store::possibly_add_note();
WC_Admin_Notes_First_Product::possibly_add_note(); First_Product::possibly_add_note();
WC_Admin_Notes_Choose_Niche::possibly_add_note(); Choose_Niche::possibly_add_note();
WC_Admin_Notes_Real_Time_Order_Alerts::possibly_add_note(); Real_Time_Order_Alerts::possibly_add_note();
WC_Admin_Notes_Customize_Store_With_Blocks::possibly_add_note(); Customize_Store_With_Blocks::possibly_add_note();
WC_Admin_Notes_Google_Ads_And_Marketing::possibly_add_note(); Google_Ads_And_Marketing::possibly_add_note();
WC_Admin_Notes_Test_Checkout::possibly_add_note(); Test_Checkout::possibly_add_note();
WC_Admin_Notes_Edit_Products_On_The_Move::possibly_add_note(); Edit_Products_On_The_Move::possibly_add_note();
WC_Admin_Notes_Performance_On_Mobile::possibly_add_note(); Performance_On_Mobile::possibly_add_note();
if ( $this->is_remote_inbox_notifications_enabled() ) { if ( $this->is_remote_inbox_notifications_enabled() ) {
DataSourcePoller::read_specs_from_data_sources(); DataSourcePoller::read_specs_from_data_sources();

View File

@ -7,20 +7,20 @@ namespace Automattic\WooCommerce\Admin;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Historical_Data; use \Automattic\WooCommerce\Admin\Notes\Historical_Data;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Order_Milestones; use \Automattic\WooCommerce\Admin\Notes\Order_Milestones;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Woo_Subscriptions_Notes; use \Automattic\WooCommerce\Admin\Notes\Woo_Subscriptions_Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Tracking_Opt_In; use \Automattic\WooCommerce\Admin\Notes\Tracking_Opt_In;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments; use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Payments;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Install_JP_And_WCS_Plugins; use \Automattic\WooCommerce\Admin\Notes\Install_JP_And_WCS_Plugins;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Draw_Attention; use \Automattic\WooCommerce\Admin\Notes\Draw_Attention;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Coupon_Page_Moved; use \Automattic\WooCommerce\Admin\Notes\Coupon_Page_Moved;
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Home_Screen_Feedback; use \Automattic\WooCommerce\Admin\Notes\Home_Screen_Feedback;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Set_Up_Additional_Payment_Types; use \Automattic\WooCommerce\Admin\Notes\Set_Up_Additional_Payment_Types;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Test_Checkout; use \Automattic\WooCommerce\Admin\Notes\Test_Checkout;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Selling_Online_Courses; use \Automattic\WooCommerce\Admin\Notes\Selling_Online_Courses;
/** /**
* Feature plugin main class. * Feature plugin main class.
@ -118,7 +118,7 @@ class FeaturePlugin {
$this->includes(); $this->includes();
ReportsSync::clear_queued_actions(); ReportsSync::clear_queued_actions();
WC_Admin_Notes::clear_queued_actions(); Notes::clear_queued_actions();
wp_clear_scheduled_hook( 'wc_admin_daily' ); wp_clear_scheduled_hook( 'wc_admin_daily' );
wp_clear_scheduled_hook( 'generate_category_lookup_table' ); wp_clear_scheduled_hook( 'generate_category_lookup_table' );
} }
@ -174,24 +174,24 @@ class FeaturePlugin {
ReportExporter::init(); ReportExporter::init();
// CRUD classes. // CRUD classes.
WC_Admin_Notes::init(); Notes::init();
// Initialize category lookup. // Initialize category lookup.
CategoryLookup::instance()->init(); CategoryLookup::instance()->init();
// Admin note providers. // Admin note providers.
// @todo These should be bundled in the features/ folder, but loading them from there currently has a load order issue. // @todo These should be bundled in the features/ folder, but loading them from there currently has a load order issue.
new WC_Admin_Notes_Woo_Subscriptions_Notes(); new Woo_Subscriptions_Notes();
new WC_Admin_Notes_Historical_Data(); new Historical_Data();
new WC_Admin_Notes_Order_Milestones(); new Order_Milestones();
new WC_Admin_Notes_Tracking_Opt_In(); new Tracking_Opt_In();
new WC_Admin_Notes_WooCommerce_Payments(); new WooCommerce_Payments();
new WC_Admin_Notes_Install_JP_And_WCS_Plugins(); new Install_JP_And_WCS_Plugins();
new WC_Admin_Notes_Draw_Attention(); new Draw_Attention();
new WC_Admin_Notes_Home_Screen_Feedback(); new Home_Screen_Feedback();
new WC_Admin_Notes_Set_Up_Additional_Payment_Types(); new Set_Up_Additional_Payment_Types();
new WC_Admin_Notes_Test_Checkout(); new Test_Checkout();
new WC_Admin_Notes_Selling_Online_Courses(); new Selling_Online_Courses();
// Initialize RemoteInboxNotificationsEngine. // Initialize RemoteInboxNotificationsEngine.
RemoteInboxNotificationsEngine::init(); RemoteInboxNotificationsEngine::init();

View File

@ -6,7 +6,7 @@
namespace Automattic\WooCommerce\Admin\Features; namespace Automattic\WooCommerce\Admin\Features;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use Automattic\WooCommerce\Admin\Notes\Notes;
/** /**
* Contains backend logic for the activity panel feature. * Contains backend logic for the activity panel feature.
@ -109,7 +109,7 @@ class ActivityPanels {
* @param array $settings Component settings. * @param array $settings Component settings.
*/ */
public function component_settings( $settings ) { public function component_settings( $settings ) {
$settings['alertCount'] = WC_Admin_Notes::get_notes_count( array( 'error', 'update' ), array( 'unactioned' ) ); $settings['alertCount'] = Notes::get_notes_count( array( 'error', 'update' ), array( 'unactioned' ) );
$settings['hasLowStock'] = $this->has_low_stock_products(); $settings['hasLowStock'] = $this->has_low_stock_products();
return $settings; return $settings;
} }

View File

@ -8,7 +8,7 @@
namespace Automattic\WooCommerce\Admin\Features; namespace Automattic\WooCommerce\Admin\Features;
use Automattic\WooCommerce\Admin\Loader; use Automattic\WooCommerce\Admin\Loader;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Coupon_Page_Moved; use Automattic\WooCommerce\Admin\Notes\Coupon_Page_Moved;
use Automattic\WooCommerce\Admin\PageController; use Automattic\WooCommerce\Admin\PageController;
/** /**
@ -53,7 +53,7 @@ class Coupons {
return; return;
} }
( new WC_Admin_Notes_Coupon_Page_Moved() )->init(); ( new Coupon_Page_Moved() )->init();
add_action( 'admin_enqueue_scripts', array( $this, 'maybe_add_marketing_coupon_script' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'maybe_add_marketing_coupon_script' ) );
add_action( 'woocommerce_register_post_type_shop_coupon', array( $this, 'move_coupons' ) ); add_action( 'woocommerce_register_post_type_shop_coupon', array( $this, 'move_coupons' ) );

View File

@ -7,7 +7,7 @@
namespace Automattic\WooCommerce\Admin\Features; namespace Automattic\WooCommerce\Admin\Features;
use \Automattic\WooCommerce\Admin\Loader; use \Automattic\WooCommerce\Admin\Loader;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Onboarding_Profiler; use \Automattic\WooCommerce\Admin\Notes\Onboarding_Profiler;
use \Automattic\WooCommerce\Admin\PluginsHelper; use \Automattic\WooCommerce\Admin\PluginsHelper;
use \Automattic\WooCommerce\Admin\Features\OnboardingSetUpShipping; use \Automattic\WooCommerce\Admin\Features\OnboardingSetUpShipping;
use \Automattic\WooCommerce\Admin\Features\OnboardingAutomateTaxes; use \Automattic\WooCommerce\Admin\Features\OnboardingAutomateTaxes;
@ -64,7 +64,7 @@ class Onboarding {
} }
// Add onboarding notes. // Add onboarding notes.
new WC_Admin_Notes_Onboarding_Profiler(); new Onboarding_Profiler();
// Add actions and filters. // Add actions and filters.
$this->add_actions(); $this->add_actions();

View File

@ -8,7 +8,7 @@
namespace Automattic\WooCommerce\Admin\Features; namespace Automattic\WooCommerce\Admin\Features;
use \Automattic\WooCommerce\Admin\PluginsHelper; use \Automattic\WooCommerce\Admin\PluginsHelper;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Review_Shipping_Settings; use \Automattic\WooCommerce\Admin\Notes\Review_Shipping_Settings;
/** /**
* This contains logic for setting up shipping when the profiler completes. * This contains logic for setting up shipping when the profiler completes.
@ -40,7 +40,7 @@ class OnboardingSetUpShipping {
} }
self::set_up_free_local_shipping(); self::set_up_free_local_shipping();
WC_Admin_Notes_Review_Shipping_Settings::possibly_add_note(); Review_Shipping_Settings::possibly_add_note();
wc_admin_record_tracks_event( 'shipping_automatically_set_up' ); wc_admin_record_tracks_event( 'shipping_automatically_set_up' );
} }

View File

@ -8,8 +8,8 @@ namespace Automattic\WooCommerce\Admin;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\API\Reports\Cache; use Automattic\WooCommerce\Admin\API\Reports\Cache;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Historical_Data; use \Automattic\WooCommerce\Admin\Notes\Historical_Data;
/** /**
* Install Class. * Install Class.
@ -485,14 +485,14 @@ class Install {
); );
} }
WC_Admin_Notes::delete_notes_with_name( $obsolete_notes_names ); Notes::delete_notes_with_name( $obsolete_notes_names );
} }
/** /**
* Create notes. * Create notes.
*/ */
protected static function create_notes() { protected static function create_notes() {
WC_Admin_Notes_Historical_Data::possibly_add_note(); Historical_Data::possibly_add_note();
} }
/** /**

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Choose_Niche. * Choose_Niche.
*/ */
class WC_Admin_Notes_Choose_Niche { class Choose_Niche {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Choose_Niche {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
@ -61,10 +63,10 @@ class WC_Admin_Notes_Choose_Niche {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'How to choose a niche for your online store', 'woocommerce-admin' ) ); $note->set_title( __( 'How to choose a niche for your online store', 'woocommerce-admin' ) );
$note->set_content( __( 'Your niche defines the products and services you develop. It directs your marketing. It focuses your attention on specific problems facing your customers. It differentiates you from the competition. Learn more about the five guiding principles to define your niche.', 'woocommerce-admin' ) ); $note->set_content( __( 'Your niche defines the products and services you develop. It directs your marketing. It focuses your attention on specific problems facing your customers. It differentiates you from the competition. Learn more about the five guiding principles to define your niche.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -72,7 +74,7 @@ class WC_Admin_Notes_Choose_Niche {
'choose-niche', 'choose-niche',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/how-to-choose-a-niche-online-business/?utm_source=inbox', 'https://woocommerce.com/posts/how-to-choose-a-niche-online-business/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -14,9 +14,9 @@ use WC_Data_Store;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Coupon_Page_Moved class. * Coupon_Page_Moved class.
*/ */
class WC_Admin_Notes_Coupon_Page_Moved { class Coupon_Page_Moved {
use NoteTraits, CouponsMovedTrait; use NoteTraits, CouponsMovedTrait;
@ -60,13 +60,13 @@ class WC_Admin_Notes_Coupon_Page_Moved {
/** /**
* Get the note object for this class. * Get the note object for this class.
* *
* @return WC_Admin_Note * @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Coupon management has moved!', 'woocommerce-admin' ) ); $note->set_title( __( 'Coupon management has moved!', 'woocommerce-admin' ) );
$note->set_content( __( 'Coupons can now be managed from Marketing > Coupons. Click the button below to remove the legacy WooCommerce > Coupons menu item.', 'woocommerce-admin' ) ); $note->set_content( __( 'Coupons can now be managed from Marketing > Coupons. Click the button below to remove the legacy WooCommerce > Coupons menu item.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_UPDATE ); $note->set_type( Note::E_WC_ADMIN_NOTE_UPDATE );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( new stdClass() ); $note->set_content_data( new stdClass() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -74,7 +74,7 @@ class WC_Admin_Notes_Coupon_Page_Moved {
'remove-legacy-coupon-menu', 'remove-legacy-coupon-menu',
__( 'Remove legacy coupon menu', 'woocommerce-admin' ), __( 'Remove legacy coupon menu', 'woocommerce-admin' ),
wc_admin_url( '&action=remove-coupon-menu' ), wc_admin_url( '&action=remove-coupon-menu' ),
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );

View File

@ -12,9 +12,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Customize_Store_With_Blocks. * Customize_Store_With_Blocks.
*/ */
class WC_Admin_Notes_Customize_Store_With_Blocks { class Customize_Store_With_Blocks {
/** /**
* Note traits. * Note traits.
*/ */
@ -27,6 +27,8 @@ class WC_Admin_Notes_Customize_Store_With_Blocks {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
@ -63,10 +65,10 @@ class WC_Admin_Notes_Customize_Store_With_Blocks {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Customize your online store with WooCommerce blocks', 'woocommerce-admin' ) ); $note->set_title( __( 'Customize your online store with WooCommerce blocks', 'woocommerce-admin' ) );
$note->set_content( __( 'With our blocks, you can select and display products, categories, filters, and more virtually anywhere on your site — no need to use shortcodes or edit lines of code. Learn more about how to use each one of them.', 'woocommerce-admin' ) ); $note->set_content( __( 'With our blocks, you can select and display products, categories, filters, and more virtually anywhere on your site — no need to use shortcodes or edit lines of code. Learn more about how to use each one of them.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -74,7 +76,7 @@ class WC_Admin_Notes_Customize_Store_With_Blocks {
'customize-store-with-blocks', 'customize-store-with-blocks',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/how-to-customize-your-online-store-with-woocommerce-blocks/?utm_source=inbox', 'https://woocommerce.com/posts/how-to-customize-your-online-store-with-woocommerce-blocks/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* WC_Admin_Note_Data_Store class file. * WC Admin Note Data_Store class file.
*/ */
namespace Automattic\WooCommerce\Admin\Notes; namespace Automattic\WooCommerce\Admin\Notes;
@ -14,7 +14,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
/** /**
* Method to create a new note in the database. * Method to create a new note in the database.
* *
* @param WC_Admin_Note $note Admin note. * @param Note $note Admin note.
*/ */
public function create( &$note ) { public function create( &$note ) {
$date_created = time(); $date_created = time();
@ -58,7 +58,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
/** /**
* Method to read a note. * Method to read a note.
* *
* @param WC_Admin_Note $note Admin note. * @param Note $note Admin note.
* @throws \Exception Throws exception when invalid data is found. * @throws \Exception Throws exception when invalid data is found.
*/ */
public function read( &$note ) { public function read( &$note ) {
@ -129,7 +129,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
/** /**
* Updates a note in the database. * Updates a note in the database.
* *
* @param WC_Admin_Note $note Admin note. * @param Note $note Admin note.
*/ */
public function update( &$note ) { public function update( &$note ) {
global $wpdb; global $wpdb;
@ -184,7 +184,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
/** /**
* Deletes a note from the database. * Deletes a note from the database.
* *
* @param WC_Admin_Note $note Admin note. * @param Note $note Admin note.
* @param array $args Array of args to pass to the delete method (not used). * @param array $args Array of args to pass to the delete method (not used).
*/ */
public function delete( &$note, $args = array() ) { public function delete( &$note, $args = array() ) {
@ -207,7 +207,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
/** /**
* Read actions from the database. * Read actions from the database.
* *
* @param WC_Admin_Note $note Admin note. * @param Note $note Admin note.
*/ */
private function read_actions( &$note ) { private function read_actions( &$note ) {
global $wpdb; global $wpdb;
@ -244,7 +244,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
* Save actions to the database. * Save actions to the database.
* This function clears old actions, then re-inserts new if any changes are found. * This function clears old actions, then re-inserts new if any changes are found.
* *
* @param WC_Admin_Note $note Note object. * @param Note $note Note object.
* *
* @return bool|void * @return bool|void
*/ */
@ -259,7 +259,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
// Process action removal. Actions are removed from // Process action removal. Actions are removed from
// the note if they aren't part of the changeset. // the note if they aren't part of the changeset.
// See WC_Admin_Note::add_action(). // See Note::add_action().
$changed_actions = $note->get_actions( 'edit' ); $changed_actions = $note->get_actions( 'edit' );
$actions_to_keep = array(); $actions_to_keep = array();
@ -380,7 +380,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
* @return string Where clauses for the query. * @return string Where clauses for the query.
*/ */
public function get_notes_where_clauses( $args = array() ) { public function get_notes_where_clauses( $args = array() ) {
$allowed_types = WC_Admin_Note::get_allowed_types(); $allowed_types = Note::get_allowed_types();
$where_type_array = array(); $where_type_array = array();
if ( isset( $args['type'] ) ) { if ( isset( $args['type'] ) ) {
foreach ( $args['type'] as $args_type ) { foreach ( $args['type'] as $args_type ) {
@ -391,7 +391,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
} }
} }
$allowed_statuses = WC_Admin_Note::get_allowed_statuses(); $allowed_statuses = Note::get_allowed_statuses();
$where_status_array = array(); $where_status_array = array();
if ( isset( $args['status'] ) ) { if ( isset( $args['status'] ) ) {
foreach ( $args['status'] as $args_status ) { foreach ( $args['status'] as $args_status ) {

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Deactivate_Plugin. * Deactivate_Plugin.
*/ */
class WC_Admin_Notes_Deactivate_Plugin { class Deactivate_Plugin {
/** /**
* Note traits. * Note traits.
*/ */
@ -32,12 +32,14 @@ class WC_Admin_Notes_Deactivate_Plugin {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Deactivate old WooCommerce Admin version', 'woocommerce-admin' ) ); $note->set_title( __( 'Deactivate old WooCommerce Admin version', 'woocommerce-admin' ) );
$note->set_content( __( 'Your current version of WooCommerce Admin is outdated and a newer version is included with WooCommerce. We recommend deactivating the plugin and using the stable version included with WooCommerce.', 'woocommerce-admin' ) ); $note->set_content( __( 'Your current version of WooCommerce Admin is outdated and a newer version is included with WooCommerce. We recommend deactivating the plugin and using the stable version included with WooCommerce.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -45,7 +47,7 @@ class WC_Admin_Notes_Deactivate_Plugin {
'deactivate-feature-plugin', 'deactivate-feature-plugin',
__( 'Deactivate', 'woocommerce-admin' ), __( 'Deactivate', 'woocommerce-admin' ),
wc_admin_url( '&action=deactivate-feature-plugin' ), wc_admin_url( '&action=deactivate-feature-plugin' ),
'unactioned', Note::E_WC_ADMIN_NOTE_UNACTIONED,
true true
); );
return $note; return $note;
@ -55,7 +57,7 @@ class WC_Admin_Notes_Deactivate_Plugin {
* Delete the note if the version is higher than the included. * Delete the note if the version is higher than the included.
*/ */
public static function delete_note() { public static function delete_note() {
WC_Admin_Notes::delete_notes_with_name( self::NOTE_NAME ); Notes::delete_notes_with_name( self::NOTE_NAME );
} }
/** /**

View File

@ -0,0 +1,773 @@
<?php
/**
* Define deprecated classes to support changing the naming convention of
* admin notes.
*/
namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\DeprecatedClassFacade;
// phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
/**
* WC_Admin_Note (deprecated, use Note instead).
*/
class WC_Admin_Note extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Note';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes (deprecated, use Notes instead).
*/
class WC_Admin_Notes extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Notes';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Choose_Niche (deprecated, use Choose_Niche instead).
*/
class WC_Admin_Notes_Choose_Niche extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Choose_Niche';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Coupon_Page_Moved (deprecated, use Coupon_Page_Moved instead).
*/
class WC_Admin_Notes_Coupon_Page_Moved extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Coupon_Page_Moved';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Customize_Store_With_Blocks (deprecated, use Customize_Store_With_Blocks instead).
*/
class WC_Admin_Notes_Customize_Store_With_Blocks extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Customize_Store_With_Blocks';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Deactivate_Plugin (deprecated, use Deactivate_Plugin instead).
*/
class WC_Admin_Notes_Deactivate_Plugin extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Deactivate_Plugin';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Draw_Attention (deprecated, use Draw_Attention instead).
*/
class WC_Admin_Notes_Draw_Attention extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Draw_Attention';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Edit_Products_On_The_Move (deprecated, use Edit_Products_On_The_Move instead).
*/
class WC_Admin_Notes_Edit_Products_On_The_Move extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Edit_Products_On_The_Move';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_EU_VAT_Number (deprecated, use EU_VAT_Number instead).
*/
class WC_Admin_Notes_EU_VAT_Number extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\EU_VAT_Number';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Facebook_Marketing_Expert (deprecated, use Facebook_Marketing_Expert instead).
*/
class WC_Admin_Notes_Facebook_Marketing_Expert extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Facebook_Marketing_Expert';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_First_Product (deprecated, use First_Product instead).
*/
class WC_Admin_Notes_First_Product extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\First_Product';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Giving_Feedback_Notes (deprecated, use Giving_Feedback_Notes instead).
*/
class WC_Admin_Notes_Giving_Feedback_Notes extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Giving_Feedback_Notes';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Historical_Data (deprecated, use Historical_Data instead).
*/
class WC_Admin_Notes_Historical_Data extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Historical_Data';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Home_Screen_Feedback (deprecated, use Home_Screen_Feedback instead).
*/
class WC_Admin_Notes_Home_Screen_Feedback extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Home_Screen_Feedback';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Insight_First_Sale (deprecated, use Insight_First_Sale instead).
*/
class WC_Admin_Notes_Insight_First_Sale extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Insight_First_Sale';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Install_JP_And_WCS_Plugins (deprecated, use Install_JP_And_WCS_Plugins instead).
*/
class WC_Admin_Notes_Install_JP_And_WCS_Plugins extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Install_JP_And_WCS_Plugins';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Launch_Checklist (deprecated, use Launch_Checklist instead).
*/
class WC_Admin_Notes_Launch_Checklist extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Launch_Checklist';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Learn_More_About_Product_Settings (deprecated, use Learn_More_About_Product_Settings instead).
*/
class WC_Admin_Notes_Learn_More_About_Product_Settings extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Learn_More_About_Product_Settings';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Marketing (deprecated, use Marketing instead).
*/
class WC_Admin_Notes_Marketing extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Marketing';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Migrate_From_Shopify (deprecated, use Migrate_From_Shopify instead).
*/
class WC_Admin_Notes_Migrate_From_Shopify extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Migrate_From_Shopify';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Mobile_App (deprecated, use Mobile_App instead).
*/
class WC_Admin_Notes_Mobile_App extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Mobile_App';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Need_Some_Inspiration (deprecated, use Need_Some_Inspiration instead).
*/
class WC_Admin_Notes_Need_Some_Inspiration extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Need_Some_Inspiration';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_New_Sales_Record (deprecated, use New_Sales_Record instead).
*/
class WC_Admin_Notes_New_Sales_Record extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\New_Sales_Record';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Onboarding_Email_Marketing (deprecated, use Onboarding_Email_Marketing instead).
*/
class WC_Admin_Notes_Onboarding_Email_Marketing extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Onboarding_Email_Marketing';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Onboarding_Payments (deprecated, use Onboarding_Payments instead).
*/
class WC_Admin_Notes_Onboarding_Payments extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Onboarding_Payments';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Onboarding_Profiler (deprecated, use Onboarding_Profiler instead).
*/
class WC_Admin_Notes_Onboarding_Profiler extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Onboarding_Profiler';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Online_Clothing_Store (deprecated, use Online_Clothing_Store instead).
*/
class WC_Admin_Notes_Online_Clothing_Store extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Online_Clothing_Store';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Order_Milestones (deprecated, use Order_Milestones instead).
*/
class WC_Admin_Notes_Order_Milestones extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Order_Milestones';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Performance_On_Mobile (deprecated, use Performance_On_Mobile instead).
*/
class WC_Admin_Notes_Performance_On_Mobile extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Performance_On_Mobile';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Personalize_Store (deprecated, use Personalize_Store instead).
*/
class WC_Admin_Notes_Personalize_Store extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Personalize_Store';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Real_Time_Order_Alerts (deprecated, use Real_Time_Order_Alerts instead).
*/
class WC_Admin_Notes_Real_Time_Order_Alerts extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Real_Time_Order_Alerts';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Review_Shipping_Settings (deprecated, use Review_Shipping_Settings instead).
*/
class WC_Admin_Notes_Review_Shipping_Settings extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Review_Shipping_Settings';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Selling_Online_Courses (deprecated, use Selling_Online_Courses instead).
*/
class WC_Admin_Notes_Selling_Online_Courses extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Selling_Online_Courses';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Set_Up_Additional_Payment_Types (deprecated, use Set_Up_Additional_Payment_Types instead).
*/
class WC_Admin_Notes_Set_Up_Additional_Payment_Types extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Set_Up_Additional_Payment_Types';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Start_Dropshipping_Business (deprecated, use Start_Dropshipping_Business instead).
*/
class WC_Admin_Notes_Start_Dropshipping_Business extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Start_Dropshipping_Business';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Test_Checkout (deprecated, use Test_Checkout instead).
*/
class WC_Admin_Notes_Test_Checkout extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Test_Checkout';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Tracking_Opt_In (deprecated, use Tracking_Opt_In instead).
*/
class WC_Admin_Notes_Tracking_Opt_In extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Tracking_Opt_In';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_Woo_Subscriptions_Notes (deprecated, use Woo_Subscriptions_Notes instead).
*/
class WC_Admin_Notes_Woo_Subscriptions_Notes extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Woo_Subscriptions_Notes';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_WooCommerce_Payments (deprecated, use WooCommerce_Payments instead).
*/
class WC_Admin_Notes_WooCommerce_Payments extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\WooCommerce_Payments';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}
/**
* WC_Admin_Notes_WooCommerce_Subscriptions (deprecated, use WooCommerce_Subscriptions instead).
*/
class WC_Admin_Notes_WooCommerce_Subscriptions extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\WooCommerce_Subscriptions';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.6.0';
}

View File

@ -12,9 +12,9 @@ use \Automattic\WooCommerce\Admin\Features\Onboarding;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Draw_Attention * Draw_Attention
*/ */
class WC_Admin_Notes_Draw_Attention { class Draw_Attention {
/** /**
* Note traits. * Note traits.
*/ */
@ -61,20 +61,22 @@ class WC_Admin_Notes_Draw_Attention {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'How to draw attention to your online store', 'woocommerce-admin' ) ); $note->set_title( __( 'How to draw attention to your online store', 'woocommerce-admin' ) );
$note->set_content( __( 'To get you started, here are seven ways to boost your sales and avoid getting drowned out by similar, mass-produced products competing for the same buyers.', 'woocommerce-admin' ) ); $note->set_content( __( 'To get you started, here are seven ways to boost your sales and avoid getting drowned out by similar, mass-produced products competing for the same buyers.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_ADMIN_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'learn-more', 'learn-more',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/how-to-make-your-online-store-stand-out/?utm_source=inbox', 'https://woocommerce.com/posts/how-to-make-your-online-store-stand-out/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_EU_VAT_Number * EU_VAT_Number
*/ */
class WC_Admin_Notes_EU_VAT_Number { class EU_VAT_Number {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_EU_VAT_Number {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
if ( 'yes' !== get_option( 'wc_connect_taxes_enabled', 'no' ) ) { if ( 'yes' !== get_option( 'wc_connect_taxes_enabled', 'no' ) ) {
@ -39,18 +41,18 @@ class WC_Admin_Notes_EU_VAT_Number {
$content = __( "If your store is based in the EU, we recommend using the EU VAT Number extension in addition to automated taxes. It provides your checkout with a field to collect and validate a customer's EU VAT number, if they have one.", 'woocommerce-admin' ); $content = __( "If your store is based in the EU, we recommend using the EU VAT Number extension in addition to automated taxes. It provides your checkout with a field to collect and validate a customer's EU VAT number, if they have one.", 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Collect and validate EU VAT numbers at checkout', 'woocommerce-admin' ) ); $note->set_title( __( 'Collect and validate EU VAT numbers at checkout', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'learn-more', 'learn-more',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/products/eu-vat-number/', 'https://woocommerce.com/products/eu-vat-number/',
'actioned', Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Edit_Products_On_The_Move * Edit_Products_On_The_Move
*/ */
class WC_Admin_Notes_Edit_Products_On_The_Move { class Edit_Products_On_The_Move {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Edit_Products_On_The_Move {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Only add this note if this store is at least a year old. // Only add this note if this store is at least a year old.
@ -34,24 +36,24 @@ class WC_Admin_Notes_Edit_Products_On_The_Move {
} }
// Check that the previous mobile app notes have not been actioned. // Check that the previous mobile app notes have not been actioned.
if ( WC_Admin_Notes_Mobile_App::has_note_been_actioned() ) { if ( Mobile_App::has_note_been_actioned() ) {
return; return;
} }
if ( WC_Admin_Notes_Real_Time_Order_Alerts::has_note_been_actioned() ) { if ( Real_Time_Order_Alerts::has_note_been_actioned() ) {
return; return;
} }
if ( WC_Admin_Notes_Performance_On_Mobile::has_note_been_actioned() ) { if ( Performance_On_Mobile::has_note_been_actioned() ) {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Edit products on the move', 'woocommerce-admin' ) ); $note->set_title( __( 'Edit products on the move', 'woocommerce-admin' ) );
$note->set_content( __( 'Edit and create new products from your mobile devices with the Woo app', 'woocommerce-admin' ) ); $note->set_content( __( 'Edit and create new products from your mobile devices with the Woo app', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_First_Product. * First_Product.
*/ */
class WC_Admin_Notes_First_Product { class First_Product {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_First_Product {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the note after seven days. // We want to show the note after seven days.
@ -63,10 +65,10 @@ class WC_Admin_Notes_First_Product {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Do you need help with adding your first product?', 'woocommerce-admin' ) ); $note->set_title( __( 'Do you need help with adding your first product?', 'woocommerce-admin' ) );
$note->set_content( __( 'This video tutorial will help you go through the process of adding your first product in WooCommerce.', 'woocommerce-admin' ) ); $note->set_content( __( 'This video tutorial will help you go through the process of adding your first product in WooCommerce.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Giving_Feedback_Notes * Giving_Feedback_Notes
*/ */
class WC_Admin_Notes_Giving_Feedback_Notes { class Giving_Feedback_Notes {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Giving_Feedback_Notes {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
protected static function get_note() { protected static function get_note() {
// We need to show Admin Giving feeback notification after 8 days of install. // We need to show Admin Giving feeback notification after 8 days of install.
@ -34,11 +36,11 @@ class WC_Admin_Notes_Giving_Feedback_Notes {
} }
// Otherwise, create our new note. // Otherwise, create our new note.
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Give feedback', 'woocommerce-admin' ) ); $note->set_title( __( 'Give feedback', 'woocommerce-admin' ) );
$note->set_content( __( 'Now that youve chosen us as a partner, our goal is to make sure we\'re providing the right tools to meet your needs. We\'re looking forward to having your feedback on the store setup experience so we can improve it in the future.', 'woocommerce-admin' ) ); $note->set_content( __( 'Now that youve chosen us as a partner, our goal is to make sure we\'re providing the right tools to meet your needs. We\'re looking forward to having your feedback on the store setup experience so we can improve it in the future.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(

View File

@ -16,8 +16,7 @@ use \Automattic\WooCommerce\Admin\PluginsHelper;
/** /**
* WC_Admin_Notes_Google_Ads_And_Marketing * WC_Admin_Notes_Google_Ads_And_Marketing
*/ */
class WC_Admin_Notes_Google_Ads_And_Marketing { class Google_Ads_And_Marketing {
/** /**
* Note traits. * Note traits.
*/ */
@ -59,12 +58,14 @@ class WC_Admin_Notes_Google_Ads_And_Marketing {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Get your products in front of millions of shoppers on Google to grow your sales', 'woocommerce-admin' ) ); $note->set_title( __( 'Get your products in front of millions of shoppers on Google to grow your sales', 'woocommerce-admin' ) );
$note->set_content( __( 'Google Ads & Marketing makes it easy to promote products on any budget. Run paid Smart Shopping campaigns to get your top selling products in front of buyers across the Google Network. You can also drive free traffic to your store with free listings for only $10 per month!', 'woocommerce-admin' ) ); $note->set_content( __( 'Google Ads & Marketing makes it easy to promote products on any budget. Run paid Smart Shopping campaigns to get your top selling products in front of buyers across the Google Network. You can also drive free traffic to your store with free listings for only $10 per month!', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -72,7 +73,7 @@ class WC_Admin_Notes_Google_Ads_And_Marketing {
'get-started', 'get-started',
__( 'Get started', 'woocommerce-admin' ), __( 'Get started', 'woocommerce-admin' ),
'https://woocommerce.com/products/google-ads-and-marketing/', 'https://woocommerce.com/products/google-ads-and-marketing/',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -12,9 +12,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Install; use \Automattic\WooCommerce\Admin\Install;
/** /**
* WC_Admin_Notes_Historical_Data. * Historical_Data.
*/ */
class WC_Admin_Notes_Historical_Data { class Historical_Data {
/** /**
* Note traits. * Note traits.
*/ */
@ -42,7 +42,7 @@ class WC_Admin_Notes_Historical_Data {
return; return;
} }
$note = WC_Admin_Notes::get_note( $note_ids[0] ); $note = Notes::get_note( $note_ids[0] );
if ( false === $note ) { if ( false === $note ) {
return; return;
} }
@ -53,6 +53,8 @@ class WC_Admin_Notes_Historical_Data {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$is_upgrading = get_option( Install::VERSION_OPTION ); $is_upgrading = get_option( Install::VERSION_OPTION );
@ -70,10 +72,10 @@ class WC_Admin_Notes_Historical_Data {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'WooCommerce Admin: Historical Analytics Data', 'woocommerce-admin' ) ); $note->set_title( __( 'WooCommerce Admin: Historical Analytics Data', 'woocommerce-admin' ) );
$note->set_content( __( 'To view your historical analytics data, you must process your existing orders and customers.', 'woocommerce-admin' ) ); $note->set_content( __( 'To view your historical analytics data, you must process your existing orders and customers.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_UPDATE ); $note->set_type( Note::E_WC_ADMIN_NOTE_UPDATE );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Home_Screen_Feedback. * Home_Screen_Feedback.
*/ */
class WC_Admin_Notes_Home_Screen_Feedback { class Home_Screen_Feedback {
/** /**
* Note traits. * Note traits.
*/ */
@ -49,6 +49,8 @@ class WC_Admin_Notes_Home_Screen_Feedback {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Homescreen first accessed at least 12 days ago. // Homescreen first accessed at least 12 days ago.
@ -62,10 +64,10 @@ class WC_Admin_Notes_Home_Screen_Feedback {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Help us improve the WooCommerce Home screen', 'woocommerce-admin' ) ); $note->set_title( __( 'Help us improve the WooCommerce Home screen', 'woocommerce-admin' ) );
$note->set_content( __( 'We\'d love your input to shape the future of the WooCommerce Home screen together. Feel free to share any feedback, ideas or suggestions that you have.', 'woocommerce-admin' ) ); $note->set_content( __( 'We\'d love your input to shape the future of the WooCommerce Home screen together. Feel free to share any feedback, ideas or suggestions that you have.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );

View File

@ -12,9 +12,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Insight_First_Sale. * Insight_First_Sale.
*/ */
class WC_Admin_Notes_Insight_First_Sale { class Insight_First_Sale {
/** /**
* Note traits. * Note traits.
*/ */
@ -27,6 +27,8 @@ class WC_Admin_Notes_Insight_First_Sale {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the note after eight days. // We want to show the note after eight days.
@ -34,10 +36,10 @@ class WC_Admin_Notes_Insight_First_Sale {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Did you know?', 'woocommerce-admin' ) ); $note->set_title( __( 'Did you know?', 'woocommerce-admin' ) );
$note->set_content( __( 'A WooCommerce powered store needs on average 31 days to get the first sale. You\'re on the right track! Do you find this type of insight useful?', 'woocommerce-admin' ) ); $note->set_content( __( 'A WooCommerce powered store needs on average 31 days to get the first sale. You\'re on the right track! Do you find this type of insight useful?', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_SURVEY ); $note->set_type( Note::E_WC_ADMIN_NOTE_SURVEY );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -49,7 +51,7 @@ class WC_Admin_Notes_Insight_First_Sale {
'affirm-insight-first-sale', 'affirm-insight-first-sale',
__( 'Yes', 'woocommerce-admin' ), __( 'Yes', 'woocommerce-admin' ),
false, false,
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
false, false,
__( 'Thanks for your feedback', 'woocommerce-admin' ) __( 'Thanks for your feedback', 'woocommerce-admin' )
); );
@ -57,7 +59,7 @@ class WC_Admin_Notes_Insight_First_Sale {
'deny-insight-first-sale', 'deny-insight-first-sale',
__( 'No', 'woocommerce-admin' ), __( 'No', 'woocommerce-admin' ),
false, false,
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
false, false,
__( 'Thanks for your feedback', 'woocommerce-admin' ) __( 'Thanks for your feedback', 'woocommerce-admin' )
); );

View File

@ -14,9 +14,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\PluginsHelper; use \Automattic\WooCommerce\Admin\PluginsHelper;
/** /**
* WC_Admin_Notes_Install_JP_And_WCS_Plugins * Install_JP_And_WCS_Plugins
*/ */
class WC_Admin_Notes_Install_JP_And_WCS_Plugins { class Install_JP_And_WCS_Plugins {
/** /**
* Note traits. * Note traits.
*/ */
@ -37,22 +37,24 @@ class WC_Admin_Notes_Install_JP_And_WCS_Plugins {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$content = __( 'We noticed that there was a problem during the Jetpack and WooCommerce Shipping & Tax install. Please try again and enjoy all the advantages of having the plugins connected to your store! Sorry for the inconvenience. The "Jetpack" and "WooCommerce Shipping & Tax" plugins will be installed & activated for free.', 'woocommerce-admin' ); $content = __( 'We noticed that there was a problem during the Jetpack and WooCommerce Shipping & Tax install. Please try again and enjoy all the advantages of having the plugins connected to your store! Sorry for the inconvenience. The "Jetpack" and "WooCommerce Shipping & Tax" plugins will be installed & activated for free.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Uh oh... There was a problem during the Jetpack and WooCommerce Shipping & Tax install. Please try again.', 'woocommerce-admin' ) ); $note->set_title( __( 'Uh oh... There was a problem during the Jetpack and WooCommerce Shipping & Tax install. Please try again.', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_ADMIN_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'install-jp-and-wcs-plugins', 'install-jp-and-wcs-plugins',
__( 'Install plugins', 'woocommerce-admin' ), __( 'Install plugins', 'woocommerce-admin' ),
false, false,
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;
@ -78,10 +80,10 @@ class WC_Admin_Notes_Install_JP_And_WCS_Plugins {
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
foreach ( $note_ids as $note_id ) { foreach ( $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
if ( $note ) { if ( $note ) {
$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); $note->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
$note->save(); $note->save();
} }
} }
@ -91,7 +93,7 @@ class WC_Admin_Notes_Install_JP_And_WCS_Plugins {
* Install the Jetpack and WooCommerce Shipping & Tax plugins in response to the action * Install the Jetpack and WooCommerce Shipping & Tax plugins in response to the action
* being clicked in the admin note. * being clicked in the admin note.
* *
* @param WC_Admin_Note $note The note being actioned. * @param Note $note The note being actioned.
*/ */
public function install_jp_and_wcs_plugins( $note ) { public function install_jp_and_wcs_plugins( $note ) {
if ( self::NOTE_NAME !== $note->get_name() ) { if ( self::NOTE_NAME !== $note->get_name() ) {

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Launch_Checklist * Launch_Checklist
*/ */
class WC_Admin_Notes_Launch_Checklist { class Launch_Checklist {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Launch_Checklist {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Only add this note if completing the task list or completed 3 tasks in 10 days. // Only add this note if completing the task list or completed 3 tasks in 10 days.
@ -42,11 +44,11 @@ class WC_Admin_Notes_Launch_Checklist {
$content = __( 'To make sure you never get that sinking "what did I forget" feeling, we\'ve put together the essential pre-launch checklist.', 'woocommerce-admin' ); $content = __( 'To make sure you never get that sinking "what did I forget" feeling, we\'ve put together the essential pre-launch checklist.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Ready to launch your store?', 'woocommerce-admin' ) ); $note->set_title( __( 'Ready to launch your store?', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/posts/pre-launch-checklist-the-essentials/?utm_source=inbox' ); $note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/posts/pre-launch-checklist-the-essentials/?utm_source=inbox' );

View File

@ -12,9 +12,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Features\Onboarding; use \Automattic\WooCommerce\Admin\Features\Onboarding;
/** /**
* WC_Admin_Notes_Learn_More_About_Product_Settings. * Learn_More_About_Product_Settings.
*/ */
class WC_Admin_Notes_Learn_More_About_Product_Settings { class Learn_More_About_Product_Settings {
/** /**
* Note traits. * Note traits.
*/ */
@ -27,6 +27,8 @@ class WC_Admin_Notes_Learn_More_About_Product_Settings {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
@ -63,10 +65,10 @@ class WC_Admin_Notes_Learn_More_About_Product_Settings {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Learn more about Product Settings', 'woocommerce-admin' ) ); $note->set_title( __( 'Learn more about Product Settings', 'woocommerce-admin' ) );
$note->set_content( __( 'In this video you\'ll find information about configuring product settings, such as how they are displayed, editing inventory options and so on.', 'woocommerce-admin' ) ); $note->set_content( __( 'In this video you\'ll find information about configuring product settings, such as how they are displayed, editing inventory options and so on.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -74,7 +76,7 @@ class WC_Admin_Notes_Learn_More_About_Product_Settings {
'learn-more-about-product-settings', 'learn-more-about-product-settings',
__( 'Watch tutorial', 'woocommerce-admin' ), __( 'Watch tutorial', 'woocommerce-admin' ),
'https://www.youtube.com/watch?v=FEmwJsE8xDY&t=', 'https://www.youtube.com/watch?v=FEmwJsE8xDY&t=',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Marketing * Marketing
*/ */
class WC_Admin_Notes_Marketing { class Marketing {
/** /**
* Note traits. * Note traits.
@ -26,12 +26,14 @@ class WC_Admin_Notes_Marketing {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Connect with your audience', 'woocommerce-admin' ) ); $note->set_title( __( 'Connect with your audience', 'woocommerce-admin' ) );
$note->set_content( __( 'Grow your customer base and increase your sales with marketing tools built for WooCommerce.', 'woocommerce-admin' ) ); $note->set_content( __( 'Grow your customer base and increase your sales with marketing tools built for WooCommerce.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -39,7 +41,7 @@ class WC_Admin_Notes_Marketing {
'open-marketing-hub', 'open-marketing-hub',
__( 'Open marketing hub', 'woocommerce-admin' ), __( 'Open marketing hub', 'woocommerce-admin' ),
admin_url( 'admin.php?page=wc-admin&path=/marketing' ), admin_url( 'admin.php?page=wc-admin&path=/marketing' ),
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED Note::E_WC_ADMIN_NOTE_ACTIONED
); );
return $note; return $note;
} }

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Migrate_From_Shopify. * Migrate_From_Shopify.
*/ */
class WC_Admin_Notes_Migrate_From_Shopify { class Migrate_From_Shopify {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Migrate_From_Shopify {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
@ -56,10 +58,10 @@ class WC_Admin_Notes_Migrate_From_Shopify {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Do you want to migrate from Shopify to WooCommerce?', 'woocommerce-admin' ) ); $note->set_title( __( 'Do you want to migrate from Shopify to WooCommerce?', 'woocommerce-admin' ) );
$note->set_content( __( 'Changing eCommerce platforms might seem like a big hurdle to overcome, but it is easier than you might think to move your products, customers, and orders to WooCommerce. This article will help you with going through this process.', 'woocommerce-admin' ) ); $note->set_content( __( 'Changing eCommerce platforms might seem like a big hurdle to overcome, but it is easier than you might think to move your products, customers, and orders to WooCommerce. This article will help you with going through this process.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -67,7 +69,7 @@ class WC_Admin_Notes_Migrate_From_Shopify {
'migrate-from-shopify', 'migrate-from-shopify',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/migrate-from-shopify-to-woocommerce/?utm_source=inbox', 'https://woocommerce.com/posts/migrate-from-shopify-to-woocommerce/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Mobile_App * Mobile_App
*/ */
class WC_Admin_Notes_Mobile_App { class Mobile_App {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Mobile_App {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the mobile app note after day 2. // We want to show the mobile app note after day 2.
@ -35,11 +37,11 @@ class WC_Admin_Notes_Mobile_App {
$content = __( 'Install the WooCommerce mobile app to manage orders, receive sales notifications, and view key metrics — wherever you are.', 'woocommerce-admin' ); $content = __( 'Install the WooCommerce mobile app to manage orders, receive sales notifications, and view key metrics — wherever you are.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Install Woo mobile app', 'woocommerce-admin' ) ); $note->set_title( __( 'Install Woo mobile app', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/mobile/' ); $note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/mobile/' );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Need_Some_Inspiration. * Need_Some_Inspiration.
*/ */
class WC_Admin_Notes_Need_Some_Inspiration { class Need_Some_Inspiration {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Need_Some_Inspiration {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the note after five days. // We want to show the note after five days.
@ -53,10 +55,10 @@ class WC_Admin_Notes_Need_Some_Inspiration {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Do you need some inspiration?', 'woocommerce-admin' ) ); $note->set_title( __( 'Do you need some inspiration?', 'woocommerce-admin' ) );
$note->set_content( __( 'Check some of our favorite customer stories from entrepreneurs, agencies, and developers in our global community.', 'woocommerce-admin' ) ); $note->set_content( __( 'Check some of our favorite customer stories from entrepreneurs, agencies, and developers in our global community.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -64,7 +66,7 @@ class WC_Admin_Notes_Need_Some_Inspiration {
'need-some-inspiration', 'need-some-inspiration',
__( 'See success stories', 'woocommerce-admin' ), __( 'See success stories', 'woocommerce-admin' ),
'https://woocommerce.com/success-stories/?utm_source=inbox', 'https://woocommerce.com/success-stories/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_New_Sales_Record * New_Sales_Record
*/ */
class WC_Admin_Notes_New_Sales_Record { class New_Sales_Record {
/** /**
* Note traits. * Note traits.
*/ */
@ -113,16 +113,16 @@ class WC_Admin_Notes_New_Sales_Record {
); );
// We only want one sales record note at any time in the inbox, so we delete any other first. // We only want one sales record note at any time in the inbox, so we delete any other first.
WC_Admin_Notes::delete_notes_with_name( self::NOTE_NAME ); Notes::delete_notes_with_name( self::NOTE_NAME );
$report_url = '?page=wc-admin&path=/analytics/revenue&period=custom&compare=previous_year&after=' . $yesterday . '&before=' . $yesterday; $report_url = '?page=wc-admin&path=/analytics/revenue&period=custom&compare=previous_year&after=' . $yesterday . '&before=' . $yesterday;
// And now, create our new note. // And now, create our new note.
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'New sales record!', 'woocommerce-admin' ) ); $note->set_title( __( 'New sales record!', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( $content_data ); $note->set_content_data( $content_data );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'view-report', __( 'View report', 'woocommerce-admin' ), $report_url ); $note->add_action( 'view-report', __( 'View report', 'woocommerce-admin' ), $report_url );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Note class. * Note class.
*/ */
class WC_Admin_Note extends \WC_Data { class Note extends \WC_Data {
// Note types. // Note types.
const E_WC_ADMIN_NOTE_ERROR = 'error'; // used for presenting error conditions. const E_WC_ADMIN_NOTE_ERROR = 'error'; // used for presenting error conditions.
@ -69,7 +69,7 @@ class WC_Admin_Note extends \WC_Data {
parent::__construct( $data ); parent::__construct( $data );
if ( $data instanceof WC_Admin_Note ) { if ( $data instanceof Note ) {
$this->set_id( absint( $data->get_id() ) ); $this->set_id( absint( $data->get_id() ) );
} elseif ( is_numeric( $data ) ) { } elseif ( is_numeric( $data ) ) {
$this->set_id( $data ); $this->set_id( $data );

View File

@ -49,7 +49,7 @@ trait NoteTraits {
public static function can_be_added() { public static function can_be_added() {
$note = self::get_note(); $note = self::get_note();
if ( ! $note instanceof WC_Admin_Note ) { if ( ! $note instanceof Note && ! $note instanceof WC_Admin_Note ) {
return; return;
} }
@ -59,7 +59,7 @@ trait NoteTraits {
if ( if (
'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) && 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) &&
WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING === $note->get_type() Note::E_WC_ADMIN_NOTE_MARKETING === $note->get_type()
) { ) {
return false; return false;
} }
@ -97,7 +97,7 @@ trait NoteTraits {
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
foreach ( $note_ids as $note_id ) { foreach ( $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
if ( $note ) { if ( $note ) {
$data_store->delete( $note ); $data_store->delete( $note );
@ -115,9 +115,9 @@ trait NoteTraits {
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
if ( ! empty( $note_ids ) ) { if ( ! empty( $note_ids ) ) {
$note = WC_Admin_Notes::get_note( $note_ids[0] ); $note = Notes::get_note( $note_ids[0] );
if ( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED === $note->get_status() ) { if ( Note::E_WC_ADMIN_NOTE_ACTIONED === $note->get_status() ) {
return true; return true;
} }
} }

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/** /**
* Admin Notes class. * Admin Notes class.
*/ */
class WC_Admin_Notes { class Notes {
/** /**
* Hook used for recurring "unsnooze" action. * Hook used for recurring "unsnooze" action.
*/ */
@ -39,7 +39,7 @@ class WC_Admin_Notes {
$notes = array(); $notes = array();
foreach ( (array) $raw_notes as $raw_note ) { foreach ( (array) $raw_notes as $raw_note ) {
try { try {
$note = new WC_Admin_Note( $raw_note ); $note = new Note( $raw_note );
$note_id = $note->get_id(); $note_id = $note->get_id();
$notes[ $note_id ] = $note->get_data(); $notes[ $note_id ] = $note->get_data();
$notes[ $note_id ]['name'] = $note->get_name( $context ); $notes[ $note_id ]['name'] = $note->get_name( $context );
@ -67,12 +67,12 @@ class WC_Admin_Notes {
* Get admin note using it's ID * Get admin note using it's ID
* *
* @param int $note_id Note ID. * @param int $note_id Note ID.
* @return WC_Admin_Note|bool * @return Note|bool
*/ */
public static function get_note( $note_id ) { public static function get_note( $note_id ) {
if ( false !== $note_id ) { if ( false !== $note_id ) {
try { try {
return new WC_Admin_Note( $note_id ); return new Note( $note_id );
} catch ( \Exception $e ) { } catch ( \Exception $e ) {
wc_caught_exception( $e, __CLASS__ . '::' . __FUNCTION__, array( $note_id ) ); wc_caught_exception( $e, __CLASS__ . '::' . __FUNCTION__, array( $note_id ) );
return false; return false;
@ -122,7 +122,7 @@ class WC_Admin_Notes {
/** /**
* Update a note. * Update a note.
* *
* @param WC_Admin_Note $note The note that will be updated. * @param Note $note The note that will be updated.
* @param array $requested_updates a list of requested updates. * @param array $requested_updates a list of requested updates.
*/ */
public static function update_note( $note, $requested_updates ) { public static function update_note( $note, $requested_updates ) {
@ -150,7 +150,7 @@ class WC_Admin_Notes {
/** /**
* Soft delete of a note. * Soft delete of a note.
* *
* @param WC_Admin_Note $note The note that will be deleted. * @param Note $note The note that will be deleted.
*/ */
public static function delete_note( $note ) { public static function delete_note( $note ) {
$note->set_is_deleted( 1 ); $note->set_is_deleted( 1 );
@ -172,10 +172,10 @@ class WC_Admin_Notes {
'per_page' => 25, 'per_page' => 25,
'page' => 1, 'page' => 1,
'type' => array( 'type' => array(
WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL, Note::E_WC_ADMIN_NOTE_INFORMATIONAL,
WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING, Note::E_WC_ADMIN_NOTE_MARKETING,
WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING, Note::E_WC_ADMIN_NOTE_WARNING,
WC_Admin_Note::E_WC_ADMIN_NOTE_SURVEY, Note::E_WC_ADMIN_NOTE_SURVEY,
), ),
'is_deleted' => 0, 'is_deleted' => 0,
) )
@ -199,7 +199,7 @@ class WC_Admin_Notes {
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$raw_notes = $data_store->get_notes( $raw_notes = $data_store->get_notes(
array( array(
'status' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_SNOOZED ), 'status' => array( Note::E_WC_ADMIN_NOTE_SNOOZED ),
) )
); );
$now = new \DateTime(); $now = new \DateTime();
@ -213,7 +213,7 @@ class WC_Admin_Notes {
$date_reminder = $note->get_date_reminder( 'edit' ); $date_reminder = $note->get_date_reminder( 'edit' );
if ( $date_reminder < $now ) { if ( $date_reminder < $now ) {
$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED ); $note->set_status( Note::E_WC_ADMIN_NOTE_UNACTIONED );
$note->set_date_reminder( null ); $note->set_date_reminder( null );
$note->save(); $note->save();
} }
@ -250,7 +250,7 @@ class WC_Admin_Notes {
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$notes = $data_store->get_notes( $notes = $data_store->get_notes(
array( array(
'type' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ), 'type' => array( Note::E_WC_ADMIN_NOTE_MARKETING ),
) )
); );
@ -269,7 +269,7 @@ class WC_Admin_Notes {
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$notes = $data_store->get_notes( $notes = $data_store->get_notes(
array( array(
'type' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_SURVEY ), 'type' => array( Note::E_WC_ADMIN_NOTE_SURVEY ),
'status' => array( 'actioned' ), 'status' => array( 'actioned' ),
) )
); );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Onboarding_Email_Marketing * Onboarding_Email_Marketing
*/ */
class WC_Admin_Notes_Onboarding_Email_Marketing { class Onboarding_Email_Marketing {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,15 +25,17 @@ class WC_Admin_Notes_Onboarding_Email_Marketing {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$content = __( 'We\'re here for you - get tips, product updates and inspiration straight to your email box', 'woocommerce-admin' ); $content = __( 'We\'re here for you - get tips, product updates and inspiration straight to your email box', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Tips, product updates, and inspiration', 'woocommerce-admin' ) ); $note->set_title( __( 'Tips, product updates, and inspiration', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'yes-please', __( 'Yes please!', 'woocommerce-admin' ), 'https://woocommerce.us8.list-manage.com/subscribe/post?u=2c1434dc56f9506bf3c3ecd21&amp;id=13860df971&amp;SIGNUPPAGE=plugin' ); $note->add_action( 'yes-please', __( 'Yes please!', 'woocommerce-admin' ), 'https://woocommerce.us8.list-manage.com/subscribe/post?u=2c1434dc56f9506bf3c3ecd21&amp;id=13860df971&amp;SIGNUPPAGE=plugin' );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Onboarding_Payments. * Onboarding_Payments.
*/ */
class WC_Admin_Notes_Onboarding_Payments { class Onboarding_Payments {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Onboarding_Payments {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the note after five days. // We want to show the note after five days.
@ -44,10 +46,10 @@ class WC_Admin_Notes_Onboarding_Payments {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Start accepting payments on your store!', 'woocommerce-admin' ) ); $note->set_title( __( 'Start accepting payments on your store!', 'woocommerce-admin' ) );
$note->set_content( __( 'Take payments with the provider thats right for you - choose from 100+ payment gateways for WooCommerce.', 'woocommerce-admin' ) ); $note->set_content( __( 'Take payments with the provider thats right for you - choose from 100+ payment gateways for WooCommerce.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -55,7 +57,7 @@ class WC_Admin_Notes_Onboarding_Payments {
'view-payment-gateways', 'view-payment-gateways',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/', 'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/',
'actioned', Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -12,9 +12,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Features\Onboarding; use \Automattic\WooCommerce\Admin\Features\Onboarding;
/** /**
* WC_Admin_Notes_Onboarding_Profiler. * Onboarding_Profiler.
*/ */
class WC_Admin_Notes_Onboarding_Profiler { class Onboarding_Profiler {
/** /**
* Note traits. * Note traits.
*/ */
@ -35,16 +35,18 @@ class WC_Admin_Notes_Onboarding_Profiler {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
if ( ! Onboarding::should_show_profiler() ) { if ( ! Onboarding::should_show_profiler() ) {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Welcome to WooCommerce! Set up your store and start selling', 'woocommerce-admin' ) ); $note->set_title( __( 'Welcome to WooCommerce! Set up your store and start selling', 'woocommerce-admin' ) );
$note->set_content( __( "We're here to help you going through the most important steps to get your store up and running.", 'woocommerce-admin' ) ); $note->set_content( __( "We're here to help you going through the most important steps to get your store up and running.", 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_UPDATE ); $note->set_type( Note::E_WC_ADMIN_NOTE_UPDATE );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -52,7 +54,7 @@ class WC_Admin_Notes_Onboarding_Profiler {
'continue-profiler', 'continue-profiler',
__( 'Continue Store Setup', 'woocommerce-admin' ), __( 'Continue Store Setup', 'woocommerce-admin' ),
wc_admin_url( '&enable_onboarding=1' ), wc_admin_url( '&enable_onboarding=1' ),
'unactioned', NOTE::E_WC_ADMIN_NOTE_UNACTIONED,
true true
); );
$note->add_action( $note->add_action(
@ -86,7 +88,7 @@ class WC_Admin_Notes_Onboarding_Profiler {
return; return;
} }
$note = WC_Admin_Notes::get_note( $note_ids[0] ); $note = Notes::get_note( $note_ids[0] );
if ( false === $note ) { if ( false === $note ) {
return; return;

View File

@ -11,9 +11,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Online_Clothing_Store. * Online_Clothing_Store.
*/ */
class WC_Admin_Notes_Online_Clothing_Store { class Online_Clothing_Store {
/** /**
* Note traits. * Note traits.
*/ */
@ -43,6 +43,8 @@ class WC_Admin_Notes_Online_Clothing_Store {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// We want to show the note after two days. // We want to show the note after two days.
@ -75,10 +77,10 @@ class WC_Admin_Notes_Online_Clothing_Store {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Start your online clothing store', 'woocommerce-admin' ) ); $note->set_title( __( 'Start your online clothing store', 'woocommerce-admin' ) );
$note->set_content( __( 'Starting a fashion website is exciting but it may seem overwhelming as well. In this article, we\'ll walk you through the setup process, teach you to create successful product listings, and show you how to market to your ideal audience.', 'woocommerce-admin' ) ); $note->set_content( __( 'Starting a fashion website is exciting but it may seem overwhelming as well. In this article, we\'ll walk you through the setup process, teach you to create successful product listings, and show you how to market to your ideal audience.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -86,7 +88,7 @@ class WC_Admin_Notes_Online_Clothing_Store {
'online-clothing-store', 'online-clothing-store',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/starting-an-online-clothing-store/?utm_source=inbox', 'https://woocommerce.com/posts/starting-an-online-clothing-store/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Order_Milestones * Order_Milestones
*/ */
class WC_Admin_Notes_Order_Milestones { class Order_Milestones {
/** /**
* Name of the "other milestones" note. * Name of the "other milestones" note.
*/ */
@ -304,15 +304,15 @@ class WC_Admin_Notes_Order_Milestones {
$this->set_last_milestone( $current_milestone ); $this->set_last_milestone( $current_milestone );
// We only want one milestone note at any time. // We only want one milestone note at any time.
WC_Admin_Notes::delete_notes_with_name( self::NOTE_NAME ); Notes::delete_notes_with_name( self::NOTE_NAME );
// Add the milestone note. // Add the milestone note.
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( $this->get_note_title_for_milestone( $current_milestone ) ); $note->set_title( $this->get_note_title_for_milestone( $current_milestone ) );
$note->set_content( $this->get_note_content_for_milestone( $current_milestone ) ); $note->set_content( $this->get_note_content_for_milestone( $current_milestone ) );
$note_action = $this->get_note_action_for_milestone( $current_milestone ); $note_action = $this->get_note_action_for_milestone( $current_milestone );
$note->add_action( $note_action['name'], $note_action['label'], $note_action['query'] ); $note->add_action( $note_action['name'], $note_action['label'], $note_action['query'] );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->save(); $note->save();

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Performance_On_Mobile * Performance_On_Mobile
*/ */
class WC_Admin_Notes_Performance_On_Mobile { class Performance_On_Mobile {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Performance_On_Mobile {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Only add this note if this store is at least 9 months old. // Only add this note if this store is at least 9 months old.
@ -34,20 +36,20 @@ class WC_Admin_Notes_Performance_On_Mobile {
} }
// Check that the previous mobile app notes have not been actioned. // Check that the previous mobile app notes have not been actioned.
if ( WC_Admin_Notes_Mobile_App::has_note_been_actioned() ) { if ( Mobile_App::has_note_been_actioned() ) {
return; return;
} }
if ( WC_Admin_Notes_Real_Time_Order_Alerts::has_note_been_actioned() ) { if ( Real_Time_Order_Alerts::has_note_been_actioned() ) {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Track your store performance on mobile', 'woocommerce-admin' ) ); $note->set_title( __( 'Track your store performance on mobile', 'woocommerce-admin' ) );
$note->set_content( __( 'Monitor your sales and high performing products with the Woo app.', 'woocommerce-admin' ) ); $note->set_content( __( 'Monitor your sales and high performing products with the Woo app.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Personalize_Store * Personalize_Store
*/ */
class WC_Admin_Notes_Personalize_Store { class Personalize_Store {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Personalize_Store {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Only show the note to stores with homepage. // Only show the note to stores with homepage.
@ -45,14 +47,14 @@ class WC_Admin_Notes_Personalize_Store {
$content = __( 'The homepage is one of the most important entry points in your store. When done right it can lead to higher conversions and engagement. Don\'t forget to personalize the homepage that we created for your store during the onboarding.', 'woocommerce-admin' ); $content = __( 'The homepage is one of the most important entry points in your store. When done right it can lead to higher conversions and engagement. Don\'t forget to personalize the homepage that we created for your store during the onboarding.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Personalize your store\'s homepage', 'woocommerce-admin' ) ); $note->set_title( __( 'Personalize your store\'s homepage', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'personalize-homepage', __( 'Personalize homepage', 'woocommerce-admin' ), admin_url( 'post.php?post=' . $homepage_id . '&action=edit' ), WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, true ); $note->add_action( 'personalize-homepage', __( 'Personalize homepage', 'woocommerce-admin' ), admin_url( 'post.php?post=' . $homepage_id . '&action=edit' ), Note::E_WC_ADMIN_NOTE_ACTIONED, true );
return $note; return $note;
} }
} }

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Real_Time_Order_Alerts * Real_Time_Order_Alerts
*/ */
class WC_Admin_Notes_Real_Time_Order_Alerts { class Real_Time_Order_Alerts {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Real_Time_Order_Alerts {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
// Only add this note if the store is 3 months old. // Only add this note if the store is 3 months old.
@ -34,17 +36,17 @@ class WC_Admin_Notes_Real_Time_Order_Alerts {
} }
// Check that the previous mobile app note was not actioned. // Check that the previous mobile app note was not actioned.
if ( WC_Admin_Notes_Mobile_App::has_note_been_actioned() ) { if ( Mobile_App::has_note_been_actioned() ) {
return; return;
} }
$content = __( 'Get notifications about store activity, including new orders and product reviews directly on your mobile devices with the Woo app.', 'woocommerce-admin' ); $content = __( 'Get notifications about store activity, including new orders and product reviews directly on your mobile devices with the Woo app.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Get real-time order alerts anywhere', 'woocommerce-admin' ) ); $note->set_title( __( 'Get real-time order alerts anywhere', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/mobile/?utm_source=inbox' ); $note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/mobile/?utm_source=inbox' );

View File

@ -12,9 +12,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Review_Shipping_Settings * Review_Shipping_Settings
*/ */
class WC_Admin_Notes_Review_Shipping_Settings { class Review_Shipping_Settings {
use NoteTraits; use NoteTraits;
const NOTE_NAME = 'wc-admin-review-shipping-settings'; const NOTE_NAME = 'wc-admin-review-shipping-settings';
@ -22,10 +22,10 @@ class WC_Admin_Notes_Review_Shipping_Settings {
/** /**
* Get the note. * Get the note.
* *
* @return WC_Admin_Note * @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -40,13 +40,13 @@ class WC_Admin_Notes_Review_Shipping_Settings {
) )
); );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->add_action( $note->add_action(
'edit-shipping-settings', 'edit-shipping-settings',
__( 'Edit shipping settings', 'woocommerce-admin' ), __( 'Edit shipping settings', 'woocommerce-admin' ),
admin_url( 'admin.php?page=wc-settings&tab=shipping' ), admin_url( 'admin.php?page=wc-settings&tab=shipping' ),
'unactioned', Note::E_WC_ADMIN_NOTE_UNACTIONED,
true true
); );

View File

@ -12,9 +12,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Features\Onboarding; use \Automattic\WooCommerce\Admin\Features\Onboarding;
/** /**
* WC_Admin_Notes_Selling_Online_Courses * Selling_Online_Courses
*/ */
class WC_Admin_Notes_Selling_Online_Courses { class Selling_Online_Courses {
/** /**
* Note traits. * Note traits.
*/ */
@ -59,21 +59,23 @@ class WC_Admin_Notes_Selling_Online_Courses {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Do you want to sell online courses?', 'woocommerce-admin' ) ); $note->set_title( __( 'Do you want to sell online courses?', 'woocommerce-admin' ) );
$note->set_content( __( 'Online courses are a great solution for any business that can teach a new skill. Since courses dont require physical product development or shipping, theyre affordable, fast to create, and can generate passive income for years to come. In this article, we provide you more information about selling courses using WooCommerce.', 'woocommerce-admin' ) ); $note->set_content( __( 'Online courses are a great solution for any business that can teach a new skill. Since courses dont require physical product development or shipping, theyre affordable, fast to create, and can generate passive income for years to come. In this article, we provide you more information about selling courses using WooCommerce.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'learn-more', 'learn-more',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/how-to-sell-online-courses-wordpress/?utm_source=inbox', 'https://woocommerce.com/posts/how-to-sell-online-courses-wordpress/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );

View File

@ -11,9 +11,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Set_Up_Additional_Payment_Types * Set_Up_Additional_Payment_Types
*/ */
class WC_Admin_Notes_Set_Up_Additional_Payment_Types { class Set_Up_Additional_Payment_Types {
/** /**
* Note traits. * Note traits.
*/ */
@ -65,23 +65,25 @@ class WC_Admin_Notes_Set_Up_Additional_Payment_Types {
/** /**
* Get the note. * Get the note.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$content = __( 'Set up additional payment providers, using third-party services or other methods.', 'woocommerce-admin' ); $content = __( 'Set up additional payment providers, using third-party services or other methods.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Set up additional payment providers', 'woocommerce-admin' ) ); $note->set_title( __( 'Set up additional payment providers', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'set-up-payments', 'set-up-payments',
__( 'Set up payments', 'woocommerce-admin' ), __( 'Set up payments', 'woocommerce-admin' ),
wc_admin_url( '&task=payments' ), wc_admin_url( '&task=payments' ),
'unactioned', Note::E_WC_ADMIN_NOTE_UNACTIONED,
true true
); );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Start_Dropshipping_Business. * Start_Dropshipping_Business.
*/ */
class WC_Admin_Notes_Start_Dropshipping_Business { class Start_Dropshipping_Business {
/** /**
* Note traits. * Note traits.
*/ */
@ -25,6 +25,8 @@ class WC_Admin_Notes_Start_Dropshipping_Business {
/** /**
* Get the note. * Get the note.
*
* @return Note|null
*/ */
public static function get_note() { public static function get_note() {
@ -61,10 +63,10 @@ class WC_Admin_Notes_Start_Dropshipping_Business {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Are you considering starting a dropshipping business?', 'woocommerce-admin' ) ); $note->set_title( __( 'Are you considering starting a dropshipping business?', 'woocommerce-admin' ) );
$note->set_content( __( 'The ability to add inventory without having to deal with production, stocking, or fulfilling orders may seem like a dream. But is dropshipping worth it? Lets explore some of the advantages and disadvantages to help you make the best decision for your business.', 'woocommerce-admin' ) ); $note->set_content( __( 'The ability to add inventory without having to deal with production, stocking, or fulfilling orders may seem like a dream. But is dropshipping worth it? Lets explore some of the advantages and disadvantages to help you make the best decision for your business.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -72,7 +74,7 @@ class WC_Admin_Notes_Start_Dropshipping_Business {
'dropshipping-business', 'dropshipping-business',
__( 'Learn more', 'woocommerce-admin' ), __( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/posts/is-dropshipping-worth-it-pros-cons/?utm_source=inbox', 'https://woocommerce.com/posts/is-dropshipping-worth-it-pros-cons/?utm_source=inbox',
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, Note::E_WC_ADMIN_NOTE_ACTIONED,
true true
); );
return $note; return $note;

View File

@ -12,9 +12,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Test_Checkout * Test_Checkout
*/ */
class WC_Admin_Notes_Test_Checkout { class Test_Checkout {
/** /**
* Note traits. * Note traits.
*/ */
@ -39,6 +39,8 @@ class WC_Admin_Notes_Test_Checkout {
/** /**
* Get the note. * Get the note.
*
* @return Note|null
*/ */
public static function get_note() { public static function get_note() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
@ -86,11 +88,11 @@ class WC_Admin_Notes_Test_Checkout {
$content = __( 'Make sure that your checkout is working properly before you launch your store. Go through your checkout process in its entirety: from adding a product to your cart, choosing a shipping location, and making a payment.', 'woocommerce-admin' ); $content = __( 'Make sure that your checkout is working properly before you launch your store. Go through your checkout process in its entirety: from adding a product to your cart, choosing a shipping location, and making a payment.', 'woocommerce-admin' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Don\'t forget to test your checkout', 'woocommerce-admin' ) ); $note->set_title( __( 'Don\'t forget to test your checkout', 'woocommerce-admin' ) );
$note->set_content( $content ); $note->set_content( $content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'test-checkout', __( 'Test checkout', 'woocommerce-admin' ), wc_get_page_permalink( 'shop' ) ); $note->add_action( 'test-checkout', __( 'Test checkout', 'woocommerce-admin' ), wc_get_page_permalink( 'shop' ) );

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Tracking_Opt_In * Tracking_Opt_In
*/ */
class WC_Admin_Notes_Tracking_Opt_In { class Tracking_Opt_In {
/** /**
* Note traits. * Note traits.
*/ */
@ -32,6 +32,8 @@ class WC_Admin_Notes_Tracking_Opt_In {
/** /**
* Get the note. * Get the note.
*
* @return Note|null
*/ */
public static function get_note() { public static function get_note() {
// Only show this note to stores that are opted out. // Only show this note to stores that are opted out.
@ -57,21 +59,21 @@ class WC_Admin_Notes_Tracking_Opt_In {
'</a>' '</a>'
); );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Help WooCommerce improve with usage tracking', 'woocommerce-admin' ) ); $note->set_title( __( 'Help WooCommerce improve with usage tracking', 'woocommerce-admin' ) );
$note->set_content( $note_content ); $note->set_content( $note_content );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'tracking-opt-in', __( 'Activate usage tracking', 'woocommerce-admin' ), false, WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, true ); $note->add_action( 'tracking-opt-in', __( 'Activate usage tracking', 'woocommerce-admin' ), false, Note::E_WC_ADMIN_NOTE_ACTIONED, true );
return $note; return $note;
} }
/** /**
* Opt in to usage tracking when note is actioned. * Opt in to usage tracking when note is actioned.
* *
* @param WC_Admin_Note $note Note being acted upon. * @param Note $note Note being acted upon.
*/ */
public function opt_in_to_tracking( $note ) { public function opt_in_to_tracking( $note ) {
if ( self::NOTE_NAME === $note->get_name() ) { if ( self::NOTE_NAME === $note->get_name() ) {

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_WooCommerce_Payments * WooCommerce_Payments
*/ */
class WC_Admin_Notes_WooCommerce_Payments { class WooCommerce_Payments {
/** /**
* Note traits. * Note traits.
*/ */
@ -56,14 +56,14 @@ class WC_Admin_Notes_WooCommerce_Payments {
if ( ! empty( $note_ids ) ) { if ( ! empty( $note_ids ) ) {
$note_id = array_pop( $note_ids ); $note_id = array_pop( $note_ids );
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
if ( false === $note ) { if ( false === $note ) {
return; return;
} }
// If the WooCommerce Payments plugin was installed after the note was created, make sure it's marked as actioned. // If the WooCommerce Payments plugin was installed after the note was created, make sure it's marked as actioned.
if ( self::is_installed() && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) { if ( self::is_installed() && Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) {
$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); $note->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
$note->save(); $note->save();
} }
@ -94,21 +94,23 @@ class WC_Admin_Notes_WooCommerce_Payments {
/** /**
* Add a note about WooCommerce Payments. * Add a note about WooCommerce Payments.
*
* @return Note
*/ */
public static function get_note() { public static function get_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Try the new way to get paid', 'woocommerce-admin' ) ); $note->set_title( __( 'Try the new way to get paid', 'woocommerce-admin' ) );
$note->set_content( __( 'Securely accept credit and debit cards on your site. Manage transactions without leaving your WordPress dashboard. Only with WooCommerce Payments.', 'woocommerce-admin' ) ); $note->set_content( __( 'Securely accept credit and debit cards on your site. Manage transactions without leaving your WordPress dashboard. Only with WooCommerce Payments.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/payments/', WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED ); $note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://woocommerce.com/payments/', Note::E_WC_ADMIN_NOTE_UNACTIONED );
$note->add_action( 'install-now', __( 'Install now', 'woocommerce-admin' ), false, WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED, true ); $note->add_action( 'install-now', __( 'Install now', 'woocommerce-admin' ), false, Note::E_WC_ADMIN_NOTE_ACTIONED, true );
// Create the note as "actioned" if the plugin is already installed. // Create the note as "actioned" if the plugin is already installed.
if ( self::is_installed() ) { if ( self::is_installed() ) {
$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); $note->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
} }
return $note; return $note;
} }
@ -128,7 +130,7 @@ class WC_Admin_Notes_WooCommerce_Payments {
/** /**
* Install WooCommerce Payments when note is actioned. * Install WooCommerce Payments when note is actioned.
* *
* @param WC_Admin_Note $note Note being acted upon. * @param Note $note Note being acted upon.
*/ */
public function install( $note ) { public function install( $note ) {
if ( self::NOTE_NAME === $note->get_name() && current_user_can( 'install_plugins' ) ) { if ( self::NOTE_NAME === $note->get_name() && current_user_can( 'install_plugins' ) ) {

View File

@ -12,9 +12,9 @@ defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Features\Onboarding; use \Automattic\WooCommerce\Admin\Features\Onboarding;
/** /**
* WC_Admin_Notes_WooCommerce_Subscriptions. * WooCommerce_Subscriptions.
*/ */
class WC_Admin_Notes_WooCommerce_Subscriptions { class WooCommerce_Subscriptions {
/** /**
* Note traits. * Note traits.
*/ */
@ -27,6 +27,8 @@ class WC_Admin_Notes_WooCommerce_Subscriptions {
/** /**
* Get the note. * Get the note.
*
* @return Note|null
*/ */
public static function get_note() { public static function get_note() {
$onboarding_data = get_option( Onboarding::PROFILE_DATA_OPTION, array() ); $onboarding_data = get_option( Onboarding::PROFILE_DATA_OPTION, array() );
@ -39,10 +41,10 @@ class WC_Admin_Notes_WooCommerce_Subscriptions {
return; return;
} }
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Do you need more info about WooCommerce Subscriptions?', 'woocommerce-admin' ) ); $note->set_title( __( 'Do you need more info about WooCommerce Subscriptions?', 'woocommerce-admin' ) );
$note->set_content( __( 'WooCommerce Subscriptions allows you to introduce a variety of subscriptions for physical or virtual products and services. Create product-of-the-month clubs, weekly service subscriptions or even yearly software billing packages. Add sign-up fees, offer free trials, or set expiration periods.', 'woocommerce-admin' ) ); $note->set_content( __( 'WooCommerce Subscriptions allows you to introduce a variety of subscriptions for physical or virtual products and services. Create product-of-the-month clubs, weekly service subscriptions or even yearly software billing packages. Add sign-up fees, offer free trials, or set expiration periods.', 'woocommerce-admin' ) );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
$note->set_name( self::NOTE_NAME ); $note->set_name( self::NOTE_NAME );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
@ -50,7 +52,7 @@ class WC_Admin_Notes_WooCommerce_Subscriptions {
'learn-more', 'learn-more',
__( 'Learn More', 'woocommerce-admin' ), __( 'Learn More', 'woocommerce-admin' ),
'https://woocommerce.com/products/woocommerce-subscriptions/?utm_source=inbox', 'https://woocommerce.com/products/woocommerce-subscriptions/?utm_source=inbox',
'actioned', Note::E_WC_ADMIN_NOTE_UNACTIONED,
true true
); );
return $note; return $note;

View File

@ -10,9 +10,9 @@ namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
/** /**
* WC_Admin_Notes_Woo_Subscriptions_Notes * Woo_Subscriptions_Notes
*/ */
class WC_Admin_Notes_Woo_Subscriptions_Notes { class Woo_Subscriptions_Notes {
const LAST_REFRESH_OPTION_KEY = 'woocommerce_admin-wc-helper-last-refresh'; const LAST_REFRESH_OPTION_KEY = 'woocommerce_admin-wc-helper-last-refresh';
const CONNECTION_NOTE_NAME = 'wc-admin-wc-helper-connection'; const CONNECTION_NOTE_NAME = 'wc-admin-wc-helper-connection';
const SUBSCRIPTION_NOTE_NAME = 'wc-admin-wc-helper-subscription'; const SUBSCRIPTION_NOTE_NAME = 'wc-admin-wc-helper-subscription';
@ -170,26 +170,26 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
* Clears all connection or subscription notes. * Clears all connection or subscription notes.
*/ */
public function remove_notes() { public function remove_notes() {
WC_Admin_Notes::delete_notes_with_name( self::CONNECTION_NOTE_NAME ); Notes::delete_notes_with_name( self::CONNECTION_NOTE_NAME );
WC_Admin_Notes::delete_notes_with_name( self::SUBSCRIPTION_NOTE_NAME ); Notes::delete_notes_with_name( self::SUBSCRIPTION_NOTE_NAME );
} }
/** /**
* Adds a note prompting to connect to WooCommerce.com. * Adds a note prompting to connect to WooCommerce.com.
*/ */
public function add_no_connection_note() { public function add_no_connection_note() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( __( 'Connect to WooCommerce.com', 'woocommerce-admin' ) ); $note->set_title( __( 'Connect to WooCommerce.com', 'woocommerce-admin' ) );
$note->set_content( __( 'Connect to get important product notifications and updates.', 'woocommerce-admin' ) ); $note->set_content( __( 'Connect to get important product notifications and updates.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() ); $note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::CONNECTION_NOTE_NAME ); $note->set_name( self::CONNECTION_NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->add_action( $note->add_action(
'connect', 'connect',
__( 'Connect', 'woocommerce-admin' ), __( 'Connect', 'woocommerce-admin' ),
'?page=wc-addons&section=helper', '?page=wc-addons&section=helper',
WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED Note::E_WC_ADMIN_NOTE_UNACTIONED
); );
$note->save(); $note->save();
} }
@ -197,7 +197,7 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
/** /**
* Gets the product_id (if any) associated with a note. * Gets the product_id (if any) associated with a note.
* *
* @param WC_Admin_Note $note The note object to interrogate. * @param Note $note The note object to interrogate.
* @return int|false * @return int|false
*/ */
public function get_product_id_from_subscription_note( &$note ) { public function get_product_id_from_subscription_note( &$note ) {
@ -220,7 +220,7 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
$note_ids = $data_store->get_notes_with_name( self::SUBSCRIPTION_NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::SUBSCRIPTION_NOTE_NAME );
foreach ( (array) $note_ids as $note_id ) { foreach ( (array) $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
$product_id = $this->get_product_id_from_subscription_note( $note ); $product_id = $this->get_product_id_from_subscription_note( $note );
if ( ! empty( $product_id ) ) { if ( ! empty( $product_id ) ) {
if ( ! in_array( $product_id, $active_product_ids, true ) ) { if ( ! in_array( $product_id, $active_product_ids, true ) ) {
@ -234,7 +234,7 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
* Finds a note for a given product ID, if the note exists at all. * Finds a note for a given product ID, if the note exists at all.
* *
* @param int $product_id The product ID to search for. * @param int $product_id The product ID to search for.
* @return WC_Admin_Note|false * @return Note|false
*/ */
public function find_note_for_product_id( $product_id ) { public function find_note_for_product_id( $product_id ) {
$product_id = intval( $product_id ); $product_id = intval( $product_id );
@ -242,7 +242,7 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$note_ids = $data_store->get_notes_with_name( self::SUBSCRIPTION_NOTE_NAME ); $note_ids = $data_store->get_notes_with_name( self::SUBSCRIPTION_NOTE_NAME );
foreach ( (array) $note_ids as $note_id ) { foreach ( (array) $note_ids as $note_id ) {
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
$found_product_id = $this->get_product_id_from_subscription_note( $note ); $found_product_id = $this->get_product_id_from_subscription_note( $note );
if ( $product_id === $found_product_id ) { if ( $product_id === $found_product_id ) {
@ -326,12 +326,12 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
); );
if ( ! $note ) { if ( ! $note ) {
$note = new WC_Admin_Note(); $note = new Note();
} }
// Reset everything in case we are repurposing an expired note as an expiring note. // Reset everything in case we are repurposing an expired note as an expiring note.
$note->set_title( $note_title ); $note->set_title( $note_title );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING ); $note->set_type( Note::E_WC_ADMIN_NOTE_WARNING );
$note->set_name( self::SUBSCRIPTION_NOTE_NAME ); $note->set_name( self::SUBSCRIPTION_NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->clear_actions(); $note->clear_actions();
@ -388,13 +388,13 @@ class WC_Admin_Notes_Woo_Subscriptions_Notes {
); );
if ( ! $note ) { if ( ! $note ) {
$note = new WC_Admin_Note(); $note = new Note();
} }
$note->set_title( $note_title ); $note->set_title( $note_title );
$note->set_content( $note_content ); $note->set_content( $note_content );
$note->set_content_data( $note_content_data ); $note->set_content_data( $note_content_data );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING ); $note->set_type( Note::E_WC_ADMIN_NOTE_WARNING );
$note->set_name( self::SUBSCRIPTION_NOTE_NAME ); $note->set_name( self::SUBSCRIPTION_NOTE_NAME );
$note->set_source( 'woocommerce-admin' ); $note->set_source( 'woocommerce-admin' );
$note->clear_actions(); $note->clear_actions();

View File

@ -11,7 +11,7 @@ namespace Automattic\WooCommerce\Admin\Composer;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Deactivate_Plugin; use Automattic\WooCommerce\Admin\Notes\Deactivate_Plugin;
use Automattic\WooCommerce\Admin\FeaturePlugin; use Automattic\WooCommerce\Admin\FeaturePlugin;
/** /**
@ -49,7 +49,7 @@ class Package {
// Avoid double initialization when the feature plugin is in use. // Avoid double initialization when the feature plugin is in use.
if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) { if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
self::$active_version = WC_ADMIN_VERSION_NUMBER; self::$active_version = WC_ADMIN_VERSION_NUMBER;
$update_version = new WC_Admin_Notes_Deactivate_Plugin(); $update_version = new Deactivate_Plugin();
if ( version_compare( WC_ADMIN_VERSION_NUMBER, self::VERSION, '<' ) ) { if ( version_compare( WC_ADMIN_VERSION_NUMBER, self::VERSION, '<' ) ) {
if ( method_exists( $update_version, 'possibly_add_note' ) ) { if ( method_exists( $update_version, 'possibly_add_note' ) ) {
$update_version::possibly_add_note(); $update_version::possibly_add_note();
@ -123,7 +123,7 @@ class Package {
* Add deactivation hook for versions of the plugin that don't have the deactivation note. * Add deactivation hook for versions of the plugin that don't have the deactivation note.
*/ */
public static function on_deactivation() { public static function on_deactivation() {
$update_version = new WC_Admin_Notes_Deactivate_Plugin(); $update_version = new Deactivate_Plugin();
$update_version::delete_note(); $update_version::delete_note();
} }
} }

View File

@ -7,7 +7,7 @@ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use \Automattic\WooCommerce\Admin\Notes\Note;
/** /**
* Evaluates the spec and returns a status. * Evaluates the spec and returns a status.
@ -33,10 +33,10 @@ class EvaluateAndGetStatus {
// Pending notes should be the spec status if the spec passes, // Pending notes should be the spec status if the spec passes,
// left alone otherwise. // left alone otherwise.
if ( WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING === $current_status ) { if ( Note::E_WC_ADMIN_NOTE_PENDING === $current_status ) {
return $evaluated_result return $evaluated_result
? $spec->status ? $spec->status
: WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING; : Note::E_WC_ADMIN_NOTE_PENDING;
} }
// When allow_redisplay isn't set, just leave the note alone. // When allow_redisplay isn't set, just leave the note alone.
@ -46,7 +46,7 @@ class EvaluateAndGetStatus {
// allow_redisplay is set, unaction the note if eval to true. // allow_redisplay is set, unaction the note if eval to true.
return $evaluated_result return $evaluated_result
? WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED ? Note::E_WC_ADMIN_NOTE_UNACTIONED
: $current_status; : $current_status;
} }
} }

View File

@ -7,8 +7,8 @@ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;
defined( 'ABSPATH' ) || exit; defined( 'ABSPATH' ) || exit;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use \Automattic\WooCommerce\Admin\Notes\Note;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
/** /**
* Runs a single spec. * Runs a single spec.
@ -26,10 +26,10 @@ class SpecRunner {
// Create or update the note. // Create or update the note.
$existing_note_ids = $data_store->get_notes_with_name( $spec->slug ); $existing_note_ids = $data_store->get_notes_with_name( $spec->slug );
if ( 0 === count( $existing_note_ids ) ) { if ( 0 === count( $existing_note_ids ) ) {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING ); $note->set_status( Note::E_WC_ADMIN_NOTE_PENDING );
} else { } else {
$note = WC_Admin_Notes::get_note( $existing_note_ids[0] ); $note = Notes::get_note( $existing_note_ids[0] );
if ( false === $note ) { if ( false === $note ) {
return; return;
} }

View File

@ -5,8 +5,8 @@
* @package WooCommerce\Admin\Tests\API * @package WooCommerce\Admin\Tests\API
*/ */
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use Automattic\WooCommerce\Admin\Notes\Note;
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use Automattic\WooCommerce\Admin\Notes\Notes;
/** /**
* Class WC_Tests_API_Admin_Notes * Class WC_Tests_API_Admin_Notes
@ -64,14 +64,14 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$this->assertEquals( 1, $note['id'] ); $this->assertEquals( 1, $note['id'] );
$this->assertEquals( 'PHPUNIT_TEST_NOTE_NAME', $note['name'] ); $this->assertEquals( 'PHPUNIT_TEST_NOTE_NAME', $note['name'] );
$this->assertEquals( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL, $note['type'] ); $this->assertEquals( Note::E_WC_ADMIN_NOTE_INFORMATIONAL, $note['type'] );
$this->assertArrayHasKey( 'locale', $note ); $this->assertArrayHasKey( 'locale', $note );
$this->assertEquals( 'PHPUNIT_TEST_NOTE_1_TITLE', $note['title'] ); $this->assertEquals( 'PHPUNIT_TEST_NOTE_1_TITLE', $note['title'] );
$this->assertEquals( 'PHPUNIT_TEST_NOTE_1_CONTENT', $note['content'] ); $this->assertEquals( 'PHPUNIT_TEST_NOTE_1_CONTENT', $note['content'] );
$this->assertArrayHasKey( 'content_data', $note ); $this->assertArrayHasKey( 'content_data', $note );
$this->assertEquals( 1.23, $note['content_data']->amount ); $this->assertEquals( 1.23, $note['content_data']->amount );
$this->assertEquals( WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED, $note['status'] ); $this->assertEquals( Note::E_WC_ADMIN_NOTE_UNACTIONED, $note['status'] );
$this->assertEquals( 'PHPUNIT_TEST', $note['source'] ); $this->assertEquals( 'PHPUNIT_TEST', $note['source'] );
$this->assertArrayHasKey( 'date_created', $note ); $this->assertArrayHasKey( 'date_created', $note );
@ -230,7 +230,7 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$this->assertEquals( $notes[0]['title'], 'PHPUNIT_TEST_NOTE_3_TITLE' ); $this->assertEquals( $notes[0]['title'], 'PHPUNIT_TEST_NOTE_3_TITLE' );
// The test snoozed note's reminder date is an hour ago. // The test snoozed note's reminder date is an hour ago.
WC_Admin_Notes::unsnooze_notes(); Notes::unsnooze_notes();
$response = $this->server->dispatch( $request ); $response = $this->server->dispatch( $request );
$notes = $response->get_data(); $notes = $response->get_data();
@ -273,10 +273,10 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$notes = $response->get_data(); $notes = $response->get_data();
$this->assertEquals( 4, count( $notes ) ); $this->assertEquals( 4, count( $notes ) );
$this->assertEquals( $notes[0]['status'], WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED ); $this->assertEquals( $notes[0]['status'], Note::E_WC_ADMIN_NOTE_UNACTIONED );
$this->assertEquals( $notes[1]['status'], WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED ); $this->assertEquals( $notes[1]['status'], Note::E_WC_ADMIN_NOTE_UNACTIONED );
$this->assertEquals( $notes[2]['status'], WC_Admin_Note::E_WC_ADMIN_NOTE_SNOOZED ); $this->assertEquals( $notes[2]['status'], Note::E_WC_ADMIN_NOTE_SNOOZED );
$this->assertEquals( $notes[3]['status'], WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); $this->assertEquals( $notes[3]['status'], Note::E_WC_ADMIN_NOTE_ACTIONED );
} }
/** /**

View File

@ -5,7 +5,7 @@
* @package WooCommerce\Admin\Tests\Framework\Helpers * @package WooCommerce\Admin\Tests\Framework\Helpers
*/ */
use Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use Automattic\WooCommerce\Admin\Notes\Note;
/** /**
* Class WC_Helper_Admin_Notes. * Class WC_Helper_Admin_Notes.
@ -29,11 +29,11 @@ class WC_Helper_Admin_Notes {
public static function add_notes_for_tests() { public static function add_notes_for_tests() {
$data_store = WC_Data_Store::load( 'admin-note' ); $data_store = WC_Data_Store::load( 'admin-note' );
$note_1 = new WC_Admin_Note(); $note_1 = new Note();
$note_1->set_title( 'PHPUNIT_TEST_NOTE_1_TITLE' ); $note_1->set_title( 'PHPUNIT_TEST_NOTE_1_TITLE' );
$note_1->set_content( 'PHPUNIT_TEST_NOTE_1_CONTENT' ); $note_1->set_content( 'PHPUNIT_TEST_NOTE_1_CONTENT' );
$note_1->set_content_data( (object) array( 'amount' => 1.23 ) ); $note_1->set_content_data( (object) array( 'amount' => 1.23 ) );
$note_1->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note_1->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note_1->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note_1->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note_1->set_source( 'PHPUNIT_TEST' ); $note_1->set_source( 'PHPUNIT_TEST' );
$note_1->set_is_snoozable( false ); $note_1->set_is_snoozable( false );
@ -51,39 +51,39 @@ class WC_Helper_Admin_Notes {
); );
$note_1->save(); $note_1->save();
$note_2 = new WC_Admin_Note(); $note_2 = new Note();
$note_2->set_title( 'PHPUNIT_TEST_NOTE_2_TITLE' ); $note_2->set_title( 'PHPUNIT_TEST_NOTE_2_TITLE' );
$note_2->set_content( 'PHPUNIT_TEST_NOTE_2_CONTENT' ); $note_2->set_content( 'PHPUNIT_TEST_NOTE_2_CONTENT' );
$note_2->set_content_data( (object) array( 'amount' => 4.56 ) ); $note_2->set_content_data( (object) array( 'amount' => 4.56 ) );
$note_2->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING ); $note_2->set_type( Note::E_WC_ADMIN_NOTE_WARNING );
$note_2->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note_2->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note_2->set_source( 'PHPUNIT_TEST' ); $note_2->set_source( 'PHPUNIT_TEST' );
$note_2->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); $note_2->set_status( Note::E_WC_ADMIN_NOTE_ACTIONED );
$note_2->set_is_snoozable( true ); $note_2->set_is_snoozable( true );
$note_2->set_layout( 'banner' ); $note_2->set_layout( 'banner' );
$note_2->set_image( 'https://an-image.jpg' ); $note_2->set_image( 'https://an-image.jpg' );
// This note has no actions. // This note has no actions.
$note_2->save(); $note_2->save();
$note_3 = new WC_Admin_Note(); $note_3 = new Note();
$note_3->set_title( 'PHPUNIT_TEST_NOTE_3_TITLE' ); $note_3->set_title( 'PHPUNIT_TEST_NOTE_3_TITLE' );
$note_3->set_content( 'PHPUNIT_TEST_NOTE_3_CONTENT' ); $note_3->set_content( 'PHPUNIT_TEST_NOTE_3_CONTENT' );
$note_3->set_content_data( (object) array( 'amount' => 7.89 ) ); $note_3->set_content_data( (object) array( 'amount' => 7.89 ) );
$note_3->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note_3->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note_3->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note_3->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note_3->set_source( 'PHPUNIT_TEST' ); $note_3->set_source( 'PHPUNIT_TEST' );
$note_3->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_SNOOZED ); $note_3->set_status( Note::E_WC_ADMIN_NOTE_SNOOZED );
$note_3->set_date_reminder( time() - HOUR_IN_SECONDS ); $note_3->set_date_reminder( time() - HOUR_IN_SECONDS );
$note_3->set_layout( 'thumbnail' ); $note_3->set_layout( 'thumbnail' );
$note_3->set_image( 'https://an-image.jpg' ); $note_3->set_image( 'https://an-image.jpg' );
// This note has no actions. // This note has no actions.
$note_3->save(); $note_3->save();
$note_4 = new WC_Admin_Note(); $note_4 = new Note();
$note_4->set_title( 'PHPUNIT_TEST_NOTE_4_TITLE' ); $note_4->set_title( 'PHPUNIT_TEST_NOTE_4_TITLE' );
$note_4->set_content( 'PHPUNIT_TEST_NOTE_4_CONTENT' ); $note_4->set_content( 'PHPUNIT_TEST_NOTE_4_CONTENT' );
$note_4->set_content_data( (object) array( 'amount' => 1.23 ) ); $note_4->set_content_data( (object) array( 'amount' => 1.23 ) );
$note_4->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note_4->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note_4->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note_4->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note_4->set_source( 'PHPUNIT_TEST' ); $note_4->set_source( 'PHPUNIT_TEST' );
$note_4->set_is_snoozable( false ); $note_4->set_is_snoozable( false );

View File

@ -5,9 +5,9 @@
* @package WooCommerce\Admin\Tests\Notes * @package WooCommerce\Admin\Tests\Notes
*/ */
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use \Automattic\WooCommerce\Admin\Notes\Note;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments; use \Automattic\WooCommerce\Admin\Notes\WooCommerce_Payments;
/** /**
* Class WC_Tests_Marketing_Notes * Class WC_Tests_Marketing_Notes
@ -20,10 +20,10 @@ class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case {
public function test_add_remove_marketing_note() { public function test_add_remove_marketing_note() {
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( 'PHPUNIT_TEST_MARKETING_NOTE' ); $note->set_title( 'PHPUNIT_TEST_MARKETING_NOTE' );
$note->set_content( 'PHPUNIT_TEST_MARKETING_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_MARKETING_NOTE_CONTENT' );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); $note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
$note->set_name( 'PHPUNIT_TEST_MARKETING_NOTE_NAME' ); $note->set_name( 'PHPUNIT_TEST_MARKETING_NOTE_NAME' );
$note->set_source( 'PHPUNIT_TEST' ); $note->set_source( 'PHPUNIT_TEST' );
$note->set_is_snoozable( false ); $note->set_is_snoozable( false );
@ -32,7 +32,7 @@ class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case {
// Load all marketing notes and check that the note was successfully saved. // Load all marketing notes and check that the note was successfully saved.
$notes = $data_store->get_notes( $notes = $data_store->get_notes(
array( array(
'type' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ), 'type' => array( Note::E_WC_ADMIN_NOTE_MARKETING ),
) )
); );
@ -44,7 +44,7 @@ class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case {
// Reload all marketing notes to verify they have been removed. // Reload all marketing notes to verify they have been removed.
$notes = $data_store->get_notes( $notes = $data_store->get_notes(
array( array(
'type' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ), 'type' => array( Note::E_WC_ADMIN_NOTE_MARKETING ),
) )
); );
@ -61,13 +61,13 @@ class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case {
// Set user preferences to disallow marketing suggestions. // Set user preferences to disallow marketing suggestions.
update_option( 'woocommerce_show_marketplace_suggestions', 'no' ); update_option( 'woocommerce_show_marketplace_suggestions', 'no' );
WC_Admin_Notes_WooCommerce_Payments::possibly_add_note(); WooCommerce_Payments::possibly_add_note();
// Load all marketing notes and check that the note was not added. // Load all marketing notes and check that the note was not added.
$data_store = \WC_Data_Store::load( 'admin-note' ); $data_store = \WC_Data_Store::load( 'admin-note' );
$notes = $data_store->get_notes( $notes = $data_store->get_notes(
array( array(
'type' => array( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ), 'type' => array( Note::E_WC_ADMIN_NOTE_MARKETING ),
) )
); );

View File

@ -5,8 +5,8 @@
* @package WooCommerce\Admin\Tests\Notes * @package WooCommerce\Admin\Tests\Notes
*/ */
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes; use \Automattic\WooCommerce\Admin\Notes\Notes;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Note; use \Automattic\WooCommerce\Admin\Notes\Note;
/** /**
* Class WC_Tests_Notes_Data_Store * Class WC_Tests_Notes_Data_Store
@ -17,10 +17,10 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
* Tests that the read data store method works as expected. * Tests that the read data store method works as expected.
*/ */
public function test_read() { public function test_read() {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( 'PHPUNIT_TEST_NOTE' ); $note->set_title( 'PHPUNIT_TEST_NOTE' );
$note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note->set_source( 'PHPUNIT_TEST' ); $note->set_source( 'PHPUNIT_TEST' );
$note->set_is_snoozable( false ); $note->set_is_snoozable( false );
@ -35,7 +35,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
$note->save(); $note->save();
// Load in a new instance of the note. // Load in a new instance of the note.
$read_note = new WC_Admin_Note(); $read_note = new Note();
$read_note->set_id( $note->get_id() ); $read_note->set_id( $note->get_id() );
WC_Data_Store::load( 'admin-note' )->read( $read_note ); WC_Data_Store::load( 'admin-note' )->read( $read_note );
@ -58,7 +58,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
global $wpdb; global $wpdb;
$data_store = WC_Data_Store::load( 'admin-note' ); $data_store = WC_Data_Store::load( 'admin-note' );
$note = new WC_Admin_Note(); $note = new Note();
$note->set_title( 'PHPUNIT_TEST_NOTE' ); $note->set_title( 'PHPUNIT_TEST_NOTE' );
$note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' );
$note->save(); $note->save();
@ -107,7 +107,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
// Create notes. // Create notes.
foreach ( $note_names as $note_name ) { foreach ( $note_names as $note_name ) {
for ( $i = 0; $i < 3; $i++ ) { for ( $i = 0; $i < 3; $i++ ) {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_name( $note_name ); $note->set_name( $note_name );
$note->set_title( 'PHPUNIT_TEST_NOTE' ); $note->set_title( 'PHPUNIT_TEST_NOTE' );
$note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' );
@ -126,7 +126,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
); );
// Delete the notes. // Delete the notes.
WC_Admin_Notes::delete_notes_with_name( $note_name_to_delete ); Notes::delete_notes_with_name( $note_name_to_delete );
// Make sure the notes were deleted. // Make sure the notes were deleted.
$this->assertEquals( $this->assertEquals(
@ -158,7 +158,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
// Create notes. // Create notes.
foreach ( $note_names as $note_name ) { foreach ( $note_names as $note_name ) {
for ( $i = 0; $i < 3; $i++ ) { for ( $i = 0; $i < 3; $i++ ) {
$note = new WC_Admin_Note(); $note = new Note();
$note->set_name( $note_name ); $note->set_name( $note_name );
$note->set_title( 'PHPUNIT_TEST_NOTE' ); $note->set_title( 'PHPUNIT_TEST_NOTE' );
$note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' );
@ -181,7 +181,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
); );
// Delete the notes. // Delete the notes.
WC_Admin_Notes::delete_notes_with_name( Notes::delete_notes_with_name(
array( array(
$note_name_to_delete_1, $note_name_to_delete_1,
$note_name_to_delete_2, $note_name_to_delete_2,
@ -208,7 +208,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
*/ */
public function test_read_throws_exception() { public function test_read_throws_exception() {
// Create a test note. // Create a test note.
$note = new WC_Admin_Note(); $note = new Note();
$note->set_name( 'PHPUNIT_TEST_NOTE_NAME' ); $note->set_name( 'PHPUNIT_TEST_NOTE_NAME' );
$note->set_title( 'PHPUNIT_TEST_NOTE_TITLE' ); $note->set_title( 'PHPUNIT_TEST_NOTE_TITLE' );
$note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' ); $note->set_content( 'PHPUNIT_TEST_NOTE_CONTENT' );
@ -232,7 +232,7 @@ class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case {
add_filter( 'woocommerce_admin-note_data_store', $filter_datastore ); add_filter( 'woocommerce_admin-note_data_store', $filter_datastore );
// Attempt to retrieve the test note. // Attempt to retrieve the test note.
$note = WC_Admin_Notes::get_note( $note_id ); $note = Notes::get_note( $note_id );
remove_filter( 'woocommerce_admin-note_data_store', $filter_datastore ); remove_filter( 'woocommerce_admin-note_data_store', $filter_datastore );