<?php

/**
 * Implements hook_preprocess_html().
 */
function metatag_opengraph_preprocess_html(&$variables) {
  // The RDF module adds the Open Graph namespace itself.
  // @see rdf_rdf_namespaces()
  if (!module_exists('rdf')) {
    $variables['rdf_namespaces'] .= "\n  xmlns:og=\"http://ogp.me/ns#\"";
  }

  // @TODO Would it be worth dynamically identifying whether these should be
  // added, or just output them all?

  // Need an extra namespace for the "article" tags.
  $variables['rdf_namespaces'] .= "\n  xmlns:article=\"http://ogp.me/ns/article#\"";
  // Need an extra namespace for the "book" tags.
  $variables['rdf_namespaces'] .= "\n  xmlns:book=\"http://ogp.me/ns/book#\"";
  // Need an extra namespace for the "profile" tags.
  $variables['rdf_namespaces'] .= "\n  xmlns:profile=\"http://ogp.me/ns/profile#\"";
  // Need an extra namespace for the "video" tags.
  $variables['rdf_namespaces'] .= "\n  xmlns:video=\"http://ogp.me/ns/video#\"";
}

/**
 * Implements hook_ctools_plugin_api().
 */
function metatag_opengraph_ctools_plugin_api($owner, $api) {
  if ($owner == 'metatag' && $api == 'metatag') {
    return array('version' => 1);
  }
}

/*
og:title = [node:title] / [user:name]
og:type = article / profile
og:image = ? / [user:picture:url]
og:url = [node:url] / [user:url]
og:description
og:site_name = [site:name]

og:latitude
og:longitude
og:street-address
og:locality
og:region
og:postal-code
og:country-name

og:email
og:phone_number
og:fax_number

og:video
og:video:height
og:video:width
og:video:type

og:audio
og:audio:title
og:audio:artist
og:audio:album
og:audio:type

og:upc
og:isbn
*/
