BxBaseModNotificationsResponse.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 BaseNotifications Base classes for Notifications like modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModNotificationsResponse extends BxDolAlertsResponse
  12. {
  13. protected $_oModule;
  14. function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. /**
  19. * Note. Check priprity is IMPORTANT!
  20. * Don't swap the checks without a REAL need.
  21. */
  22. protected function _getObjectOwnerId($aExtras)
  23. {
  24. if(!is_array($aExtras))
  25. return 0;
  26. if(isset($aExtras['parent_author_id']))
  27. return (int)$aExtras['parent_author_id'];
  28. if(isset($aExtras['object_author_id']))
  29. return (int)$aExtras['object_author_id'];
  30. return 0;
  31. }
  32. protected function _getObjectPrivacyView($aExtras)
  33. {
  34. return is_array($aExtras) && isset($aExtras['privacy_view']) ? (int)$aExtras['privacy_view'] : $this->_oModule->_oConfig->getPrivacyViewDefault('object');
  35. }
  36. /**
  37. * Note. Check priprity is NOT IMPORTANT!
  38. */
  39. protected function _getSubObjectId($aExtras)
  40. {
  41. if(!is_array($aExtras))
  42. return 0;
  43. if(isset($aExtras['comment_id']))
  44. return (int)$aExtras['comment_id'];
  45. if(isset($aExtras['vote_id']))
  46. return (int)$aExtras['vote_id'];
  47. if(isset($aExtras['repost_id']))
  48. return (int)$aExtras['repost_id'];
  49. if(isset($aExtras['timeline_post_id']))
  50. return (int)$aExtras['timeline_post_id'];
  51. if(isset($aExtras['performer_id']))
  52. return (int)$aExtras['performer_id'];
  53. return 0;
  54. }
  55. }
  56. /** @} */