Index: nodewords_basic/nodewords_basic.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords_basic/nodewords_basic.module,v
retrieving revision 1.8.2.24
diff -u -p -r1.8.2.24 nodewords_basic.module
--- nodewords_basic/nodewords_basic.module	30 Nov 2009 23:01:54 -0000	1.8.2.24
+++ nodewords_basic/nodewords_basic.module	2 Dec 2009 23:19:56 -0000
@@ -179,8 +179,6 @@ function nodewords_basic_canonical_prepa
     $content['value'] = trim($content['value'], '/');
   }
 
-  $content['value'] = trim($content['value'], '/');
-
   if (empty($content['value'])) {
     $path = '';
 
@@ -352,7 +350,7 @@ function nodewords_basic_description_pre
 function nodewords_basic_description_settings_form(&$form, $form_id, $options) {
   switch ($form_id) {
     case 'nodewords_settings_form':
-      $form['meta_tags']['node_teaser']['nodewords_use_teaser'] = array(
+      $form['metatags_creation']['node_teaser']['nodewords_use_teaser'] = array(
         '#type' => 'checkbox',
         '#title' => t('Use the node teaser if the description meta tag is not set'),
         '#description' => t('Using the node teaser to populate the meta tag DESCRIPTION can cause problems with some content types; rather than enabling this option globally, it would be better to enable it separately for each content type (when it has been verified that enabling it for a specific content type does not create problems). This option is overwritten from the similar option for the content type.'),
@@ -621,7 +619,7 @@ function nodewords_basic_robots_settings
         'noydir' => t('NOYDIR'),
       );
 
-      $form['advanced']['nodewords_list_robots'] = array(
+      $form['metatags_creation']['nodewords_list_robots'] = array(
         '#type' => 'checkboxes',
         '#title' => t('Meta tag ROBOTS for lists'),
         '#description' => t('The value to use for the meta tag ROBOTS for the pages that use a pager; this setting is not used for the first page of the list, or when the option to repeat the meta tags for all the pages in the same list is selected.'),
Index: nodewords_extra/nodewords_extra.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords_extra/nodewords_extra.module,v
retrieving revision 1.7.2.10
diff -u -p -r1.7.2.10 nodewords_extra.module
--- nodewords_extra/nodewords_extra.module	30 Nov 2009 23:01:49 -0000	1.7.2.10
+++ nodewords_extra/nodewords_extra.module	2 Dec 2009 23:19:56 -0000
@@ -227,8 +227,26 @@ function nodewords_extra_dc_contributor_
  * Set the meta tag content.
  */
 function nodewords_extra_dc_contributor_prepare(&$tags, $content, $options) {
-  $value = empty($content['value']) ? (!empty($options['default']['dc.contributor']['value']) ? $options['default']['dc.contributor']['value'] : '') : $content['value'];
-  $tags['dc.contributor'] = nodewords_replace_tokens($value, $options['id'], $options['sid']);
+  if (!empty($content['value'])) {
+    $tags['dc.contributor'] = nodewords_replace_tokens($content['value'], $options['id'], $options['sid']);
+  }
+  elseif (!empty($options['default']['dc.contributor']['value'])) {
+    $tags['dc.contributor'] = nodewords_replace_tokens($options['default']['dc.contributor']['value'], $options['id'], $options['sid']);
+  }
+  else {
+    if ($options['type'] == NODEWORDS_TYPE_NODE && count($options['ids']) == 1) {
+      $bool = (
+        ($node = node_load($options['ids'][0])) &&
+        ($uid = $node->uid) &&
+        ($user = user_load($uid)) &&
+        $user->name
+      );
+
+      if ($bool) {
+        $tags['dc.contributor'] = $user->name;
+      }
+    }
+  }
 }
 
 /**
@@ -253,8 +271,26 @@ function nodewords_extra_dc_creator_form
  * Set the meta tag content.
  */
 function nodewords_extra_dc_creator_prepare(&$tags, $content, $options) {
-  $value = empty($content['value']) ? (!empty($options['default']['dc.creator']['value']) ? $options['default']['dc.creator']['value'] : '') : $content['value'];
-  $tags['dc.creator'] = nodewords_replace_tokens($value, $options['type'], $options['id'], $options['sid']);
+  if (!empty($content['value'])) {
+    $tags['dc.creator'] = nodewords_replace_tokens($content['value'], $options['id'], $options['sid']);
+  }
+  elseif (!empty($options['default']['dc.creator']['value'])) {
+    $tags['dc.creator'] = nodewords_replace_tokens($options['default']['dc.creator']['value'], $options['id'], $options['sid']);
+  }
+  else {
+    if ($options['type'] == NODEWORDS_TYPE_NODE && count($options['ids']) == 1) {
+      $bool = (
+        ($node = node_load($options['ids'][0])) &&
+        ($uid = $node->uid) &&
+        ($user = user_load($uid)) &&
+        $user->name
+      );
+
+      if ($bool) {
+        $tags['dc.creator'] = $user->name;
+      }
+    }
+  }
 }
 
 /**
Index: API.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/Attic/API.txt,v
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.3 API.txt
--- API.txt	30 Nov 2009 23:01:41 -0000	1.1.4.3
+++ API.txt	2 Dec 2009 23:19:56 -0000
@@ -59,3 +59,13 @@ API version 2.8
   (nodewords_settings_form).
 
 * The module uses also hook_nodewords_tags_output_alter().
+
+API version 2.9
+
+* The function nodewords_form() uses the option 'fieldset:description' that allows
+  to set a description for the fieldset.
+
+
+* The function nodewords_form() uses the options 'fields:before', and
+  'fields:after' that allows add form fields before, and after the ones used for
+  the meta tags content.
Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/CHANGELOG.txt,v
retrieving revision 1.9.2.19
diff -u -p -r1.9.2.19 CHANGELOG.txt
--- CHANGELOG.txt	30 Nov 2009 23:01:41 -0000	1.9.2.19
+++ CHANGELOG.txt	2 Dec 2009 23:19:57 -0000
@@ -1,7 +1,15 @@
 ; $Id: CHANGELOG.txt,v 1.9.2.19 2009/11/30 23:01:41 kiam Exp $
 ; All the dates reported here are referred to UTC.
 
-Nodewords 6.x-1 2009-11-30
+Nodewords 6.x-3 2009-12-02
+--------------------------
+#648414 by kiamlaluno: Error while accessing the property of a not object, and an undefined variable.
+ 
+Nodewords 6.x-3 2009-12-01
+--------------------------
+#647356 by kiamlaluno: Wrong implementation of hook_theme().
+
+Nodewords 6.x-3 2009-11-30
 --------------------------
 #640716 by ilo, kiamlaluno: Admin settings when no tags module is enabled.
 #628868 by kiamlaluno: Meta tags content is not indexed from the search module.
@@ -17,7 +25,7 @@ Nodewords 6.x-1 2009-11-30
 #636798 by KiamLaLuno: Re-add the call to drupal_alter('nodewords_tags').
 #636978 by KiamLaLuno: Ubercart catalog page support.
 
-Nodewords 6.x-1 2009-11-17
+Nodewords 6.x-3 2009-11-17
 --------------------------
 #635386 by KiamLaLuno: Add more options to filter the text present in the node teaser used as meta tag content.
 
Index: nodewords.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords.admin.inc,v
retrieving revision 1.6.2.12
diff -u -p -r1.6.2.12 nodewords.admin.inc
--- nodewords.admin.inc	1 Dec 2009 01:34:20 -0000	1.6.2.12
+++ nodewords.admin.inc	2 Dec 2009 23:19:57 -0000
@@ -87,12 +87,6 @@ function nodewords_pages_overview() {
     );
   }
 
-  $form['add_meta_tags'] = array(
-    '#value' => t(' <a href="@add_metatags">Add meta tags</a> for a new page.', array('@add_metatags' => url('admin/content/nodewords/meta-tags/other/add'))),
-    '#prefix' => '<div>',
-    '#suffix' => '</div>',
-  );
-
   if (!empty($pages)) {
     $bool = (
       variable_get('nodewords_enable_checkall', FALSE) &&
@@ -138,6 +132,23 @@ function nodewords_pages_overview_submit
  */
 function nodewords_pages_edit($form_state, $page = NULL) {
   $form = array();
+
+  if (!isset($page)) {
+    $page = (object) array(
+      'name' => t('Custom page'),
+      'path' => '',
+      'weight' => 0,
+      'enabled' => 1,
+      'tags' => array(),
+    );
+  }
+  else {
+    $form['pid'] = array(
+      '#type' => 'value',
+      '#value' => $page->pid,
+    );
+  }
+  
   $nodewords_form = nodewords_form(
     NODEWORDS_TYPE_PAGE,
     $page->tags,
@@ -145,6 +156,7 @@ function nodewords_pages_edit($form_stat
       'fieldset' => FALSE,
     )
   );
+  
   if (empty($nodewords_form)) {
     if (!count(array_filter(variable_get('nodewords_edit', array())))) {
       drupal_set_message(
@@ -158,22 +170,6 @@ function nodewords_pages_edit($form_stat
     return $form;
   }
   else {
-    if (!isset($page)) {
-      $page = (object) array(
-        'name' => t('Custom page'),
-        'path' => '',
-        'weight' => 0,
-        'enabled' => 1,
-        'tags' => array(),
-      );
-    }
-    else {
-      $form['pid'] = array(
-        '#type' => 'value',
-        '#value' => $page->pid,
-      );
-    }
-
     $form['name'] = array(
       '#type' => 'textfield',
       '#title' => t('Name'),
@@ -207,7 +203,7 @@ function nodewords_pages_edit($form_stat
       '#default_value' => $page->enabled,
     );
 
-    $form['nodewords'] = $nodeword_form;
+    $form['nodewords'] = $nodewords_form;
     $form['nodewords']['#tree'] = TRUE;
 
     $form['submit'] = array(
@@ -251,7 +247,7 @@ function nodewords_pages_edit_validate($
 function nodewords_pages_edit_submit($form, &$form_state) {
   $form_state['values']['path'] = trim($form_state['values']['path']);
 
-  nodewords_save_tags(NODEWORDS_TYPE_PAGE, $form_state['values']['path'], $form_state['values']['nodewords'], TRUE);
+  nodewords_save_tags($form_state['values']['nodewords'], NODEWORDS_TYPE_PAGE, $form_state['values']['path']);
   drupal_write_record('nodewords_custom', $form_state['values'], isset($form_state['values']['pid']) ? 'pid' : array());
 
   drupal_set_message(t('The configuration options have been saved.'));
@@ -263,80 +259,103 @@ function nodewords_pages_edit_submit($fo
  * Menu callback: settings form.
  */
 function nodewords_settings_form() {
-  $edit_options = array();
-  $edit_tags = variable_get('nodewords_edit', array());
   $form = array();
-  $head_options = array();
-  $head_tags = variable_get('nodewords_head', array());
+  $index_options = array();
+  $metatags_options = array(
+    'fields:before' => array(
+      'operations' => array(
+        '#type' => 'fieldset',
+        '#title' => t('Operations'),
+        'reset_metatags' => array(
+          '#type' => 'submit', 
+          '#value' => t('Reset default meta tag values'),
+          '#submit' => array('nodewords_settings_form_reset_metatags'),
+        ),
+      ),
+    ),
+    'fieldset:description' => t('These are the values used for the meta tags content when there are not values for the viewed page.'),
+    'fieldset:title' => t('Default meta tags'),
+    'fieldset:weight' => 0,
+  );
+  $options = array();
   $tags_info = nodewords_get_possible_tags();
 
+  $form['enabled'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Enabled meta tags'),
+    '#description' => t('Select the meta tags you want to be able to edit, and which should be output.'),
+    '#collapsible' => TRUE,
+    '#weight' => 0,
+  );
+
+  $form['enabled']['metatags'] = array(
+    '#type' => 'fieldset',
+    '#theme' => 'nodewords_enabled_metatags',
+    '#weight' => 0,
+  );
+
   if (!empty($tags_info)) {
     foreach ($tags_info as $name => $info) {
-      $edit_options[$name] = $head_options[$name] = $info['widget:label'];
+      if (isset($info['tag:template:index']) && is_array($info['tag:template:index'])) {
+        $index_options[$name] = $info['widget:label'];
+      }
+
+      $options[$name] = $info['widget:label'];
     }
 
-    uasort($edit_options, 'strnatcmp');
-    uasort($head_options, 'strnatcmp');
-  }
-  else {
-    drupal_set_message(t('There are no modules that implement meta tags. You need to enable at least one module between nodewords_basic.module, nodewords_extra.module, and nodewords_verification_tags.module that are listed under <em>Meta tags</em> in the <a href="@modules-page">modules page</a>.', array('@modules-page' => url('admin/build/modules'))), 'error');
-  }
+    uasort($index_options, 'strnatcmp');
+    uasort($options, 'strnatcmp');
 
-  $form['edit'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Meta tags to show on edit forms'),
-    '#description' => t('Select the meta tags you want to be able to edit.'),
-    '#collapsible' => TRUE,
-  );
+    foreach ($options as $name => $title) {
+      $form['enabled']['metatags']['titles'][$name] = array(
+        '#value' => $title,
+      );
+    }
 
-  if (!empty($tags_info)) {
-    $form['edit']['nodewords_edit'] = array(
+    $form['enabled']['metatags']['nodewords_edit'] = array(
       '#type' => 'checkboxes',
-      '#options' => $edit_options,
-      '#default_value' => $edit_tags,
-      '#checkall' => TRUE,
-    );
-  }
-  else {
-    $form['edit']['nodewords_edit'] = array(
-      '#type' => 'value',
-      '#value' => $edit_tags,
+      '#options' => $options,
+      '#default_value' => variable_get('nodewords_edit', array()),
+      '#checkall' => variable_get('nodewords_enable_checkall', FALSE) ? 'nodewords-enabled-metatags-edit-form' : FALSE,
     );
-  }
 
-  $form['head'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Meta tags to output in HTML'),
-    '#description' => t('Select the meta tags you want to appear in the HEAD section of the HTML pages.'),
-    '#collapsible' => TRUE,
-  );
-
-  if (!empty($tags_info)) {
-    $form['head']['nodewords_head'] = array(
+    $form['enabled']['metatags']['nodewords_head'] = array(
       '#type' => 'checkboxes',
-      '#options' => $head_options,
-      '#default_value' => $head_tags,
-      '#checkall' => TRUE,
+      '#options' => $options,
+      '#default_value' => variable_get('nodewords_head', array()),
+      '#checkall' => variable_get('nodewords_enable_checkall', FALSE) ? 'nodewords-enabled-metatags-html-tag' : FALSE,
     );
-  }
-  else {
-    $form['head']['nodewords_head'] = array(
-      '#type' => 'value',
-      '#value' => $head_tags,
+
+    $form['enabled']['metatags']['nodewords_index'] = array(
+      '#type' => 'checkboxes',
+      '#options' => $index_options,
+      '#default_value' => variable_get('nodewords_index', array()),
+      '#checkall' => variable_get('nodewords_enable_checkall', FALSE) ? 'nodewords-enabled-metatags-search-index' : FALSE,
     );
   }
 
+  $form['enabled']['nodewords_enable_user_metatags'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable the user profile meta tags'),
+    '#default_value' => variable_get('nodewords_enable_user_metatags', TRUE),
+  );
+
+  $form['enabled']['nodewords_enable_node_metatags'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable the node meta tags'),
+    '#default_value' => variable_get('nodewords_enable_node_metatags', TRUE),
+  );
+
+  $form['default_metatags'] = nodewords_form(
+    NODEWORDS_TYPE_DEFAULT, nodewords_load_tags(), $metatags_options
+  );
+
   $form['metatags_creation'] = array(
     '#type' => 'fieldset',
     '#title' => t('Meta tags creation options'),
     '#description' => t('These options change the way the meta tags are generated.'),
     '#collapsible' => TRUE,
-  );
-
-  $form['metatags_creation']['nodewords_enable_user_metatags'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Enable the user profile meta tags'),
-    '#default_value' => variable_get('nodewords_enable_user_metatags', TRUE),
+    '#weight' => 1,
   );
 
   $form['metatags_creation']['nodewords_list_repeat'] = array(
@@ -412,6 +431,7 @@ function nodewords_settings_form() {
     '#title' => t('Third party modules integration'),
     '#description' => t('These options enable the integration between Nodewords and other modules.'),
     '#collapsible' => TRUE,
+    '#weight' => 1,
   );
 
   $form['third_party_integration']['nodewords_enable_checkall'] = array(
@@ -420,11 +440,14 @@ function nodewords_settings_form() {
       'Enable the integration with <a href="@checkall">checkall.module</a>',
       array('@checkall' => 'http://drupal.org/project/checkall')
     ),
+    '#description' => t(
+      'The integration with checkall.module allows to check/uncheck all the checkboxes of a set with a click.'
+    ),
     '#default_value' => variable_get('nodewords_enable_checkall', FALSE),
   );
 
   if (!module_exists('checkall')) {
-    $form['third_party_integration']['nodewords_enable_checkall']['#description'] = t(
+    $form['third_party_integration']['nodewords_enable_checkall']['#description'] .= ' ' .t(
       'The module checkall.module is not enabled, or installed.'
     );
 
@@ -440,7 +463,7 @@ function nodewords_settings_form() {
       array('@token' => 'http://drupal.org/project/token')
     ),
     '#description' => t(
-      'The integration with token-module allows to use tokens in meta tags content.'
+      'The integration with token.module allows to use tokens in meta tags content.'
     ),
     '#default_value' => variable_get('nodewords_enable_tokens', TRUE),
   );
@@ -459,6 +482,9 @@ function nodewords_settings_form() {
       'Enable the integration with <a href="@vertical_tabs">vertical_tabs.module</a>',
       array('@vertical_tabs' => 'http://drupal.org/project/vertical_tabs')
     ),
+    '#description' => t(
+      'The integration with vertical_tabs.module allows to visualize the form fieldsets as vertical tabs.'
+    ),
     '#default_value' => variable_get('nodewords_enable_vertical_tabs', FALSE),
   );
 
@@ -483,9 +509,21 @@ function nodewords_settings_form() {
     }
   }
 
-  $form = system_settings_form($form);
   $form['buttons']['#weight'] = 100;
+  
+  $form['buttons']['submit'] = array(
+    '#type' => 'submit', 
+    '#value' => t('Save configuration'),
+  );
+  $form['buttons']['reset'] = array(
+    '#type' => 'submit', 
+    '#value' => t('Reset to defaults'),
+    '#submit' => array('nodewords_settings_form_reset'),
+  );
 
+  $form['#submit'][] = 'nodewords_settings_form_submit';
+  $form['#theme'] = 'nodewords_settings_form';
+  
   return $form;
 }
 
@@ -520,6 +558,72 @@ function nodewords_max_size_validate($el
 }
 
 /**
+ * Submission function for the settings page.
+ */
+function nodewords_settings_form_submit($form, &$form_state) {
+  nodewords_save_tags($form_state['values']['default_metatags'], NODEWORDS_TYPE_DEFAULT, '');
+  
+  // Exclude unnecessary elements.
+  unset(
+    $form_state['values']['default_metatags'],
+    $form_state['values']['form_build_id'],
+    $form_state['values']['form_id'],
+    $form_state['values']['form_token'], 
+    $form_state['values']['op'],
+    $form_state['values']['reset'],
+    $form_state['values']['submit']
+  );
+
+  foreach ($form_state['values'] as $key => $value) {
+    if (is_array($value) && isset($form_state['values']['array_filter'])) {
+      $value = array_keys(array_filter($value));
+    }
+    
+    variable_set($key, $value);
+  }
+  
+  drupal_set_message(t('The configuration options have been saved.'));
+  cache_clear_all();
+  drupal_rebuild_theme_registry();
+}
+
+/**
+ * Submission function for the reset button of the settings page.
+ */
+function nodewords_settings_form_reset($form, &$form_state) {
+  nodewords_delete_tags(NODEWORDS_TYPE_DEFAULT, '');
+  
+  // Exclude unnecessary elements.
+  unset(
+    $form_state['values']['default_metatags'],
+    $form_state['values']['form_build_id'],
+    $form_state['values']['form_id'],
+    $form_state['values']['form_token'], 
+    $form_state['values']['op'], 
+    $form_state['values']['reset'],
+    $form_state['values']['submit']
+  );
+
+  foreach ($form_state['values'] as $key => $value) {
+    variable_del($key);
+  }
+  
+  drupal_set_message(t('The configuration options have been reset to their default values.'));
+  cache_clear_all();
+  drupal_rebuild_theme_registry();
+}
+
+/**
+ * Submission function for the meta tags reset button.
+ */
+function nodewords_settings_form_reset_metatags($form, &$form_state) {
+  nodewords_delete_tags(NODEWORDS_TYPE_DEFAULT, '');
+  
+  drupal_set_message(t('The default meta tag values have been reset.'));
+  cache_clear_all();
+}
+
+/**
  * Front page settings form.
  */
 function nodewords_tags_form(&$form_state, $type = NODEWORDS_TYPE_DEFAULT, $id = '', $options = array()) {
@@ -601,6 +705,66 @@ function nodewords_tags_form_submit($for
 /**
  * Render the list of pages with meta tags.
  */
+function theme_nodewords_enabled_metatags($form) {
+  $has_tags = isset($form['titles']) && is_array($form['titles']);
+  $rows = array();
+  $tags_info = nodewords_get_possible_tags();
+
+  if ($has_tags) {
+    foreach (element_children($form['titles']) as $key) {
+      $row = array();
+
+      // Unset the titles to not show them twice.
+      unset($form['nodewords_edit'][$key]['#title']);
+      unset($form['nodewords_head'][$key]['#title']);
+      unset($form['nodewords_index'][$key]['#title']);
+
+      $row[] = drupal_render($form['titles'][$key]);
+      $row[] = drupal_render($form['nodewords_edit'][$key]);
+      $row[] = drupal_render($form['nodewords_head'][$key]);
+      $row[] = isset($form['nodewords_index'][$key]) ? drupal_render($form['nodewords_index'][$key]) : ' ';
+
+      $rows[] = $row;
+    }
+  }
+
+  if (empty($rows)) {
+    $rows[] = array(
+      array(
+        'data' => t('There are no modules that implement meta tags. You need to enable at least one module between nodewords_basic.module, nodewords_extra.module, and nodewords_verification_tags.module that are listed under <em>Meta tags</em> in the <a href="@modules-page">modules page</a>.', array('@modules-page' => url('admin/build/modules'))),
+        'colspan' => '4'
+      )
+    );
+  }
+
+  $header[] = t('Meta tag');
+
+  if (!empty($rows)) {
+    $header[] = array(
+      'data' => t('Show in edit form'),
+      'class' => count($rows) > 1 ? 'nodewords-enabled-metatags-edit-form' : '',
+    );
+    $header[] = array(
+      'data' => t('Show in tag HEAD'),
+      'class' => count($rows) > 1 ? 'nodewords-enabled-metatags-html-tag' : '',
+    );
+    $header[] = array(
+      'data' => t('Use in search index'),
+      'class' => count($rows) > 1 ? 'nodewords-enabled-metatags-search-index' : '',
+    );
+  }
+  else {
+    $header[] = array(t('Show in edit form'));
+    $header[] = array(t('Show in tag HEAD'));
+    $header[] = array(t('Use in search index'));
+  }
+
+  return theme('table', $header, $rows) . drupal_render($form);
+}
+
+/**
+ * Render the list of pages with meta tags.
+ */
 function theme_nodewords_pages_overview($form) {
   $has_pages = isset($form['name']) && is_array($form['name']);
   $rows = array();
Index: nodewords.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords.install,v
retrieving revision 1.18.2.15
diff -u -p -r1.18.2.15 nodewords.install
--- nodewords.install	30 Nov 2009 23:01:41 -0000	1.18.2.15
+++ nodewords.install	2 Dec 2009 23:19:57 -0000
@@ -316,24 +316,6 @@ function nodewords_update_6305() {
 /**
  * Implementation of hook_update_N().
  */
-function nodewords_update_6306() {
-  $ret = array();
-
-  if (!variable_get('menu_rebuild_needed', FALSE)) {
-    variable_set('menu_rebuild_needed', TRUE);
-
-    $ret[] = array(
-      'success' => TRUE,
-      'query' => 'UPDATE MENUS',
-    );
-  }
-
-  return $ret;
-}
-
-/**
- * Implementation of hook_update_N().
- */
 function nodewords_update_6307() {
   $ret = array();
 
@@ -369,7 +351,7 @@ function nodewords_update_6308() {
       'query' => 'RESTORE MODULE SETTINGS',
     );
 
-    drupal_set_message(t('The previous value for the meta tag ROBOTS used in list pages has been restored. Check it is the desired value.'));
+    drupal_set_message('The previous value for the meta tag ROBOTS used in list pages has been restored. Check it is the desired value.');
   }
 
   $ret[] = update_sql("DELETE FROM {nodewords} WHERE type = '" . NODEWORDS_TYPE_PAGER . "'");
@@ -421,9 +403,8 @@ function nodewords_update_6310() {
   $ret = array();
 
   drupal_set_message(
-    t(
-      'Nodewords has settings to enable the integration with third-party modules. You can enable it in the <a href="@settings">settings page</a>.',
-      array('@settings' => url('admin/content/nodewords/settings'))
+    'Nodewords has settings to enable the integration with third-party modules. You can enable it in the <a href="' . url('admin/content/nodewords/settings') . '">settings page</a>.',
+      array('@settings' => url('admin/content/nodewords/settings')
     )
   );
 
@@ -620,6 +601,24 @@ function nodewords_update_6317() {
 }
 
 /**
+ * Implementation of hook_update_N().
+ */
+function nodewords_update_6318() {
+  $ret = array();
+
+  if (!variable_get('menu_rebuild_needed', FALSE)) {
+    variable_set('menu_rebuild_needed', TRUE);
+
+    $ret[] = array(
+      'success' => TRUE,
+      'query' => 'UPDATE MENUS',
+    );
+  }
+
+  return $ret;
+}
+
+/**
  * Implementation of hook_uninstall().
  */
 function nodewords_uninstall() {
@@ -638,6 +637,7 @@ function nodewords_uninstall() {
   variable_del('nodewords_global_keywords');
   variable_del('nodewords_head');
   variable_del('nodewords_icra_validation_content');
+  variable_del('nodewords_index');
   variable_del('nodewords_keyword_vids');
   variable_del('nodewords_list_repeat');
   variable_del('nodewords_list_robots');
@@ -660,33 +660,3 @@ function nodewords_uninstall() {
     variable_del('nodewords_use_teaser_' . $node_type);
   }
 }
-
-/*****************************************************************************
- * Private functions.
- ****************************************************************************/
-
-/*
- * Remove the duplicates from a list of items separated from the separator,
- * preserving the order in which they appear.
- * @param $text
- *   The string containing the list of items.
- *
- * @return
- *   A string containing only unique items present in the string of concatenated
- *   items.
- */
-function _nodewords_get_unique_values($text) {
-  $lc_values = array();
-  $unique_values = array();
-
-  foreach (array_filter(array_map('trim', explode(',', $text))) as $item) {
-    $lowercase = drupal_strtolower($item);
-
-    if (!in_array($lowercase, $lc_values)) {
-      $lc_values[] = $lowercase;
-      $unique_values[] = $item;
-    }
-  }
-
-  return implode(', ', $unique_values);
-}
Index: nodewords.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodewords/nodewords.module,v
retrieving revision 1.66.2.37
diff -u -p -r1.66.2.37 nodewords.module
--- nodewords.module	30 Nov 2009 23:01:41 -0000	1.66.2.37
+++ nodewords.module	2 Dec 2009 23:19:58 -0000
@@ -46,7 +46,7 @@ define('NODEWORDS_MINIMUM_API_VERSION', 
 /**
  * The current API version implemented.
  */
-define('NODEWORDS_API_VERSION', '2.8');
+define('NODEWORDS_API_VERSION', '2.9');
 
 /*****************************************************************************
  * Drupal hooks.
@@ -87,6 +87,7 @@ function nodewords_form_alter(&$form, &$
     isset($form['type']) &&
     isset($form['type']['#value']) &&
     $form_id == $form['type']['#value'] . '_node_form' &&
+    variable_get('nodewords_enable_node_metatags', TRUE) &&
     variable_get('nodewords_edit_metatags_' . $form['type']['#value'], TRUE)
   );
 
@@ -298,7 +299,7 @@ function nodewords_menu() {
   );
 
   $items['admin/content/nodewords/settings'] = array(
-    'title' => 'Settings',
+    'title' => 'General settings',
     'access arguments' => $admin_access,
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -1,
@@ -306,27 +307,18 @@ function nodewords_menu() {
   );
 
   $items['admin/content/nodewords/meta-tags'] = array(
-    'title' => 'Default and specific meta tags',
+    'title' => 'Specific meta tags',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('nodewords_tags_form'),
+    'page arguments' => array('nodewords_tags_form', NODEWORDS_TYPE_ERRORPAGE, '403'),
     'access arguments' => $admin_access,
     'type' => MENU_LOCAL_TASK,
     'file' => 'nodewords.admin.inc',
   );
 
-  $items['admin/content/nodewords/meta-tags/default'] = array(
-    'title' => 'Default values',
-    'access arguments' => $admin_access,
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-    'file' => 'nodewords.admin.inc',
-  );
-
   $items['admin/content/nodewords/meta-tags/errorpage_403'] = array(
     'title' => 'Error 403 page',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('nodewords_tags_form', NODEWORDS_TYPE_ERRORPAGE, '403'),
     'access arguments' => $admin_access,
-    'type' => MENU_LOCAL_TASK,
+    'type' => MENU_DEFAULT_LOCAL_TASK,
     'file' => 'nodewords.admin.inc',
   );
 
@@ -357,8 +349,8 @@ function nodewords_menu() {
     'file' => 'nodewords.admin.inc',
   );
 
-  $items['admin/content/nodewords/meta-tags/other'] = array(
-    'title' => 'Other pages',
+  $items['admin/content/nodewords/other'] = array(
+    'title' => 'Other pages meta tags',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('nodewords_pages_overview'),
     'access arguments' => $admin_access,
@@ -367,16 +359,24 @@ function nodewords_menu() {
     'file' => 'nodewords.admin.inc',
   );
 
-  $items['admin/content/nodewords/meta-tags/other/add'] = array(
-    'title' => 'Add page meta tags',
+  $items['admin/content/nodewords/other/list'] = array(
+    'title' => 'List',
+    'access arguments' => $admin_access,
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -1,
+    'file' => 'nodewords.admin.inc',
+  );
+
+  $items['admin/content/nodewords/other/add'] = array(
+    'title' => 'Add',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('nodewords_pages_edit'),
     'access arguments' => $admin_access,
-    'type' => MENU_CALLBACK,
+    'type' => MENU_LOCAL_TASK,
     'file' => 'nodewords.admin.inc',
   );
 
-  $items['admin/content/nodewords/meta-tags/other/delete/%nodewords_page'] = array(
+  $items['admin/content/nodewords/other/delete/%nodewords_page'] = array(
     'title' => 'Delete page meta tags',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('nodewords_pages_confirm_delete', 6),
@@ -386,7 +386,7 @@ function nodewords_menu() {
     'file' => 'nodewords.admin.inc',
   );
 
-  $items['admin/content/nodewords/meta-tags/other/edit/%nodewords_page'] = array(
+  $items['admin/content/nodewords/other/edit/%nodewords_page'] = array(
     'title' => 'Edit page meta tags',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('nodewords_pages_edit', 6),
@@ -452,6 +452,7 @@ function nodewords_nodeapi(&$node, $op, 
       );
 
     case 'update index':
+      $index_tags = variable_get('nodewords_index', array());
       $output_tags = array();
       $tag_options = array(
         'type' => NODEWORDS_TYPE_NODE,
@@ -464,6 +465,7 @@ function nodewords_nodeapi(&$node, $op, 
         // Prepare the tags.
         foreach (nodewords_get_possible_tags() as $name => $info) {
           $bool = (
+            in_array($name, $index_tags) &&
             !empty($info['tag:template:index']) &&
             function_exists($function = $info['tag:function:prefix'] . '_prepare')
           );
@@ -554,6 +556,11 @@ function nodewords_theme() {
   return array(
     'nodewords_pages_overview' => array(
       'arguments' => array('form' => array()),
+      'file' => 'nodewords.admin.inc',
+    ),
+    'nodewords_enabled_metatags' => array(
+      'arguments' => array('form' => array()),
+      'file' => 'nodewords.admin.inc',
     ),
   );
 }
@@ -635,6 +642,7 @@ function nodewords_delete_tags($type, $i
     $args[] = $options['sid'];
     $query .= ' AND sid = %d';
   }
+
   if ($options['language'] != '*') {
     $args[] = $options['language'];
     $query .= " AND language = '%s'";
@@ -662,7 +670,10 @@ function nodewords_delete_tags($type, $i
 // TODO: Add the language option.
 function nodewords_form($type, $tags, $options = array()) {
   $default_options = array(
+    'fields:after' => array(),
+    'fields:before' => array(),
     'fieldset' => TRUE,
+    'fieldset:description' => '',
     'fieldset:title' => t('Meta tags'),
     'fieldset:weight' => 20,
     'tokens' => TRUE,
@@ -671,44 +682,44 @@ function nodewords_form($type, $tags, $o
   $form = array();
   $head_tags = variable_get('nodewords_head', array());
   $options += $default_options;
-
   $tag_options = array(
     'default' => nodewords_load_tags(),
     'type' => $type,
   );
+  $tags_info = nodewords_get_possible_tags();
+  $tokens_support = FALSE;
+
 
   if (isset($options['tag_options'])) {
     $tag_options = array_merge($options['tag_options'], $tag_options);
   }
 
-  $tags_info = nodewords_get_possible_tags();
   $tokens_enabled = module_exists('token') && $options['tokens'];
-  $tokens_support = FALSE;
+
+  if (!empty($options['fields:before'])) {
+    $form = $options['fields:before'];
+  }
 
   foreach ($tags_info as $name => $info) {
-    if ($type == NODEWORDS_TYPE_DEFAULT) {
-      if (empty($edit_tags[$name]) && empty($head_tags[$name])) {
-        continue;
-      }
-    }
-    elseif (empty($edit_tags[$name])) {
+    if ($type != NODEWORDS_TYPE_DEFAULT && empty($edit_tags[$name])) {
       continue;
     }
 
-    if (!empty($info['tag:context:allowed'])) {
-      $bool = (
-        in_array(NODEWORDS_TYPE_NONE, $info['tag:context:allowed']) ||
+    $bool = (
+      (
+        !empty($info['tag:context:allowed']) &&
+        is_array($info['tag:context:allowed']) &&
         !in_array($type, $info['tag:context:allowed'])
-      );
+      ) ||
+      (
+        !empty($info['tag:context:denied']) &&
+        is_array($info['tag:context:denied']) &&
+        in_array($type, $info['tag:context:denied'])
+      )
+    );
 
-      if ($bool) {
-        continue;
-      }
-    }
-    elseif (!empty($info['tag:context:denied'])) {
-      if (in_array($type, $info['tag:context:denied'])) {
-        continue;
-      }
+    if ($bool) {
+      continue;
     }
 
     $bool = (
@@ -735,50 +746,55 @@ function nodewords_form($type, $tags, $o
     }
   }
 
+  if (!empty($options['fields:after'])) {
+    $form += $options['fields:after'];
+  }
+
   if (!empty($form)) {
     if ($options['fieldset']) {
       $form['#type'] = 'fieldset';
       $form['#title'] = $options['fieldset:title'];
+      $form['#description'] = $options['fieldset:description'];
       $form['#tree'] = TRUE;
       $form['#collapsible'] = TRUE;
       $form['#collapsed'] = TRUE;
       $form['#weight'] = $options['fieldset:weight'];
     }
+  }
 
-    if ($tokens_enabled && $tokens_support) {
-      switch ($type) {
-        case NODEWORDS_TYPE_ERRORPAGE:
-        case NODEWORDS_TYPE_FRONTPAGE:
-        case NODEWORDS_TYPE_PAGER:
-        case NODEWORDS_TYPE_TRACKER:
-          $token_type = 'global';
-          break;
-
-        case NODEWORDS_TYPE_NODE:
-          $token_type = 'node';
-          break;
-
-        case NODEWORDS_TYPE_USER:
-          $token_type = 'user';
-          break;
-
-        default:
-          $token_type = '';
-      }
-
-      if ($token_type) {
-        $form['token_help'] = array(
-          '#title' => t('Replacement patterns'),
-          '#type' => 'fieldset',
-          '#collapsible' => TRUE,
-          '#collapsed' => TRUE,
-          '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!'),
-        );
+  if ($tokens_enabled && $tokens_support) {
+    switch ($type) {
+      case NODEWORDS_TYPE_ERRORPAGE:
+      case NODEWORDS_TYPE_FRONTPAGE:
+      case NODEWORDS_TYPE_PAGER:
+      case NODEWORDS_TYPE_TRACKER:
+        $token_type = 'global';
+        break;
+
+      case NODEWORDS_TYPE_NODE:
+        $token_type = 'node';
+        break;
+
+      case NODEWORDS_TYPE_USER:
+        $token_type = 'user';
+        break;
+
+      default:
+        $token_type = '';
+    }
+
+    if ($token_type) {
+      $form['token_help'] = array(
+        '#title' => t('Replacement patterns'),
+        '#type' => 'fieldset',
+        '#collapsible' => TRUE,
+        '#collapsed' => TRUE,
+        '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!'),
+      );
 
-        $form['token_help']['help'] = array(
-          '#value' => theme('token_help', $token_type),
-        );
-      }
+      $form['token_help']['help'] = array(
+        '#value' => theme('token_help', $token_type),
+      );
     }
   }
 
@@ -930,6 +946,8 @@ function nodewords_get_tags($type, $id =
       }
     }
   }
+
+  return $output_tags;
 }
 
 /**
@@ -1249,12 +1267,14 @@ function nodewords_save_tags($tags, $typ
   static $tags_info;
 
   $default_options = array(
-    'sid => 0',
+    'sid' => 0,
     'language' => '',
     'log_message' => TRUE,
   );
   $done = FALSE;
   $options += $default_options;
+
+  $language = $options['language'];
   $sid = $options['sid'];
 
   if (!isset($tags_info)) {
