em.php 899 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. require_once('./inc/header.inc.php');
  10. $aEmbedData = BxDolPage::getEmbedData(bx_get('url'));
  11. $aResult = [
  12. 'version' => '1.0',
  13. 'type' => 'rich',
  14. 'title' => $aEmbedData['title'],
  15. 'url' => $aEmbedData['url'],
  16. 'provider_name' => getParam('site_title'),
  17. 'provider_url' => BX_DOL_URL_ROOT,
  18. 'html' => $aEmbedData['html'],
  19. ];
  20. if ($aEmbedData['thumbnail_url']){
  21. $aResult['thumbnail_url'] = $aEmbedData['thumbnail_url'];
  22. }
  23. if ($aEmbedData['author_name']){
  24. $aResult['author_name'] = $aEmbedData['author_name'];
  25. }
  26. if ($aEmbedData['author_url']){
  27. $aResult['author_url'] = $aEmbedData['author_url'];
  28. }
  29. header('Content-Type: application/json; charset=utf-8');
  30. echo json_encode($aResult);