BxBasePushWonderPush.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. ]),
  32. 'tags' => json_encode($aTags),
  33. ]);
  34. }
  35. }
  36. /** @} */