metatag_opengraph.module 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Implements hook_preprocess_html().
  4. */
  5. function metatag_opengraph_preprocess_html(&$variables) {
  6. // The RDF module adds the Open Graph namespace itself.
  7. // @see rdf_rdf_namespaces()
  8. if (!module_exists('rdf')) {
  9. $variables['rdf_namespaces'] .= "\n xmlns:og=\"http://ogp.me/ns#\"";
  10. }
  11. // @TODO Would it be worth dynamically identifying whether these should be
  12. // added, or just output them all?
  13. // Need an extra namespace for the "article" tags.
  14. $variables['rdf_namespaces'] .= "\n xmlns:article=\"http://ogp.me/ns/article#\"";
  15. // Need an extra namespace for the "book" tags.
  16. $variables['rdf_namespaces'] .= "\n xmlns:book=\"http://ogp.me/ns/book#\"";
  17. // Need an extra namespace for the "profile" tags.
  18. $variables['rdf_namespaces'] .= "\n xmlns:profile=\"http://ogp.me/ns/profile#\"";
  19. // Need an extra namespace for the "video" tags.
  20. $variables['rdf_namespaces'] .= "\n xmlns:video=\"http://ogp.me/ns/video#\"";
  21. // And for product tags.
  22. $variables['rdf_namespaces'] .= "\n xmlns:product=\"http://ogp.me/ns/product#\"";
  23. }
  24. /**
  25. * Implements hook_ctools_plugin_api().
  26. */
  27. function metatag_opengraph_ctools_plugin_api($owner, $api) {
  28. if ($owner == 'metatag' && $api == 'metatag') {
  29. return array('version' => 1);
  30. }
  31. }
  32. /*
  33. og:title = [node:title] / [user:name]
  34. og:type = article / profile
  35. og:image = ? / [user:picture:url]
  36. og:url = [node:url] / [user:url]
  37. og:description
  38. og:site_name = [site:name]
  39. og:latitude
  40. og:longitude
  41. og:street-address
  42. og:locality
  43. og:region
  44. og:postal-code
  45. og:country-name
  46. og:email
  47. og:phone_number
  48. og:fax_number
  49. og:video
  50. og:video:height
  51. og:video:width
  52. og:video:type
  53. og:audio
  54. og:audio:title
  55. og:audio:artist
  56. og:audio:album
  57. og:audio:type
  58. og:upc
  59. og:isbn
  60. */