From f592072b4b6253914dde4342ec163c6b427c58b2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Jun 2013 17:04:05 +0200 Subject: [ticket/11481] Move feed topic base to own file PHPBB3-11481 --- phpBB/includes/feed/topic_base.php | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 phpBB/includes/feed/topic_base.php (limited to 'phpBB/includes/feed/topic_base.php') diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/includes/feed/topic_base.php new file mode 100644 index 0000000000..353b9cac15 --- /dev/null +++ b/phpBB/includes/feed/topic_base.php @@ -0,0 +1,61 @@ +set('title', 'topic_title'); + $this->set('title2', 'forum_name'); + + $this->set('author_id', 'topic_poster'); + $this->set('creator', 'topic_first_poster_name'); + $this->set('published', 'post_time'); + $this->set('updated', 'post_edit_time'); + $this->set('text', 'post_text'); + + $this->set('bitfield', 'bbcode_bitfield'); + $this->set('bbcode_uid','bbcode_uid'); + + $this->set('enable_bbcode', 'enable_bbcode'); + $this->set('enable_smilies', 'enable_smilies'); + $this->set('enable_magic_url', 'enable_magic_url'); + } + + function adjust_item(&$item_row, &$row) + { + global $phpEx, $config, $user; + + $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); + + if ($config['feed_item_statistics']) + { + $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) + . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')]) + . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) + . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] + . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : ''); + } + } +} -- cgit v1.2.1 From 3efe0eb24687a0e36e316b60887eff3ed45ae9b4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Jun 2013 20:04:23 +0200 Subject: [ticket/11481] Use container for all classes and inject dependencies PHPBB3-11481 --- phpBB/includes/feed/topic_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/feed/topic_base.php') diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/includes/feed/topic_base.php index 353b9cac15..959ed5c469 100644 --- a/phpBB/includes/feed/topic_base.php +++ b/phpBB/includes/feed/topic_base.php @@ -47,7 +47,7 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base { global $phpEx, $config, $user; - $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); + $item_row['link'] = $this->helper->append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); if ($config['feed_item_statistics']) { -- cgit v1.2.1 From 63334514555acea665186f20046a49a5ed41c334 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Jun 2013 20:32:47 +0200 Subject: [ticket/11481] Remove globals and use dependency injection instead PHPBB3-11481 --- phpBB/includes/feed/topic_base.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/feed/topic_base.php') diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/includes/feed/topic_base.php index 959ed5c469..0c845c30bd 100644 --- a/phpBB/includes/feed/topic_base.php +++ b/phpBB/includes/feed/topic_base.php @@ -45,17 +45,15 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base function adjust_item(&$item_row, &$row) { - global $phpEx, $config, $user; + $item_row['link'] = $this->helper->append_sid('/viewtopic.' . $this->phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); - $item_row['link'] = $this->helper->append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); - - if ($config['feed_item_statistics']) + if ($this->config['feed_item_statistics']) { - $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) - . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('published')]) - . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) - . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] - . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : ''); + $item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) + . ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')]) + . ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) + . ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views'] + . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : ''); } } } -- cgit v1.2.1 From e36deed24f62f4fca0a3e82b2d58d97499ff7764 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Jun 2013 20:35:38 +0200 Subject: [ticket/11481] Move prepended slash from calls into function PHPBB3-11481 --- phpBB/includes/feed/topic_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/feed/topic_base.php') diff --git a/phpBB/includes/feed/topic_base.php b/phpBB/includes/feed/topic_base.php index 0c845c30bd..e6a47b4c86 100644 --- a/phpBB/includes/feed/topic_base.php +++ b/phpBB/includes/feed/topic_base.php @@ -45,7 +45,7 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base function adjust_item(&$item_row, &$row) { - $item_row['link'] = $this->helper->append_sid('/viewtopic.' . $this->phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); + $item_row['link'] = $this->helper->append_sid('viewtopic.' . $this->phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']); if ($this->config['feed_item_statistics']) { -- cgit v1.2.1