From 8f3ea0806a1aba814a75473b8645c293549fddaa Mon Sep 17 00:00:00 2001
From: Jesse Hofmann-Smith <jesse@opensourcery.com>
Date: Thu, 14 Nov 2013 13:32:18 -0800
Subject: [PATCH] adding external url host token

---
 extlink_extra.module | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/extlink_extra.module b/extlink_extra.module
index 1609cc4..a52df0c 100644
--- a/extlink_extra.module
+++ b/extlink_extra.module
@@ -269,6 +269,10 @@ function extlink_extra_token_info() {
     'name' => t("External URL"), 
     'description' => t("The URL of the external site that the user has just clicked."),
   );
+  $extlinks['external-host'] = array(
+    'name' => t("External URL Host"),
+    'description' => t("The trimmed Hostname of the external site that the user has just clicked. Ex: If the raw URL is http://www.example.com/about, the output would be www.example.com"),
+  );
   $extlinks['back-url'] = array(
     'name' => t("Back URL"), 
     'description' => t("The URL of the page the user was on when they clicked the external link"),
@@ -293,6 +297,9 @@ function extlink_extra_tokens($type, $tokens, array $data = array(), array $opti
         case 'external-url':
           $replacements[$original] = $data['extlink']['external_url'];
           break;
+        case 'external-host':
+          $replacements[$original] = parse_url($data['extlink']['external_url'], PHP_URL_HOST);
+          break;
         case 'back-url':
           $replacements[$original] = $data['extlink']['back_url'];
           break;
-- 
1.8.3.4 (Apple Git-47)

