From 46a6ddc2d4280078575aa6ad956103c745756285 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Mon, 15 Feb 2016 22:04:24 -0800
Subject: [PATCH] Raw footer output

---
 eth-escape-headspace.php | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/eth-escape-headspace.php b/eth-escape-headspace.php
index a16f4b6..4a2a62f 100644
--- a/eth-escape-headspace.php
+++ b/eth-escape-headspace.php
@@ -45,9 +45,7 @@ class ETH_Escape_HeadSpace2 {
 	private $hs_string_keys = array(
 		'_headspace_description',
 		'_headspace_metakey',
-		'_headspace_page_title',
 		'_headspace_raw',
-		'_headspace_raw_footer',
 	);
 
 	private $hs_array_keys = array(
@@ -75,6 +73,7 @@ class ETH_Escape_HeadSpace2 {
 	 */
 	private function __construct() {
 		add_action( 'wp_head', array( $this, 'action_wp_head' ) );
+		add_action( 'wp_footer', array( $this, 'action_wp_footer' ) );
 	}
 
 	/**
@@ -163,7 +162,7 @@ class ETH_Escape_HeadSpace2 {
 		}
 
 		// Raw output should follow all other output
-		if ( isset( $hs_data[ '_headspace_raw' ] ) ) {
+		if ( isset( $hs_data[ '_headspace_raw' ] ) && ! empty( $hs_data[ '_headspace_raw' ] ) ) {
 			$output[] = $hs_data[ '_headspace_raw' ];
 		}
 
@@ -175,6 +174,17 @@ class ETH_Escape_HeadSpace2 {
 		// Mark end of output
 		echo "\n<!-- Escape HeadSpace2 -->\n";
 	}
+
+	/**
+	 *
+	 */
+	public function action_wp_footer() {
+		$output = get_post_meta( get_the_ID(), '_headspace_raw_footer', true );
+
+		if ( ! empty( $output ) ) {
+			echo $output . "\n";
+		}
+	}
 }
 
 ETH_Escape_HeadSpace2::get_instance();
-- 
GitLab