diff options
Diffstat (limited to 'phpBB/phpbb/notification/type/topic.php')
-rw-r--r-- | phpBB/phpbb/notification/type/topic.php | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index fb08a9eee1..5c42afa8c8 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -50,11 +50,27 @@ class topic extends \phpbb\notification\type\base * @var bool|array False if the service should use it's default data * Array of data (including keys 'id', 'lang', and 'group') */ - public static $notification_option = array( + static public $notification_option = array( 'lang' => 'NOTIFICATION_TYPE_TOPIC', 'group' => 'NOTIFICATION_GROUP_POSTING', ); + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + /** * Is available */ @@ -67,8 +83,9 @@ 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 */ - public static function get_item_id($post) + static public function get_item_id($post) { return (int) $post['topic_id']; } @@ -77,8 +94,9 @@ 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 */ - public static function get_item_parent_id($post) + static public function get_item_parent_id($post) { return (int) $post['forum_id']; } @@ -138,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 ); @@ -151,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')) ); @@ -164,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') ); @@ -243,7 +261,7 @@ class topic extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users) || !$this->inherit_read_status) + if (!count($notify_users) || !$this->inherit_read_status) { return array(); } @@ -263,13 +281,7 @@ class topic extends \phpbb\notification\type\base } /** - * Function for preparing the data for insertion in an SQL query - * (The service handles insertion) - * - * @param array $post Data from submit_post - * @param array $pre_create_data Data from pre_create_insert_array() - * - * @return array Array of data ready to be inserted into the database + * {@inheritdoc} */ public function create_insert_array($post, $pre_create_data = array()) { @@ -290,6 +302,6 @@ class topic extends \phpbb\notification\type\base $this->notification_read = true; } - return parent::create_insert_array($post, $pre_create_data); + parent::create_insert_array($post, $pre_create_data); } } |