diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2015-10-29 14:46:02 +0100 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2015-10-29 14:46:02 +0100 |
commit | 257f5f8b24b34f6e37144a59d4a2cabf665f5fc8 (patch) | |
tree | 1a1c8bfa2b254be0281a941208d02409f8672626 /phpBB/phpbb/notification | |
parent | 5f85f19a5ea9f89a869c9fcb6391e48faa5cbd0c (diff) | |
parent | 28cc98a7ac69f5670ccb2746f8e4158681aa7926 (diff) | |
download | forums-257f5f8b24b34f6e37144a59d4a2cabf665f5fc8.tar forums-257f5f8b24b34f6e37144a59d4a2cabf665f5fc8.tar.gz forums-257f5f8b24b34f6e37144a59d4a2cabf665f5fc8.tar.bz2 forums-257f5f8b24b34f6e37144a59d4a2cabf665f5fc8.tar.xz forums-257f5f8b24b34f6e37144a59d4a2cabf665f5fc8.zip |
Merge pull request #3971 from VSEphpbb/ticket/14237
[ticket/14237] Use $language class for notifications
Diffstat (limited to 'phpBB/phpbb/notification')
-rw-r--r-- | phpBB/phpbb/notification/manager.php | 30 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/board.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/notification/method/messenger_base.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/admin_activate_user.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/base.php | 64 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_post.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_topic.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/group_request.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/group_request_approved.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/pm.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/post.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/quote.php | 1 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm.php | 23 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm_closed.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post.php | 16 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post_closed.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/topic.php | 8 |
17 files changed, 112 insertions, 73 deletions
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 4be678ac91..ea1b800dc5 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -44,6 +44,9 @@ class manager /** @var \phpbb\cache\service */ protected $cache; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\user */ protected $user; @@ -63,13 +66,14 @@ class manager * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\cache\service $cache + * @param \phpbb\language\language $language * @param \phpbb\user $user * @param string $notification_types_table * @param string $user_notifications_table * * @return \phpbb\notification\manager */ - public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, $notification_types_table, $user_notifications_table) + public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\language\language $language, \phpbb\user $user, $notification_types_table, $user_notifications_table) { $this->notification_types = $notification_types; $this->notification_methods = $notification_methods; @@ -79,6 +83,7 @@ class manager $this->phpbb_dispatcher = $phpbb_dispatcher; $this->db = $db; $this->cache = $cache; + $this->language = $language; $this->user = $user; $this->notification_types_table = $notification_types_table; @@ -111,7 +116,7 @@ class manager if (! $method instanceof \phpbb\notification\method\method_interface) { - throw new \phpbb\notification\exception($this->user->lang('NOTIFICATION_METHOD_INVALID', $method_name)); + throw new \phpbb\notification\exception($this->language->lang('NOTIFICATION_METHOD_INVALID', $method_name)); } else if ($method->is_available()) { @@ -166,7 +171,7 @@ class manager $notification_type_id = false; } - /** @var method_interface $method */ + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->mark_notifications($notification_type_id, $item_id, $user_id, $time, $mark_read); @@ -208,6 +213,7 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); } + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->mark_notifications_by_parent($notification_type_id, $item_parent_id, $user_id, $time, $mark_read); @@ -263,8 +269,6 @@ class manager return $notified_users; } - $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); - // find out which users want to receive this type of notification $notify_users = $this->get_item_type_class($notification_type_name)->find_users_for_notification($data, $options); @@ -317,7 +321,7 @@ class manager $item_id = $this->get_item_type_class($notification_type_name)->get_item_id($data); $user_ids = array(); - $notification_objects = $notification_methods = array(); + $notification_methods = array(); // Never send notifications to the anonymous user! unset($notify_users[ANONYMOUS]); @@ -325,6 +329,7 @@ class manager // Make sure not to send new notifications to users who've already been notified about this item // This may happen when an item was added, but now new users are able to see the item // We remove each user which was already notified by at least one method. + /** @var method\method_interface $method */ foreach ($this->get_subscription_methods_instances() as $method) { $notified_users = $method->get_notified_users($notification_type_id, array('item_id' => $item_id)); @@ -415,6 +420,7 @@ class manager $options['item_id'] = $notification->get_item_id($data); } + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->update_notification($notification, $data, $options); @@ -443,6 +449,7 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->delete_notifications($notification_type_id, $item_id, $parent_id, $user_id); @@ -462,6 +469,7 @@ class manager foreach ($this->notification_types as $type_name => $data) { + /** @var type\base $type */ $type = $this->get_item_type_class($type_name); if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available()) @@ -497,6 +505,7 @@ class manager { $subscription_methods = array(); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method_name => $method) { $subscription_methods[$method_name] = array( @@ -539,6 +548,7 @@ class manager { $subscription_methods = array(); + /** @var method\method_interface $method */ foreach ($this->get_subscription_methods_instances() as $method_name => $method) { if ($method->is_available()) @@ -768,6 +778,7 @@ class manager { $notification_type_id = $this->get_notification_type_id($notification_type_name); + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->purge_notifications($notification_type_id); @@ -805,6 +816,7 @@ class manager */ public function prune_notifications($timestamp, $only_read = true) { + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $method->prune_notifications($timestamp, $only_read); @@ -834,6 +846,8 @@ class manager /** * Helper to get the notifications item type class and set it up * + * @param string $notification_type_name + * @param array $data * @return type\type_interface */ public function get_item_type_class($notification_type_name, $data = array()) @@ -848,6 +862,7 @@ class manager /** * Helper to get the notifications method class and set it up * + * @param string $method_name * @return method\method_interface */ public function get_method_class($method_name) @@ -858,6 +873,7 @@ class manager /** * Helper to load objects (notification types/methods) * + * @param string $object_name * @return method\method_interface|type\type_interface */ protected function load_object($object_name) @@ -950,6 +966,8 @@ class manager $notification_type_id = $this->get_notification_type_id($notification_type_name); $notified_users = array(); + + /** @var method\method_interface $method */ foreach ($this->get_available_subscription_methods() as $method) { $notified_users = $notified_users + $method->get_notified_users($notification_type_id, $options); diff --git a/phpBB/phpbb/notification/method/board.php b/phpBB/phpbb/notification/method/board.php index c45f3a8caa..931b252daa 100644 --- a/phpBB/phpbb/notification/method/board.php +++ b/phpBB/phpbb/notification/method/board.php @@ -266,6 +266,7 @@ class board extends \phpbb\notification\method\base { $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table); + /** @var \phpbb\notification\type\type_interface $notification */ foreach ($this->queue as $notification) { $data = $notification->get_insert_array(); diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 61119b9882..8a8e284e13 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -82,6 +82,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $messenger = new \messenger(); // Time to go through the queue and send emails + /** @var \phpbb\notification\type\type_interface $notification */ foreach ($this->queue as $notification) { if ($notification->get_email_template() === false) diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php index b191fa62ae..9f2ae857ef 100644 --- a/phpBB/phpbb/notification/type/admin_activate_user.php +++ b/phpBB/phpbb/notification/type/admin_activate_user.php @@ -130,7 +130,7 @@ class admin_activate_user extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang($this->language_key, $username); + return $this->language->lang($this->language_key, $username); } /** diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 31e853d7d9..4aacb1c99e 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -24,6 +24,9 @@ abstract class base implements \phpbb\notification\type\type_interface /** @var \phpbb\db\driver\driver_interface */ protected $db; + /** @var \phpbb\language\language */ + protected $language; + /** @var \phpbb\user */ protected $user; @@ -56,7 +59,7 @@ abstract class base implements \phpbb\notification\type\type_interface protected $notification_type_id; /** - * Indentification data + * Identification data * notification_type_id - ID of the item type (auto generated, from notification types table) * item_id - ID of the item (e.g. post_id, msg_id) * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) @@ -71,19 +74,20 @@ abstract class base implements \phpbb\notification\type\type_interface private $data = array(); /** - * Notification Type Base Constructor - * - * @param \phpbb\db\driver\driver_interface $db - * @param \phpbb\user $user - * @param \phpbb\auth\auth $auth - * @param string $phpbb_root_path - * @param string $php_ext - * @param string $user_notifications_table - * @return \phpbb\notification\type\base - */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) + * Notification Type Base Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\language\language $language + * @param \phpbb\user $user + * @param \phpbb\auth\auth $auth + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $user_notifications_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) { $this->db = $db; + $this->language = $language; $this->user = $user; $this->auth = $auth; @@ -192,7 +196,7 @@ abstract class base implements \phpbb\notification\type\type_interface 'notification_time' => time(), 'notification_read' => false, - 'notification_data' => array(), + 'notification_data' => array(), ), $this->data); } @@ -304,6 +308,7 @@ abstract class base implements \phpbb\notification\type\type_interface * URL to unsubscribe to this notification (fall back) * * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + * @return false */ public function get_unsubscribe_url($method = false) { @@ -371,8 +376,11 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Load the special items (fall back) - */ + * Load the special items (fall back) + * + * @param array $data + * @param array $notifications + */ public function load_special($data, $notifications) { return; @@ -389,10 +397,12 @@ abstract class base implements \phpbb\notification\type\type_interface } /** - * Pre create insert array function (fall back) - * - * @return array - */ + * Pre create insert array function (fall back) + * + * @param array $type_data + * @param array $notify_users + * @return array + */ public function pre_create_insert_array($type_data, $notify_users) { return array(); @@ -403,13 +413,13 @@ abstract class base implements \phpbb\notification\type\type_interface */ /** - * Find the users who want to receive notifications (helper) - * - * @param array $user_ids User IDs to check if they want to receive notifications - * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) - * - * @return array - */ + * Find the users who want to receive notifications (helper) + * + * @param array|bool $user_ids User IDs to check if they want to receive notifications + * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) + * @param array $options + * @return array + */ protected function check_user_notification_options($user_ids = false, $options = array()) { $options = array_merge(array( @@ -505,6 +515,8 @@ abstract class base implements \phpbb\notification\type\type_interface { $this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read); } + + return null; } /** diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 21338bddb7..2d908eb254 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -73,7 +73,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_title() { - return $this->user->lang($this->language_key); + return $this->language->lang($this->language_key); } /** @@ -83,7 +83,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -96,7 +96,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ public function get_reason() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 30a23a83fe..c2522fb562 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -73,7 +73,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_title() { - return $this->user->lang($this->language_key); + return $this->language->lang($this->language_key); } /** @@ -83,7 +83,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -96,7 +96,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ public function get_reason() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('disapprove_reason') ); diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index 8a0027bfec..28a9e73bf9 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -114,7 +114,7 @@ class group_request extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); - return $this->user->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); } /** diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index dc353f3380..f55d28bafd 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -69,7 +69,7 @@ class group_request_approved extends \phpbb\notification\type\base */ public function get_title() { - return $this->user->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); + return $this->language->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name')); } /** diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php index 2de2dcfa0b..8fb9172911 100644 --- a/phpBB/phpbb/notification/type/pm.php +++ b/phpBB/phpbb/notification/type/pm.php @@ -128,7 +128,7 @@ class pm extends \phpbb\notification\type\base { $username = $this->user_loader->get_username($this->get_data('from_user_id'), 'no_profile'); - return $this->user->lang('NOTIFICATION_PM', $username); + return $this->language->lang('NOTIFICATION_PM', $username); } /** @@ -138,7 +138,7 @@ class pm extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', $this->get_data('message_subject') ); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index b16014ff74..b9afc6d70a 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -83,6 +83,7 @@ class post extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The post id */ static public function get_item_id($post) { @@ -93,6 +94,7 @@ class post extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The topic id */ static public function get_item_parent_id($post) { @@ -218,14 +220,14 @@ class post extends \phpbb\notification\type\base if ($trimmed_responders_cnt > 20) { - $usernames[] = $this->user->lang('NOTIFICATION_MANY_OTHERS'); + $usernames[] = $this->language->lang('NOTIFICATION_MANY_OTHERS'); } else if ($trimmed_responders_cnt) { - $usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); + $usernames[] = $this->language->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); } - return $this->user->lang( + return $this->language->lang( $this->language_key, phpbb_generate_string_list($usernames, $this->user), $responders_cnt @@ -239,7 +241,7 @@ class post extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -407,6 +409,7 @@ class post extends \phpbb\notification\type\base * Add responders to the notification * * @param mixed $post + * @return array Array of responder data */ public function add_responders($post) { diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index 2edf37efc7..684463c8c3 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -106,6 +106,7 @@ class quote extends \phpbb\notification\type\post * Update a notification * * @param array $post Data specific for this type that will be updated + * @return true */ public function update_notifications($post) { diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index 4be4705d05..6091919769 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -70,6 +70,7 @@ class report_pm extends \phpbb\notification\type\pm * Get the id of the parent * * @param array $pm The data from the pm + * @return int The report id */ static public function get_item_parent_id($pm) { @@ -144,10 +145,10 @@ class report_pm extends \phpbb\notification\type\pm $user_data = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); return array( - 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), - 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), + 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), + 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), - 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", + 'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details", ); } @@ -168,11 +169,11 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -185,7 +186,7 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); @@ -200,21 +201,21 @@ class report_pm extends \phpbb\notification\type\pm { if ($this->get_data('report_text')) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', - $this->user->lang[$this->get_data('reason_title')] + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('reason_description') ); diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index f793c7df9a..5e98eb5feb 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -106,7 +106,7 @@ class report_pm_closed extends \phpbb\notification\type\pm { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -119,7 +119,7 @@ class report_pm_closed extends \phpbb\notification\type\pm */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('message_subject')) ); diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 6eefd53832..84a5241417 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -139,11 +139,11 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_title() { - $this->user->add_lang('mcp'); + $this->language->add_lang('mcp'); $username = $this->user_loader->get_username($this->get_data('reporter_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -156,7 +156,7 @@ class report_post extends \phpbb\notification\type\post_in_queue */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); @@ -171,21 +171,21 @@ class report_post extends \phpbb\notification\type\post_in_queue { if ($this->get_data('report_text')) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('report_text') ); } - if (isset($this->user->lang[$this->get_data('reason_title')])) + if ($this->language->is_set($this->get_data('reason_title'))) { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', - $this->user->lang[$this->get_data('reason_title')] + $this->language->lang($this->get_data('reason_title')) ); } - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REASON', $this->get_data('reason_description') ); diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 6327011f2d..165034d57e 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -113,7 +113,7 @@ class report_post_closed extends \phpbb\notification\type\post { $username = $this->user_loader->get_username($this->get_data('closer_id'), 'no_profile'); - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -126,7 +126,7 @@ class report_post_closed extends \phpbb\notification\type\post */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('post_subject')) ); diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 4812e8b5af..671c34fe96 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -83,6 +83,7 @@ class topic extends \phpbb\notification\type\base * Get the id of the item * * @param array $post The data from the post + * @return int The topic id */ static public function get_item_id($post) { @@ -93,6 +94,7 @@ class topic extends \phpbb\notification\type\base * Get the id of the parent * * @param array $post The data from the post + * @return int The forum id */ static public function get_item_parent_id($post) { @@ -154,7 +156,7 @@ class topic extends \phpbb\notification\type\base $username = $this->user_loader->get_username($this->get_data('poster_id'), 'no_profile'); } - return $this->user->lang( + return $this->language->lang( $this->language_key, $username ); @@ -167,7 +169,7 @@ class topic extends \phpbb\notification\type\base */ public function get_reference() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_REFERENCE', censor_text($this->get_data('topic_title')) ); @@ -180,7 +182,7 @@ class topic extends \phpbb\notification\type\base */ public function get_forum() { - return $this->user->lang( + return $this->language->lang( 'NOTIFICATION_FORUM', $this->get_data('forum_name') ); |