Skip to content
Snippets Groups Projects
Commit 3c4fc0d9 authored by Erick Hitter's avatar Erick Hitter
Browse files

Trait to share stripping of initial redirect args

parent adb9ba18
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
namespace Automattic\WP\Bulk_Actions_Cron_Offload;
// Plugin dependencies.
require __DIR__ . '/includes/trait-remove-one-time-args.php';
require __DIR__ . '/includes/trait-bulk-actions.php';
require __DIR__ . '/includes/utils.php';
......
......@@ -11,6 +11,11 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
* Class Main
*/
class Main {
/**
* Strip notice arguments after the initial redirect
*/
use Remove_One_Time_Args;
/**
* Prefix for bulk-process hook invoked by request-specific classes
*/
......@@ -36,6 +41,7 @@ class Main {
add_action( 'load-edit.php', array( __CLASS__, 'intercept' ) );
add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
add_filter( 'removable_query_args', array( __CLASS__, 'remove_notice_arg' ) );
}
/**
......
......@@ -11,6 +11,11 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
* Trait Bulk_Actions
*/
trait Bulk_Actions {
/**
* Strip notice arguments after the initial redirect
*/
use Remove_One_Time_Args;
/**
* Register this bulk process' hooks
*/
......@@ -174,16 +179,4 @@ trait Bulk_Actions {
return $where;
}
/**
* Strip the custom notice key, otherwise it turns up in pagination and other unwanted places.
*
* @param array $args Array of one-time query args.
* @return array
*/
public static function remove_notice_arg( $args ) {
$args[] = self::ADMIN_NOTICE_KEY;
return $args;
}
}
<?php
/**
* Strip one-time arguments after redirects
*
* @package Bulk_Actions_Cron_Offload
*/
namespace Automattic\WP\Bulk_Actions_Cron_Offload;
/**
* Trait Remove_One_Time_Args
*/
trait Remove_One_Time_Args {
/**
* Strip the custom notice key, otherwise it turns up in pagination and other unwanted places.
*
* @param array $args Array of one-time query args.
* @return array
*/
public static function remove_notice_arg( $args ) {
$args[] = self::ADMIN_NOTICE_KEY;
return $args;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment