From aaeca400fdeb43977e7700bce805751fe9f9d567 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Tue, 28 Feb 2017 17:00:23 -0800
Subject: [PATCH] Helpers make this easier to follow

---
 includes/class-main.php | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/includes/class-main.php b/includes/class-main.php
index 2a33672..c56dd61 100644
--- a/includes/class-main.php
+++ b/includes/class-main.php
@@ -15,10 +15,12 @@ class Main {
 	 */
 	public static function intercept() {
 		// Nothing to do
-		if ( ! isset( $_REQUEST['action'] ) && ! isset( $_REQUEST['action2'] ) && ! isset( $_REQUEST['delete_all'] ) ) {
+		if ( ! self::should_intercept_request() ) {
 			return;
 		}
 
+		// TODO: nonce/referrer checks
+
 		// Parse request to determine what to do
 		$vars = self::capture_vars();
 
@@ -53,6 +55,13 @@ class Main {
 		}
 	}
 
+	/**
+	 * Determine if current request is a bulk edit
+	 */
+	private static function should_intercept_request() {
+		return isset( $_REQUEST['action'] ) || isset( $_REQUEST['action2'] ) || isset( $_REQUEST['delete_all'] );
+	}
+
 	/**
 	 * Capture relevant variables
 	 */
-- 
GitLab