OEmbedInterface.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /**
  3. * OEmbedInterface
  4. *
  5. * This file is part of Grav MediaEmbed plugin.
  6. *
  7. * Dual licensed under the MIT or GPL Version 3 licenses, see LICENSE.
  8. * http://benjamin-regler.de/license/
  9. */
  10. namespace Grav\Plugin\MediaEmbed\OEmbed;
  11. /**
  12. * OEmbedInterface
  13. */
  14. interface OEmbedInterface
  15. {
  16. /**
  17. * Initialize service.
  18. */
  19. public function init($embedCode, $config = []);
  20. /**
  21. * Reset service.
  22. */
  23. public function reset();
  24. /**
  25. * Extract and normalize id from embed code.
  26. *
  27. * @param string $embedCode The embed code to be canonicalized
  28. * @return string Returns the canonicalized embed code,
  29. * usually an id.
  30. */
  31. public function canonicalize($embedCode);
  32. /**
  33. * Returns the unique id of a media resource.
  34. *
  35. * @return string
  36. */
  37. public function id();
  38. /**
  39. * Returns the host as slugged string.
  40. *
  41. * @return string
  42. */
  43. public function slug();
  44. /**
  45. * Returns the name of this media.
  46. *
  47. * @return string
  48. */
  49. public function name();
  50. /**
  51. * Returns the title of this media.
  52. *
  53. * @return string
  54. */
  55. public function title();
  56. /**
  57. * Returns the description of this media.
  58. *
  59. * @return string
  60. */
  61. public function description();
  62. /**
  63. * The URL of this media
  64. *
  65. * @return string
  66. */
  67. public function url();
  68. /**
  69. * The website where this media come from.
  70. *
  71. * @return string
  72. */
  73. public function website();
  74. /**
  75. * Gets the thumbnail of the media and its dimensions.
  76. *
  77. * @return array
  78. */
  79. public function thumbnail();
  80. /**
  81. * Returns the type of this media.
  82. *
  83. * @return string
  84. */
  85. public function type();
  86. /**
  87. * Gets the author and informations about him from the media.
  88. *
  89. * @return array
  90. */
  91. public function author($key = 'name');
  92. /**
  93. * Gets or sets object attributes about the media
  94. *
  95. * @param bool $var Media attributes
  96. *
  97. * @return array Returns object attributes about the media i.e.
  98. * width, height and so on.
  99. */
  100. public function attributes($var = [], $reset = false);
  101. /**
  102. * Gets or sets object parameter about the media
  103. *
  104. * @param bool $var Media parameter.
  105. *
  106. * @return array Returns the object parameter about the media i.e.
  107. * additional parameter for the request
  108. */
  109. public function params($var = [], $reset = false);
  110. /**
  111. * Returns the final HTML code for display.
  112. *
  113. * @return string
  114. */
  115. public function getEmbedCode($params = []);
  116. /**
  117. * Returns information about the media. See http://www.oembed.com/.
  118. *
  119. * @return
  120. * If oEmbed information is available, an array containing 'title', 'type',
  121. * 'url', and other information as specified by the oEmbed standard.
  122. * Otherwise, NULL.
  123. */
  124. public function getOEmbed();
  125. /**
  126. * Returns the accepted domains of this media resource
  127. *
  128. * @return array
  129. */
  130. public function getDomains();
  131. /**
  132. * Special Template events fired by Grav\Plugin\MediaEmbed\Service.
  133. */
  134. // public function onTwigTemplatePaths();
  135. // public function onTwigTemplateVariables(Event $event);
  136. }