diff --git a/includes/class-delete-all.php b/includes/class-delete-all.php index dc540b562f8cf40ff73e5ede0018735b675c34e2..2f1da5efef33b27f64d6f32507e44afda89ca784 100644 --- a/includes/class-delete-all.php +++ b/includes/class-delete-all.php @@ -14,14 +14,16 @@ class Delete_All { /** * Class constants */ + const ACTION = 'delete_all'; + const ADMIN_NOTICE_KEY = 'bulk_edit_cron_offload_deleted_all'; /** * Register this bulk process' hooks */ public static function register_hooks() { - add_action( Main::build_hook( 'delete_all' ), array( __CLASS__, 'process' ) ); - add_action( Main::build_cron_hook( 'delete_all' ), array( __CLASS__, 'process_via_cron' ) ); + add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) ); + add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) ); add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) ); add_filter( 'posts_where', array( __CLASS__, 'hide_posts_pending_delete' ), 999, 2 ); @@ -39,7 +41,7 @@ class Delete_All { */ public static function process( $vars ) { // Special keys are used to trigger this request, and we need to remove them on redirect. - $extra_keys = array( 'delete_all', 'delete_all2' ); + $extra_keys = array( self::ACTION, self::ACTION . '2' ); $action_scheduled = self::action_next_scheduled( $vars->post_type ); @@ -224,7 +226,7 @@ class Delete_All { foreach ( $action_instances as $instance => $instance_args ) { $vars = array_shift( $instance_args['args'] ); - if ( 'delete_all' === $vars->action && $post_type === $vars->post_type ) { + if ( self::ACTION === $vars->action && $post_type === $vars->post_type ) { return array( 'timestamp' => $timestamp, 'args' => $vars, diff --git a/includes/class-move-to-trash.php b/includes/class-move-to-trash.php index edcd11eed855a9833ba16d1c60c369c08e4a74a9..3350e81e2ac1ef0cb80125b03c6f1287068274c7 100644 --- a/includes/class-move-to-trash.php +++ b/includes/class-move-to-trash.php @@ -14,14 +14,16 @@ class Move_To_Trash { /** * Class constants */ + const ACTION = 'trash'; + const ADMIN_NOTICE_KEY = 'bulk_edit_cron_offload_move_to_trash'; /** * Register this bulk process' hooks */ public static function register_hooks() { - add_action( Main::build_hook( 'trash' ), array( __CLASS__, 'process' ) ); - add_action( Main::build_cron_hook( 'trash' ), array( __CLASS__, 'process_via_cron' ) ); + add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) ); + add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) ); add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) ); add_filter( 'posts_where', array( __CLASS__, 'hide_posts_pending_move' ), 999, 2 ); @@ -187,7 +189,7 @@ class Move_To_Trash { foreach ( $action_instances as $instance => $instance_args ) { $vars = array_shift( $instance_args['args'] ); - if ( 'trash' === $vars->action && $post_type === $vars->post_type ) { + if ( self::ACTION === $vars->action && $post_type === $vars->post_type ) { if ( $post_status === $vars->post_status || 'all' === $vars->post_status || 'all' === $post_status ) { $ids[] = array( 'timestamp' => $timestamp,