Index: nodewords.module
===================================================================
--- nodewords.module	(revision 916)
+++ nodewords.module	(working copy)
@@ -723,6 +723,18 @@
 function _nodewords_get_possible_tags() {
   static $tags;
   if (!isset($tags)) {
+    $tags = _nodewords_invoke($tags, 'list', $type, $ids);
+    sort($tags);
+  }
+  return $tags;
+}
+
+/**
+ * Return a list of plugins in the metatags directory
+ */
+function _nodewords_get_local_plugins() {
+  static $tags;
+  if (!isset($tags)) {
     $tags = array();
     $path = drupal_get_path('module', 'nodewords') . '/metatags';
     $files = file_scan_directory($path, '.*\.inc$');
@@ -758,18 +770,8 @@
  * - adding or altering some content (eg add global keywords)
  */
 function _nodewords_prepare($type, $ids, $tags, $filtered = TRUE) {
-  $settings = _nodewords_get_settings();
-
   _nodewords_invoke($tags, 'prepare', $type, $ids);
 
-  // Prepare the tags
-  foreach (_nodewords_get_possible_tags() as $tag) {
-    $function = 'nodewords_'. $tag .'_prepare';
-    if (function_exists($function)) {
-      $tags[$tag] = $function($type, $ids, isset($tags[$tag]) ? $tags[$tag] : '', $settings);
-    }
-  }
-
   // Filter out tags the user has chosen not to see
   if ($filtered) {
     $tags = _nodewords_filter_viewable($tags);
@@ -808,7 +810,7 @@
     }
     unset($tags['geourl']);
   }
-  
+
   // Check 'content' of each tag
   $tags = array_map('_nodewords_check_content', $tags);
 
@@ -980,3 +982,25 @@
   }
   return $return;
 }
+
+/**
+ * Implementation of hook_nodewords().
+ */
+function nodewords_nodewords(&$tags, $op, $type = null, $ids = null) {
+  switch ($op) {
+    case 'list':
+      return _nodewords_get_local_plugins();
+    case 'prepare':
+      $settings = _nodewords_get_settings();
+
+      // Prepare the tags
+      foreach (_nodewords_get_local_plugins() as $tag) {
+        $function = 'nodewords_'. $tag .'_prepare';
+        if (function_exists($function)) {
+          $tags[$tag] = $function($type, $ids, isset($tags[$tag]) ? $tags[$tag] : '', $settings);
+        }
+      }
+      break;
+  }
+}
+
