metatag_opengraph.module 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. }
  22. /**
  23. * Implements hook_ctools_plugin_api().
  24. */
  25. function metatag_opengraph_ctools_plugin_api($owner, $api) {
  26. if ($owner == 'metatag' && $api == 'metatag') {
  27. return array('version' => 1);
  28. }
  29. }
  30. /*
  31. og:title = [node:title] / [user:name]
  32. og:type = article / profile
  33. og:image = ? / [user:picture:url]
  34. og:url = [node:url] / [user:url]
  35. og:description
  36. og:site_name = [site:name]
  37. og:latitude
  38. og:longitude
  39. og:street-address
  40. og:locality
  41. og:region
  42. og:postal-code
  43. og:country-name
  44. og:email
  45. og:phone_number
  46. og:fax_number
  47. og:video
  48. og:video:height
  49. og:video:width
  50. og:video:type
  51. og:audio
  52. og:audio:title
  53. og:audio:artist
  54. og:audio:album
  55. og:audio:type
  56. og:upc
  57. og:isbn
  58. */