--- token_contrib.info
+++ token_contrib.info
@@ -0,0 +1,5 @@
+; $Id$
+name = Token contrib
+description = Provides additional tokens for some contributed modules.
+dependencies[] = token
+core = 6.x

--- token_contrib.module
+++ token_contrib.module
@@ -0,0 +1,35 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * The Token contrib module.
+ *
+ * The Token contrib module provides additional tokens for some contributed modules.
+ *
+ * @ingroup token
+ */
+
+/**
+ * General function to include the files that token relies on for the real work.
+ */
+function token_contrib_include() {
+  static $run = FALSE;
+
+  if (!$run) {
+    $run = TRUE;
+    $modules_enabled = array_keys(module_list());
+    $modules = array('views');
+    $modules = array_intersect($modules, $modules_enabled);
+    foreach ($modules as $module) {
+      module_load_include('inc', 'token', "token_$module");
+    }
+  }
+}
+
+/**
+ * Implementation of hook_init().
+ */
+function token_contrib_init() {
+  token_contrib_include();
+}

--- token_views.inc
+++ token_views.inc
@@ -0,0 +1,79 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Token module support for the Views module.
+ *
+ * This provides additional tokens for the Views module.
+ */
+
+/**
+ * Implementation of hook_token_list().
+ */
+function views_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'global' || $type == 'all') {
+    // List all views.
+    $views = views_get_all_views();
+
+    foreach ($views as $view) {
+      // Skip disabled views.
+      if (!empty($view->disabled)) {
+        continue;
+      }
+
+      foreach ($view->display as $display) {
+        if (isset($display->display_options['path'])) {
+          // Provide path tokens.
+          $tokens['views']['views-'. $view->name .'-'. $display->id .'-display-path'] = t('The path of the "'. $display->id .'" display of the "'. $view->name .'" view.');
+          $tokens['views']['views-'. $view->name .'-'. $display->id .'-display-path-raw'] = t('Unfiltered path of the "'. $display->id .'" display of the "'. $view->name .'" view.  WARNING - raw user input.');
+        }
+
+        if (isset($display->display_options['title'])) {
+          // Provide title tokens.
+          $tokens['views']['views-'. $view->name .'-'. $display->id .'-display-title'] = t('The title of the "'. $display->id .'" display of the "'. $view->name .'" view.');
+          $tokens['views']['views-'. $view->name .'-'. $display->id .'-display-title-raw'] = t('Unfiltered title of the "'. $display->id .'" display of the "'. $view->name .'" view.  WARNING - raw user input.');
+        }
+      }
+    }
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implementation of hook_token_values().
+ */
+function views_token_values($type, $object = NULL) {
+  $values = array();
+
+  if ($type == 'global') {
+    // List all views.
+    $views = views_get_all_views();
+
+    foreach ($views as $view) {
+      // Skip disabled views.
+      if (!empty($view->disabled)) {
+        continue;
+      }
+
+      foreach ($view->display as $display) {
+        if (isset($display->display_options['path'])) {
+          // Provide path tokens.
+          $values['views-'. $view->name .'-'. $display->id .'-display-path'] = decode_entities(check_plain($display->display_options['path']));
+          $values['views-'. $view->name .'-'. $display->id .'-display-path-raw'] = $display->display_options['path'];
+        }
+
+        if (isset($display->display_options['title'])) {
+          // Provide title tokens.
+          $values['views-'. $view->name .'-'. $display->id .'-display-title'] = decode_entities(check_plain($display->display_options['title']));
+          $values['views-'. $view->name .'-'. $display->id .'-display-title-raw'] = $display->display_options['title'];
+        }
+      }
+    }
+  }
+
+  return $values;
+}


