diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-20 18:55:13 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-20 18:55:13 -0500 |
commit | 0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5 (patch) | |
tree | 2acd6d92adfd66176804b27f40360ed84ac68724 | |
parent | a93067eb4196454c147ea516733182abd1612e84 (diff) | |
download | forums-0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5.tar forums-0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5.tar.gz forums-0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5.tar.bz2 forums-0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5.tar.xz forums-0ac9079d1c4e32ae04bb7b5da55fa030279ec9b5.zip |
[ticket/11103] Replace $email_template with get_email_template()
PHPBB3-11103
18 files changed, 163 insertions, 99 deletions
diff --git a/phpBB/includes/notification/method/email.php b/phpBB/includes/notification/method/email.php index e902ea1e85..df7edb13e7 100644 --- a/phpBB/includes/notification/method/email.php +++ b/phpBB/includes/notification/method/email.php @@ -78,6 +78,11 @@ class phpbb_notification_method_email extends phpbb_notification_method_base // Time to go through the queue and send emails foreach ($this->queue as $notification) { + if ($notification->get_email_template() === false) + { + continue; + } + $user = $this->notification_manager->get_user($notification->user_id); if ($user['user_type'] == USER_IGNORE || in_array($notification->user_id, $banned_users)) @@ -85,7 +90,7 @@ class phpbb_notification_method_email extends phpbb_notification_method_base continue; } - $messenger->template($notification->email_template, $user['user_lang']); + $messenger->template($notification->get_email_template(), $user['user_lang']); $messenger->to($user['user_email'], $user['username']); diff --git a/phpBB/includes/notification/type/approve_post.php b/phpBB/includes/notification/type/approve_post.php index 6ed9b6c67c..4ed5124415 100644 --- a/phpBB/includes/notification/type/approve_post.php +++ b/phpBB/includes/notification/type/approve_post.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_approve_post extends phpbb_notification_type_post { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'post_approved'; - - /** * Language key used to output the text * * @var string @@ -166,4 +159,14 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'post_approved'; + } } diff --git a/phpBB/includes/notification/type/approve_topic.php b/phpBB/includes/notification/type/approve_topic.php index 1ff5ae43bd..32a1de8cf8 100644 --- a/phpBB/includes/notification/type/approve_topic.php +++ b/phpBB/includes/notification/type/approve_topic.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_approve_topic extends phpbb_notification_type_topic { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'topic_approved'; - - /** * Language key used to output the text * * @var string @@ -162,4 +155,14 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_approved'; + } } diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index ab2f76c650..4c496f0a22 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -52,13 +52,6 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i protected $php_ext = null; /** - * Array of user data containing information needed to output the notifications to the template - * - * @var array - */ - protected $users = array(); - - /** * Notification option data (for outputting to the user) * * @var bool|array False if the service should use its default data diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php index dff7ac4c7d..eb1a735249 100644 --- a/phpBB/includes/notification/type/bookmark.php +++ b/phpBB/includes/notification/type/bookmark.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_bookmark extends phpbb_notification_type_post { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/bookmark'; - - /** * Language key used to output the text * * @var string @@ -131,4 +124,14 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post return $notify_users; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/bookmark'; + } } diff --git a/phpBB/includes/notification/type/disapprove_post.php b/phpBB/includes/notification/type/disapprove_post.php index 8044a3e0ea..d4e659c5f3 100644 --- a/phpBB/includes/notification/type/disapprove_post.php +++ b/phpBB/includes/notification/type/disapprove_post.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_disapprove_post extends phpbb_notification_type_approve_post { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'post_disapproved'; - - /** * Language key used to output the text * * @var string @@ -113,4 +106,14 @@ class phpbb_notification_type_disapprove_post extends phpbb_notification_type_ap return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'post_disapproved'; + } } diff --git a/phpBB/includes/notification/type/disapprove_topic.php b/phpBB/includes/notification/type/disapprove_topic.php index 04fec87014..4bbf458d4a 100644 --- a/phpBB/includes/notification/type/disapprove_topic.php +++ b/phpBB/includes/notification/type/disapprove_topic.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_approve_topic { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'topic_disapproved'; - - /** * Language key used to output the text * * @var string @@ -113,4 +106,14 @@ class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_a return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_disapproved'; + } } diff --git a/phpBB/includes/notification/type/interface.php b/phpBB/includes/notification/type/interface.php index 1d79a2c8d8..25dc24d922 100644 --- a/phpBB/includes/notification/type/interface.php +++ b/phpBB/includes/notification/type/interface.php @@ -123,6 +123,13 @@ interface phpbb_notification_type_interface public function prepare_for_display(); /** + * Get email template + * + * @return string|bool + */ + public function get_email_template(); + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/pm.php b/phpBB/includes/notification/type/pm.php index dc4bd3b3a5..721af4bce5 100644 --- a/phpBB/includes/notification/type/pm.php +++ b/phpBB/includes/notification/type/pm.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_pm extends phpbb_notification_type_base { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'privmsg_notify'; - - /** * Get the type of notification this is * phpbb_notification_type_ */ @@ -130,6 +123,16 @@ class phpbb_notification_type_pm extends phpbb_notification_type_base } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'privmsg_notify'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index a5e822336d..9bb06e3620 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_post extends phpbb_notification_type_base { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'topic_notify'; - - /** * Language key used to output the text * * @var string @@ -213,6 +206,16 @@ class phpbb_notification_type_post extends phpbb_notification_type_base } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_notify'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/post_in_queue.php b/phpBB/includes/notification/type/post_in_queue.php index 499fd1e8ed..0bf8685660 100644 --- a/phpBB/includes/notification/type/post_in_queue.php +++ b/phpBB/includes/notification/type/post_in_queue.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/post_in_queue'; - - /** * Language key used to output the text * * @var string @@ -151,4 +144,14 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/post_in_queue'; + } } diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php index 4c615d8dc6..f700821353 100644 --- a/phpBB/includes/notification/type/quote.php +++ b/phpBB/includes/notification/type/quote.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_quote extends phpbb_notification_type_post { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/quote'; - - /** * regular expression to match to find usernames * * @var string @@ -202,6 +195,16 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/quote'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/includes/notification/type/report_pm.php index d78c108f56..b18493ff29 100644 --- a/phpBB/includes/notification/type/report_pm.php +++ b/phpBB/includes/notification/type/report_pm.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_report_pm extends phpbb_notification_type_pm { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/report_pm'; - - /** * Language key used to output the text * * @var string @@ -140,6 +133,16 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/report_pm'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/report_pm_closed.php b/phpBB/includes/notification/type/report_pm_closed.php index 8d79c8446b..0bde7dfe48 100644 --- a/phpBB/includes/notification/type/report_pm_closed.php +++ b/phpBB/includes/notification/type/report_pm_closed.php @@ -69,6 +69,16 @@ class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_p } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return false; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/includes/notification/type/report_post.php index 151841ef02..f1ee073a4d 100644 --- a/phpBB/includes/notification/type/report_post.php +++ b/phpBB/includes/notification/type/report_post.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_report_post extends phpbb_notification_type_post_in_queue { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/report_post'; - - /** * Language key used to output the text * * @var string @@ -83,6 +76,16 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/report_post'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/report_post_closed.php b/phpBB/includes/notification/type/report_post_closed.php index 3e66bde9bc..52bdadc547 100644 --- a/phpBB/includes/notification/type/report_post_closed.php +++ b/phpBB/includes/notification/type/report_post_closed.php @@ -69,6 +69,16 @@ class phpbb_notification_type_report_post_closed extends phpbb_notification_type } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return false; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/topic.php b/phpBB/includes/notification/type/topic.php index a9beb469c3..4737031e87 100644 --- a/phpBB/includes/notification/type/topic.php +++ b/phpBB/includes/notification/type/topic.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_topic extends phpbb_notification_type_base { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'newtopic_notify'; - - /** * Language key used to output the text * * @var string @@ -180,6 +173,16 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base } /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'newtopic_notify'; + } + + /** * Get email template variables * * @return array diff --git a/phpBB/includes/notification/type/topic_in_queue.php b/phpBB/includes/notification/type/topic_in_queue.php index eb14c098e1..ee565ab6e6 100644 --- a/phpBB/includes/notification/type/topic_in_queue.php +++ b/phpBB/includes/notification/type/topic_in_queue.php @@ -24,13 +24,6 @@ if (!defined('IN_PHPBB')) class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_topic { /** - * Email template to use to send notifications - * - * @var string - */ - public $email_template = 'notifications/topic_in_queue'; - - /** * Language key used to output the text * * @var string @@ -144,4 +137,14 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top return $data; } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'notifications/topic_in_queue'; + } } |