<?php
// $Id: extra_metatags.module,v 1.1.2.14 2009/09/21 19:50:56 kiam Exp $

/**
 * @file
 * Allows users to add extra meta tags to node, user profile, and taxonomy term pages.
 */

/**
 * @addtogroup extra_metatags
 * @{
 */

/**
 * Include the file for the meta tag definitions.
 */
module_load_include('inc', 'extra_metatags', 'extra_metatags.metatags');

/**
 * Implementation of hook_nodewords_api().
 */
function extra_metatags_nodewords_api() {
  return array(
    'version' => 1.1,
  );
}

/**
 * Implementation of hook_nodewords_tags_info().
 */
function extra_metatags_nodewords_tags_info() {
  $tags = array(
    'dc.title' => array(
      'tag:context:denied' => array('default'),
      'tag:db:type' => 'string',
      'tag:function:prefix' => 'extra_metatags_dc_title',
      'tag:template' => array('dc.title' => NODEWORDS_META),
      'widget:label' => t('Dublin Core title'),
      'widget:permission' => 'edit Dublin Core title meta tag',
    ),
    'location' => array(
      'tag:context:allowed' => array('node', 'user'),
      'tag:db:type' => 'array',
      'tag:function:prefix' => 'extra_metatags_location',
      'tag:template' => array(
        'geo.position' => NODEWORDS_META,
        'icbm' => NODEWORDS_META,
      ),
      'widget:label' => t('Location'),
      'widget:permission' => 'edit location meta tag',
    ),
    'pics-label' => array(
      'tag:context:allowed' => array('default', 'node'),
      'tag:db:type' => 'string',
      'tag:function:prefix' => 'extra_metatags_pics',
      'tag:template' => array('pics-label' => NODEWORDS_HTTP_EQUIV),
      'widget:label' => t('PICS labels'),
      'widget:permission' => 'edit PICS meta tag',
    ),
  );

  $directory = drupal_get_path('module', 'extra_metatags') . '/tags';

  foreach (file_scan_directory($directory, '.*\.inc', array('.', '..', 'CVS'), 0, FALSE) as $filename => $info) {
    if (is_file($filename)) {
      require_once './' . $filename;
      if (function_exists($function = $info->name . '_tags_list')) {
        $result = $function();
        if (isset($result)) {
          $tags = array_merge($tags, $result);
        }
      }
    }
  }

  return $tags;
}

/**
 * @} End of "addtogroup extra_metatags".
 */
