From f592072b4b6253914dde4342ec163c6b427c58b2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 6 Jun 2013 17:04:05 +0200 Subject: [PATCH] [ticket/11481] Move feed topic base to own file PHPBB3-11481 --- phpBB/feed.php | 45 ---------------------- phpBB/includes/feed/topic_base.php | 61 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 45 deletions(-) create mode 100644 phpBB/includes/feed/topic_base.php diff --git a/phpBB/feed.php b/phpBB/feed.php index 039d9fc80a..9c37ac3b72 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -335,51 +335,6 @@ function feed_generate_content($content, $uid, $bitfield, $options) return $content; } -/** -* Abstract class for topic based feeds -* -* @package phpBB3 -*/ -class phpbb_feed_topic_base extends phpbb_feed_base -{ - var $num_items = 'feed_limit_topic'; - - function set_keys() - { - $this->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'] : ''); - } - } -} - /** * Board wide feed (aka overall feed) * 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'] : ''); + } + } +}