1
0

oembed.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  11. $aLinks = bx_get('l');
  12. bx_import('BxDolEmbed');
  13. $oEmbed = BxDolEmbed::getObjectInstance('sys_iframely');
  14. if (bx_get('html')){
  15. echo '<style>body, html {margin:0px}</style><div style="max-width:900; margin:0px auto; justify-content: center;" id="ifr">' . $oEmbed->getDataHtml($aLinks, bx_get('theme')) . '<script language="javascript" src="'.BX_DOL_URL_ROOT.'/plugins_public/jquery/jquery.min.js"></script><script>
  16. $(document).ready(function () {
  17. a = ["' . bx_get('hash') . '", $("#ifr").height(),$("#ifr").width()];
  18. try{
  19. window.parent.postMessage(JSON.stringify(a), "*");
  20. window.ReactNativeWebView.postMessage(JSON.stringify(a));
  21. }
  22. catch(){}
  23. })
  24. window.addEventListener("message", function(event) {
  25. if (event.data && event.data!=""){
  26. try {
  27. a = JSON.parse(event.data);
  28. } catch (e) {
  29. console.error("Failed to parse JSON:", event.data);
  30. throw e;
  31. }
  32. if (a && a.method=="resize"){
  33. a = ["' . bx_get('hash') . '", a.height,$(".iframely-embed").width()];
  34. try{
  35. window.parent.postMessage(JSON.stringify(a), "*");
  36. window.ReactNativeWebView.postMessage(JSON.stringify(a));
  37. }
  38. catch(){}
  39. }
  40. }
  41. }, false);
  42. </script></div>';
  43. exit();
  44. }
  45. echoJson($oEmbed->parseLinks($aLinks));