mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/11103] Replace $email_template with get_email_template()
PHPBB3-11103
This commit is contained in:
parent
a93067eb41
commit
0ac9079d1c
18 changed files with 163 additions and 99 deletions
|
@ -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']);
|
||||
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,13 +51,6 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
|||
/** @var string */
|
||||
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)
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,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
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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_
|
||||
|
@ -129,6 +122,16 @@ class phpbb_notification_type_pm extends phpbb_notification_type_base
|
|||
return $this->user->lang('NOTIFICATION_PM', $username, $this->get_data('message_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return 'privmsg_notify';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -212,6 +205,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
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -201,6 +194,16 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return 'notifications/quote';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -139,6 +132,16 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
|||
return $notify_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return 'notifications/report_pm';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -68,6 +68,16 @@ class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_p
|
|||
return array($pm['reporter'] => array(''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -82,6 +75,16 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
|||
return $notify_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return 'notifications/report_post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -68,6 +68,16 @@ class phpbb_notification_type_report_post_closed extends phpbb_notification_type
|
|||
return array($post['reporter'] => array(''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public function get_email_template()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -179,6 +172,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
|
||||
*
|
||||
|
|
|
@ -23,13 +23,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
|
||||
*
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue