BxBaseEmbedIframely.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * Iframely integration.
  11. * @see BxDolEmbed
  12. */
  13. class BxBaseEmbedIframely extends BxDolEmbed
  14. {
  15. public function __construct ($aObject, $oTemplate)
  16. {
  17. parent::__construct ($aObject);
  18. if ($oTemplate)
  19. $this->_oTemplate = $oTemplate;
  20. else
  21. $this->_oTemplate = BxDolTemplate::getInstance();
  22. }
  23. public function getLinkHTML ($sLink, $sTitle = '', $sMaxWidth = '')
  24. {
  25. $aAttrs = array(
  26. 'title' => bx_html_attribute($sTitle),
  27. );
  28. // check for external link
  29. if (strncmp(BX_DOL_URL_ROOT, $sLink, strlen(BX_DOL_URL_ROOT)) !== 0) {
  30. $aAttrs['target'] = '_blank';
  31. if (getParam('sys_add_nofollow') == 'on')
  32. $aAttrs['rel'] = 'nofollow';
  33. }
  34. return $this->_oTemplate->parseHtmlByName('embed_iframely_link.html', array(
  35. 'link' => $sLink,
  36. 'title' => $sTitle,
  37. 'attrs' => bx_convert_array2attrs($aAttrs),
  38. 'width' => $sMaxWidth,
  39. ));
  40. }
  41. public function addJsCss ()
  42. {
  43. $sKey = getParam('sys_iframely_api_key');
  44. return $this->_oTemplate->parseHtmlByName('embed_iframely_integration.html', array(
  45. 'key' => $sKey,
  46. ));
  47. }
  48. }
  49. /** @} */