* Fix-woocommerce/woocommerce-admin#1982 * Fix-woocommerce/woocommerce-admin#1982 #Tabs replaced with spaces * woocommerce/woocommerce-admin#1982 * Fix-woocommerce/woocommerce-admin#1982 Resolved Inline comments must end in full-stops, exclamation marks, or question marks. * update with tabs fixes formatting * update woocommerce-admin.php tab formatting fixes. * Update woocommerce-admin.php Update Co-Authored-By: Mr-AjayM <32254909+Mr-AjayM@users.noreply.github.com> * Update woocommerce-admin.php remove leading / Co-Authored-By: Mr-AjayM <32254909+Mr-AjayM@users.noreply.github.com>
This commit is contained in:
parent
d38b888a2e
commit
4dddb62195
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WooCommerce Admin (Dashboard) Giving feedback notes provider.
|
||||||
|
*
|
||||||
|
* Adds notes to the merchant's inbox about giving feedback.
|
||||||
|
*
|
||||||
|
* @package WooCommerce Admin
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Admin_Notes_Giving_Feedback_Notes
|
||||||
|
*/
|
||||||
|
class WC_Admin_Notes_Giving_Feedback_Notes {
|
||||||
|
/**
|
||||||
|
* Add notes for admin giving feedback.
|
||||||
|
*/
|
||||||
|
public static function add_notes_for_admin_giving_feedback() {
|
||||||
|
self::possibly_add_admin_giving_feedback_note();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possibly add a notice setting moved note.
|
||||||
|
*/
|
||||||
|
protected static function possibly_add_admin_giving_feedback_note() {
|
||||||
|
$name = 'wc-admin-store-notice-giving-feedback';
|
||||||
|
|
||||||
|
$data_store = WC_Data_Store::load( 'admin-note' );
|
||||||
|
|
||||||
|
// We already have this note? Then exit, we're done.
|
||||||
|
$note_ids = $data_store->get_notes_with_name( $name );
|
||||||
|
if ( ! empty( $note_ids ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getting install timestamp reference class-wc-admin-install.php.
|
||||||
|
$wc_admin_installed = get_option( 'wc_admin_install_timestamp', false );
|
||||||
|
if ( false === $wc_admin_installed ) {
|
||||||
|
$wc_admin_installed = time();
|
||||||
|
update_option( 'wc_admin_install_timestamp', $wc_admin_installed );
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_time = time();
|
||||||
|
$three_days_in_seconds = 259200;
|
||||||
|
|
||||||
|
// We need to show Admin Giving feeback notification after 3 days of install.
|
||||||
|
if ( $current_time - $wc_admin_installed < $three_days_in_seconds ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, create our new note.
|
||||||
|
$note = new WC_Admin_Note();
|
||||||
|
$note->set_title( __( 'Giving feedback', 'woocommerce-admin' ) );
|
||||||
|
$note->set_content( __( 'Are you enjoying the new WooCommerce experience? We\'d love to get your feedback.', 'woocommerce-admin' ) );
|
||||||
|
$note->set_content_data( (object) array() );
|
||||||
|
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
||||||
|
$note->set_icon( 'info' );
|
||||||
|
$note->set_name( $name );
|
||||||
|
$note->set_source( 'woocommerce-admin' );
|
||||||
|
$note->add_action(
|
||||||
|
'share-feedback',
|
||||||
|
__( 'Share feedback', 'woocommerce-admin' ),
|
||||||
|
'https://github.com/woocommerce/woocommerce-admin/issues/new/choose'
|
||||||
|
);
|
||||||
|
$note->save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -153,6 +153,7 @@ add_action( 'admin_menu', 'wc_admin_devdocs' );
|
||||||
*/
|
*/
|
||||||
function wc_admin_do_wc_admin_daily() {
|
function wc_admin_do_wc_admin_daily() {
|
||||||
WC_Admin_Notes_New_Sales_Record::possibly_add_sales_record_note();
|
WC_Admin_Notes_New_Sales_Record::possibly_add_sales_record_note();
|
||||||
|
WC_Admin_Notes_Giving_Feedback_Notes::add_notes_for_admin_giving_feedback();
|
||||||
WC_Admin_Notes_Mobile_App::possibly_add_mobile_app_note();
|
WC_Admin_Notes_Mobile_App::possibly_add_mobile_app_note();
|
||||||
}
|
}
|
||||||
add_action( 'wc_admin_daily', 'wc_admin_do_wc_admin_daily' );
|
add_action( 'wc_admin_daily', 'wc_admin_do_wc_admin_daily' );
|
||||||
|
@ -207,9 +208,11 @@ function wc_admin_plugins_loaded() {
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/class-wc-admin-install.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/class-wc-admin-install.php';
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/class-wc-admin-api-init.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/class-wc-admin-api-init.php';
|
||||||
|
|
||||||
|
// 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.
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-new-sales-record.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-new-sales-record.php';
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-settings-notes.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-settings-notes.php';
|
||||||
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-giving-feedback-notes.php';
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-woo-subscriptions-notes.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-woo-subscriptions-notes.php';
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-historical-data.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-historical-data.php';
|
||||||
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-order-milestones.php';
|
require_once WC_ADMIN_ABSPATH . 'includes/notes/class-wc-admin-notes-order-milestones.php';
|
||||||
|
|
Loading…
Reference in New Issue