From 6b81fe154233509729eef09960555d909fc4d0a5 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Thu, 14 Sep 2017 18:49:53 -0700
Subject: [PATCH] Switch remaining classes to trait

---
 includes/class-delete-permanently.php | 16 +++++-----------
 includes/class-edit.php               | 16 +++++-----------
 includes/class-move-to-trash.php      | 16 +++++-----------
 includes/class-restore-from-trash.php | 16 +++++-----------
 4 files changed, 20 insertions(+), 44 deletions(-)

diff --git a/includes/class-delete-permanently.php b/includes/class-delete-permanently.php
index f801855..5d989b4 100644
--- a/includes/class-delete-permanently.php
+++ b/includes/class-delete-permanently.php
@@ -12,22 +12,16 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
  */
 class Delete_Permanently {
 	/**
-	 * Class constants
+	 * Common hooks and such
 	 */
-	const ACTION = 'delete';
-
-	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_delete_permanently';
+	use Bulk_Actions;
 
 	/**
-	 * Register this bulk process' hooks
+	 * Class constants
 	 */
-	public static function register_hooks() {
-		add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) );
-		add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) );
+	const ACTION = 'delete';
 
-		add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
-		add_filter( 'posts_where', array( __CLASS__, 'hide_posts' ), 999, 2 );
-	}
+	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_delete_permanently';
 
 	/**
 	 * Handle a request to delete selected posts from the trash
diff --git a/includes/class-edit.php b/includes/class-edit.php
index 522eace..2e7ce48 100644
--- a/includes/class-edit.php
+++ b/includes/class-edit.php
@@ -12,22 +12,16 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
  */
 class Edit {
 	/**
-	 * Class constants
+	 * Common hooks and such
 	 */
-	const ACTION = 'edit';
-
-	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_edit';
+	use Bulk_Actions;
 
 	/**
-	 * Register this bulk process' hooks
+	 * Class constants
 	 */
-	public static function register_hooks() {
-		add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) );
-		add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) );
+	const ACTION = 'edit';
 
-		add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
-		add_filter( 'posts_where', array( __CLASS__, 'hide_posts' ), 999, 2 );
-	}
+	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_edit';
 
 	/**
 	 * Handle a request to edit some posts
diff --git a/includes/class-move-to-trash.php b/includes/class-move-to-trash.php
index 2a9f786..51d60b1 100644
--- a/includes/class-move-to-trash.php
+++ b/includes/class-move-to-trash.php
@@ -12,22 +12,16 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
  */
 class Move_To_Trash {
 	/**
-	 * Class constants
+	 * Common hooks and such
 	 */
-	const ACTION = 'trash';
-
-	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_move_to_trash';
+	use Bulk_Actions;
 
 	/**
-	 * Register this bulk process' hooks
+	 * Class constants
 	 */
-	public static function register_hooks() {
-		add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) );
-		add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) );
+	const ACTION = 'trash';
 
-		add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
-		add_filter( 'posts_where', array( __CLASS__, 'hide_posts' ), 999, 2 );
-	}
+	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_move_to_trash';
 
 	/**
 	 * Handle a request to move some posts to the trash
diff --git a/includes/class-restore-from-trash.php b/includes/class-restore-from-trash.php
index 59ccbe4..2b982be 100644
--- a/includes/class-restore-from-trash.php
+++ b/includes/class-restore-from-trash.php
@@ -12,22 +12,16 @@ namespace Automattic\WP\Bulk_Actions_Cron_Offload;
  */
 class Restore_From_Trash {
 	/**
-	 * Class constants
+	 * Common hooks and such
 	 */
-	const ACTION = 'untrash';
-
-	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_restore_from_trash';
+	use Bulk_Actions;
 
 	/**
-	 * Register this bulk process' hooks
+	 * Class constants
 	 */
-	public static function register_hooks() {
-		add_action( Main::build_hook( self::ACTION ), array( __CLASS__, 'process' ) );
-		add_action( Main::build_cron_hook( self::ACTION ), array( __CLASS__, 'process_via_cron' ) );
+	const ACTION = 'untrash';
 
-		add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
-		add_filter( 'posts_where', array( __CLASS__, 'hide_posts' ), 999, 2 );
-	}
+	const ADMIN_NOTICE_KEY = 'bulk_actions_cron_offload_restore_from_trash';
 
 	/**
 	 * Handle a request to restore some posts from the trash
-- 
GitLab