ProviderInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * ProviderInterface
  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;
  11. /**
  12. * ProviderInterface
  13. */
  14. interface ProviderInterface
  15. {
  16. /**
  17. * Initialize service.
  18. */
  19. public function init($embedCode);
  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 type of this media.
  52. *
  53. * @return string
  54. */
  55. public function type();
  56. /**
  57. * Gets or sets object attributes about the media
  58. *
  59. * @param bool $var Media attributes
  60. *
  61. * @return array Returns object attributes about the media i.e.
  62. * width, height and so on.
  63. */
  64. public function attributes($var = []);
  65. /**
  66. * Gets or sets object parameter about the media
  67. *
  68. * @param bool $var Media parameter.
  69. *
  70. * @return array Returns the object parameter about the media i.e.
  71. * additional parameter for the request
  72. */
  73. public function params($var = []);
  74. /**
  75. * Returns the final HTML code for display.
  76. *
  77. * @return string
  78. */
  79. public function getEmbedCode();
  80. /**
  81. * Returns information about the media. See http://www.oembed.com/.
  82. *
  83. * @return
  84. * If oEmbed information is available, an array containing 'title', 'type',
  85. * 'url', and other information as specified by the oEmbed standard.
  86. * Otherwise, NULL.
  87. */
  88. public function getOEmbed();
  89. /**
  90. * Returns the accepted domains of this media resource
  91. *
  92. * @return array
  93. */
  94. public function getDomains();
  95. /**
  96. * Special Template events fired by Grav\Plugin\MediaEmbed\Service.
  97. */
  98. // public function onTwigTemplatePaths();
  99. // public function onTwigTemplateVariables(Event $event);
  100. }