social_media_links.platforms.inc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @file
  4. * Callbacks for the platforms.
  5. */
  6. /**
  7. * Register the default platforms.
  8. *
  9. * @return array
  10. * List with the default supported platforms.
  11. */
  12. function social_media_links_social_media_links_platform_info() {
  13. $platforms['facebook'] = array(
  14. 'title' => t('Facebook'),
  15. 'base url' => 'https://www.facebook.com/',
  16. );
  17. $platforms['twitter'] = array(
  18. 'title' => t('Twitter'),
  19. 'base url' => 'http://www.twitter.com/',
  20. );
  21. $platforms['googleplus'] = array(
  22. 'title' => t('Google+'),
  23. 'base url' => 'https://plus.google.com/',
  24. 'image alt' => 'Google+ icon',
  25. );
  26. $platforms['tumblr'] = array(
  27. 'title' => t('Tumblr'),
  28. 'base url' => '',
  29. 'image alt' => 'Tumblr',
  30. );
  31. $platforms['instagram'] = array(
  32. 'title' => t('Instagram'),
  33. 'base url' => 'http://www.instagram.com/',
  34. );
  35. $platforms['linkedin'] = array(
  36. 'title' => t('LinkedIn'),
  37. 'base url' => 'http://www.linkedin.com/',
  38. );
  39. $platforms['pinterest'] = array(
  40. 'title' => t('Pinterest'),
  41. 'base url' => 'http://www.pinterest.com/',
  42. );
  43. $platforms['vimeo'] = array(
  44. 'title' => t('Vimeo'),
  45. 'base url' => 'http://www.vimeo.com/',
  46. );
  47. $platforms['youtube'] = array(
  48. 'title' => t('YouTube'),
  49. 'base url' => 'http://www.youtube.com/user/',
  50. );
  51. $platforms['youtube_channel'] = array(
  52. 'title' => t('Youtube (Channel)'),
  53. 'base url' => 'http://www.youtube.com/channel/',
  54. );
  55. $platforms['rss'] = array(
  56. 'title' => t('RSS'),
  57. 'base url' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
  58. );
  59. $platforms['contact'] = array(
  60. 'title' => t('Contact'),
  61. 'base url' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
  62. 'link attributes' => FALSE,
  63. );
  64. $platforms['email'] = array(
  65. 'title' => t('E-Mail'),
  66. 'base url' => '',
  67. 'url callback' => 'social_media_links_email_url',
  68. 'link attributes' => FALSE,
  69. );
  70. return $platforms;
  71. }
  72. /**
  73. * Callback function to generate the correct url for e-mail links.
  74. */
  75. function social_media_links_email_url($base_url, $platform_value) {
  76. if (valid_email_address($platform_value)) {
  77. return 'mailto:' . $platform_value;
  78. }
  79. return FALSE;
  80. }