Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories\Admin
UI::admin_notices()
Displays any admin notices that might be needed.
Method of the class: UI{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->admin_notices();
UI::admin_notices() UI::admin notices code WC 9.8.2
private function admin_notices() { // phpcs:disable WordPress.Security.NonceVerification.Recommended $successfully_deleted = isset( $_GET['deleted-ids'] ) ? (int) $_GET['deleted-ids'] : 0; $successfully_enabled = isset( $_GET['enabled-ids'] ) ? (int) $_GET['enabled-ids'] : 0; $successfully_disabled = isset( $_GET['disabled-ids'] ) ? (int) $_GET['disabled-ids'] : 0; $failed_updates = isset( $_GET['bulk-fails'] ) ? (int) $_GET['bulk-fails'] : 0; $edit_status = sanitize_text_field( wp_unslash( $_GET['edit-status'] ?? '' ) ); $edit_url = esc_attr( sanitize_text_field( wp_unslash( $_GET['submitted-url'] ?? '' ) ) ); // phpcs:enable if ( $successfully_deleted ) { WC_Admin_Settings::add_message( sprintf( /* translators: %d: count */ _n( '%d approved directory URL deleted.', '%d approved directory URLs deleted.', $successfully_deleted, 'woocommerce' ), $successfully_deleted ) ); } elseif ( $successfully_enabled ) { WC_Admin_Settings::add_message( sprintf( /* translators: %d: count */ _n( '%d approved directory URL enabled.', '%d approved directory URLs enabled.', $successfully_enabled, 'woocommerce' ), $successfully_enabled ) ); } elseif ( $successfully_disabled ) { WC_Admin_Settings::add_message( sprintf( /* translators: %d: count */ _n( '%d approved directory URL disabled.', '%d approved directory URLs disabled.', $successfully_disabled, 'woocommerce' ), $successfully_disabled ) ); } if ( $failed_updates ) { WC_Admin_Settings::add_error( sprintf( /* translators: %d: count */ _n( '%d URL could not be updated.', '%d URLs could not be updated.', $failed_updates, 'woocommerce' ), $failed_updates ) ); } if ( 'added' === $edit_status ) { WC_Admin_Settings::add_message( __( 'URL was successfully added.', 'woocommerce' ) ); } if ( 'updated' === $edit_status ) { WC_Admin_Settings::add_message( __( 'URL was successfully updated.', 'woocommerce' ) ); } if ( 'failure' === $edit_status && ! empty( $edit_url ) ) { WC_Admin_Settings::add_error( sprintf( /* translators: %s is the submitted URL. */ __( '"%s" could not be saved. Please review, ensure it is a valid URL and try again.', 'woocommerce' ), $edit_url ) ); } }