From cbcea87158aba4cfd34f4716dc7ca4117572ee5a Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Sat, 30 Jan 2016 12:32:38 -0800
Subject: [PATCH] Retreive supported keys and begin approach to build output

---
 eth-escape-headspace.php | 48 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php
index 0613d95..49d3645 100644
--- a/eth-escape-headspace.php
+++ b/eth-escape-headspace.php
@@ -40,12 +40,56 @@ class ETH_Escape_HeadSpace2 {
 	}
 
 	/**
-	 * Register actions and filters
+	 * Class properties
+	 */
+	private $hs_keys = array(
+		'_headspace_description',
+		'_headspace_metakey',
+		'_headspace_noindex',
+	);
+
+	/**
+	 * Register plugin's hooks
 	 *
 	 * @return null
 	 */
 	private function __construct() {
-		//
+		add_action( 'wp_head', array( $this, 'action_wp_head' ) );
+	}
+
+	/**
+	 *
+	 */
+	public function action_wp_head() {
+		// Applies only to individual post objects
+		if ( ! is_singular() ) {
+			return;
+		}
+
+		// Check for HS data
+		$hs_data = array();
+
+		foreach ( $this->hs_keys as $hs_key ) {
+			$value = get_post_meta( get_the_ID(), $hs_key, true );
+
+			if ( ! empty( $value ) ) {
+				$hs_data[ $hs_key ] = $value;
+			}
+		}
+
+		// Bail if no HS data exists for this post
+		if ( empty( $hs_data ) ) {
+			return;
+		}
+
+		// Build output
+		foreach ( $hs_data as $hs_key => $hs_value ) {
+			switch( $hs_key ) {
+				default :
+					continue;
+					break;
+			}
+		}
 	}
 }
 
-- 
GitLab