OskarsM

Notification phpbb

Jan 17th, 2017
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * This file is part of the phpBB Forum Software package.
  5. *
  6. * @copyright (c) phpBB Limited <https://www.phpbb.com>
  7. * @license GNU General Public License, version 2 (GPL-2.0)
  8. *
  9. * For full copyright and license information, please see
  10. * the docs/CREDITS.txt file.
  11. *
  12. */
  13.  
  14. namespace phpbb\notification\method;
  15.  
  16. /**
  17. * Email notification method class
  18. * This class handles sending emails for notifications
  19. */
  20.  
  21. class email extends \phpbb\notification\method\messenger_base
  22. {
  23. /** @var \phpbb\user */
  24. protected $user;
  25.  
  26. /** @var \phpbb\config\config */
  27. protected $config;
  28.  
  29. /**
  30. * Notification Method email Constructor
  31. *
  32. * @param \phpbb\user_loader $user_loader
  33. * @param \phpbb\user $user
  34. * @param \phpbb\config\config $config
  35. * @param string $phpbb_root_path
  36. * @param string $php_ext
  37. */
  38. public function __construct(\phpbb\user_loader $user_loader, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
  39. {
  40. parent::__construct($user_loader, $phpbb_root_path, $php_ext);
  41.  
  42. $this->user = $user;
  43. $this->config = $config;
  44. }
  45.  
  46. /**
  47. * Get notification method name
  48. *
  49. * @return string
  50. */
  51. public function get_type()
  52. {
  53. return 'notification.method.email';
  54. }
  55.  
  56. /**
  57. * Is this method available for the user?
  58. * This is checked on the notifications options
  59. */
  60. public function is_available()
  61. {
  62. return $this->config['email_enable'] && $this->user->data['user_email'];
  63. }
  64.  
  65. /**
  66. * Parse the queue and notify the users
  67. */
  68. public function notify()
  69. {
  70. return $this->notify_using_messenger(NOTIFY_EMAIL);
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment