BxBasePushWonderPush.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. * WonderPush integration.
  11. * @see BxDolPush
  12. */
  13. class BxBasePushWonderPush extends BxDolPushWonderPush
  14. {
  15. protected function _getCodePageHeader()
  16. {
  17. if($this->_bCodeAdded || !$this->_sAppId)
  18. return '';
  19. $iProfileId = bx_get_logged_profile_id();
  20. if(empty($iProfileId))
  21. return '';
  22. $aTags = self::getTags($iProfileId);
  23. if(!$aTags)
  24. return '';
  25. $this->_bCodeAdded = true;
  26. return $this->_oTemplate->parseHtmlByName('wonderpush.html', [
  27. 'params' => json_encode([
  28. 'webKey' => $this->_sWebKey,
  29. 'userId' => $aTags['user_hash'],
  30. 'applicationName' => getParam('site_title'),
  31. 'requiresUserConsent' => getParam('sys_push_wonderpush_requires_user_consent') ? true : false,
  32. ]),
  33. 'tags' => json_encode($aTags),
  34. ]);
  35. }
  36. }
  37. /** @} */