/** * Prepare the thread for iteration * @param disThread $thread * @return array */ protected function prepareThread(disThread $thread) { $thread->calcLastPostPage(); $thread->getUrl(); $threadArray = $thread->toArray(); $threadArray['createdon'] = strftime($this->getOption('dateFormat'), strtotime($threadArray['createdon'])); $threadArray['icons'] = ''; /* set css class */ $class = $this->getOption('clsRow'); $class = explode(',', $class); if ($this->getOption('enableHot')) { $threshold = $this->getOption('hotThreadThreshold'); if ($this->discuss->user->get('id') == $threadArray['author'] && $this->discuss->user->isLoggedIn) { $class[] = $threadArray['replies'] < $threshold ? $this->getOption('clsMyNormalThread') : $this->getOption('clsMyHotThread'); } else { $class[] = $threadArray['replies'] < $threshold ? $this->getOption('clsNormalThread') : $this->getOption('clsHotThread'); } } $threadArray['class'] = implode(' ', $class); /* if sticky/locked */ $icons = array(); if ($threadArray['locked']) { $icons[] = $this->getOption('iconLocked'); } if ($this->getOption('enableSticky') && $threadArray['sticky']) { $icons[] = $this->getOption('iconSticky'); } $threadArray['icons'] = implode($this->getOption('iconSeparator'), $icons); $threadArray['views'] = number_format($threadArray['views']); $threadArray['replies'] = number_format($threadArray['replies']); /* unread class */ $threadArray['unread'] = true; $threadArray['unread-cls'] = $this->getOption('clsUnread'); $threadArray['author_link'] = $this->getOption('canViewProfiles') ? '<a class="dis-last-post-by" href="' . $this->discuss->request->makeUrl('user', array('type' => 'username', 'user' => $threadArray['author_username'])) . '">' . $threadArray['author_username'] . '</a>' : $threadArray['author_username']; return $threadArray; }