Automattic\WooCommerce\Internal\Admin\ProductReviews

Reviews::get_bulk_action_notice_messages()protectedWC 1.0

Gets the applicable bulk action admin notice messages.

Method of the class: Reviews{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_bulk_action_notice_messages() : array;

Reviews::get_bulk_action_notice_messages() code WC 7.1.0

protected function get_bulk_action_notice_messages() : array {

	$approved   = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0;
	$unapproved = isset( $_REQUEST['unapproved'] ) ? (int) $_REQUEST['unapproved'] : 0;
	$deleted    = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
	$trashed    = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0;
	$untrashed  = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0;
	$spammed    = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0;
	$unspammed  = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;

	$messages = [];

	if ( $approved > 0 ) {
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review approved', '%s reviews approved', $approved, 'woocommerce' ), $approved );
	}

	if ( $unapproved > 0 ) {
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review unapproved', '%s reviews unapproved', $unapproved, 'woocommerce' ), $unapproved );
	}

	if ( $spammed > 0 ) {
		$ids = isset( $_REQUEST['ids'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['ids'] ) ) : 0;
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review marked as spam.', '%s reviews marked as spam.', $spammed, 'woocommerce' ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo', 'woocommerce' ) . '</a><br />';
	}

	if ( $unspammed > 0 ) {
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review restored from the spam', '%s reviews restored from the spam', $unspammed, 'woocommerce' ), $unspammed );
	}

	if ( $trashed > 0 ) {
		$ids = isset( $_REQUEST['ids'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['ids'] ) ) : 0;
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review moved to the Trash.', '%s reviews moved to the Trash.', $trashed, 'woocommerce' ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo', 'woocommerce' ) . '</a><br />';
	}

	if ( $untrashed > 0 ) {
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review restored from the Trash', '%s reviews restored from the Trash', $untrashed, 'woocommerce' ), $untrashed );
	}

	if ( $deleted > 0 ) {
		/* translators: %s is an integer higher than 0 (1, 2, 3...) */
		$messages[] = sprintf( _n( '%s review permanently deleted', '%s reviews permanently deleted', $deleted, 'woocommerce' ), $deleted );
	}

	return $messages;
}